AgeReplacementPolicy#
- class relife.policies.AgeReplacementPolicy(lifetime_model, cf, cp, discounting_rate=0.0)[source]#
Age replacement policy.
Asset is replaced at a fixed age \(a_r\) with cost \(c_p\) or it is replaced upon failure with cost \(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
- cpfloat or 1darray
Costs of preventive replacements
- discounting_ratefloat, default is 0.
The discounting rate value used in the exponential discounting function
- Attributes:
- baseline_modelunivariate parametric lifetime model.
The underlying lifetime model.
- discounting_ratefloat
The discounting value.
References
[1]Mazzuchi, T. A., Van Noortwijk, J. M., & Kallen, M. J. (2007). Maintenance optimization. Encyclopedia of Statistics in Quality and Reliability, 1000-1008.
Methods
The expected annual number of replacements upon failures.
The expected annual number of replacements.
The asymtotic expected equivalent annual cost.
The asymtotic expected net present value.
Compute the optimal ages of replacement.
The expected equivalent annual cost.
The expected net present value.
Generate failure data
Cost of failure.
Costs of preventive replacements.
Renewal data sampling.
set_cfset_cp- annual_number_of_failures(nb_years, ar, a0=None)[source]#
The expected annual number of replacements upon failures.
- Parameters:
- nb_yearsint
The number of years on which the annual number of replacements are projected.
- arfloat or np.ndarray
Ages of replacements.
- a0float or np.ndarray, optional.
The initial ages.
- annual_number_of_replacements(nb_years, ar, a0=None)[source]#
The expected annual number of replacements.
- Parameters:
- nb_yearsint
The number of years on which the annual number of replacements are projected
- arfloat or np.ndarray
Ages of replacements.
- a0float or np.ndarray, optional.
The initial ages.
- asymptotic_expected_equivalent_annual_cost(ar, a0=None)[source]#
The asymtotic expected equivalent annual cost.
\[\lim_{t\to\infty} q(t)\]- Parameters:
- arfloat or np.ndarray
Preventive ages of replacements.
- a0float or np.ndarray, optional
Initial ages of the assets.
- Returns:
- ndarray
The asymptotic expected values.
- asymptotic_expected_net_present_value(ar, a0=None)[source]#
The asymtotic expected net present value.
\[\lim_{t\to\infty} z(t)\]- Parameters:
- arfloat or np.ndarray
Preventive ages of replacements.
- a0float or np.ndarray, optional
Initial ages of the assets.
- Returns:
- ndarray
The asymptotic expected values.
- compute_optimal_ar()[source]#
Compute the optimal ages of replacement.
The optimal ages of replacement depends one the costs, the discounting rate and the underlying lifetime model.
- Returns:
- outfloat or np.ndarray
Optimal ages of replacements.
- discounting_rate#
Base class of age replacement policies.
- expected_equivalent_annual_cost(tf, nb_steps, ar, a0=None)[source]#
The expected equivalent annual cost.
\[q(t) = \dfrac{\delta z(t)}{1 - e^{-\delta t}}\]where :
\(t\) is the time.
\(z(t)\) is the expected net present value at time \(t\).
\(\delta\) is the discounting rate.
- Parameters:
- tffloat
The final time.
- nb_stepsint
The number of steps used to discretized the time.
- arfloat or np.ndarray
Preventive ages of replacements.
- a0float or np.ndarray, optional
Initial ages of the assets.
- Returns:
- tuple of two ndarrays
A tuple containing the timeline and the computed values.
- expected_net_present_value(tf, nb_steps, ar, a0=None)[source]#
The expected net present value.
\[z(t) = \mathbb{E}(Z_t) = \int_{0}^{\infty}\mathbb{E}(Z_t~|~X_1 = x)dF(x)\]where :
\(t\) is the time
\(X_1 \sim F\) is the random lifetime of the first asset
\(Z_t\) are the random costs at each time \(t\)
\(\delta\) is the discounting rate
It is computed by solving the renewal equation.
- Parameters:
- tffloat
The final time.
- nb_stepsint
The number of steps used to discretized the time.
- arfloat or np.ndarray
Preventive ages of replacements.
- a0float or np.ndarray, optional
Initial ages of the assets.
- Returns:
- tuple of two ndarrays
A tuple containing the timeline and the computed values.
- generate_failure_data(nb_samples, time_window, ar, a0=None, seed=None)[source]#
Generate failure data
This function will generate failure data that can be used to fit a lifetime model.
- Parameters:
- arfloat or np.ndarray
Ages of replacements
- nb_samplesint
The number of samples.
- time_windowtuple of two floats
Time window in which data are sampled.
- seedint, optional
Random seed, by default None.
- a0float or np.ndarray or None
Optional, initial ages
- Returns:
- A dict of time, event, entry and args (covariates)
- get_cf()#
Cost of failure.
- Returns:
- np.ndarray
- get_cp()#
Costs of preventive replacements.
- Returns:
- np.ndarray
- sample(nb_samples, time_window, ar, a0=None, seed=None)[source]#
Renewal data sampling.
This function will sample data and encapsulate them in an object.
- Parameters:
- nb_samplesint
The number of samples.
- time_windowtuple of two floats
Time window in which data are sampled.
- seedint, optional
Random seed, by default None.