RenewalRewardProcess#

class relife.stochastic_processes.RenewalRewardProcess(lifetime_model, first_lifetime_model=None)[source]#

Renewal reward process.

Parameters:
lifetime_modelParametricLifetimeModel

Lifetime model representing durations between events.

first_lifetime_modelParametricLifetimeModel, optional

Lifetime model for the first renewal in a delayed renewal process. Defaults to lifetime_model.

Methods

asymptotic_expected_equivalent_annual_worth

Asymptotic expected equivalent annual worth.

asymptotic_expected_total_reward

Asymptotic expected total reward.

expected_equivalent_annual_worth

Expected equivalent annual worth.

expected_number_of_events

The expected number of observed events.

expected_number_of_preventive_renewals

The expected number of preventive renewals.

expected_total_reward

The expected total reward.

get_params

Get the parameters of this model.

is_fitted

Whether fitting results are set.

is_parametrized

Whether at least one parameter value is set.

renewal_density

The renewal density.

renewal_function

The renewal function.

set_params

Set the parameters of this model.

asymptotic_expected_equivalent_annual_worth(*, cf, cp=None, ar=None, cf1=None, cp1=None, a0=None, discounting_rate=0.0)[source]#

Asymptotic expected equivalent annual worth.

Parameters:
cffloat or 1d array

The cost of failure.

cpfloat or 1d array, optional

The cost of preventive replacement. Must be set with ar.

arfloat or 1d array, optional

Preventive ages of replacements. Must be set with cp.

a0float or 1d array, optional

Initial ages of the assets.

cf1float or 1d array, optional

The cost of first failure. If not set, defaults to cf.

cp1float or 1d array, optional

The cost of the first preventive replacement. Must be set with ar. If not set, defaults to cp.

discounting_ratefloat, default is 0.

The discounting rate to apply for reward computations.

Returns:
ndarray

The asymptotic expected equivalent annual worth.

asymptotic_expected_total_reward(*, cf, cp=None, ar=None, cf1=None, cp1=None, a0=None, discounting_rate=0.0)[source]#

Asymptotic expected total reward.

The asymptotic expected total reward is:

\[z^\infty = \lim_{t\to \infty} z(t) = \dfrac{E\left[Y e^{-\delta X}\right]}{1-E\left[e^{-\delta X}\right]}\]

where:

  • \(X\) the interarrival random variable.

  • \(Y\) the associated reward.

  • \(D\) the exponential discount factor.

If the renewal reward process is delayed, the asymptotic expected total reward is modified as:

\[z_1^\infty = E\left[Y_1 e^{-\delta X_1}\right] + z^\infty E\left[e^{-\delta X_1}\right]\]

where:

  • \(X_1\) the interarrival random variable of the first renewal.

  • \(Y_1\) the associated reward of the first renewal.

Parameters:
cffloat or 1d array

The cost of failure.

cpfloat or 1d array, optional

The cost of preventive replacement. Must be set with ar.

arfloat or 1d array, optional

Preventive ages of replacements. Must be set with cp.

a0float or 1d array, optional

Initial ages of the assets.

cf1float or 1d array, optional

The cost of first failure. If not set, defaults to cf.

cp1float or 1d array, optional

The cost of the first preventive replacement. Must be set with ar. If not set, defaults to cp.

discounting_ratefloat, default is 0.

The discounting rate to apply for reward computations.

Returns:
ndarray

The asymptotic expected total reward of the process.

expected_equivalent_annual_worth(tf, nb_steps, *, cf, cp=None, ar=None, cf1=None, cp1=None, a0=None, discounting_rate=0.0)[source]#

Expected equivalent annual worth.

Gives the equivalent annual worth of the expected total reward of the process at each point of the timeline.

The equivalent annual worth at time \(t\) is equal to the expected total reward \(z\) divided by the annuity factor \(AF(t)\).

Parameters:
tffloat

The final time.

nb_stepsint

The number of steps used to discretize the time.

cffloat or 1d array

The cost of failure.

cpfloat or 1d array, optional

The cost of preventive replacement. Must be set with ar.

arfloat or 1d array, optional

Preventive ages of replacements. Must be set with cp.

a0float or 1d array, optional

Initial ages of the assets.

cf1float or 1d array, optional

The cost of first failure. If not set, defaults to cf.

cp1float or 1d array, optional

The cost of the first preventive replacement. Must be set with ar. If not set, defaults to cp.

discounting_ratefloat, default is 0.

The discounting rate to apply for reward computations.

Returns:
tuple of np.ndarray

Timeline and corresponding values.

expected_number_of_events(tf, nb_steps, *, a0=None, ar=None)#

The expected number of observed events.

Here, events are assets failures, i.e. only the assets failures are counted (not the preventive replacements at ar).

The function is noted \(m_e\) and computed by solving :

\[m_e(t) = F(\text{min}(t,~a_r)) + \int_0^{t}m_e(t-x)dF_{a_r}(x)\]

where:

  • \(F\) is the cumulative distribution function of the time to failure \(X\).

  • \(F_{a_r}\) is the cumulative distribution of \(T = \text{min}(X,~a_r)\).

If a0 or first_lifetime_model is given, instead, we compute \(m_e^{\text{delayed}}\) by solving:

\[m_e^{\text{delayed}}(t) = F_1(\text{min}(t,~a_r)) + \int_0^{t}m_e(t-x)dF_{1_{a_r}}(x)\]

where:

  • \(F_1\) is the cumulative distribution function of the first time to failure \(X_1\).

  • \(F_{1_{a_r}}\) is the cumulative distribution of \(T_1 = \text{min}(X_1,~a_r)\).

Note

If ar is None, \(a_r = \infty\).

This function is complementary to expected_number_of_preventive_renewals() i.e. \(m(t) = m_e(t) + m_p(t)\).

See also renewal_function().

Parameters:
tffloat

The final time.

nb_stepsint

The number of steps used to discretize the time.

a0float or 1d array, optional

Initial ages of the assets.

arfloat or 1d array, optional

Preventive ages of replacements.

Returns:
outtuple of np.ndarray

Timeline and corresponding values.

Notes

Preventive replacements are not considered as events. Only renewals are. Thus, they are not counted.

expected_number_of_preventive_renewals(tf, nb_steps, *, ar, a0=None)#

The expected number of preventive renewals.

The function is noted \(m_p\) and computed by solving :

\[m_p(t) = \mathbb{1}_{t > a_r} \cdot (1 - F(a_r)) + \int_0^{t}m_p(t-x)dF_{a_r}(x)\]

where:

  • \(F\) is the cumulative distribution function of the time to failure \(X\).

  • \(F_{a_r}\) is the cumulative distribution of \(T = \text{min}(X,~a_r)\).

If a0 or first_lifetime_model is given, instead, we compute \(m_p^{\text{delayed}}\) by solving:

\[m_p^{\text{delayed}}(t) = \mathbb{1}_{t > a_r} \cdot (1 - F_1(a_r)) + \int_0^{t}m_p(t-x)dF_{1_{a_r}}(x)\]

where:

  • \(F_1\) is the cumulative distribution function of the first time to failure \(X_1\).

  • \(F_{1_{a_r}}\) is the cumulative distribution of \(T_1 = \text{min}(X_1,~a_r)\).

Note

If ar is None, \(a_r = \infty\).

This function is complementary to expected_number_of_events() i.e. \(m(t) = m_e(t) + m_p(t)\).

See also renewal_function().

Parameters:
tffloat

The final time.

nb_stepsint

The number of steps used to discretize the time.

arfloat or 1d array

Preventive ages of replacements.

a0float or 1d array, optional

Initial ages of the assets.

Returns:
outtuple of np.ndarray

Timeline and corresponding values.

expected_total_reward(tf, nb_steps, *, cf, cp=None, ar=None, cf1=None, cp1=None, a0=None, discounting_rate=0.0)[source]#

The expected total reward.

The renewal equation solved to compute the expected reward is:

\[z(t) = \int_0^t E[Y | X = x] e^{-\delta x} \mathrm{d}F(x) + \int_0^t z(t-x) e^{-\delta x}\mathrm{d}F(x)\]

where:

  • \(z\) is the expected total reward.

  • \(F\) is the cumulative distribution function of the underlying lifetime model.

  • \(X\) the interarrival random variable.

  • \(Y\) the associated reward.

  • \(D\) the exponential discount factor.

If the renewal reward process is delayed, the expected total reward is modified as:

\[z_1(t) = \int_0^t E[Y_1 | X_1 = x] e^{-\delta x} \mathrm{d}F_1(x) + \int_0^t z(t-x) e^{-\delta x} \mathrm{d}F_1(x)\]

where:

  • \(z_1\) is the expected total reward with delay.

  • \(F_1\) is the cumulative distribution function of the lifetime model for the first renewal.

  • \(X_1\) the interarrival random variable of the first renewal.

  • \(Y_1\) the associated reward of the first renewal.

Parameters:
tffloat

The final time.

nb_stepsint

The number of steps used to discretize the time.

cffloat or 1d array

The cost of failure.

cpfloat or 1d array, optional

The cost of preventive replacement. Must be set with ar.

arfloat or 1d array, optional

Preventive ages of replacements. Must be set with cp.

a0float or 1d array, optional

Initial ages of the assets.

cf1float or 1d array, optional

The cost of first failure. If not set, defaults to cf.

cp1float or 1d array, optional

The cost of the first preventive replacement. Must be set with ar. If not set, defaults to cp.

discounting_ratefloat, default is 0.

The discounting rate to apply for reward computations.

Returns:
tuple of np.ndarray

Timeline and corresponding values.

get_params()#

Get the parameters of this model.

Returns:
out1darray of floats

Model parameters.

Notes

If parameter values are not set, they default to np.nan values.

is_fitted()#

Whether fitting results are set.

is_parametrized()#

Whether at least one parameter value is set.

renewal_density(tf, nb_steps, *, a0=None, ar=None)#

The renewal density.

It is the derivative \(\omega\) of the renewal function \(m\). See the renewal_function().

\[\omega(t) = m'(t) = f_1(t) + \int_0^t \omega(t-x) \mathrm{d}F(x)\]

where:

  • \(F\) is the cumulative distribution function of the time to failure \(X\).

  • \(f_1\) is the probability density function of the first time to failure \(X_1\).

If ar is given, \(F\) becomes \(F_{a_r}\) defined by \(T = \text{min}(X,~a_r) \sim F_{a_r}\). The same applies for \(X_1\). \(F_1\) becomes \(F_{1_{a_r}}\) defined by \(T_1 = \text{min}(X_1,~a_r) \sim F_{1_{a_r}}\).

If a0 is given, \(F_1\) becomes \(\mathbb{P}(X \leq t |~ X > a_0)\).

Parameters:
tffloat

The final time.

nb_stepsint

The number of steps used to discretize the time.

a0float or 1d array, optional

Initial ages of the assets.

arfloat or 1d array, optional

Preventive ages of replacements.

Returns:
tuple of np.ndarray

Timeline and corresponding values.

References

[1]

Rausand, M., Barros, A., & Hoyland, A. (2020). System Reliability Theory: Models, Statistical Methods, and Applications. John Wiley & Sons.

renewal_function(tf, nb_steps, *, a0=None, ar=None)#

The renewal function.

It gives the expected total number of renewals \(m\). It is computed by solving the renewal equation:

\[m(t) = F_1(t) + \int_0^t m(t-x) \mathrm{d}F(x)\]

where:

  • \(F\) is the cumulative distribution function of the time to failure \(X\).

  • \(F_1\) is the cumulative distribution function of the first time to failure \(X_1\).

If ar is given, \(F\) becomes \(F_{a_r}\) defined by \(T = \text{min}(X,~a_r) \sim F_{a_r}\). The same applies for \(X_1\). \(F_1\) becomes \(F_{1_{a_r}}\) defined by \(T_1 = \text{min}(X_1,~a_r) \sim F_{a_r}\).

If a0 is given, \(F_1\) becomes \(\mathbb{P}(X \leq t |~ X > a_0)\).

Parameters:
tffloat

The final time.

nb_stepsint

The number of steps used to discretize the time.

a0float or 1d array, optional

Initial ages of the assets.

arfloat or 1d array, optional

Preventive ages of replacements.

Returns:
outtuple of np.ndarray

Timeline and corresponding values.

References

[1]

Rausand, M., Barros, A., & Hoyland, A. (2020). System Reliability Theory: Models, Statistical Methods, and Applications. John Wiley & Sons.

set_params(new_params)#

Set the parameters of this model.

Parameters:
new_params1d array-like of floats

Model parameters.

Notes

set_params definition expects an array-like of floats. At runtime, complex parameters might be setted temporarily to approximate fitted parameters covariance. This is contradictory to the given typing. At the moment, we don’t see a better solution and we believe that this is actually a limitation of what can be expressed in the static typesystem.