%define OT_CalibrationStrategy_doc
"Calibration strategy.

Available constructors:
    CalibrationStrategy(*range*)

    CalibrationStrategy(*range=[0.117, 0.468], expansionFactor=1.2, shrinkFactor=0.8, calibrationStep=100*)

Parameters
----------
range : :class:`~openturns.Interval` of dimension 1 :math:`[m,M]`
    Acceptance rate values for which no update of the *calibration* coefficient
    is performed.
expansionFactor : float, :math:`e > 1`
    Expansion factor :math:`e` to use to rescale the *calibration* coefficient
    if the latter is too high (greater than the upper bound of range).
shrinkFactor : float, :math:`0 < s < 1`
    Shrink factor :math:`s` to use to rescale the *calibration* coefficient if
    the latter is too low (smaller than the lower bound of range). If
    *expansionFactor* is specified, *shrinkFactor* must be mentioned too.
calibrationStep : positive int
    Calibration step corresponding for example to :math:`q` in the description
    of the method
    :meth:`~openturns.RandomWalkMetropolisHastings.getCalibrationStrategyPerComponent`
    of the RandomWalkMetropolisHastings class.

Notes
-----
A CalibrationStrategy can be used by a
:class:`~openturns.RandomWalkMetropolisHastings` for example (see the
description of the method
:meth:`~openturns.RandomWalkMetropolisHastings.getCalibrationStrategyPerComponent`
)."
%enddef
%feature("docstring") OT::CalibrationStrategyImplementation
OT_CalibrationStrategy_doc

// ---------------------------------------------------------------------

%define OT_CalibrationStrategy_computeUpdateFactor_doc
"Compute the update factor.

Parameters
----------
rho : float
    Acceptance rate :math:`\rho` to take into account.

Returns
-------
lambda : float
    Let :math:`\lambda` be the *calibration* coefficient to update, it gives a
    factor :math:`\phi(\rho)` such that :math:`\phi(\rho) \lambda` is the
    updated *calibration* coefficient according to the strategy. The value is
    computed as follows:

.. math::

    \phi(\rho) = \left\{
                 \begin{array}{l}
                     \displaystyle s  \quad if \; \rho < m \\
                     \displaystyle e  \quad if \; \rho > M \\
                     \displaystyle 1  \quad otherwise
                 \end{array}
                 \right.

with :math:`s \in ]0, 1[, e > 1` and :math:`[m,M]` the values given,
respectively, by the methods :meth:`getShrinkFactor`,
:meth:`getExpansionFactor` and :meth:`getRange`.

Examples
--------
>>> import openturns as ot
>>> calibration = ot.CalibrationStrategy(ot.Interval(0.1, 0.4), 1.2, 0.8)
>>> print(calibration.computeUpdateFactor(0.09))
0.8
>>> print(calibration.computeUpdateFactor(0.6))
1.2
>>> print(calibration.computeUpdateFactor(0.18))
1.0"
%enddef
%feature("docstring") OT::CalibrationStrategyImplementation::computeUpdateFactor
OT_CalibrationStrategy_computeUpdateFactor_doc

// ---------------------------------------------------------------------

%define OT_CalibrationStrategy_getCalibrationStep_doc
"Get the calibration step.

Returns
-------
step : positive int
    Calibration step corresponding for example to :math:`q` in the description
    of the method
    :meth:`~openturns.RandomWalkMetropolisHastings.getCalibrationStrategyPerComponent`
    of the RandomWalkMetropolisHastings class."
%enddef
%feature("docstring") OT::CalibrationStrategyImplementation::getCalibrationStep
OT_CalibrationStrategy_getCalibrationStep_doc

// ---------------------------------------------------------------------

%define OT_CalibrationStrategy_setCalibrationStep_doc
"Set the calibration step.

Parameters
----------
step : positive int
    Calibration step corresponding for example to :math:`q` in the description
    of the method
    :meth:`~openturns.RandomWalkMetropolisHastings.getCalibrationStrategyPerComponent`
    of the RandomWalkMetropolisHastings class."
%enddef
%feature("docstring") OT::CalibrationStrategyImplementation::setCalibrationStep
OT_CalibrationStrategy_setCalibrationStep_doc

// ---------------------------------------------------------------------

%define OT_CalibrationStrategy_getExpansionFactor_doc
"Get the expansion factor.

Returns
-------
expansionFactor : float
    Expansion factor :math:`e`. See the description of the method
    :meth:`computeUpdateFactor`."
%enddef
%feature("docstring") OT::CalibrationStrategyImplementation::getExpansionFactor
OT_CalibrationStrategy_getExpansionFactor_doc

// ---------------------------------------------------------------------

%define OT_CalibrationStrategy_setExpansionFactor_doc
"Set the expansion factor.

Parameters
----------
expansionFactor : float, :math:`e > 1`
    Expansion factor :math:`e`. See the description of the method
    :meth:`computeUpdateFactor`."
%enddef
%feature("docstring") OT::CalibrationStrategyImplementation::setExpansionFactor
OT_CalibrationStrategy_setExpansionFactor_doc

// ---------------------------------------------------------------------

%define OT_CalibrationStrategy_getRange_doc
"Get the range.

Returns
-------
range : :class:`~openturns.Interval` of dimension 1
    Range :math:`[m,M]` in the description of the method
    :meth:`computeUpdateFactor`."
%enddef
%feature("docstring") OT::CalibrationStrategyImplementation::getRange
OT_CalibrationStrategy_getRange_doc

// ---------------------------------------------------------------------

%define OT_CalibrationStrategy_setRange_doc
"Set the range.

Parameters
----------
range : :class:`~openturns.Interval` of dimension 1
    Range :math:`[m,M]` in the description of the method
    :meth:`computeUpdateFactor`."
%enddef
%feature("docstring") OT::CalibrationStrategyImplementation::setRange
OT_CalibrationStrategy_setRange_doc

// ---------------------------------------------------------------------

%define OT_CalibrationStrategy_getShrinkFactor_doc
"Get the shrink factor.

Returns
-------
shrinkFactor : float
    Shrink factor :math:`s` in the description of the method
    :meth:`computeUpdateFactor`."
%enddef
%feature("docstring") OT::CalibrationStrategyImplementation::getShrinkFactor
OT_CalibrationStrategy_getShrinkFactor_doc

// ---------------------------------------------------------------------

%define OT_CalibrationStrategy_setShrinkFactor_doc
"Set the shrink factor.

Parameters
----------
shrinkFactor : float, :math:`0 < s < 1`
    Shrink factor :math:`s` in the description of the method
    :meth:`computeUpdateFactor`."
%enddef
%feature("docstring") OT::CalibrationStrategyImplementation::setShrinkFactor
OT_CalibrationStrategy_setShrinkFactor_doc