RobustOptimizationProblem¶
- class otrobopt.RobustOptimizationProblem(*args)¶
Robust optimization problem.
Must consist at least of one
MeasureEvaluation
, either on the objective or the constraint.Available constructors:
RobustOptimizationProblem(robustnessMeasure, reliabilityMeasure)
RobustOptimizationProblem(objective, reliabilityMeasure)
RobustOptimizationProblem(robustnessMeasure, inequalityConstraint)
- Parameters:
- robustnessMeasure
MeasureEvaluation
Measure function on the objective.
- reliabilityMeasure
MeasureEvaluation
Mesure function on the constraints
- objective
openturns.Function
Objective function
- inequalityConstraint
openturns.Function
Inequality constraint
- robustnessMeasure
Examples
>>> import openturns as ot >>> import otrobopt
Pure robustness problem:
>>> thetaDist = ot.Normal(2.0, 0.1) >>> f_base = ot.SymbolicFunction(['x1', 'theta'], ['x1*theta+cos(x1+theta)']) >>> f = ot.ParametricFunction(f_base, [1], [1.0]) >>> robustnessMeasure = otrobopt.VarianceMeasure(f, thetaDist) >>> problem = otrobopt.RobustOptimizationProblem(robustnessMeasure, ot.Function()) >>> algo = ot.Cobyla(problem) >>> algo.setStartingPoint([0.0]*robustnessMeasure.getInputDimension()) >>> algo.run() >>> x_et = algo.getResult().getOptimalPoint() >>> print(x_et) [0.55...] >>> J_et = algo.getResult().getOptimalValue() >>> print(J_et) [3.42...e-05]
Robustness problem with deterministic constraint:
>>> thetaDist = ot.Normal(2.0, 0.1) >>> f_base = ot.SymbolicFunction(['x1', 'theta'], ['x1*theta']) >>> f = ot.ParametricFunction(f_base, [1], [1.0]) >>> robustnessMeasure = otrobopt.MeanMeasure(f, thetaDist) >>> g = ot.SymbolicFunction(['x1'], ['x1 - 5.0']) >>> problem = otrobopt.RobustOptimizationProblem(robustnessMeasure, g) >>> algo = ot.Cobyla(problem) >>> algo.setStartingPoint([0.0]*robustnessMeasure.getInputDimension()) >>> algo.run() >>> x_et = algo.getResult().getOptimalPoint() >>> J_et = algo.getResult().getOptimalValue()
Pure reliability problem:
>>> thetaDist = ot.Normal(2.0, 0.1) >>> f = ot.SymbolicFunction(['x1'], ['x1+1']) >>> g_base = ot.SymbolicFunction(['x1', 'theta'], ['x1+theta']) >>> g = ot.ParametricFunction(g_base, [1], [1.0]) >>> reliabilityMeasure = otrobopt.JointChanceMeasure(g, thetaDist, ot.Greater(), 0.95) >>> problem = otrobopt.RobustOptimizationProblem(f, reliabilityMeasure) >>> algo = ot.Cobyla(problem) >>> algo.setStartingPoint([0.0]*robustnessMeasure.getInputDimension()) >>> algo.run() >>> x_et = algo.getResult().getOptimalPoint() >>> print(x_et) [-1.83...] >>> J_et = algo.getResult().getOptimalValue() >>> print(J_et) [-0.83...]
Robustness & reliability problem:
>>> thetaDist = ot.Normal(2.0, 0.1) >>> f_base = ot.SymbolicFunction(['x1', 'theta'], ['x1*theta']) >>> f = ot.ParametricFunction(f_base, [1], [1.0]) >>> robustnessMeasure = otrobopt.MeanMeasure(f, thetaDist) >>> g_base = ot.SymbolicFunction(['x1', 'theta'], ['x1+theta']) >>> g = ot.ParametricFunction(g_base, [1], [1.0]) >>> reliabilityMeasure = otrobopt.JointChanceMeasure(g, thetaDist, ot.Greater(), 0.95) >>> problem = otrobopt.RobustOptimizationProblem(robustnessMeasure, reliabilityMeasure) >>> algo = ot.Cobyla(problem) >>> algo.setStartingPoint([0.0]*robustnessMeasure.getInputDimension()) >>> algo.run() >>> x_et = algo.getResult().getOptimalPoint() >>> print(x_et) [-1.83...] >>> J_et = algo.getResult().getOptimalValue() >>> print(J_et) [-3.67...]
Methods
Accessor to bounds.
Accessor to the object's name.
Accessor to input dimension.
Distribution accessor.
Accessor to equality constraints.
Accessor to inequality constraints.
Accessor to level function.
Accessor to level value.
getName
()Accessor to the object's name.
Accessor to objective function.
Reliability measure accessor.
Accessor to level function.
Robustness measure accessor.
Accessor to the variables type.
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.
hasName
()Test if the object is named.
Reliability measure flag accessor.
Test whether a least-square problem is defined.
Robustness measure flag accessor.
Check if the problem is continuous.
isMinimization
([marginalIndex])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[, marginalIndex])Tell whether this is a minimization or maximization problem.
setName
(name)Accessor to the object's name.
setObjective
(objective)Accessor to objective function.
setReliabilityMeasure
(reliabilityMeasure)Reliability measure accessor.
setResidualFunction
(residualFunction)Accessor to level function.
setRobustnessMeasure
(robustnessMeasure)Robustness measure accessor.
setVariablesType
(variableType)Accessor to the variables type.
- __init__(*args)¶
- 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.
- getDistribution()¶
Distribution accessor.
- Returns:
- distribution
openturns.Distribution
Parameter distribution
- distribution
- getEqualityConstraint()¶
Accessor to equality constraints.
- Returns:
- equality
Function
Describe equality constraints.
- equality
- 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.
- getReliabilityMeasure()¶
Reliability measure accessor.
The measure on associated to the constraint
- Returns:
- reliabilityMeasure
MeasureEvaluation
Mesure function on the constraints
- reliabilityMeasure
- getRobustnessMeasure()¶
Robustness measure accessor.
The measure on associated to the objective function
- Returns:
- robustnessMeasure
MeasureEvaluation
Measure function on the objective.
- robustnessMeasure
- getVariablesType()¶
Accessor to the variables type.
- Returns:
- variablesType
Indices
Types of the variables.
- variablesType
Notes
Possible values for each variable are ot.OptimizationProblemImplementation.CONTINUOUS, ot.OptimizationProblemImplementation.INTEGER and ot.OptimizationProblemImplementation.`BINARY`.
- 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.
- hasName()¶
Test if the object is named.
- Returns:
- hasNamebool
True if the name is not empty.
- hasReliabilityMeasure()¶
Reliability measure flag accessor.
If no reliability measure was set, the problem should have a robustness measure. The constraints are deduced from the reliability measure.
- Returns:
- hasReliabilityMeasurebool
Whether a reliability measure was set
- hasResidualFunction()¶
Test whether a least-square problem is defined.
- Returns:
- valuebool
True if this is a least-squares problem, False otherwise.
- hasRobustnessMeasure()¶
Robustness measure flag accessor.
If no robustness measure was set, the problem should have a reliability measure. The objective is deduced from the robustness measure.
- Returns:
- hasReliabilityMeasurebool
Whether a robustness measure was set
- isContinuous()¶
Check if the problem is continuous.
- Returns:
- isContinuousbool
Returns True if all variables are continuous.
- isMinimization(marginalIndex=0)¶
Test whether this is a minimization or maximization problem.
- Parameters:
- marginal_indexint, default=0
Index of the output marginal (for multi-objective only)
- 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, marginalIndex=0)¶
Tell whether this is a minimization or maximization problem.
- Parameters:
- minimizationbool
True if this is a minimization problem, False otherwise.
- marginal_indexint, default=0
Index of the output marginal (for multi-objective only)
- setName(name)¶
Accessor to the object’s name.
- Parameters:
- namestr
The name of the object.
- setObjective(objective)¶
Accessor to objective function.
- Parameters:
- objectiveFunction
Function
Objective function.
- objectiveFunction
Notes
Constraints and bounds are cleared if the objective has a different input dimension in order to keep the problem valid at all time.
- setReliabilityMeasure(reliabilityMeasure)¶
Reliability measure accessor.
The measure on associated to the constraint
- Parameters:
- reliabilityMeasure
MeasureEvaluation
Mesure function on the constraints
- reliabilityMeasure
- setResidualFunction(residualFunction)¶
Accessor to level function.
- Parameters:
- levelFunction
Function
Level function.
- levelFunction
- setRobustnessMeasure(robustnessMeasure)¶
Robustness measure accessor.
The measure on associated to the objective function
- Parameters:
- robustnessMeasure
MeasureEvaluation
Measure function on the objective.
- robustnessMeasure
- setVariablesType(variableType)¶
Accessor to the variables type.
- Parameters:
- variablesType
Indices
Types of the variables.
- variablesType
Notes
Possible values for each variable are ot.OptimizationProblemImplementation.CONTINUOUS, ot.OptimizationProblemImplementation.INTEGER and ot.OptimizationProblemImplementation.BINARY.