A large-scale water resources network optimization algorithm