DoglegSystemSolver Class

Represents an algorithm that solves a system of nonlinear equations using Powell's dogleg method.

Definition

Namespace: Extreme.Mathematics.EquationSolvers
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
C#
public sealed class DoglegSystemSolver : EquationSystemSolver
Inheritance
Object  →  ManagedIterativeAlgorithm<Object, Double, SolutionReport<Object, Double>>  →  ManagedIterativeAlgorithm<Object>  →  ManagedIterativeAlgorithm  →  EquationSystemSolver  →  DoglegSystemSolver

Remarks

Use the DoglegSystemSolver class to solve a system of nonlinear equations. The class uses a variant of Powell's dogleg method to find a solution. This is the method of choice for most problems.

The target functions are set in one of two ways. The TargetFunction property is a delegate that represents a multivariate function returning a vector in its second argument. This is a function that returns a vector containing the values each target function. Alternatively, the SetTargetFunctions(Func<Vector<Double>, Double>[]) method can be used to provide the target functions as an array of multivariate function delegates.

Similarly, the gradients of the target functions can be set in two ways. The JacobianFunction property is a delegate that represents a multivariate function returning a matrix in its second argument that calculates the Jacobian of the system of equations. The Jacobian is a matrix whose rows are the gradients of the target functions. Alternatively, the SetGradientFunctions(Func<Vector<Double>, Vector<Double>>[]) method lets you supply the gradients of individual target functions as an array of either multivariate function returning a vector or multivariate function returning a vector in its second argument delegates.

The starting point for the iteration is set through the InitialGuess property. This property must be set to a valid Vector before the algorithm is run. MaxIterations sets the maximum number of iterations, while MaxEvaluations sets the maximum number of function evaluations.

The Solve() method performs the actual approximation of the root. This method returns the Vector that is best approximation that was found. The Status property indicates whether the algorithm was successful. One value to look out for is ConvergedToFalseSolution. This occurs when the algorithm converges to a local minimum of the sum of squares of the function valuies.

The algorithm has two convergence tests. By default, the algorithm terminates when either of these is satisfied. You can deactivate either test by setting its Enabled property to false. If both tests are deactivated, then the algorithm always terminates when the maximum number of iterations or function evaluations is reached.

The first test is based on the uncertainty in the location of the approximate solution. The SolutionTest property returns a VectorConvergenceTest<T> object that allows you to specify the desired Tolerance and specific ConvergenceCriterion. See the VectorConvergenceTest<T> class for details on how to further customize this test.

The second test is based on the value of the target functions at the approximate solution. The ValueTest property returns a VectorConvergenceTest<T> object that can be used to customize the test. By default, the error is set to the component with the largest absolute value.

The method uses derivative information if it is available. If the JacobianFunction property is null, and no gradient functions have been supplied, then numerical derivatives are used. Special techniques are used to keep the number of numerical derivative evaluations down to a minimum. Even though the algorithm without derivatives takes less time per iteration, it usually requires significantly more iterations to find a solution. Except for very large problems, or when the evaluation of derivatives is very expensive, derivative information should be supplied.

The dogleg algorithm works by minimizing the sum of the squares of the target functions. The approximation to the solution is updated in each step by either a Newton step, a steepest descent step, or a combination of both.

This method produces excellent results in most cases. However, because the algorithm is in essence a minimizer, it is possible that the algorithm gets 'stuck' in a local minimum, and converges to a point that is not a solution of the system of equations. The Status property indicates whether an actual solution was found.

Constructors

Properties

ConvergenceTests Gets the collection of convergence tests for the algorithm.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
CurrentPoint Gets or sets the current best approximation to the solution.
(Inherited from EquationSystemSolver)
CurrentValue Gets or sets the value of the target functions at the current point.
(Inherited from EquationSystemSolver)
Dimensions Gets or sets the number of dimensions of the optimization problem.
(Inherited from EquationSystemSolver)
EstimatedError Gets a value indicating the size of the absolute error of the result.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
EvaluationsNeeded Gets the number of evaluations needed to execute the algorithm.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
HasSharedDegreeOfParallelism Indicates whether the degree of parallelism is a property that is shared across instances.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
InitialGuess Gets or sets the initial value for the Newton-Raphson iteration.
(Inherited from EquationSystemSolver)
InitializeJacobian Gets or sets whether the Jacobian should be initialized to an all zero matrix.
(Inherited from EquationSystemSolver)
IterationsNeeded Gets the number of iterations needed by the algorithm to reach the desired accuracy.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
JacobianFunction Gets or sets the Jacobian for the EquationSystemSolver.
(Inherited from EquationSystemSolver)
MaxDegreeOfParallelism Gets or sets the maximum degree of parallelism enabled by this instance.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
MaxEvaluations Gets or sets the maximum number of evaluations during the calculation.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
MaxIterationsGets or sets the maximum number of iterations to use when approximating the roots of the target function.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
MinIterations Gets or sets the minimum iterations that have to be performed.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
ParallelOptions Gets or sets the configuration for the parallel behavior of the algorithm.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
Result Gets the result of an algorithm after it has executed.
(Inherited from EquationSystemSolver)
RightHandSide Gets or sets the right-hand side of the system of equations.
(Inherited from EquationSystemSolver)
SolutionReport Gets the result of an algorithm after it has executed.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
SolutionTest Gets the VectorConvergenceTest<T> that uses the approximate solution.
(Inherited from EquationSystemSolver)
Status Gets the AlgorithmStatus following an execution of the algorithm.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
TargetFunction Gets or sets the target function for the EquationSystemSolver.
(Inherited from EquationSystemSolver)
ThrowExceptionOnFailure Gets or sets a value indicating whether to throw an exception when the algorithm fails to converge.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
TrustRegionRadius Gets or sets the radius of the trust region.
ValueTest Gets the VectorConvergenceTest<T> that uses the value of the target functions.
(Inherited from EquationSystemSolver)

Methods

EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
SetGradientFunctions(Func<Vector<Double>, Vector<Double>>[]) Sets the target functions.
(Inherited from EquationSystemSolver)
SetGradientFunctions(Func<Vector<Double>, Vector<Double>, Vector<Double>>[]) Sets the target functions.
(Inherited from EquationSystemSolver)
SetSymbolicTargetFunctions Defines the left hand sides of the equations to solve as a set of lambda expressions.
(Inherited from EquationSystemSolver)
SetTargetFunctions Sets the target functions.
(Inherited from EquationSystemSolver)
Solve() Attempts to find a root or zero of the target function.
(Inherited from EquationSystemSolver)
Solve(Vector<Double>) Attempts to find the point where the target function equals the specified value.
(Inherited from EquationSystemSolver)
ToStringReturns a string that represents the current object.
(Inherited from Object)

See Also