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

Add sparse jacobian #83

Merged
merged 3 commits into from
Nov 4, 2022
Merged

Add sparse jacobian #83

merged 3 commits into from
Nov 4, 2022

Conversation

tmigot
Copy link
Member

@tmigot tmigot commented Oct 12, 2022

I will split this into several PRs as it is a large change

  • Add c in backend constructors
  • Add get_nln_nnzj and get_nln_nnzh functions
  • Extend ADModelBackend to NLS functions
  • Add sparse jacobian!

@tmigot tmigot marked this pull request as draft October 12, 2022 00:41
@codecov
Copy link

codecov bot commented Oct 12, 2022

Codecov Report

Base: 99.44% // Head: 99.45% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (9e87cd7) compared to base (6e45688).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #83      +/-   ##
==========================================
+ Coverage   99.44%   99.45%   +0.01%     
==========================================
  Files           7        8       +1     
  Lines         715      740      +25     
==========================================
+ Hits          711      736      +25     
  Misses          4        4              
Impacted Files Coverage Δ
src/ADNLPModels.jl 100.00% <ø> (ø)
src/ad.jl 96.29% <ø> (+0.14%) ⬆️
src/nlp.jl 100.00% <ø> (ø)
src/nls.jl 100.00% <ø> (ø)
src/sparse_derivatives.jl 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@tmigot
Copy link
Member Author

tmigot commented Nov 2, 2022

I also added a complementary tests with problems from OptimizationProblems.jl:

using ADNLPModels, LinearAlgebra, NLPModels, NLPModelsJuMP, OptimizationProblems

for prob in intersect(names(ADNLPProblems), names(PureJuMP))
  if prob == :hs61
    continue
  end
  if occursin("tetra", string(prob)) || occursin("triangle", string(prob))
    continue # too slow
  end
  nlp = eval(Meta.parse("ADNLPProblems.$(prob)()"))
  model = MathOptNLPModel(eval(Meta.parse("PureJuMP.$(prob)()")))
  if nlp.meta.ncon > 0
    x = nlp.meta.x0
    test = Matrix(jac(nlp, x)) ≈ Matrix(jac(model, x))
    if !test
      println("$prob : $(nlp.meta.nvar), $(nlp.meta.ncon)")
      @show norm(Matrix(jac(nlp, x)) - Matrix(jac(model, x)))
    end
  end
end

and all the tests passed (after this JuliaSmoothOptimizers/OptimizationProblems.jl#223).

@github-actions
Copy link
Contributor

github-actions bot commented Nov 2, 2022

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

@tmigot tmigot marked this pull request as ready for review November 2, 2022 16:48
@tmigot tmigot requested review from dpo and amontoison November 2, 2022 16:48
src/nlp.jl Show resolved Hide resolved
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2022

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

@probot-auto-merge probot-auto-merge bot merged commit 01742c5 into main Nov 4, 2022
@probot-auto-merge probot-auto-merge bot deleted the add-sym branch November 4, 2022 16:20
@dpo
Copy link
Member

dpo commented Nov 5, 2022

We really have to update the config of that dratted probot. I didn't even have a chance to look at this PR!

@tmigot
Copy link
Member Author

tmigot commented Nov 6, 2022

Sorry for that, if you have some feedback on this I can open a new PR to fix it.

#91 should help with the bot.

@tmigot tmigot mentioned this pull request Nov 14, 2022
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.

None yet

3 participants