Stochastic Modelling and Maintenance Optimization of Systems Subject to Deterioration