Optimization of opportunistic replacement activities in deterministic and stochastic multi-component systems