LeastSquaresEquationsSolver

class LeastSquaresEquationsSolver(*args)

Solve systems of non-linear equations using a least squares method.

Warning

This class is experimental and likely to be modified in future releases. To use it, import the openturns.experimental submodule.

Parameters:
absErrorpositive float

Absolute error between two successive iterates at the end point. Default value is defined in the ResourceMap via the Solver-DefaultAbsoluteError key is set to 10^{-5}.

relErrorpositive float

Relative error between the two last successive iterates with regards to the last iterate. Default value is defined in the ResourceMap via the Solver-DefaultRelativeError key is set to 10^{-5}.

resErrorpositive float

Absolute threshold on f(x) for accepting a given solution. It is also used as residual error for the least square optimizer. value. Default value is defined in the ResourceMap via the Solver-DefaultResidualError and is set to 0.

maximumFunctionEvaluationint

The maximum number of evaluations of the function. Default value is defined in the ResourceMap via the Solver-DefaultMaximumFunctionEvaluation and is set to 100.

Methods

getAbsoluteError()

Accessor to the absolute error.

getCallsNumber()

Accessor to the number of function calls.

getClassName()

Accessor to the object's name.

getMaximumCallsNumber()

Accessor to the maximum number of function calls.

getName()

Accessor to the object's name.

getOptimizationAlgorithm()

Get the used algorithm for the optimization.

getRelativeError()

Accessor to the relative error.

getResidualError()

Accessor to the residual error.

hasName()

Test if the object is named.

setAbsoluteError(absoluteError)

Accessor to the absolute error.

setMaximumCallsNumber(maximumFunctionEvaluation)

Accessor to the maximum number of function calls.

setName(name)

Accessor to the object's name.

setOptimizationAlgorithm(algorithm)

Set the used algorithm for the optimization.

setRelativeError(relativeError)

Accessor to the relative error.

setResidualError(residualError)

Accessor to the residual error.

solve(*args)

Solve a system of non-linear equations.

Notes

LeastSquaresEquationsSolver might fail and not obtain a result lower than the specified threshold, in this case an error is thrown.

Examples

>>> import openturns as ot
>>> from openturns.experimental import LeastSquaresEquationsSolver
>>> inputs = ['x', 'y']
>>> formulas = ['y*x-sin(2*x)', '1 + cos(y) + x']
>>> analytical = ot.SymbolicFunction(inputs, formulas)
>>> algo = LeastSquaresEquationsSolver()
>>> algo.setResidualError(1e-8)
>>> starting_point = [2.0, 1.0]
>>> solution = algo.solve(analytical, starting_point)
__init__(*args)
getAbsoluteError()

Accessor to the absolute error.

Returns:
absErrorfloat

The absolute error: distance between two successive iterates at the end point.

getCallsNumber()

Accessor to the number of function calls.

Returns:
nEvalint

The number of function calls.

getClassName()

Accessor to the object’s name.

Returns:
class_namestr

The object class name (object.__class__.__name__).

getMaximumCallsNumber()

Accessor to the maximum number of function calls.

Returns:
maxEvalint

The maximum number of function calls.

getName()

Accessor to the object’s name.

Returns:
namestr

The name of the object.

getOptimizationAlgorithm()

Get the used algorithm for the optimization.

Returns:
algorithmOptimizationAlgorithm

The used optimization algorithm.

getRelativeError()

Accessor to the relative error.

Returns:
relErrorfloat

The relative error: distance between the two last successive iterates with regards to the last iterate.

getResidualError()

Accessor to the residual error.

Returns:
resErrorfloat

The residual errors: difference between the last iterate value and the expected value.

hasName()

Test if the object is named.

Returns:
hasNamebool

True if the name is not empty.

setAbsoluteError(absoluteError)

Accessor to the absolute error.

Parameters:
absErrorfloat

The absolute error: distance between two successive iterates at the end point.

setMaximumCallsNumber(maximumFunctionEvaluation)

Accessor to the maximum number of function calls.

Parameters:
maxEvalint

The maximum number of function calls.

setName(name)

Accessor to the object’s name.

Parameters:
namestr

The name of the object.

setOptimizationAlgorithm(algorithm)

Set the used algorithm for the optimization.

Parameters:
algorithmOptimizationAlgorithm

The optimization algorithm to be used.

setRelativeError(relativeError)

Accessor to the relative error.

Parameters:
relErrorfloat

The relative error: distance between the two last successive iterates with regards to the last iterate.

setResidualError(residualError)

Accessor to the residual error.

Parameters:
resErrorfloat

The residual errors: difference between the last iterate value and the expected value.

solve(*args)

Solve a system of non-linear equations.

Parameters:
functionFunction

The vectorial function of the system of equations function_i(x) = 0 \forall i \in {1,...,n} to be solved. Remark that it is an unbounded resolution.

startingPointsequence of floats

The starting point of the optimization algorithm.

boundsInterval

Bounds for searching the solution of the system of equations.

Returns:
resultPoint

The result of the root research.

Notes

LeastSquaresEquationsSolver might fail and not obtain a result lower than the specified threshold, in this case an error is thrown.