LevenbergMarquardt2D Class

A class for finding minimum of a least squared problem on the form f(x,y) = ||fv(x,y)|| where fv is a 2D function - returns a vector of length 2.

It is using a Levenberg-Marquardt method or a Newton-Raphson method, according to UseLm.

Finding zeros of a nonlinear system of equations, i.e. fv(x,y) = [0,0] is a special case of a least square minimization problem, where the minimum is in the zero point and fv(x*,y*) = (0,0).

If the Jacobian is available, it can be provided, otherwise it works by numerically calculating the Jacobian.

Definition

Namespace: DHI.Mike1D.Generic.MathAlgorithms
Assembly: DHI.Mike1D.Generic (in DHI.Mike1D.Generic.dll) Version: 24.0.0.0 (11.1.1.1111)
C#
public class LevenbergMarquardt2D
Inheritance
Object    LevenbergMarquardt2D

Constructors

LevenbergMarquardt2D(LevenbergMarquardt2DFunction) Constructor for minimizing/finding zeros of the function
LevenbergMarquardt2D(LevenbergMarquardt2DFunction, LevenbergMarquardt2DFunction) Constructor for minimizing/finding zeros of the function

The jacobian must return a vector containing the coefficients [df1_dx1, df1_dx2, df2_dx1, df2_dx2].

Properties

Epsilon Epsilon, used in stopping criteria

Default value is 1e-9

LambdaScaling Scaling factor in J^T*J+lambda*I, replacing the diagonal of I by those in LambdaScaling

By default they are [1,1]. They can not be negative.

MaxIter Maximum number of iterations. Default 100
MaxLineSearchIter Maximum number of line search iterations. Default 0.
NumFunctionEval Hold the number of function evaluations.
NumIter Hold the actual number of iterations for the last solve.
NumJacobianEval Hold the number of Jacobian evaluations.
UseLineSearch Flag specifying whether a line search approach is to be used. Default false.
UseLm Flag whether a LM algorithm should be used. Default true. If set to false the Newton-Raphson method will be used. The Newton-Raphson method can only be used for finding zeros, not for minimizing.

Methods

CalcJacobian Calculates numerically the Jacobian
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
JacobianTest Calculates the 2-norm difference between the exact and the numeric jacobian, on an element-wise basis (not matrix norm, but element/vector norm)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Solve Minimize/Solves for zeros, using x as starting point and updating the value of x as a result.
SwapT Swapping two elements.
ToStringReturns a string that represents the current object.
(Inherited from Object)

See Also