LHSResult¶
-
class
LHSResult
(*args)¶ Summarize the results of an LHS optimization.
- Available constructor:
LHSResult(bounds, spaceFilling, nRestart)
- Parameters
- spaceFilling
SpaceFilling
The space filling criteria used by optimization algorithm
- nRestartint
The number of restarts performed by optimization algorithm
- spaceFilling
Notes
This class is not intendeted to be built by hand, but returned by optimization algorithms.
Examples
>>> import openturns as ot >>> lhs = ot.LHSExperiment(ot.ComposedDistribution([ot.Uniform(0.0, 1.0)]*3), 100) >>> lhs.setAlwaysShuffle(True) # randomized >>> profile = ot.GeometricProfile() >>> spaceFilling = ot.SpaceFillingC2() >>> # Optim algo >>> algo = ot.SimulatedAnnealingLHS(lhs, profile, spaceFilling) >>> # first, generate a design >>> design = algo.generate() >>> # then, get the result >>> result = algo.getResult()
Methods
drawHistoryCriterion
(self, \*args)Draw criterion history.
drawHistoryProbability
(self, \*args)Draw probability history.
drawHistoryTemperature
(self, \*args)Draw temperature history.
getAlgoHistory
(self, \*args)Accessor to the internal values computed during optimization algorithm.
getC2
(self, \*args)Accessor to the C2 criterion evaluated on the optimal design.
getClassName
(self)Accessor to the object’s name.
getId
(self)Accessor to the object’s id.
getMinDist
(self, \*args)Minimum distance accessor.
getName
(self)Accessor to the object’s name.
getNumberOfRestarts
(self)Restart number accessor.
getOptimalDesign
(self, \*args)Accessor to the optimal design.
getOptimalValue
(self, \*args)Optimal value accessor.
getPhiP
(self, \*args)Accessor the PhiP criterion evaluated on the optimal design.
getShadowedId
(self)Accessor to the object’s shadowed id.
getVisibility
(self)Accessor to the object’s visibility state.
hasName
(self)Test if the object is named.
hasVisibleName
(self)Test if the object has a distinguishable name.
setName
(self, name)Accessor to the object’s name.
setShadowedId
(self, id)Accessor to the object’s shadowed id.
setVisibility
(self, visible)Accessor to the object’s visibility state.
add
-
__init__
(self, \*args)¶ Initialize self. See help(type(self)) for accurate signature.
-
drawHistoryCriterion
(self, \*args)¶ Draw criterion history.
- Parameters
- restartint (optional)
The restart index.
- titlestr (optional)
Graph title.
- Returns
- graph
Graph
The resulting graph.
- graph
-
drawHistoryProbability
(self, \*args)¶ Draw probability history.
- Parameters
- restartint (optional)
The restart index.
- titlestr (optional)
Graph title.
- Returns
- graph
Graph
The resulting graph.
- graph
-
drawHistoryTemperature
(self, \*args)¶ Draw temperature history.
- Parameters
- restartint (optional)
The restart index.
- titlestr (optional)
Graph title.
- Returns
- graph
Graph
The resulting graph.
- graph
-
getAlgoHistory
(self, \*args)¶ Accessor to the internal values computed during optimization algorithm.
- Returns
- history
Point
Some internal values computed during optimization algorithm. SimulatedAnnealingLHS stores criterion value, temperature and probability at each iteration.
- history
Examples
>>> import openturns as ot >>> lhs = ot.LHSExperiment(ot.ComposedDistribution([ot.Uniform(0.0, 1.0)]*3), 100) >>> lhs.setAlwaysShuffle(True) # randomized >>> profile = ot.GeometricProfile() >>> spaceFilling = ot.SpaceFillingPhiP(50) >>> algoSA = ot.SimulatedAnnealingLHS(lhs, profile, spaceFilling) >>> # Get LHSResult >>> design = algoSA.generateWithRestart(5) >>> resultSA = algoSA.getResult() >>> criterionHistory = resultSA.getAlgoHistory()
-
getC2
(self, \*args)¶ Accessor to the C2 criterion evaluated on the optimal design.
- Returns
- c2float
The C2 criterion.
Examples
>>> import openturns as ot >>> lhs = ot.LHSExperiment(ot.ComposedDistribution([ot.Uniform(0.0, 1.0)]*3), 100) >>> lhs.setAlwaysShuffle(True) # randomized >>> profile = ot.GeometricProfile() >>> spaceFilling = ot.SpaceFillingPhiP(50) >>> algoSA = ot.SimulatedAnnealingLHS(lhs, profile, spaceFilling) >>> # Get LHSResult >>> design = algoSA.generate() >>> resultSA = algoSA.getResult() >>> c2 = resultSA.getC2()
-
getClassName
(self)¶ Accessor to the object’s name.
- Returns
- class_namestr
The object class name (object.__class__.__name__).
-
getId
(self)¶ Accessor to the object’s id.
- Returns
- idint
Internal unique identifier.
-
getMinDist
(self, \*args)¶ Minimum distance accessor.
- Parameters
- restartint (optional)
The restart index.
- Returns
- minDistfloat
The minimum distance of sample points.
-
getName
(self)¶ Accessor to the object’s name.
- Returns
- namestr
The name of the object.
-
getNumberOfRestarts
(self)¶ Restart number accessor.
- Returns
- restartint (optional)
The number of restart.
-
getOptimalDesign
(self, \*args)¶ Accessor to the optimal design.
- Returns
- design
Sample
The design that optimizes the criterion.
- design
Examples
>>> import openturns as ot >>> lhs = ot.LHSExperiment(ot.ComposedDistribution([ot.Uniform(0.0, 1.0)]*3), 100) >>> lhs.setAlwaysShuffle(True) # randomized >>> spaceFilling = ot.SpaceFillingPhiP(10) >>> # By Monte Carlo >>> algoMC = ot.MonteCarloLHS(lhs, 1000, spaceFilling) >>> # Get LHSResult >>> optimalDesignMC = algoMC.generate() >>> resultMC = algoMC.getResult() >>> # By simulated annealing, with restart >>> profile = ot.GeometricProfile() >>> algoSA = ot.SimulatedAnnealingLHS(lhs, profile, spaceFilling) >>> # Get LHSResult >>> optimalDesignSA = algoSA.generateWithRestart(5) >>> resultSA = algoSA.getResult() >>> # Get optimal results for all restarts >>> optimRestart = [resultSA.getOptimalDesign(i) for i in range(resultSA.getNumberOfRestarts())]
-
getOptimalValue
(self, \*args)¶ Optimal value accessor.
- Returns
- valuefloat (optional)
The optimal value.
-
getPhiP
(self, \*args)¶ Accessor the PhiP criterion evaluated on the optimal design.
- Returns
- phiPfloat
The PhiP criterion.
Examples
>>> import openturns as ot >>> lhs = ot.LHSExperiment(ot.ComposedDistribution([ot.Uniform(0.0, 1.0)]*3), 100) >>> lhs.setAlwaysShuffle(True) # randomized >>> profile = ot.GeometricProfile() >>> spaceFilling = ot.SpaceFillingPhiP(50) >>> algoSA = ot.SimulatedAnnealingLHS(lhs, profile, spaceFilling) >>> design = algoSA.generate() >>> # Get LHSResult >>> resultSA = algoSA.getResult() >>> phip = resultSA.getPhiP()
-
getShadowedId
(self)¶ Accessor to the object’s shadowed id.
- Returns
- idint
Internal unique identifier.
-
getVisibility
(self)¶ Accessor to the object’s visibility state.
- Returns
- visiblebool
Visibility flag.
-
hasName
(self)¶ Test if the object is named.
- Returns
- hasNamebool
True if the name is not empty.
-
hasVisibleName
(self)¶ Test if the object has a distinguishable name.
- Returns
- hasVisibleNamebool
True if the name is not empty and not the default one.
-
setName
(self, name)¶ Accessor to the object’s name.
- Parameters
- namestr
The name of the object.
-
setShadowedId
(self, id)¶ Accessor to the object’s shadowed id.
- Parameters
- idint
Internal unique identifier.
-
setVisibility
(self, visible)¶ Accessor to the object’s visibility state.
- Parameters
- visiblebool
Visibility flag.