An efficient algorithm for computing optimal (s,S) policies