NEML2 1.4.0
|
The nonlinear solver solves a nonlinear system of equations. More...
The nonlinear solver solves a nonlinear system of equations.
The Newton-Raphson method is used to iteratively update the initial guess until the residual becomes zero within specified tolerances.
Each update step is obtained by solving a trust-region subproblem, i.e. a quadratic bound-constrained problem.
The trust-region outer loop is implemented following Nocedal and Wright, section 4.1.
The subproblem implemented here is an alternative linearization of the original subproblem, introduced in
Yuan, Ya-xiang. Trust region algorithms for nonlinear equations. Hong Kong Baptist University, Department of Mathematics, 1994.
#include <NewtonWithTrustRegion.h>
Public Member Functions | |
NewtonWithTrustRegion (const OptionSet &options) | |
Public Member Functions inherited from Newton | |
Newton (const OptionSet &options) | |
virtual std::tuple< bool, size_t > | solve (NonlinearSystem &system, Tensor &x) override |
Solve the given nonlinear system. | |
Public Member Functions inherited from NonlinearSolver | |
NonlinearSolver (const OptionSet &options) | |
Construct a new NonlinearSolver object. | |
Public Member Functions inherited from Solver | |
Solver (const OptionSet &options) | |
Construct a new Solver object. | |
Public Member Functions inherited from NEML2Object | |
NEML2Object (const OptionSet &options) | |
Construct a new NEML2Object object. | |
virtual | ~NEML2Object ()=default |
const OptionSet & | input_options () const |
virtual void | setup () |
Setup this object. | |
const std::string & | name () const |
A readonly reference to the object's name. | |
const std::string & | type () const |
A readonly reference to the object's type. | |
const std::string & | path () const |
A readonly reference to the object's path. | |
const std::string & | doc () const |
A readonly reference to the object's docstring. | |
template<typename T = NEML2Object> | |
const T * | host () const |
Get a readonly pointer to the host. | |
template<typename T = NEML2Object> | |
T * | host () |
Get a writable pointer to the host. | |
Static Public Member Functions | |
static OptionSet | expected_options () |
Static Public Member Functions inherited from Newton | |
static OptionSet | expected_options () |
Static Public Member Functions inherited from NonlinearSolver | |
static OptionSet | expected_options () |
Static Public Member Functions inherited from Solver | |
static OptionSet | expected_options () |
Static Public Member Functions inherited from NEML2Object | |
static OptionSet | expected_options () |
Protected Member Functions | |
OptionSet | subproblem_options (const OptionSet &) const |
Extract options for the subproblem. | |
OptionSet | subproblem_solver_options (const OptionSet &) const |
Extract options for the subproblem solver. | |
virtual void | prepare (const NonlinearSystem &system, const Tensor &x) override |
Prepare solver internal data before the iterative update. | |
virtual void | update (NonlinearSystem &system, Tensor &x) override |
Update trial solution. | |
virtual Tensor | solve_direction (const NonlinearSystem &system) override |
Find the current update direction. | |
Scalar | merit_function_reduction (const NonlinearSystem &system, const Tensor &p) const |
Reduction in the merit function. | |
Protected Member Functions inherited from Newton | |
virtual bool | converged (size_t itr, const torch::Tensor &nR, const torch::Tensor &nR0) const |
Check for convergence. The current iteration is said to be converged if the residual norm is below the absolute tolerance or or the ratio between the residual norm and the initial residual norm is below the relative tolerance. | |
virtual void | final_update (NonlinearSystem &system, Tensor &x) |
Do a final update to track AD function graph. | |
Protected Attributes | |
TrustRegionSubProblem | _subproblem |
Trust-region subproblem. | |
Newton | _subproblem_solver |
Solver used to solver the trust-region subproblem. | |
Scalar | _delta |
The trust region radius. | |
Real | _delta_0 |
Initial size of the trust region. | |
Real | _delta_max |
Maximum size of the trust region. | |
Real | _reduce_criteria |
Criteria for reducing the trust region. | |
Real | _expand_criteria |
Criteria for expanding the trust region. | |
Real | _reduce_factor |
Cutback factor if we do reduce the trust region. | |
Real | _expand_factor |
Expansion factor if we do increase the trust region. | |
Real | _accept_criteria |
Acceptance criteria for a step. | |
Additional Inherited Members | |
Public Attributes inherited from NonlinearSolver | |
Real | atol |
Absolute tolerance. | |
Real | rtol |
Relative tolerance. | |
unsigned int | miters |
Maximum number of iterations. | |
Public Attributes inherited from Solver | |
const bool | verbose |
Whether to print additional (debugging) information during the solve. | |
NewtonWithTrustRegion | ( | const OptionSet & | options | ) |
|
static |
|
protected |
Reduction in the merit function.
|
overrideprotectedvirtual |
Prepare solver internal data before the iterative update.
Reimplemented from Newton.
|
overrideprotectedvirtual |
Find the current update direction.
Reimplemented from Newton.
Extract options for the subproblem.
Extract options for the subproblem solver.
|
overrideprotectedvirtual |
Update trial solution.
Reimplemented from Newton.
|
protected |
Acceptance criteria for a step.
|
protected |
The trust region radius.
|
protected |
Initial size of the trust region.
|
protected |
Maximum size of the trust region.
|
protected |
Criteria for expanding the trust region.
|
protected |
Expansion factor if we do increase the trust region.
|
protected |
Criteria for reducing the trust region.
|
protected |
Cutback factor if we do reduce the trust region.
|
protected |
Trust-region subproblem.