JuliaSmoothOptimizers / JuliaSmoothOptimizers/ADNLPModels.jl
Compatibility issue with OrdinaryDiffEq due to sparsity analysis in v0.8.3
- Dominant language
- Julia
- Stars
- 44
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
Hello @amontoison @gdalle @tmigot,
First, thank you for your work on this project! I recently updated to v0.8.3 and encountered an issue with my code. I use OrdinaryDiffEq to solve an ODE within the constraint function of my problem. Previously, before v0.8, no sparsity analysis was done by default, and everything worked smoothly. However, since v0.8, the default sparsity analysis seems to cause OrdinaryDiffEq's solve function to throw an error. This behaviour seems to cause #247 as well.
Here is a comparison of my code before and after the update:
Before:
```julia
model = ADNLPModel!(x -> obj(x, p), x, lb, ub, (c, x) -> cons!(c, x, p), lc, uc)
```
After:
```julia
my_backend = copy(ADNLPModels.predefined_backend[:default])
my_backend[:hessian_residual_backend] = ADNLPModels.ForwardDiffADHessian
my_backend[:hessian_backend] = ADNLPModels.ForwardDiffADHessian
my_backend[:jacobian_residual_backend] = ADNLPModels.ForwardDiffADJacobian
my_backend[:jacobian_backend] = ADNLPModels.ForwardDiffADJacobian
model = ADNLPModel!(x -> obj(x, p), x, lb, ub, (c, x) -> cons!(c, x, p), lc, uc; my_backend...)
```
I understand that enabling sparsity by default can improve performance in many cases, but it seems to cause issues in this particular scenario. Would it be possible to provide an option to disable sparsity analysis, or is there another recommended approach to maintain compatibility?
Thank you for your time and assistance!
ping @jbcaillau
Contributor guide
Assessment
This issue has not been assessed yet.