Two new methodologies have been developed for determining the optimal operation of water distribution systems for water quality purposes. These methodologies are based upon describing the operation as a discrete time optimal control problem that can be used to determine the optimal operation schedules of the pumps in distribution systems. One solution methodology is based upon a mathematical programming approach and the second methodology is based upon a simulated annealing approach. These two methodologies have been applied to example water distribution systems for the sake of performing a comparison. The results are compared in detail along with their respective advantages and disadvantages.