OptimizationSolver

class OptimizationSolver(*args)

Base class for optimization wrappers.

Available constructors:
OptimizationSolver(problem, verbose=False)
Parameters:

problem : OptimizationProblem

Optimization problem.

verbose : bool

Let solver be more verbose.

Notes

Class OptimizationSolver is an abstract class, which has several implementations. The default implementation is Cobyla, but there are also AbdoRackwitz, SQP and TNC.

Examples

Define an optimization problem to find the minimum of the Rosenbrock function:

>>> import openturns as ot
>>> rosenbrock = ot.NumericalMathFunction(['x1', 'x2'], ['(1-x1)^2+100*(x2-x1^2)^2'])
>>> problem = ot.OptimizationProblem()
>>> problem.setObjective(rosenbrock)
>>> solver = ot.OptimizationSolver(problem)
>>> solver.setStartingPoint([0, 0])
>>> solver.setMaximumResidualError(1.e-3)
>>> solver.setMaximumIterationNumber(100)
>>> solver.run()
>>> result = solver.getResult()

Methods

getClassName() Accessor to the object’s name.
getId() Accessor to the object’s id.
getImplementation(*args) Accessor to the underlying implementation.
getMaximumAbsoluteError() Accessor to maximum allowed absolute error.
getMaximumConstraintError() Accessor to maximum allowed constraint error.
getMaximumIterationNumber() Accessor to maximum allowed number of iterations.
getMaximumRelativeError() Accessor to maximum allowed relative error.
getMaximumResidualError() Accessor to maximum allowed residual error.
getName() Accessor to the object’s name.
getProblem() Accessor to optimization problem.
getResult() Accessor to optimization result.
getStartingPoint() Accessor to starting point.
getVerbose() Accessor to the verbosity flag.
run() Launch the optimization.
setMaximumAbsoluteError(maximumAbsoluteError) Accessor to maximum allowed absolute error.
setMaximumConstraintError(maximumConstraintError) Accessor to maximum allowed constraint error.
setMaximumIterationNumber(maximumIterationNumber) Accessor to maximum allowed number of iterations.
setMaximumRelativeError(maximumRelativeError) Accessor to maximum allowed relative error.
setMaximumResidualError(maximumResidualError) Accessor to maximum allowed residual error.
setName(name) Accessor to the object’s name.
setProblem(problem) Accessor to optimization problem.
setResult(result) Accessor to optimization result.
setStartingPoint(startingPoint) Accessor to starting point.
setVerbose(verbose) Accessor to the verbosity flag.
__init__(*args)
getClassName()

Accessor to the object’s name.

Returns:

class_name : str

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

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getImplementation(*args)

Accessor to the underlying implementation.

Returns:

impl : Implementation

The implementation class.

getMaximumAbsoluteError()

Accessor to maximum allowed absolute error.

Returns:

maximumAbsoluteError : float

Maximum allowed absolute error.

getMaximumConstraintError()

Accessor to maximum allowed constraint error.

Returns:

maximumConstraintError : float

Maximum allowed constraint error.

getMaximumIterationNumber()

Accessor to maximum allowed number of iterations.

Returns:

N : int

Maximum allowed number of iterations.

getMaximumRelativeError()

Accessor to maximum allowed relative error.

Returns:

maximumRelativeError : float

Maximum allowed relative error.

getMaximumResidualError()

Accessor to maximum allowed residual error.

Returns:

maximumResidualError : float

Maximum allowed residual error.

getName()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

getProblem()

Accessor to optimization problem.

Returns:

problem : OptimizationProblem

Optimization problem.

getResult()

Accessor to optimization result.

Returns:

result : OptimizationResult

Result class.

getStartingPoint()

Accessor to starting point.

Returns:

startingPoint : NumericalPoint

Starting point.

getVerbose()

Accessor to the verbosity flag.

Returns:

verbose : bool

Verbosity flag state.

run()

Launch the optimization.

setMaximumAbsoluteError(maximumAbsoluteError)

Accessor to maximum allowed absolute error.

Parameters:

maximumAbsoluteError : float

Maximum allowed absolute error.

setMaximumConstraintError(maximumConstraintError)

Accessor to maximum allowed constraint error.

Parameters:

maximumConstraintError : float

Maximum allowed constraint error.

setMaximumIterationNumber(maximumIterationNumber)

Accessor to maximum allowed number of iterations.

Parameters:

N : int

Maximum allowed number of iterations.

setMaximumRelativeError(maximumRelativeError)

Accessor to maximum allowed relative error.

Parameters:

maximumRelativeError : float

Maximum allowed relative error.

setMaximumResidualError(maximumResidualError)

Accessor to maximum allowed residual error.

Parameters:

maximumResidualError : float

Maximum allowed residual error.

setName(name)

Accessor to the object’s name.

Parameters:

name : str

The name of the object.

setProblem(problem)

Accessor to optimization problem.

Parameters:

problem : OptimizationProblem

Optimization problem.

setResult(result)

Accessor to optimization result.

Parameters:

result : OptimizationResult

Result class.

setStartingPoint(startingPoint)

Accessor to starting point.

Parameters:

startingPoint : NumericalPoint

Starting point.

setVerbose(verbose)

Accessor to the verbosity flag.

Parameters:

verbose : bool

Verbosity flag state.