Dynamic adaptation of urban water infrastructure in response to a changing environment