OptimizationProblem¶

class
OptimizationProblem
(*args)¶ Base class to define an optimization problem.
 Available constructors:
OptimizationProblem()
OptimizationProblem(objective)
OptimizationProblem(objective, equality, inequality, bounds)
OptimizationProblem(level, value)
Parameters:  objective :
Function
Objective function. Additional constraints and bounds must always be consistent with the objective input dimension.
 equality :
Function
Equality constraints.
 inequality :
Function
Inequality constraints.
 bounds :
Interval
Bounds.
 level :
Function
Level function.
 value : float
Level value.
Notes
The first form 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.
The second form represents a nearest point problem:
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.OptimizationProblem(levelFunction, 3.0)
Methods
getBounds
()Accessor to bounds. getClassName
()Accessor to the object’s name. getDimension
()Accessor to spatial dimension. getEqualityConstraint
()Accessor to equality constraints. getId
()Accessor to the object’s id. getImplementation
(*args)Accessor to the underlying implementation. getInequalityConstraint
()Accessor to inequality constraints. getLevelFunction
()Accessor to level function. getLevelValue
()Accessor to level value. getName
()Accessor to the object’s name. getObjective
()Accessor to objective function. hasBounds
()Test whether bounds had been specified. hasEqualityConstraint
()Test whether equality constraints had been specified. hasInequalityConstraint
()Test whether inequality constraints had been specified. hasLevelFunction
()Test whether level function had been specified. hasMultipleObjective
()Test whether objective function is a scalar or vector function. isMinimization
()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. 
__init__
(*args)¶ Initialize self. See help(type(self)) for accurate signature.

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

getDimension
()¶ Accessor to spatial dimension.
Returns:  dimension : int
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:  id : int
Internal unique identifier.

getImplementation
(*args)¶ Accessor to the underlying implementation.
Returns:  impl : Implementation
The implementation class.

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

getLevelValue
()¶ Accessor to level value.
Returns:  value : float
Level value.

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

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

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

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

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

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

isMinimization
()¶ Test whether this is a minimization or maximization problem.
Returns:  value : bool
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:  levelValue : float
Level value.

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

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