Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[documentation] Explain how we can provide a sparsity pattern #286

Merged

Conversation

amontoison
Copy link
Member

@tmigot It seems that we can't create an ADNLPModel / ADNLSModel with an initialized AD backend.
I wanted to create nlp with the following constructor:

nlp = ADNLPModel!(f, x0, lvar, uvar, c!, lcon, ucon, acobian_backend=J_backend,hessian_backend=H_backend)

but the code here wants to call the constructor of an ADNLPModels.ADBackend.
We can use set_adbackend! as a workaround.

Related to #284 and control-toolbox/CTDirect.jl#183
cc @jbcaillau

@amontoison amontoison requested a review from tmigot August 5, 2024 02:25
Copy link
Contributor

github-actions bot commented Aug 5, 2024

Package name latest stable
CaNNOLeS.jl
DCISolver.jl
DerivativeFreeSolvers.jl
JSOSolvers.jl
NLPModelsIpopt.jl
OptimalControl.jl
OptimizationProblems.jl
Percival.jl
QuadraticModels.jl
SolverBenchmark.jl
SolverTools.jl

@tmigot
Copy link
Member

tmigot commented Aug 5, 2024

You could adapt this line

hessian_backend = if hessian_backend isa AbstractNLPModel
(and the others) to make it work.

Essentially, we expect 3 types as a jacobian_backend:

  • A ADBackend type, and then in the constructor of ADModelBackend we call its constructor;
  • An AbstractNLPModel
  • An instantiated ADBackend (this is what you want, and is missing right now).

@amontoison
Copy link
Member Author

You could adapt this line

hessian_backend = if hessian_backend isa AbstractNLPModel

(and the others) to make it work.
Essentially, we expect 3 types as a jacobian_backend:

  • A ADBackend type, and then in the constructor of ADModelBackend we call its constructor;
  • An AbstractNLPModel
  • An instantiated ADBackend (this is what you want, and is missing right now).

The issue is what can we do to do the difference between an ADBackend type and an insantiated ADBackend?

@amontoison amontoison changed the title [documentation] Explain how we can provide a parsity pattern [documentation] Explain how we can provide a sparsity pattern Aug 5, 2024
@amontoison amontoison force-pushed the doc_sparsity_pattern branch from 9e2c14e to 668bea9 Compare August 6, 2024 19:01
@amontoison amontoison merged commit 6db1605 into JuliaSmoothOptimizers:main Aug 6, 2024
32 of 37 checks passed
@amontoison amontoison deleted the doc_sparsity_pattern branch August 6, 2024 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants