relife.replacement_policy.AgeReplacementPolicy
relife.replacement_policy.AgeReplacementPolicy¶
- class relife.replacement_policy.AgeReplacementPolicy(model: relife.model.AbsolutelyContinuousLifetimeModel, args: Tuple[numpy.ndarray, ...] = (), a0: Optional[numpy.ndarray] = None, ar: Optional[numpy.ndarray] = None, ar1: Optional[numpy.ndarray] = None, cf: Optional[numpy.ndarray] = None, cp: Optional[numpy.ndarray] = None, rate: numpy.ndarray = 0)[source]¶
Bases:
object
Time based replacement policy.
Age replacement renewal policy.
Renewal reward process where assets are replaced at a fixed age ar with costs cp or upon failure with costs cf if earlier.
- Parameters
model (AbsolutelyContinuousLifetimeModel) – Absolutely continuous lifetime model of the asset.
args (Tuple[ndarray,...], optional) – Extra arguments required by the lifetime model, by default ().
a0 (float or 2D array, optional) – Current ages of the assets, by default 0 for each asset.
ar (float, 2D array, optional) – Ages of preventive replacements, by default None.
ar1 (float, 2D array, optional) – Ages of the first preventive replacements, by default None.
cf (float, 2D array or 3D array, optional) – Costs of failures, by default None, by default None.
cp (float, 2D array or 3D array, optional) – Costs of preventive replacements, by default None.
rate (float, 2D array or 3D array, optional) – Discount rate, by default 0.
Notes
If ar, ar1, cf or cp is set to None, the argument should be defined when using methods to compute costs.
If cf, cp and rate are 2D or 3D array, then:
axis=-2 represents the indices of each asset,
axis=-3 represents the indices of each component of the cost vector.
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 asymptotic expected equivalent annual cost.
The asymptotic expected total cost.
The expected equivalent annual cost.
The expected total discounted cost.
Computes and sets the optimal age of replacement for each asset.
Compute the optimal age of preventive replacement for each asset.
Arguments of the underlying renewal reward process.
Age replacement renewal policy sampling.
Attributes
Exponential discounting.
Costs of the replacement.
- reward: relife.reward.AgeReplacementCost = <relife.reward.AgeReplacementCost object>¶
Costs of the replacement.
- discount: relife.discounting.ExponentialDiscounting = <relife.discounting.ExponentialDiscounting object>¶
Exponential discounting.
- rrp_args(ar: Optional[numpy.ndarray] = None, ar1: Optional[numpy.ndarray] = None, cf: Optional[numpy.ndarray] = None, cp: Optional[numpy.ndarray] = None, rate: Optional[numpy.ndarray] = None) Tuple[Tuple[numpy.ndarray, ...], ...] [source]¶
Arguments of the underlying renewal reward process.
- Parameters
ar (float, 2D array, optional) – Ages of preventive replacements, by default None.
ar1 (float, 2D array, optional) – Ages of the first preventive replacements, by default None.
cf (float, 2D array or 3D array, optional) – Costs of failures, by default None, by default None.
cp (float, 2D array or 3D array, optional) – Costs of preventive replacements, by default None.
rate (float, 2D array or 3D array, optional) – Discount rate, by default 0.
- Returns
(model_args, reward_args, model1_args, reward1_args, discount_args)
- Return type
Tuple[Tuple[ndarray,…],…]
Notes
If an argument is None, the value of the class attribute is taken.
- classmethod optimal_replacement_age(model: relife.model.AbsolutelyContinuousLifetimeModel, cf: numpy.ndarray, cp: numpy.ndarray, rate: numpy.ndarray = 0, args: Tuple[numpy.ndarray, ...] = ()) numpy.ndarray [source]¶
Compute the optimal age of preventive replacement for each asset.
The optimal age of preventive replacement is computed by minimizing the asymptotic expected equivalent annual cost of the renewal reward process.
- Parameters
model (AbsolutelyContinuousLifetimeModel) – Absolutely continuous lifetime model.
cf (float, 2D array or 3D array) – Costs of failures.
cp (float, 2D array or 3D array) – Costs of preventive replacements.
rate (float, 2D array or 3D array, optional) – Discount rate, by default 0.
args (Tuple[ndarray,...], optional) – Extra arguments required by the lifetime model, by default ().
- Returns
The optimal age of preventive replacement.
- Return type
ndarray
Notes
The optimal age of replacement minimizes the asymptotic expected equivalent annual cost:
\[EEAC_\infty(a) = \sum_i \dfrac{{c_f}_i \int_0^a e^{-\delta_i x} f(x) \mathrm{d}x + {c_p}_i e^{-\delta_i a} S(a)}{\int_0^a e^{-\delta_i x} S(x) \mathrm{d}x}\]where:
\(a\) is the age of replacement,
\({c_f}_i, {c_p}_i, \delta_i\) are respectively the components of the failures costs, preventive costs and the associated discount rate,
\(S, f, h\) are respectively the survival function, the probability density function and the hazard function of the underlying lifetime model.
The optimal age of replacement is then solution of the equation:
\[\sum_i \dfrac{\left( ({c_f}_i - {c_p}_i) \left( h(a) \int_0^a e^{-\delta_i x} S(x) \mathrm{d}x - \int_0^a e^{-\delta_i x} f(x) \mathrm{d}x \right) - {c_p}_i \right)} {\left( \int_0^a e^{-\delta_i x} S(x) \mathrm{d}x \right)^2} = 0\]
- fit(cf: Optional[numpy.ndarray] = None, cp: Optional[numpy.ndarray] = None, rate: Optional[numpy.ndarray] = None, fit_ar1: bool = True) relife.replacement_policy.AgeReplacementPolicy [source]¶
Computes and sets the optimal age of replacement for each asset.
- Parameters
cf (float, 2D array or 3D array, optional) – Costs of failures, by default None.
cp (float, 2D array or 3D array, optional) – Costs of preventive replacements, by default None.
rate (float, 2D array or 3D array, optional) – Discount rate, by default None.
fit_ar1 (bool, optional) – If True, computes and sets the optimal age of replacement for the first replacement considering a one-cycle age replacement criteria.
- Returns
The fitted policy as the current object.
- Return type
self
Notes
If an argument is None, the value of the class attribute is taken.
- expected_total_cost(t: numpy.ndarray, ar: Optional[numpy.ndarray] = None, ar1: Optional[numpy.ndarray] = None, cf: Optional[numpy.ndarray] = None, cp: Optional[numpy.ndarray] = None, rate: Optional[numpy.ndarray] = None) numpy.ndarray [source]¶
The expected total discounted cost.
The expected total discounted cost is computed by solving the renewal equation.
- Parameters
t (1D array) – Timeline.
ar (float or 2D array, optional) – Ages of replacement, by default None.
ar1 (float, 2D array, optional) – Ages of the first preventive replacements, by default None.
cf (float, 2D array or 3D array, optional) – Costs of failures, by default None.
cp (float, 2D array or 3D array, optional) – Costs of preventive replacements, by default None.
rate (float, 2D array or 3D array, optional) – Discount rate, by default None.
- Returns
The cumulative expected total cost for each asset along the timeline.
- Return type
ndarray
Notes
If an argument is None, the value of the class attribute is taken.
- asymptotic_expected_total_cost(ar: Optional[numpy.ndarray] = None, ar1: Optional[numpy.ndarray] = None, cf: Optional[numpy.ndarray] = None, cp: Optional[numpy.ndarray] = None, rate: Optional[numpy.ndarray] = None) numpy.ndarray [source]¶
The asymptotic expected total cost.
- Parameters
ar (float or 2D array, optional) – Ages of preventive replacement, by default None.
ar1 (float, 2D array, optional) – Ages of the first preventive replacements, by default None.
cf (float, 2D array or 3D array, optional) – Costs of failures, by default None.
cp (float, 2D array or 3D array, optional) – Costs of preventive replacements, by default None.
rate (float, 2D array or 3D array, optional) – Discount rate, by default None.
- Returns
The asymptotic expected total cost for each asset.
- Return type
ndarray
Notes
If an argument is None, the value of the class attribute is taken.
- expected_equivalent_annual_cost(t: numpy.ndarray, ar: Optional[numpy.ndarray] = None, ar1: Optional[numpy.ndarray] = None, cf: Optional[numpy.ndarray] = None, cp: Optional[numpy.ndarray] = None, rate: Optional[numpy.ndarray] = None) numpy.ndarray [source]¶
The expected equivalent annual cost.
- Parameters
t (1D array) – Timeline.
ar (float or 2D array, optional) – Ages of replacement, by default None.
ar1 (float, 2D array, optional) – Ages of the first preventive replacements, by default None.
cf (float, 2D array or 3D array, optional) – Costs of failures, by default None.
cp (float, 2D array or 3D array, optional) – Costs of preventive replacements, by default None.
rate (float, 2D array or 3D array, optional) – Discount rate, by default None.
- Returns
The expected equivalent annual cost for each asset along the timeline.
- Return type
ndarray
Notes
If an argument is None, the value of the class attribute is taken.
The expected equivalent annual cost at time \(t\) is:
\[EEAC(t) = \dfrac{\delta z(t)}{1 - e^{-\delta t}}\]where \(z\) is the expected total cost.
- asymptotic_expected_equivalent_annual_cost(ar: Optional[numpy.ndarray] = None, ar1: Optional[numpy.ndarray] = None, cf: Optional[numpy.ndarray] = None, cp: Optional[numpy.ndarray] = None, rate: Optional[numpy.ndarray] = None) numpy.ndarray [source]¶
The asymptotic expected equivalent annual cost.
- Parameters
ar (float or 2D array, optional) – Ages of replacement, by default None.
ar1 (float, 2D array, optional) – Ages of the first preventive replacements, by default None.
cf (float, 2D array or 3D array, optional) – Costs of failures, by default None.
cp (float, 2D array or 3D array, optional) – Costs of preventive replacements, by default None.
rate (float, 2D array or 3D array, optional) – Discount rate, by default None.
- Returns
The asymptotic expected equivalent annual cost for each asset.
- Return type
ndarray
Notes
If an argument is None, the value of the class attribute is taken.
The asymptotic expected equivalent annual cost is:
\[EEAC_\infty = \lim_{t \to \infty} EEAC(t)\]
- sample(T: float, ar: Optional[numpy.ndarray] = None, ar1: Optional[numpy.ndarray] = None, cf: Optional[numpy.ndarray] = None, cp: Optional[numpy.ndarray] = None, rate: Optional[numpy.ndarray] = None, n_samples: int = 1, random_state: Optional[int] = None) relife.data.ReplacementPolicyData [source]¶
Age replacement renewal policy sampling.
- Parameters
T (float) – End of the observation period.
ar (float or 2D array, optional) – Ages of replacement, by default None.
ar1 (float, 2D array, optional) – Ages of the first preventive replacements, by default None.
cf (float, 2D array or 3D array, optional) – Costs of failures, by default None.
cp (float, 2D array or 3D array, optional) – Costs of preventive replacements, by default None.
rate (float, 2D array or 3D array, optional) – Discount rate, by default None.
n_samples (int, optional) – Number of samples, by default 1.
random_state (int, optional) – Random seed, by default None.
- Returns
Samples of replacement times, durations, costs and events for each asset.
- Return type
Notes
If an argument is None, the value of the class attribute is taken.