Optimal water allocation in a petroleum refinery