SORARobustOptimizationAlgorithm¶
- class otrobopt.SORARobustOptimizationAlgorithm(*args)¶
Sequential optimization and reliability assessment.
This class is experimental and may change in future releases.
The algorithm solves the reliability-based design optimization problem
where
is a scalar classical function and the chance constraint is given by a
JointChanceMeasure. The distribution parameter is kept fixed. The joint chance constraint is handled by sequential optimization and reliability assessment (SORA): a sequence of deterministic optimizations with shifted constraints alternates with a performance-measure analysis (PMA) in the standard normal space.At iteration
, let
be the design point and
the physical image of the most probable point found by PMA. The physical shift is
The deterministic subproblem is
that is,
. A new PMA is then performed at
and the shift is updated. The loop stops when both the design point and the shift change by less than the outer absolute or relative error tolerances.
The physical shift is only defined when the design dimension and the random dimension are equal. A problem with
is rejected with an explicit dimension error; use
DoubleLoopRBDOAlgorithmor a sample-based algorithm for such problems.A vector limit state is handled with the
setJointChanceTreatment()option:SORARobustOptimizationAlgorithm.EXACTuses one scalarized system limit statefor the PMA and maintains one shift. This is a FORM approximation of the joint event, not an exact system reliability calculation.
SORARobustOptimizationAlgorithm.BONFERRONIreplaces the joint event by component events with the conservative target. Each component has its own PMA and its own shift.
The treatment is always explicit and is reported by
getJointChanceTreatment(). The target index is, where
is the safe-event probability and
is the one-dimensional marginal of the standard distribution (
when the standard space is normal). For a
Greateroperator the safe event isand
. For a
Lessoperator the safe event is the complementary eventand
. The exact and Bonferroni treatments therefore require
.
Available constructors:
SORARobustOptimizationAlgorithm(problem, solver, innerSolver)
SORARobustOptimizationAlgorithm(problem, solver)
SORARobustOptimizationAlgorithm()
- Parameters:
- problem
RBDOProblem Reliability-based design optimization problem.
- solver
openturns.OptimizationAlgorithm Deterministic optimization algorithm used for each shifted subproblem.
- innerSolver
openturns.OptimizationAlgorithm Reliability algorithm used by the PMA. The default is
Cobyla.
- problem
Methods
FORM approximation of the safe probability at the solution.
Accessor to check status flag.
Accessor to the object's name.
Accessor to the inner reliability algorithm.
Accessor to the joint chance treatment.
Accessor to maximum allowed absolute error.
Accessor to maximum allowed number of calls.
Accessor to maximum allowed constraint error.
Accessor to maximum allowed number of iterations.
Accessor to maximum allowed relative error.
Accessor to maximum allowed residual error.
Accessor to the maximum duration.
getName()Accessor to the object's name.
Accessor to the deterministic optimization algorithm.
Performance measure at the solution.
Physical-space design point of the worst component at the solution.
Accessor to optimization problem.
Accessor to the reliability-based design optimization problem.
Diagnostic reliability index at the solution.
Accessor to optimization result.
getShift()Physical shift of the worst component at the solution.
Standard-space design point of the worst component at the solution.
Accessor to starting point.
Accessor to starting sample.
Target reliability index defined by the chance constraint.
hasName()Test if the object is named.
run()Launch the optimization.
setCheckStatus(checkStatus)Accessor to check status flag.
setInnerOptimizationAlgorithm(solver)Set the inner reliability algorithm.
setJointChanceTreatment(treatment)Set the joint chance treatment.
setMaximumAbsoluteError(maximumAbsoluteError)Accessor to maximum allowed absolute error.
setMaximumCallsNumber(maximumCallsNumber)Accessor to maximum allowed number of calls
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.
setMaximumTimeDuration(maximumTime)Accessor to the maximum duration.
setName(name)Accessor to the object's name.
setOptimizationAlgorithm(solver)Set the deterministic optimization algorithm.
setProblem(problem)Accessor to optimization problem.
setProgressCallback(*args)Set up a progress callback.
setRBDOProblem(problem)Set the reliability-based design optimization problem.
setResult(result)Accessor to optimization result.
setStartingPoint(startingPoint)Accessor to starting point.
setStartingSample(startingSample)Accessor to starting sample.
setStopCallback(*args)Set up a stop callback.
Notes
The PMA is performed in the standard space of the distribution. The standard-space limit state is built from the inverse isoprobabilistic transformation of the distribution, and the origin of the standard space is the median point of the distribution.
For a normal or a non-elliptical distribution the standard space is the standard normal space and
. For an elliptical distribution with a non-normal standard representative, for example a Student distribution, the standard space is the same-kind spherical space of the generalized Nataf transformation:
is the quantile of its one-dimensional marginal
, and the FORM probability is
. This is the generalized reliability index of Lebrun and Dutfoy; the normal-space formulas are recovered with
. See the theory page for details.
The algorithm requires the limit-state function to expose a gradient when a gradient-based deterministic or inner solver is used. The default
Cobylasolvers do not require it.The reliability analysis is a first-order one. It assumes that the limit state is continuously differentiable, that its zero set has probability zero and that the minimum of the scalarized limit state over the ball of radius
is reached on its boundary. These assumptions are the standard FORM and PMA assumptions. In particular, the safe event of a
Lessoperator is the open set, so the boundary
is not safe: a limit state that vanishes on a set of positive probability, such as
, is outside the scope. A limit state that is negative inside the target sphere while non-negative on its boundary is not detected by the PMA sphere test either.
The outer loop uses the inherited controls
setMaximumIterationNumber,setMaximumAbsoluteErrorandsetMaximumRelativeError. The result status isSUCCESSwhen the design and the shift converge, the last deterministic subproblem succeeds, the final design satisfies the deterministic constraints and the final design satisfies the chance constraint,INTERRUPTIONwhen the stop callback interrupts the loop, andFAILUREwhen the maximum number of iterations is reached first, when a subproblem fails or when a converged design is not admissible. The status message reports the selected joint chance treatment.The default inner solver tolerances can be changed with the ResourceMap keys
SORARobustOptimizationAlgorithm-DefaultInnerMaximumCallsNumber,SORARobustOptimizationAlgorithm-DefaultInnerMaximumConstraintErrorandSORARobustOptimizationAlgorithm-DefaultInnerMaximumAbsoluteError. The inner reliability solves record their evaluations to recover the best iterate when OpenTURNS reports no optimal point; the ResourceMap keyRBDOAlgorithmTools-InnerEvaluationHistoryMaximumSizebounds the number of recorded evaluations.The result is available through the inherited
getResultmethod. It is associated with the RBDO problem, so that a saved algorithm keeps its result across a study round trip. The reliability analysis at the solution is reported bygetReliabilityIndex(),getPerformanceMeasure(),getShift(),getStandardSpaceDesignPoint(),getPhysicalSpaceDesignPoint()andgetApproximateProbability().Examples
>>> import openturns as ot >>> import otrobopt >>> limitState = ot.ParametricFunction( ... ot.SymbolicFunction(["x", "theta"], ["theta - x"]), [1], [0.0] ... ) >>> measure = otrobopt.JointChanceMeasure( ... limitState, ot.Normal(), ot.GreaterOrEqual(), 0.9 ... ) >>> problem = otrobopt.RBDOProblem( ... ot.SymbolicFunction(["x"], ["x^2"]), measure ... ) >>> algo = otrobopt.SORARobustOptimizationAlgorithm( ... problem, ot.Cobyla() ... ) >>> algo.run() >>> result = algo.getResult()
- __init__(*args)¶
- getApproximateProbability()¶
FORM approximation of the safe probability at the solution.
- Returns:
- probabilityfloat
The value
, where
is the one-dimensional marginal of the standard distribution. It is
when the standard space is normal and, for example,
for a Student distribution. It is not available when no finite reliability index could be computed.
- Raises:
- RuntimeError
If the algorithm has not been run.
Notes
With the
EXACTjoint chance treatmentis the joint index, so the value approximates the joint safe probability. With the
BONFERRONItreatment the components are solved at the common component target andis the worst component index: the value is then the worst component probability, that is an upper bound of the joint safe probability, not the joint probability itself.
- getCheckStatus()¶
Accessor to check status flag.
- Returns:
- checkStatusbool
Whether to check the termination status. If set to False,
run()will not throw an exception if the algorithm does not fully converge and will allow one to still find a feasible candidate.
- getClassName()¶
Accessor to the object’s name.
- Returns:
- class_namestr
The object class name (object.__class__.__name__).
- getInnerOptimizationAlgorithm()¶
Accessor to the inner reliability algorithm.
- Returns:
- solver
openturns.OptimizationAlgorithm Reliability algorithm used by the performance-measure analysis.
- solver
- getJointChanceTreatment()¶
Accessor to the joint chance treatment.
- Returns:
- treatmentint
Either
SORARobustOptimizationAlgorithm.EXACTorSORARobustOptimizationAlgorithm.BONFERRONI.
- getMaximumAbsoluteError()¶
Accessor to maximum allowed absolute error.
- Returns:
- maximumAbsoluteErrorfloat
Maximum allowed absolute error, where the absolute error is defined by
where
and
are two consecutive approximations of the optimum.
- getMaximumCallsNumber()¶
Accessor to maximum allowed number of calls.
- Returns:
- maximumCallsNumberint
Maximum allowed number of function evaluations, including direct calls through the () operator and indirect calls through finite difference gradients.
- getMaximumConstraintError()¶
Accessor to maximum allowed constraint error.
- Returns:
- maximumConstraintErrorfloat
Maximum allowed constraint error, where the constraint error is defined by
where
is the current approximation of the optimum and
is the function that gathers all the equality and inequality constraints (violated values only)
- getMaximumIterationNumber()¶
Accessor to maximum allowed number of iterations.
- Returns:
- maximumIterationNumberint
Maximum allowed number of iterations.
- getMaximumRelativeError()¶
Accessor to maximum allowed relative error.
- Returns:
- maximumRelativeErrorfloat
Maximum allowed relative error, where the relative error is defined by
if
, else
.
- getMaximumResidualError()¶
Accessor to maximum allowed residual error.
- Returns:
- maximumResidualErrorfloat
Maximum allowed residual error, where the residual error is defined by
if
, else
.
- getMaximumTimeDuration()¶
Accessor to the maximum duration.
- Returns:
- maximumTimefloat
Maximum optimization duration in seconds.
- getName()¶
Accessor to the object’s name.
- Returns:
- namestr
The name of the object.
- getOptimizationAlgorithm()¶
Accessor to the deterministic optimization algorithm.
- Returns:
- solver
openturns.OptimizationAlgorithm Deterministic optimization algorithm used for each shifted subproblem.
- solver
- getPerformanceMeasure()¶
Performance measure at the solution.
- Returns:
- performanceMeasurefloat
Minimum of the scalarized limit state on the target sphere at the worst component of the solution.
- Raises:
- RuntimeError
If the algorithm has not been run.
- getPhysicalSpaceDesignPoint()¶
Physical-space design point of the worst component at the solution.
- Returns:
- designPoint
Point Image of the standard-space design point by the inverse isoprobabilistic transformation.
- designPoint
- Raises:
- RuntimeError
If the algorithm has not been run.
- getProblem()¶
Accessor to optimization problem.
- Returns:
- problem
OptimizationProblem Optimization problem.
- problem
- getRBDOProblem()¶
Accessor to the reliability-based design optimization problem.
- Returns:
- problem
RBDOProblem Reliability-based design optimization problem.
- problem
- getReliabilityIndex()¶
Diagnostic reliability index at the solution.
The index is measured in the standard space of the distribution. For an elliptical distribution it is the generalized reliability index of Lebrun and Dutfoy, whose FORM probability is
.
The index is computed by a reliability index analysis (RIA) at the SORA solution. It is negative when the origin of the standard space belongs to the failure domain.
- Returns:
- reliabilityIndexfloat
Signed reliability index
.
- Raises:
- RuntimeError
If the algorithm has not been run.
- getResult()¶
Accessor to optimization result.
- Returns:
- result
OptimizationResult Result class.
- result
- getShift()¶
Physical shift of the worst component at the solution.
The shift is
, where
is the design point and
the physical image of the most probable point. For a Bonferroni treatment, the shift of the component with the smallest performance measure is returned.
- Returns:
- shift
Point Physical shift of dimension
.
- shift
- Raises:
- RuntimeError
If the algorithm has not been run.
- getStandardSpaceDesignPoint()¶
Standard-space design point of the worst component at the solution.
- Returns:
- designPoint
Point Most probable point in the standard normal space.
- designPoint
- Raises:
- RuntimeError
If the algorithm has not been run.
- getTargetReliabilityIndex()¶
Target reliability index defined by the chance constraint.
The index is
for the exact treatment and the Bonferroni component index for the conservative treatment, where
is the one-dimensional marginal of the standard distribution. It is
when the standard space is normal.
- Returns:
- targetIndexfloat
Target reliability index
.
- hasName()¶
Test if the object is named.
- Returns:
- hasNamebool
True if the name is not empty.
- run()¶
Launch the optimization.
- setCheckStatus(checkStatus)¶
Accessor to check status flag.
- Parameters:
- checkStatusbool
Whether to check the termination status. If set to False,
run()will not throw an exception if the algorithm does not fully converge and will allow one to still find a feasible candidate.
- setInnerOptimizationAlgorithm(solver)¶
Set the inner reliability algorithm.
- Parameters:
- solver
openturns.OptimizationAlgorithm Reliability algorithm used by the performance-measure analysis.
- solver
- setJointChanceTreatment(treatment)¶
Set the joint chance treatment.
- Parameters:
- treatmentint
Either
SORARobustOptimizationAlgorithm.EXACTfor the scalarized joint event orSORARobustOptimizationAlgorithm.BONFERRONIfor the conservative componentwise split.
- setMaximumAbsoluteError(maximumAbsoluteError)¶
Accessor to maximum allowed absolute error.
- Parameters:
- maximumAbsoluteErrorfloat
Maximum allowed absolute error, where the absolute error is defined by
where
and
are two consecutive approximations of the optimum.
- setMaximumCallsNumber(maximumCallsNumber)¶
Accessor to maximum allowed number of calls
- Parameters:
- maximumCallsNumberint
Maximum allowed number of function evaluations, including direct calls through the () operator and indirect calls through finite difference gradients.
- setMaximumConstraintError(maximumConstraintError)¶
Accessor to maximum allowed constraint error.
- Parameters:
- maximumConstraintErrorfloat
Maximum allowed constraint error, where the constraint error is defined by
where
is the current approximation of the optimum and
is the function that gathers all the equality and inequality constraints (violated values only)
- setMaximumIterationNumber(maximumIterationNumber)¶
Accessor to maximum allowed number of iterations.
- Parameters:
- maximumIterationNumberint
Maximum allowed number of iterations.
- setMaximumRelativeError(maximumRelativeError)¶
Accessor to maximum allowed relative error.
- Parameters:
- maximumRelativeErrorfloat
Maximum allowed relative error, where the relative error is defined by
if
, else
.
- setMaximumResidualError(maximumResidualError)¶
Accessor to maximum allowed residual error.
- Parameters:
- maximumResidualErrorfloat
Maximum allowed residual error, where the residual error is defined by
if
, else
.
- setMaximumTimeDuration(maximumTime)¶
Accessor to the maximum duration.
- Parameters:
- maximumTimefloat
Maximum optimization duration in seconds.
- setName(name)¶
Accessor to the object’s name.
- Parameters:
- namestr
The name of the object.
- setOptimizationAlgorithm(solver)¶
Set the deterministic optimization algorithm.
- Parameters:
- solver
openturns.OptimizationAlgorithm Deterministic optimization algorithm used for each shifted subproblem.
- solver
- setProblem(problem)¶
Accessor to optimization problem.
- Parameters:
- problem
OptimizationProblem Optimization problem.
- problem
- setProgressCallback(*args)¶
Set up a progress callback.
Can be used to programmatically report the progress of an optimization.
- Parameters:
- callbackcallable
Takes a float as argument as percentage of progress.
Examples
>>> import sys >>> import openturns as ot >>> rosenbrock = ot.SymbolicFunction(['x1', 'x2'], ['(1-x1)^2+100*(x2-x1^2)^2']) >>> problem = ot.OptimizationProblem(rosenbrock) >>> solver = ot.OptimizationAlgorithm(problem) >>> solver.setStartingPoint([0, 0]) >>> solver.setMaximumResidualError(1.e-3) >>> solver.setMaximumCallsNumber(10000) >>> def report_progress(progress): ... sys.stderr.write('-- progress=' + str(progress) + '%\n') >>> solver.setProgressCallback(report_progress) >>> solver.run()
- setRBDOProblem(problem)¶
Set the reliability-based design optimization problem.
- Parameters:
- problem
RBDOProblem Reliability-based design optimization problem.
- problem
- setResult(result)¶
Accessor to optimization result.
- Parameters:
- result
OptimizationResult Result class.
- result
- setStartingPoint(startingPoint)¶
Accessor to starting point.
- Parameters:
- startingPoint
Point Starting point.
- startingPoint
- setStartingSample(startingSample)¶
Accessor to starting sample.
- Parameters:
- startingSample
Sample Starting sample.
- startingSample
- setStopCallback(*args)¶
Set up a stop callback.
Can be used to programmatically stop an optimization.
- Parameters:
- callbackcallable
Returns an int deciding whether to stop or continue.
Examples
>>> import openturns as ot >>> rosenbrock = ot.SymbolicFunction(['x1', 'x2'], ['(1-x1)^2+100*(x2-x1^2)^2']) >>> problem = ot.OptimizationProblem(rosenbrock) >>> solver = ot.OptimizationAlgorithm(problem) >>> solver.setStartingPoint([0, 0]) >>> solver.setMaximumResidualError(1.e-3) >>> solver.setMaximumCallsNumber(10000) >>> def ask_stop(): ... return True >>> solver.setStopCallback(ask_stop) >>> solver.run()
otrobopt