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 derivative check for Jacobian of residual #85

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

tmigot
Copy link
Member

@tmigot tmigot commented Jul 13, 2023

@codecov
Copy link

codecov bot commented Jul 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.54%. Comparing base (9585863) to head (e8d8059).
Report is 3 commits behind head on main.

Current head e8d8059 differs from pull request most recent head 64a857d

Please upload reports for the commit 64a857d to get more accurate results.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #85   +/-   ##
=======================================
  Coverage   92.54%   92.54%           
=======================================
  Files           5        5           
  Lines         295      295           
=======================================
  Hits          273      273           
  Misses         22       22           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@amontoison amontoison closed this Jun 19, 2024
@amontoison amontoison reopened this Jun 19, 2024
@tmigot
Copy link
Member Author

tmigot commented Jun 19, 2024

@amontoison the issue here is that the jacobian of the residual is most likely not correct so the test won't pass :s

@amontoison
Copy link
Member

Is it possible to isolate which components are wrong?
First do we have the correct sparsity pattern?

@dpo
Copy link
Member

dpo commented Jun 19, 2024

The Jacobian was computed explicitly here: https://www.gerad.ca/en/papers/G-2020-42. That should be what’s implemented.

@dpo
Copy link
Member

dpo commented Jun 19, 2024

@amontoison Could you have your test print the errors?

@amontoison
Copy link
Member

@amontoison Could you have your test print the errors?

@tmigot You opened the PR and know better than me what is implemented in NLPModelsTest.jl.
Is it possible?

@tmigot
Copy link
Member Author

tmigot commented Jun 20, 2024

You can compare the obtained result with auto diff eventually ? https://jso.dev/ADNLPModels.jl/dev/mixed/ you can build an ADNLSModel from a BundleAdjustmentModel.

jacobian_residual_check returns a Dict{Tuple{Int, Int}, Float64} where the Tuple is the indices of the Jacobian matrix and Float64 the error when it is nonzero. In other words, those are the wrong indices.

@dpo
Copy link
Member

dpo commented Jun 20, 2024

The error will be nonzero, because it's finite differences (except in special cases), so it's the magnitude of the error that we should look at.

@amontoison
Copy link
Member

amontoison commented Jun 22, 2024

I checked the Jacobians with ADNLPModels.jl and it's only correct when we use x = nlp.meta.x0.
Something is wrong in the function coord_residual implemented in this package.
In #92, I added an option in the benchmarks to also check the Jacobian.

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.

3 participants