-
Notifications
You must be signed in to change notification settings - Fork 10
Refactor tests: R2N #271
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
base: master
Are you sure you want to change the base?
Refactor tests: R2N #271
Conversation
|
LSR1 is allocating, will try to fix in LinearOperators.jl |
|
Thank you @MaxenceGollier very thoughtful, having the algorithms tested on different problems (toys, bpdn and others) will be very useful! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #271 +/- ##
===========================================
+ Coverage 61.53% 84.74% +23.21%
===========================================
Files 11 13 +2
Lines 1292 1626 +334
===========================================
+ Hits 795 1378 +583
+ Misses 497 248 -249 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@dpo, @MohamedLaghdafHABIBOULLAH, maybe we merge this first and then do the other solvers ? Or do I just do everything at once here ? |
|
@MaxenceGollier I think you should keep this PR tested only with R2N, so that it is easy to review and we will add the other solvers in different PR! |
| # Remove the x0 entry from solver_kwargs | ||
| optimized_solver_kwargs = Base.structdiff(solver_kwargs, NamedTuple{(:x0,)}) | ||
| solve!(solver, reg_nlp, stats_optimized; x = x0, optimized_solver_kwargs...) # It would be interesting to check for allocations here as well but depending on | ||
| # the structure of solver_kwargs, some variables might get boxed, resulting in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you open an issue for this comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is just a bad idea to add the allocations tests inside this function because this means that you can not assign a variable to one of the solver_constructor_kwargs or solver_kwargs, or else they will get boxed and result in allocations.
To be clearer @wrappedallocs works in such a way that even if
@wrappedallocs solve!(solver, reg_nlp, stats; atol = 1e-3)
returns 0,
tol = 1e-3
@wrappedallocs solve!(solver, reg_nlp, stats; atol = tol)
doesn't.
I think adding this constraint is very confusing so we should just leave the allocation tests out of this function.
I want to keep the comment though so that users will understand why we did not add the allocation tests there, but it might be more precise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we have a function wrappedallocsv2 to avoid this?
| solve!(solver, reg_nlp, stats, σk = 1.0, β = 1e16, atol = 1e-6, rtol = 1e-6) | ||
| ) == 0 | ||
|
|
||
| #test_solver(reg_nlp, # FIXME: divide by 0 error in the LBFGS approximation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MaxenceGollier
I checked this in detail. The issue is actually related to R2DH, and we should probably open a dedicated issue. The problem occurs when
Although this quantity may be small, it is not negligible. When we compute its root, the resulting value can be larger than expected, which may prevent the algorithm from terminating.
A simple and reasonable fix is to assume instead that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never understood why we added this term to
@dpo @MohamedLaghdafHABIBOULLAH, related to #130.
This is very much WIP, but you can already take a look.
I did a proof of concept with R2N, all solvers will eventually have similar tests.
test-solver.jl