Conversation
update 11/8
update 5/30
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #93 +/- ##
==========================================
- Coverage 81.67% 81.55% -0.13%
==========================================
Files 49 49
Lines 2025 2082 +57
Branches 269 271 +2
==========================================
+ Hits 1654 1698 +44
- Misses 371 384 +13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/polysolve/nonlinear/Solver.hpp
Outdated
|
|
||
| virtual double compute_grad_norm(const Problem &objFunc, const TVector &x, const TVector &grad) const | ||
| { | ||
| return objFunc.grad_norm(grad, norm_type_); |
There was a problem hiding this comment.
I believe so. Is there an issue I am overlooking?
| default_init_step_size = params["line_search"]["default_init_step_size"]; | ||
| step_ratio = params["line_search"]["step_ratio"]; | ||
|
|
||
| try_interpolating_step = params["line_search"]["try_interpolating_step"]; |
src/polysolve/nonlinear/Problem.hpp
Outdated
| virtual double step_norm_rescaling(const std::string &norm_type) const {return 1;} | ||
| virtual double energy_norm_rescaling(const std::string &norm_type) const {return 1;} | ||
|
|
||
| virtual double grad_norm(const TVector &x, const std::string &norm_type) const {return x.norm();} |
There was a problem hiding this comment.
this is super misleading. x is the solution, now it is the grad. which one is it?
src/polysolve/nonlinear/Problem.hpp
Outdated
| /// @return True if the solver should stop, false otherwise. | ||
| virtual bool stop(const TVector &x) { return false; } | ||
|
|
||
| virtual double grad_norm_rescaling(const std::string &norm_type) const {return 1;} |
There was a problem hiding this comment.
fixed. I use an enum now. It feels a bit awkward as it seems like something that would be more natural to define in the code defining the problem completely (e.g., PolyFEM), but I don't see a better solution at the moment.
| double grad_norm_rescaling = 1; | ||
| bool try_interpolating_step; | ||
| double rel_interpolation_accuracy_tol = 0; | ||
| std::string norm_type = "Euclidean"; |
There was a problem hiding this comment.
Solver::set_line_search
| bool is_converged_status(const Status s) | ||
| { | ||
| return s == Status::XDeltaTolerance || s == Status::FDeltaTolerance || s == Status::GradNormTolerance; | ||
| return s == Status::XDeltaTolerance || s == Status::FDeltaTolerance || s == Status::GradNormTolerance || s == Status::NewtonDecrementTolerance || s == Status::RelGradNormTolerance || s == Status::RelXDeltaTolerance; |
There was a problem hiding this comment.
why newton here? this interface is more generic
There was a problem hiding this comment.
The Newton decrement is a generic estimate of how close you are to the optimum and applies for non-Newton methods.
src/polysolve/nonlinear/Solver.cpp
Outdated
|
|
||
| m_descent_strategy = 0; | ||
|
|
||
| norm_type_ = solver_params["norm_type"]; |
| }, | ||
| { | ||
| "pointer": "/norm_type", | ||
| "default": "L2", |
There was a problem hiding this comment.
use options to enumearte all. in the code is called euclidean
| { | ||
| m_logger.debug("[{}] large (or nan) linear solve residual {}>{} (‖∇f‖={})", | ||
| name(), residual, residual_tolerance * characteristic_length, grad.norm()); | ||
| name(), residual, current_residual_tolerance, objFunc.grad_norm(grad, "L2")); |
src/polysolve/nonlinear/Problem.hpp
Outdated
| virtual double step_norm_rescaling(const std::string &norm_type) const {return 1;} | ||
| virtual double energy_norm_rescaling(const std::string &norm_type) const {return 1;} | ||
|
|
||
| virtual double grad_norm(const TVector &x, const std::string &norm_type) const {return x.norm();} |
There was a problem hiding this comment.
also why is the problem resposible for this?
update 3/13
cbedb97 to
f842fd4
Compare
Added functions to nonlinear Problem class to allow user-specified norms with appropriate rescaling functions
Updated nonlinear solver and line search logic to use these norms and custom rescalings