OptimizationProblem¶

class
OptimizationProblem
(*args)¶ Base class to define an optimization problem.
This represents a general optimization problem:
where B is problem’s bounds, f is the objective function, g are equality constraints, and h are inequality constraints.
 Available constructors:
OptimizationProblem(objective)
OptimizationProblem(objective, equality, inequality, bounds)
 Parameters
Examples
Define an optimization problem to find the minimum of the Rosenbrock function:
>>> import openturns as ot >>> rosenbrock = ot.SymbolicFunction(['x1', 'x2'], ['(1x1)^2+100*(x2x1^2)^2']) >>> problem = ot.OptimizationProblem(rosenbrock)
Define an optimization problem to find the point with minimum norm which satisfies .
>>> import openturns as ot >>> levelFunction = ot.SymbolicFunction( ... ['x1', 'x2', 'x3', 'x4'], ['x1+2*x23*x3+4*x4']) >>> problem = ot.NearestPointProblem(levelFunction, 3.0)
 Attributes
thisown
The membership flag
Methods
Accessor to bounds.
Accessor to the object’s name.
Accessor to input dimension.
Accessor to equality constraints.
getId
()Accessor to the object’s id.
getImplementation
(*args)Accessor to the underlying implementation.
Accessor to inequality constraints.
Accessor to level function.
Accessor to level value.
getName
()Accessor to the object’s name.
Accessor to objective function.
Accessor to the residual function.
Test whether bounds had been specified.
Test whether equality constraints had been specified.
Test whether inequality constraints had been specified.
Test whether level function had been specified.
Test whether objective function is a scalar or vector function.
Test whether a leastsquare problem is defined.
Test whether this is a minimization or maximization problem.
setBounds
(bounds)Accessor to bounds.
setEqualityConstraint
(equalityConstraint)Accessor to equality constraints.
setInequalityConstraint
(inequalityConstraint)Accessor to inequality constraints.
setLevelFunction
(levelFunction)Accessor to level function.
setLevelValue
(levelValue)Accessor to level value.
setMinimization
(minimization)Tell whether this is a minimization or maximization problem.
setName
(name)Accessor to the object’s name.
setObjective
(objective)Accessor to objective function.
setResidualFunction
(residualFunction)Accessor to the residual function.

__init__
(*args)¶ Initialize self. See help(type(self)) for accurate signature.

getClassName
()¶ Accessor to the object’s name.
 Returns
 class_namestr
The object class name (object.__class__.__name__).

getDimension
()¶ Accessor to input dimension.
 Returns
 dimensionint
Input dimension of objective function.

getEqualityConstraint
()¶ Accessor to equality constraints.
 Returns
 equality
Function
Describe equality constraints.
 equality

getId
()¶ Accessor to the object’s id.
 Returns
 idint
Internal unique identifier.

getImplementation
(*args)¶ Accessor to the underlying implementation.
 Returns
 implImplementation
The implementation class.

getInequalityConstraint
()¶ Accessor to inequality constraints.
 Returns
 inequality
Function
Describe inequality constraints.
 inequality

getLevelValue
()¶ Accessor to level value.
 Returns
 valuefloat
Level value.

getName
()¶ Accessor to the object’s name.
 Returns
 namestr
The name of the object.

getResidualFunction
()¶ Accessor to the residual function.
 Returns
 residualFunction
Function
Residual function.
 residualFunction

hasBounds
()¶ Test whether bounds had been specified.
 Returns
 valuebool
True if bounds had been set for this problem, False otherwise.

hasEqualityConstraint
()¶ Test whether equality constraints had been specified.
 Returns
 valuebool
True if equality constraints had been set for this problem, False otherwise.

hasInequalityConstraint
()¶ Test whether inequality constraints had been specified.
 Returns
 valuebool
True if inequality constraints had been set for this problem, False otherwise.

hasLevelFunction
()¶ Test whether level function had been specified.
 Returns
 valuebool
True if level function had been set for this problem, False otherwise.

hasMultipleObjective
()¶ Test whether objective function is a scalar or vector function.
 Returns
 valuebool
False if objective function is scalar, True otherwise.

hasResidualFunction
()¶ Test whether a leastsquare problem is defined.
 Returns
 valuebool
True if this is a leastsquares problem, False otherwise.

isMinimization
()¶ Test whether this is a minimization or maximization problem.
 Returns
 valuebool
True if this is a minimization problem (default), False otherwise.

setEqualityConstraint
(equalityConstraint)¶ Accessor to equality constraints.
 Parameters
 equalityConstraint
Function
Equality constraints.
 equalityConstraint

setInequalityConstraint
(inequalityConstraint)¶ Accessor to inequality constraints.
 Parameters
 inequalityConstraint
Function
Inequality constraints.
 inequalityConstraint

setLevelFunction
(levelFunction)¶ Accessor to level function.
 Parameters
 levelFunction
Function
Level function.
 levelFunction

setLevelValue
(levelValue)¶ Accessor to level value.
 Parameters
 levelValuefloat
Level value.

setMinimization
(minimization)¶ Tell whether this is a minimization or maximization problem.
 Parameters
 minimizationbool
True if this is a minimization problem, False otherwise.

setName
(name)¶ Accessor to the object’s name.
 Parameters
 namestr
The name of the object.