TimerCallback

TimerCallback(duration)

Time stopping criterion.

Usable as stopping callback for simulation, optimization algorithms.

Parameters
durationfloat

Maximum duration in seconds of the algorithm.

Examples

>>> import openturns as ot
>>> model = ot.SymbolicFunction(['R', 'S'], ['R-S'])
>>> distribution = ot.Normal(2)
>>> vect = ot.RandomVector(distribution)
>>> output = ot.CompositeRandomVector(model, vect)
>>> event = ot.ThresholdEvent(output, ot.Less(), 0.0)
>>> experiment = ot.MonteCarloExperiment()
>>> algo = ot.ProbabilitySimulationAlgorithm(event, experiment)
>>> algo.setMaximumOuterSampling(int(1e9))
>>> algo.setMaximumCoefficientOfVariation(-1.0)
>>> timer = ot.TimerCallback(1.5)
>>> algo.setStopCallback(timer)
>>> algo.run()