relife.replacement_policy.OneCycleAgeReplacementPolicy

relife.replacement_policy.OneCycleAgeReplacementPolicy

class relife.replacement_policy.OneCycleAgeReplacementPolicy(model: relife.model.AbsolutelyContinuousLifetimeModel, args: Tuple[numpy.ndarray, ...] = (), a0: Optional[numpy.ndarray] = None, ar: Optional[numpy.ndarray] = None, cf: Optional[numpy.ndarray] = None, cp: Optional[numpy.ndarray] = None, rate: numpy.ndarray = 0)[source]

Bases: object

One-cyle age replacement policy.

The asset is disposed at a fixed age ar with costs cp or upon failure with costs cf if earlier.

One-cyle age replacement policy.

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.

  • 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 0.

Notes

If ar, 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

Coolen-Schrijner, P., & Coolen, F. P. A. (2006). On optimality criteria for age replacement. Proceedings of the Institution of Mechanical Engineers, Part O: Journal of Risk and Reliability, 220(1), 21-29

Methods

asymptotic_expected_equivalent_annual_cost

The asymptotic expected equivalent annual cost.

asymptotic_expected_total_cost

The asymptotic expected total cost.

expected_equivalent_annual_cost

The expected equivalent annual cost.

expected_total_cost

The expected total discounted cost.

fit

Computes and sets the optimal age of replacement for each asset.

optimal_replacement_age

Compute the optimal age of preventive replacement for each asset.

rrp_args

Arguments of the underlying renewal reward process.

sample

One-cycle age replacement policy sampling.

Attributes

discount

Exponential discounting.

reward

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, 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 or 2D array, optional) – Ages of 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

(model_args, reaward_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 on one-cycle.

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 {c_f}_i \int_0^a \dfrac{\delta_i e^{-\delta_i t}}{1 - e^{-\delta_i t}} f(t) \mathrm{d}t + {c_p}_i S(a)\dfrac{\delta_i e^{-\delta_i a}}{1 - e^{-\delta_i a}}\]

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{\delta_i e^{-\delta_i a}}{1 - e^{-\delta_i a}} \left( ({c_f}_i - {c_p}_i) h(a) - \dfrac{\delta_i {c_p}_i}{1 - e^{-\delta_i a}} \right) = 0\]
fit(cf: Optional[numpy.ndarray] = None, cp: Optional[numpy.ndarray] = None, rate: Optional[numpy.ndarray] = None) relife.replacement_policy.OneCycleAgeReplacementPolicy[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.

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, cf: Optional[numpy.ndarray] = None, cp: Optional[numpy.ndarray] = None, rate: Optional[numpy.ndarray] = None) numpy.ndarray[source]

The expected total discounted cost.

Parameters
  • t (1D array) – Timeline.

  • ar (float or 2D array, optional) – Ages of replacement, 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, 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.

  • 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, cf: Optional[numpy.ndarray] = None, cp: Optional[numpy.ndarray] = None, rate: Optional[numpy.ndarray] = None, dt: float = 1.0) numpy.ndarray[source]

The expected equivalent annual cost.

Parameters
  • t (1D array) – Timeline.

  • ar (float or 2D array, optional) – Ages of preventive replacement, 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.

  • dt (float, optional) – The length of the first period before discounting, by default 1.

Returns

The cumulative expected equivalent annual cost until time t.

Return type

ndarray

Notes

If an argument is None, the value of the class attribute is taken.

The expected equivalent annual cost until time \(t\) is:

\[EEAC(t) = \int_0^t \frac{\delta c_f e^{-\delta x}}{1 - e^{-\delta x}} \mathrm{d}F(x)\]
asymptotic_expected_equivalent_annual_cost(ar: Optional[numpy.ndarray] = None, cf: Optional[numpy.ndarray] = None, cp: Optional[numpy.ndarray] = None, rate: Optional[numpy.ndarray] = None, dt: float = 1.0) numpy.ndarray[source]

The asymptotic expected equivalent annual cost.

Parameters
  • ar (float or 2D array, optional) – Ages of preventive replacement, 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.

  • dt (float, optional) – The length of the first period before discounting, by default 1.

Returns

The asymptotic expected equivalent annual cost.

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 = \int_0^\infty \frac{\delta c_f e^{-\delta x}}{1 - e^{-\delta x}} \mathrm{d}F(x)\]
sample(ar: 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]

One-cycle age replacement policy sampling.

Parameters
  • ar (float or 2D array, optional) – Ages of preventive replacement, 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

ReplacementPolicyData

Notes

If an argument is None, the value of the class attribute is taken.