Click or drag to resize

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.

Inheritance Hierarchy
SystemObject
  DHI.Mike1D.Generic.MathAlgorithmsLevenbergMarquardt2D

Namespace:  DHI.Mike1D.Generic.MathAlgorithms
Assembly:  DHI.Mike1D.Generic (in DHI.Mike1D.Generic.dll) Version: 19.0.0.0 (11.1.1.1111)
Syntax
public class LevenbergMarquardt2D

The LevenbergMarquardt2D type exposes the following members.

Constructors
  NameDescription
Public methodLevenbergMarquardt2D(LevenbergMarquardt2DFunction)
Constructor for minimizing/finding zeros of the function
Public methodLevenbergMarquardt2D(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].

Top
Properties
  NameDescription
Public propertyEpsilon
Epsilon, used in stopping criteria

Default value is 1e-9

Public propertyLambdaScaling
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.

Public propertyMaxIter
Maximum number of iterations. Default 100
Public propertyMaxLineSearchIter
Maximum number of line search iterations. Default 0.
Public propertyNumFunctionEval
Hold the number of function evaluations.
Public propertyNumIter
Hold the actual number of iterations for the last solve.
Public propertyNumJacobianEval
Hold the number of Jacobian evaluations.
Public propertyUseLineSearch
Flag specifying whether a line search approach is to be used. Default false.
Public propertyUseLm
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.
Top
Methods
  NameDescription
Public methodStatic memberCalcJacobian
Calculates numerically the Jacobian
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberJacobianTest
Calculates the 2-norm difference between the exact and the numeric jacobian, on an element-wise basis (not matrix norm, but element/vector norm)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodSolve
Minimize/Solves for zeros, using x as starting point and updating the value of x as a result.
Public methodStatic memberSwapT
Swapping two elements.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
See Also