Residual problem#108
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #108 +/- ##
==========================================
+ Coverage 80.53% 80.82% +0.29%
==========================================
Files 49 51 +2
Lines 2106 2117 +11
Branches 281 280 -1
==========================================
+ Hits 1696 1711 +15
+ Misses 410 406 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds first-class support for “residual-style” nonlinear problems by introducing a residual problem marker on Problem, adjusting solver descent-direction handling accordingly, and adding a new ResidualBacktracking line-search option.
Changes:
- Add
Problem::is_residual()(defaultfalse) and use it in the nonlinear solver to skip the descent-direction fallback logic for residual problems. - Introduce a new line-search method
ResidualBacktrackingand register it in the factory, CMake sources, and JSON solver spec. - Treat SuperLU include directories as
SYSTEMto reduce third-party warning noise.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/polysolve/nonlinear/Solver.cpp | Skips the “not a descent direction” strategy fallback for residual problems. |
| src/polysolve/nonlinear/Problem.hpp | Adds is_residual() hook and minor formatting cleanup. |
| src/polysolve/nonlinear/line_search/ResidualBacktracking.hpp | Declares new residual-focused backtracking line-search. |
| src/polysolve/nonlinear/line_search/ResidualBacktracking.cpp | Implements the new acceptance criterion for residual backtracking. |
| src/polysolve/nonlinear/line_search/LineSearch.cpp | Registers ResidualBacktracking in the line-search factory and method list. |
| src/polysolve/nonlinear/line_search/CMakeLists.txt | Adds new ResidualBacktracking sources to the build. |
| nonlinear-solver-spec.json | Exposes ResidualBacktracking as a configurable line-search method (plus minor formatting). |
| cmake/recipes/superlu.cmake | Marks SuperLU include dirs as SYSTEM to suppress external warnings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| bool ResidualBacktracking::criteria(const TVector &delta_x, | ||
| Problem &objFunc, | ||
| const bool use_grad_norm, | ||
| const double old_energy, | ||
| const TVector &old_grad, | ||
| const TVector &new_x, | ||
| const double new_energy, | ||
| const double step_size) const | ||
| { | ||
| TVector new_grad; | ||
| objFunc.gradient(new_x, new_grad); | ||
| return objFunc.grad_norm(new_grad, norm_type) | ||
| < objFunc.grad_norm(old_grad, norm_type); | ||
| } |
|
Why do we need a new backtracking strategy? if the energy is 0.5*r^2, isn't checking the energy the same as checking grad norm? |
|
There is no energy or better it has no meaning |
No description provided.