Class NewtonSolver

Inheritance Relationships

Base Type

  • public handle

Class Documentation

class NewtonSolver : public handle

Class container for a dumped Newton’s method with affine invariant step.

Solution Algorithm:

Given a zeros of a vectorial function problem of the form \( \mathbf{F} (\mathbf{x}) = \mathbf{0} \), where \( \mathbf{F}: \mathbb{R}^n \rightarrow \mathbb{R}^n \), then the Newton’s method is defined as:

\[ \mathbf{JF}(\mathbf{x}_k)\mathbf{h} = -\mathbf{F}(\mathbf{x}_k). \]

The dumped step is defined as:

\[ \mathbf{x}_{k+1} = \mathbf{x}_k + \alpha_k \mathbf{h} \]

where \( \alpha_k \) is a dumping coefficient that satisfies:

\[ \left\| \mathbf{JF}(\mathbf{x}_k)^{-1} \mathbf{F}(\mathbf{x}_{k+1}) \right\| \leq \left(1 - \dfrac{\alpha_k}{2}\right) \left\| \mathbf{JF}(\mathbf{x}_k)^{-1} \mathbf{F}(\mathbf{x}_k) \right\| = \left(1 - \dfrac{\alpha_k}{2} \right) \left\| \mathbf{h} \right\|. \]

Note:

For more details on the Newton’s method with affine invariant step refer to: https://www.zib.de/deuflhard/research/algorithm/ainewton.en.html.

Public Functions

function NewtonSolver()

Newton’s solver class constructor.

Returns

The Newton’s solver object.

function set_tolerance(t_tolerance)

Set algorithm tolerance.

Parameters

t_tolerance – The algorithm tolerance.

function get_tolerance()

Get algorithm tolerance.

Returns

The algorithm tolerance.

function set_max_iterations(t_max_iterations)

Set maximum allowed algorithm iterations.

Parameters

t_max_iterations – The maximum allowed algorithm iterations.

function get_max_iterations()

Set maximum allowed algorithm iterations.

Returns

The maximum allowed algorithm iterations.

function set_max_relaxations(t_max_relaxations)

Set maximum allowed algorithm relaxations.

Parameters

t_max_relaxations – The maximum allowed algorithm relaxations.

function get_max_relaxations()

Get maximum allowed algorithm relaxations.

Returns

The maximum allowed algorithm relaxations.

function set_alpha(t_alpha)

Set relaxation factor.

Parameters

t_alpha – The relaxation factor.

function get_alpha()

Get relaxation factor.

Returns

The relaxation factor.

function enable_verbose()

Enable verbose mode.

Parameters

t_alpha – The relaxation factor.

function disable_verbose()

Disable verbose mode.

Parameters

t_alpha – The relaxation factor.

function out_iterations()

Get algorithm iterations.

Returns

The algorithm iterations.

function out_function_evaluations()

Set function evaluations.

Returns

The function evaluations.

function out_jacobian_evaluations()

Set Jacobian evaluations.

Returns

The Jacobian evaluations.

function out_relaxations()

Get algorithm relaxations.

Returns

The algorithm relaxations.

function out_residuals()

Get function evaluations.

Returns

The function evaluations.

function out_converged()

Get convergence boolean value.

Returns

The convergence boolean value.

function solve_handle(t_function_handle, t_jacobian_handle, x_ini)

Solve non-linear system of equations \( \mathbf{F}(\mathbf{x}) = \mathbf{0} \)

Parameters
  • t_function_handle – The function handle.

  • t_jacobian_handle – The Jacobian handle.

  • x_ini – The initial guess vector \( \mathbf{x} \).

Returns

The solution vector \( \mathbf{x} \).

function reset()

Reset solver internal counter and variables.

Parameters

t_function_handle – The function handle.

function eval_function(x)

Perform function \( \mathbf{F}(\mathbf{x}) \) evaluation.

Parameters

x – The input vector \( \mathbf{x} \).

Returns

The function value \( \mathbf{F}(\mathbf{x}) \).

function eval_jacobian(x)

Perform function \( \mathbf{JF}(\mathbf{x}) \) evaluation.

Parameters

x – The input vector \( \mathbf{x} \).

Returns

The Jacobian value \( \mathbf{JF}(\mathbf{x}) \).

function solve(x_ini)

Solve non-linear system of equations \( \mathbf{F} (\mathbf{x}) = \mathbf{0} \).

Parameters

x_ini – The initial guess for the vector \( \mathbf{x} \).

Returns

The solution \( \mathbf{x} \) and the output flag: \( 0 \) = success, \( 1 \) = failed because of bad initial point, \( 2 \) = failed because of bad dumping (step got too short).