Optimum Policies for an Energy Harvesting