Skip to contents

Algorithms for solve() on nonlinear problems, named as in NonlinearSolve.jl.

Usage

NewtonRaphson(
  concrete_jac = NULL,
  linsolve = NULL,
  linesearch = NULL,
  autodiff = NULL,
  vjp_autodiff = NULL,
  jvp_autodiff = NULL
)

SimpleNewtonRaphson(autodiff = NULL)

TrustRegion(
  concrete_jac = NULL,
  linsolve = NULL,
  radius_update_scheme = NULL,
  subproblem = TrustRegionSubproblem$More,
  max_trust_radius = 0,
  initial_trust_radius = 0,
  step_threshold = 1/10000,
  shrink_threshold = 1/4,
  expand_threshold = 3/4,
  shrink_factor = 1/4,
  expand_factor = 2,
  max_shrink_times = 32L,
  autodiff = NULL,
  vjp_autodiff = NULL,
  jvp_autodiff = NULL,
  jacobian_reuse = NULL
)

SimpleTrustRegion(
  nlsolve_update_rule = FALSE,
  max_trust_radius = NULL,
  initial_trust_radius = NULL,
  autodiff = NULL
)

LevenbergMarquardt(
  linsolve = NULL,
  damping_initial = 1,
  alpha_geodesic = 0.75,
  disable_geodesic = FALSE,
  damping_increase_factor = 2,
  damping_decrease_factor = 3,
  finite_diff_step_geodesic = 0.1,
  b_uphill = 1,
  min_damping_D = 1e-08,
  autodiff = NULL,
  vjp_autodiff = NULL,
  jvp_autodiff = NULL,
  jacobian_reuse = NULL
)

GaussNewton(
  concrete_jac = NULL,
  linsolve = NULL,
  linesearch = NULL,
  autodiff = NULL,
  vjp_autodiff = NULL,
  jvp_autodiff = NULL
)

Broyden(
  max_resets = 100L,
  linesearch = NULL,
  reset_tolerance = NULL,
  init_jacobian = "identity",
  alpha = NULL,
  update_rule = "good_broyden",
  autodiff = NULL
)

Klement(
  max_resets = 100L,
  linesearch = NULL,
  alpha = NULL,
  init_jacobian = "identity",
  autodiff = NULL
)

FastShortcutNonlinearPolyalg(u0_len = NULL, must_use_jacobian = FALSE)

RobustMultiNewton()

FastShortcutNLLSPolyalg()

Arguments

concrete_jac, linsolve, vjp_autodiff, jvp_autodiff, jacobian_reuse

Options of the Julia signature without an effect here.

linesearch

NULL or "BackTracking".

autodiff

How the Jacobian is computed when the problem has none: NULL or AutoForwardDiff() (the default of NonlinearSolve: dual numbers, with forward differences when the residual cannot run on duals) or AutoFiniteDiff() (forward, central or complex step differences, with the steps of FiniteDiff.jl).

radius_update_scheme

One of RadiusUpdateSchemes; NULL picks the default of the subproblem.

subproblem

TrustRegionSubproblem$More, TrustRegionSubproblem$Dogleg or a descent such as MoreTrustRegionDescent(scaling = TrustRegionScaling$Auto).

max_trust_radius, initial_trust_radius

Trust region radii; chosen from the initial residual and the scheme when NULL or 0.

step_threshold, shrink_threshold, expand_threshold, shrink_factor, expand_factor

Settings of the GenericTrustRegionScheme(); 0 selects the scheme's own value.

max_shrink_times

Largest number of consecutive radius shrinks.

nlsolve_update_rule

Use the trust region radius update of NLsolve.

damping_initial

Initial damping of Levenberg Marquardt.

alpha_geodesic, disable_geodesic, finite_diff_step_geodesic

Geodesic acceleration of LevenbergMarquardt(): the correction is kept when 2 |a| <= alpha_geodesic |v|; disable_geodesic = TRUE turns it off.

damping_increase_factor, damping_decrease_factor

Factors applied to the damping after a rejected and an accepted step.

b_uphill

Exponent of the uphill acceptance test.

min_damping_D

Smallest entry of the diagonal damping matrix.

max_resets

Largest number of Jacobian resets of the quasi Newton methods before giving up.

reset_tolerance

Tolerance of the reset test of Broyden(); eps^(3/4) when NULL.

init_jacobian

"identity" (scaled by alpha), "true_jacobian" or, for Klement(), "true_jacobian_diagonal".

alpha

Scale of the initial identity Jacobian; NULL uses 2 |f(u0)| / max(|u0|, 1).

update_rule

"good_broyden", "bad_broyden" or "diagonal".

u0_len

Problem size; the polyalgorithm starts at Newton when it is at most 25.

must_use_jacobian

Leave out the methods that do not use the Jacobian.

Value

An algorithm object.

Details

  • NewtonRaphson() is Newton's method; linesearch = "BackTracking" adds a backtracking line search on the residual norm. SimpleNewtonRaphson() is the same iteration without options.

  • TrustRegion() is the trust region method of NonlinearSolve, a GeneralizedFirstOrderAlgorithm() with a GenericTrustRegionScheme(). subproblem solves the trust region subproblem: TrustRegionSubproblem$More (the default, More's nearly exact step of MINPACK's lmpar, see MoreTrustRegionDescent()), TrustRegionSubproblem$Dogleg (the dogleg path) or a descent. radius_update_scheme selects how the radius changes, one of RadiusUpdateSchemes ("Simple", "NLsolve", "NocedalWright", "Hei", "Yuan", "More", "Bastin", "Fan"); it defaults to "More" with More's subproblem and to "Simple" otherwise. SimpleTrustRegion() is the dogleg method of SimpleNonlinearSolve, where nlsolve_update_rule = TRUE selects the radius update of NLsolve.

  • LevenbergMarquardt() is the damped least squares method, and GaussNewton() the undamped one; both also solve NonlinearLeastSquaresProblems.

  • Broyden() is Broyden's quasi Newton method: it starts from the Jacobian alpha * I (or the true Jacobian with init_jacobian = "true_jacobian"), updates the inverse with the good (or bad) Broyden rule and starts over when neither the state nor the residual changed for three steps. Klement() keeps a diagonal Jacobian with Klement's update and starts over when a diagonal entry vanishes. Neither needs Jacobian evaluations, and both can succeed where a singular Jacobian stops Newton's method.

  • FastShortcutNonlinearPolyalg() tries Broyden, Klement, Newton, the trust region methods (Simple and Fan) and Levenberg Marquardt in turn, until one succeeds. With u0_len <= 25 it starts at Newton, and with must_use_jacobian = TRUE (a problem with a Jacobian function) it leaves out the quasi Newton methods, as NonlinearSolve's default. It is the default for NonlinearProblems, built with the problem size and whether the problem has a Jacobian.

  • RobustMultiNewton() tries the trust region methods with the Simple, Bastin, NLsolve and Fan radius updates and Newton with and without line search.

  • FastShortcutNLLSPolyalg() is the default for least squares problems (Gauss Newton, Levenberg Marquardt, trust region, Gauss Newton with line search).

Solver options given to solve(): abstol (tolerance on the largest absolute residual, default eps^0.8), reltol, maxiters (default 1000).

Examples

prob <- NonlinearProblem(function(u, p) c(u[1]^2 + u[2]^2 - p, u[1] - u[2]), c(1, 2), 2)
solve(prob, NewtonRaphson())$u
#> [1] 1 1
solve(prob, TrustRegion(radius_update_scheme = "Fan"))$u
#> [1] 1 1
solve(prob, LevenbergMarquardt())$u
#> [1] 1 1
solve(prob, Broyden())$u
#> [1] -1 -1
solve(prob, Klement())$u
#> [1] -1 -1