Optimal pipe replacement accounting for leakage reduction and isolation valves