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

nRestart : int

The number of restarts performed by optimization algorithm

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

add(optimalDesign, criterion, C2, PhiP, ...)
drawHistoryCriterion(*args) Draw criterion history.
drawHistoryProbability(*args) Draw probability history.
drawHistoryTemperature(*args) Draw temperature history.
getAlgoHistory(*args) Accessor to the internal values computed during optimization algorithm.
getC2(*args) Accessor to the C2 criterion evaluated on the optimal design.
getClassName() Accessor to the object’s name.
getId() Accessor to the object’s id.
getMinDist(*args) Minimum distance accessor.
getName() Accessor to the object’s name.
getNumberOfRestarts() Restart number accessor.
getOptimalDesign(*args) Accessor to the optimal design.
getOptimalValue(*args) Optimal value accessor.
getPhiP(*args) Accessor the PhiP criterion evaluated on the optimal design.
getShadowedId() Accessor to the object’s shadowed id.
getVisibility() Accessor to the object’s visibility state.
hasName() Test if the object is named.
hasVisibleName() Test if the object has a distinguishable name.
setName(name) Accessor to the object’s name.
setShadowedId(id) Accessor to the object’s shadowed id.
setVisibility(visible) Accessor to the object’s visibility state.
__init__(*args)
drawHistoryCriterion(*args)

Draw criterion history.

Parameters:

restart : int (optional)

The restart index.

title : str (optional)

Graph title.

Returns:

graph : Graph

The resulting graph.

drawHistoryProbability(*args)

Draw probability history.

Parameters:

restart : int (optional)

The restart index.

title : str (optional)

Graph title.

Returns:

graph : Graph

The resulting graph.

drawHistoryTemperature(*args)

Draw temperature history.

Parameters:

restart : int (optional)

The restart index.

title : str (optional)

Graph title.

Returns:

graph : Graph

The resulting graph.

getAlgoHistory(*args)

Accessor to the internal values computed during optimization algorithm.

Returns:

history : NumericalPoint

Some internal values computed during optimization algorithm. SimulatedAnnealingLHS stores criterion value, temperature and probability at each iteration.

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(*args)

Accessor to the C2 criterion evaluated on the optimal design.

Returns:

c2 : float

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()

Accessor to the object’s name.

Returns:

class_name : str

The object class name (object.__class__.__name__).

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getMinDist(*args)

Minimum distance accessor.

Parameters:

restart : int (optional)

The restart index.

Returns:

minDist : float

The minimum distance of sample points.

getName()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

getNumberOfRestarts()

Restart number accessor.

Returns:

restart : int (optional)

The number of restart.

getOptimalDesign(*args)

Accessor to the optimal design.

Returns:

design : NumericalSample

The design that optimizes the criterion.

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(*args)

Optimal value accessor.

Returns:

value : float (optional)

The optimal value.

getPhiP(*args)

Accessor the PhiP criterion evaluated on the optimal design.

Returns:

phiP : float

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()

Accessor to the object’s shadowed id.

Returns:

id : int

Internal unique identifier.

getVisibility()

Accessor to the object’s visibility state.

Returns:

visible : bool

Visibility flag.

hasName()

Test if the object is named.

Returns:

hasName : bool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns:

hasVisibleName : bool

True if the name is not empty and not the default one.

setName(name)

Accessor to the object’s name.

Parameters:

name : str

The name of the object.

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters:

id : int

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:

visible : bool

Visibility flag.