Computation of optimal policies in replacement models