Design of optimal water distribution systems