RunToFailurePolicy#

class relife.policy.RunToFailurePolicy(lifetime_model, cf, discounting_rate=0.0, first_lifetime_model=None, a0=None)[source]#

Run-to-failure renewal policy.

Renewal reward stochastic_process where assets are replaced on failure with costs \(c_f\).

Parameters:
lifetime_modelany lifetime distribution or frozen lifetime model

A lifetime model representing the durations between events.

cffloat or 1darray

Costs of failures

discounting_ratefloat, default is 0.

The discounting rate value used in the exponential discounting function

first_lifetime_modelany lifetime distribution or frozen lifetime model, optional

A lifetime model for the first renewal (delayed renewal process). It is None by default

a0float or 1darray, optional

Current ages of the assets, by default 0 for each asset. If it is given, left truncations of a0 will be take into account for the first cycle.

Attributes:
cf

Cost of failures

References

[1]

Van der Weide, J. A. M., & Van Noortwijk, J. M. (2008). Renewal theory with exponential and hyperbolic discounting. Probability in the Engineering and Informational Sciences, 22(1), 53-74.

Methods

asymptotic_expected_equivalent_annual_cost

Calculate the asymptotic expected equivalent annual cost.

asymptotic_expected_total_cost

Calculate the asymptotic expected total cost.

expected_equivalent_annual_cost

Calculate the expected equivalent annual cost over a given timeline.

expected_nb_replacements

The expected number of replacements.

expected_total_cost

Calculate the expected total cost over a given timeline.

generate_lifetime_data

Generate lifetime data

sample

Renewal data sampling.

asymptotic_expected_equivalent_annual_cost()#

Calculate the asymptotic expected equivalent annual cost.

It takes into account discounting_rate attribute value.

The asymptotic expected total cost is:

\[\lim_{t\to\infty} \text{EEAC}(t)\]

where \(\text{EEAC}(t)\) is the expected equivalent annual cost at \(t\). See expected_equivalent_annual_cost() for more details.

Returns:
np.ndarray

The asymptotic expected equivalent annual cost.

asymptotic_expected_total_cost()#

Calculate the asymptotic expected total cost.

It takes into account discounting_rate attribute value.

The asymptotic expected total cost is:

\[\lim_{t\to\infty} z(t)\]

where \(z(t)\) is the expected total cost at \(t\). See expected_total_cost() for more details.

Returns:
np.ndarray

The asymptotic expected total cost.

property cf#

Cost of failures

Returns:
ndarray
expected_equivalent_annual_cost(tf, nb_steps)#

Calculate the expected equivalent annual cost over a given timeline.

It takes into account discounting_rate attribute value.

The expected equivalent annual cost \(\text{EEAC}(t)\) is given by:

\[\text{EEAC}(t) = \dfrac{\delta z(t)}{1 - e^{-\delta t}}\]

where :

  • \(t\) is the time

  • \(z(t)\) is the expected_total_cost at \(t\). See expected_total_cost() for more details.`.

  • \(\delta\) is the discounting rate.

Parameters:
timeline: np.ndarray

Values of the timeline over which the expected equivalent annual cost is to be calculated.

Returns:
np.ndarray

The expected equivalent annual cost.

expected_nb_replacements(tf, nb_steps)#

The expected number of replacements.

It is computed by solving the renewal equation:

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

where:

  • \(m\) is the renewal function,

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

  • \(F_1\) is the cumulative distribution function of the underlying lifetime model for the fist renewal in the case of a delayed renewal process.

Parameters:
tffloat

Time horizon. The expected number of replacements will be computed up until this calendar time.

nb_stepsint

The number of steps used to compute the expected number of replacements

Returns:
tuple of two ndarrays

A tuple containing the timeline used to compute the expected number of replacements and its corresponding values at each step of the timeline.

expected_total_cost(tf, nb_steps)#

Calculate the expected total cost over a given timeline.

It takes into account discounting_rate attribute value.

The expected total cost \(z(t)\) is computed by solving the renewal equation and is given by:

\[z(t) = \mathbb{E}(Z_t) = \int_{0}^{\infty}\mathbb{E}(Z_t~|~X_1 = x)dF(x)\]

where :

  • \(t\) is the time

  • \(X_i \sim F\) are \(n\) random variable lifetimes, i.i.d., of cumulative distribution \(F\).

  • \(Z_t\) is the random variable reward at each time \(t\).

  • \(\delta\) is the discounting rate.

Parameters:
timeline: np.ndarray

Values of the timeline over which the expected total cost is to be calculated.

Returns:
np.ndarray

The expected total cost.

generate_lifetime_data(size, tf, t0=0.0, seed=None)#

Generate lifetime data

This function will generate lifetime data that can be used to fit a lifetime model.

Parameters:
sizeint

The size of the desired sample.

tffloat

Time at the end of the observation.

t0float, default 0

Time at the beginning of the observation.

seedint, optional

Random seed, by default None.

Returns:
A dict of time, event, entry and args (covariates)
sample(size, tf, t0=0.0, seed=None)#

Renewal data sampling.

This function will sample data and encapsulate them in an object.

Parameters:
sizeint

The size of the desired sample.

tffloat

Time at the end of the observation.

t0float, default 0

Time at the beginning of the observation.

sizeint or tuple of 2 int

Size of the sample

seedint, optional

Random seed, by default None.