Optimising the design of complex water networks