Optimal water and waste load allocation in reservoir–river systems: a case study