Skip to content

meghnathomas/MILPNet

Repository files navigation

MILPNet

image

MILPNet is a Mixed-Integer Linear Programming framework for water distribution system (WDS) optimization problems. MILPNet models the following aspects of WDSs:

  1. system hydraulics (i.e., mass balance equations and energy conservation equations)
  2. hydraulic devices (e.g., storage tanks, pumps, pressure-reducing valves (PRVs), and gate valves (GVs))
  3. status checks (e.g., preventing flow into/out of a tank if it is full/empty)
  4. event-based and time-based control rules

MILPNet extracts WDS network topology and system boundary conditions (e.g., reservoir heads, junction demands, initial tank level, etc.) from a .INP file of a WDS model using the Python package WNTR. The Gurobi (v 9.5.1) Python API is used to formulate and solve an extended period optimization problem for WDSs.

Checking MILPNet modeling accuracy

The file example1_set_up_milpnet.py builds an optimization problem using the run_gurobi function with the following components:

decision variables: heads of junctions and tanks, flow rates of pipes, pumps, GVs, and PRVs, status of pumps, GVs, and tank-links (open/closed), status of PRVs (active/open/closed)

objective function: 0

constraints: system hydraulics, hydraulic devices, status checks, control rules

The non-linear pipe head loss equation (based on the Hazen-Williams equation) and pump head gain equations are approximated using piece-wise linear segments.

MILPNet employs Gurobi's in-built piece-wise linearization, indicator, and AND/OR/XOR constraint functionalities to model constraints.

The file example1_apply_milpnet.py takes in a .INP file of a WDS network model and the number of time steps in a simulation duration (other inputs to the run_gurobi function can be specified as well if desired) and solves the feasibility optimization problem. Plots comparing the MILPNet optimization results for junction pressure heads and flows in links to EPANET results (through WNTR) are displayed to highlight modeling accuracy.

Demonstrating application of MILPNet to a optimization problem

Here, we show an example of how MILPNet can be used to build and solve a pump scheduling optimization problem. The optimization problems involve determining the operational status and flow rates supplied by the pumps to minimize the energy costs under different cost structures while subject to system hydraulics. The file example2_set_up_pump_scheduling.py builds an optimization problem using the run_gurobi function with the following components:

decision variables: heads of junctions and tanks, flow rates of pipes, pumps, GVs, and PRVs, status of pumps, GVs, and tank-links (open/closed), status of PRVs (active/open/closed), pump switches (binary variables relating pump status between consecutive time steps t amd t+1)

objective function: minimize cost of pump operation and number of pump switches

constraints: system hydraulics, hydraulic devices, status checks, control rules

The file example2_solve_for_optimal_pump_scheduling.py builds and solves the optimization problem for a modified version of network ANET/Net1. We generate plots displaying the MILPNet optimization results for pump flow rates under different cost structures.

The Networks folder includes 8 benchmark networks for testing and validation (+ 2 networks to demonstrate pump scheduling examples). The original network names, modifications, and sources are as follows:

Network Original Name Modification Source
ANET Net1 None Rossman et al (2020)
BNET Net2 None Rossman et al (1994)
CNET Net2 Added open PRV Rossman et al (1994)
DNET Net2 Added active + closed PRV Rossman et al (1994)
ENET CA1 None Rossman and Boulos (1996)
FNET PA2 None Vasconcelos et al. (1997)
GNET Net3 Created a reduced model using MAGNets (max_nodal_degree =2) Clark et al. (1995)
HNET ky6 Created a fully reduced model using MAGNets and replaced power pump with head pump Jolly et al. (2014)
Net1_casestudy2 Net1 Removed control rules, modified demand pattern Rossman et al (2020)

Cite Us

To cite MILPNet, please use the following publication: A Mixed-Integer Linear Programming Framework for Optimization of Water Network Operations Problems

@article{title={A Mixed-Integer Linear Programming Framework for Optimization of Water Network Operations Problems},
         author={Thomas, Meghna and Sela, Lina},
         journal={Water Resources Research},
         volume={60},
         number={2},
         pages={e2023WR034526},
         year={2024},
         publisher={Wiley Online Library}
         }

Contact

Meghna Thomas - meghnathomas@utexas.edu

Lina Sela - linasela@utexas.edu

About

Mixed-Integer Linear Programming framework for water distribution system optimization

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages