Skip to content

Residual problem#108

Merged
teseoch merged 2 commits into
mainfrom
residual_problem
Jul 8, 2026
Merged

Residual problem#108
teseoch merged 2 commits into
mainfrom
residual_problem

Conversation

@teseoch

@teseoch teseoch commented Jun 29, 2026

Copy link
Copy Markdown
Member

No description provided.

@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.82%. Comparing base (231f7e8) to head (9b2df43).

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     
Flag Coverage Δ
polysolve 80.82% <100.00%> (+0.29%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() (default false) and use it in the nonlinear solver to skip the descent-direction fallback logic for residual problems.
  • Introduce a new line-search method ResidualBacktracking and register it in the factory, CMake sources, and JSON solver spec.
  • Treat SuperLU include directories as SYSTEM to 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.

Comment on lines +15 to +28
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);
}
@iiiian

iiiian commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

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?

@teseoch

teseoch commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

There is no energy or better it has no meaning

@teseoch teseoch merged commit a7727e3 into main Jul 8, 2026
10 checks passed
@teseoch teseoch deleted the residual_problem branch July 8, 2026 17:45
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