OptimizationAnalysis¶
- class persalys.OptimizationAnalysis(*args)¶
Perform the optimization analysis of a model.
- Parameters
- namestr
Name
- physicalModel
PhysicalModel
Physical model
- solverNamestr
Optimization algorithm name (optional). Use
GetSolverNames()
to list available names.
Examples
>>> import openturns as ot >>> import persalys
Create the model:
>>> R = persalys.Input('R', 0., ot.LogNormalMuSigma(300., 30., 0.).getDistribution(), 'Yield strength') >>> F = persalys.Input('F', 0., ot.Normal(75000., 5000.), 'Traction load') >>> G = persalys.Output('G', 'deviation') >>> myPhysicalModel = persalys.SymbolicPhysicalModel('myPhysicalModel', [R, F], [G], ['R-F/(pi_*100.0)'])
Create the Model evaluation:
>>> analysis = persalys.OptimizationAnalysis('anAnalysis', myPhysicalModel, 'TNC') >>> analysis.setInterestVariables(['G']) >>> analysis.run()
Get the result:
>>> result = analysis.getResult() >>> x = result.getOptimalPoint() >>> y = result.getOptimalValue()
- Attributes
- AlgorithmDictionary
Methods
GetSolverNames
(*args)Accessor to the list of solver names.
addConstraint
(*args)Adds a constraint to the analysis
Accessor to bounds.
Accessor to the object's name.
Error message accessor.
Get the variables to analyse.
Accessor to maximum allowed absolute error.
Accessor to maximum allowed constraint error.
Accessor to maximum allowed relative error.
Accessor to maximum allowed residual error.
Test whether this is a minimization or maximization problem.
getName
()Accessor to the object's name.
Physical model accessor.
Physical model accessor.
Accessor to constraints equations
Accessor to optimization result.
Accessor to solver name
Accessor to starting point.
Accessor to variable input names
Warning message accessor.
hasName
()Test if the object is named.
Whether the analysis has been run.
Whether the analysis involves reliability.
Whether the analysis is running.
Clears the current analysis constraints
run
()Launch the analysis.
setBounds
(bounds)Accessor to bounds.
setInterestVariables
(variablesNames)Set the variables to analyse.
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.
setMaximumRelativeError
(maximumRelativeError)Accessor to maximum allowed relative error.
setMaximumResidualError
(maximumResidualError)Accessor to maximum allowed residual error.
setMinimization
(minimization)Tell whether this is a minimization or maximization problem.
setName
(name)Accessor to the object's name.
setSolverName
(name)Accessor to solver name
setStartingPoint
(startingPoint)Accessor to starting point.
setVariableInputs
(inputs)Accessor to variable input names
canBeLaunched
defineProblem
getElapsedTime
getEqualityConstraints
getInequalityConstraints
getMaximumCallsNumber
getParentObserver
getVariablesType
setVariablesType
- __init__(*args)¶
- static GetSolverNames(*args)¶
Accessor to the list of solver names.
- Returns
- names
Description
List of available solver names.
- names
- addConstraint(*args)¶
Adds a constraint to the analysis
- Parameters
- constraintstr
Constraint equation
- getClassName()¶
Accessor to the object’s name.
- Returns
- class_namestr
The object class name (object.__class__.__name__).
- getErrorMessage()¶
Error message accessor.
- Returns
- messagestr
Error message if the analysis failed
- getInterestVariables()¶
Get the variables to analyse.
- Returns
- variablesNamessequence of str
Names of the variables to analyse
- getMaximumAbsoluteError()¶
Accessor to maximum allowed absolute error.
- Returns
- maximumAbsoluteErrorfloat
Maximum allowed absolute error.
- getMaximumConstraintError()¶
Accessor to maximum allowed constraint error.
- Returns
- maximumConstraintErrorfloat
Maximum allowed constraint error.
- getMaximumRelativeError()¶
Accessor to maximum allowed relative error.
- Returns
- maximumRelativeErrorfloat
Maximum allowed relative error.
- getMaximumResidualError()¶
Accessor to maximum allowed residual error.
- Returns
- maximumResidualErrorfloat
Maximum allowed residual error.
- getMinimization()¶
Test whether this is a minimization or maximization problem.
- Returns
- valuebool
True if this is a minimization problem (default), False otherwise.
- getName()¶
Accessor to the object’s name.
- Returns
- namestr
The name of the object.
- getPhysicalModel()¶
Physical model accessor.
- Returns
- model
PhysicalModel
Physical model
- model
- getPythonScript()¶
Physical model accessor.
- Returns
- scriptstr
Python script to replay the analysis
- getRawEquations()¶
Accessor to constraints equations
- Returns
- equationssequence of str
Constraints equations
- getResult()¶
Accessor to optimization result.
- Returns
- result
OptimizationResult
Result class.
- result
- getSolverName()¶
Accessor to solver name
- Returns
- solverstr
Solver name
- getVariableInputs()¶
Accessor to variable input names
- Returns
- inputs
Description
Variable input names. It is set by default to the list of inputs of the model.
- inputs
- getWarningMessage()¶
Warning message accessor.
- Returns
- messagestr
Warning message which can appear during the analysis computation
- hasName()¶
Test if the object is named.
- Returns
- hasNamebool
True if the name is not empty.
- hasValidResult()¶
Whether the analysis has been run.
- Returns
- hasValidResultbool
Whether the analysis has already been run
- isReliabilityAnalysis()¶
Whether the analysis involves reliability.
- Returns
- isReliabilityAnalysisbool
Whether the analysis involves a reliability analysis
- isRunning()¶
Whether the analysis is running.
- Returns
- isRunningbool
Whether the analysis is running
- resetConstraints()¶
Clears the current analysis constraints
- run()¶
Launch the analysis.
- setInterestVariables(variablesNames)¶
Set the variables to analyse.
- Parameters
- variablesNamessequence of str
Names of the variables to analyse
- setMaximumAbsoluteError(maximumAbsoluteError)¶
Accessor to maximum allowed absolute error.
- Parameters
- maximumAbsoluteErrorfloat
Maximum allowed absolute error.
- setMaximumCallsNumber(maximumCallsNumber)¶
Accessor to maximum allowed number of calls.
- Parameters
- Nint
Maximum allowed number of calls.
- setMaximumConstraintError(maximumConstraintError)¶
Accessor to maximum allowed constraint error.
- Parameters
- maximumConstraintErrorfloat
Maximum allowed constraint error.
- setMaximumRelativeError(maximumRelativeError)¶
Accessor to maximum allowed relative error.
- Parameters
- maximumRelativeErrorfloat
Maximum allowed relative error.
- setMaximumResidualError(maximumResidualError)¶
Accessor to maximum allowed residual error.
- Parameters
- maximumResidualErrorfloat
Maximum allowed residual error.
- 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.
- setSolverName(name)¶
Accessor to solver name
- Parameters
- solverstr
Solver name. Use
GetSolverNames()
to list available names.
- setStartingPoint(startingPoint)¶
Accessor to starting point.
- Parameters
- startingPointsequence of float
Starting point.
- setVariableInputs(inputs)¶
Accessor to variable input names
- Parameters
- inputssequence of str
Variable input names. It is set by default to the list of inputs of the model.