Mixed-Integer Pump Scheduling

A water distribution network with a pump station, a hilltop tank and a town

Open the Water Distribution Pumping and Pressure app

Advanced Control Exercise 25 of 30 in Nonlinear and Economic MPC · All exercises · Time: 15 minutes

Two fixed-speed pumps are either on or off; a third runs at variable speed. Filling the hilltop tank when power is cheap is a schedule of binary decisions against a tariff, a mixed-integer program. This exercise reads the program's relaxation bound and branch and bound, then shows why a schedule made once a day drifts from the day it meets, and how re-solving every hour keeps it honest.

Learning Outcomes

  • Formulate a pump schedule with binary on-off decisions, an inventory balance and limits.
  • Explain the LP relaxation as a bound and branch and bound as the search that closes the gap.
  • Explain why a schedule is re-solved on a receding horizon, and measure what it saves.

Book Chapter

Model Predictive Control and Economic Optimization (Volume 9), Chapter 11, Water Distribution Simulator That Schedules Integer Pumps Under a Pressure Floor. Read the chapter, open the PDF, or watch the lecture slides.

Theory in Brief

Over hourly slots `k`, pump `i` is on (`b_{i,k} = 1`) or off, the variable-speed pump delivers `q_{3,k}`, and the tank volume `V` follows the balance with the town's forecast demand `d_k`:

$$\begin{gathered} \min \sum_k \pi_k \Delta t \left( \sum_i P_i b_{i,k} + e_3 q_{3,k} \right) \\ \mathrm{s.t.}\quad V_{k+1} = V_k + \Delta t \left( \sum_i Q_i b_{i,k} + q_{3,k} - d_k \right) \end{gathered}$$

$$\begin{gathered} V_{lo} \le V_k \le V_{hi}, \\ b_{i,k} \in \{0, 1\}, \\ \textstyle\sum_k \max\left(0,\, b_{i,k} - b_{i,k-1}\right) \le n_{starts} \end{gathered}$$

Replacing `b \in \{0,1\}` by `0 \le b \le 1` gives a linear program, the relaxation. Its optimum is a lower bound on every integer schedule. Branch and bound fixes a fractional `b` to 0 in one branch and to 1 in the other, solves each relaxation, and prunes any branch whose bound is above the best integer schedule found so far. The gap between the best integer cost and the lowest open bound proves how far from optimal the schedule can be. A schedule is a plan on a forecast; re-solving every slot from the measured tank level is the receding horizon that keeps it true.

Model: Physics-based hydraulics reduced to a tank inventory balance, with the town's demand forecast as an input.
Decision: Which pumps run in each hour, and the variable pump's speed, for the next 24 hours.
Learning: The demand forecast is scaled each slot by what the town actually used; a learned forecast would enter the same way.

Exercise

Read 2 min · Predict 1 min · Run 7 min · Explain 3 min · Check your AI 2 min.

Predict. Will the best on-off schedule cost much more than the relaxation, which lets a pump run at "half on"? Will a schedule made once a day keep the tank where it planned?

Run the Water Distribution Pumping and Pressure app. Use the fastest speed, 0.5 h/s, and press Run again to pause at the times in each step.

  1. Open 4 · The schedule: relaxation and branch and bound on the Schedule view. Press Run and pause just after the start, then read the side panel's first solve: relaxation cost, plan cost, nodes and branches. Run on to 24 h at 0.5 h/s and read the Energy cost · leakage tile.
  2. Open 5 · Receding horizon: the plan moves, the tank holds. Run the day on Once a day and watch the measured tank leave its plan. Read Energy cost · leakage and Tank · starts.
  3. Set Re-solve to Every slot (Advanced), press Reset, and run the day again.

Explain.

  1. The relaxation is cheaper than any on-off schedule. Why is it still useful?
  2. Why does the plan followed blind drift, and why does re-solving every slot cost less, not more?

Generative AI Learning

"Explain branch and bound for a mixed-integer linear program that schedules on-off pumps against a time-of-use tariff. What is the LP relaxation, and what does the optimality gap tell me?"

Check the answer against your run: A good answer says the relaxation is a lower bound, branching fixes fractional binaries, pruning uses the best integer solution, and the gap bounds the distance to optimal. Your step 1 side panel shows each quantity. The assistant is your tutor and reviewer; you answer for every claim you turn in.

What to Turn In

A table with the relaxation and plan costs, nodes and branches, and the day's energy cost for once a day and every slot, your written prediction, and three sentences that answer the two questions.

At the first solve the relaxation costs $194.91 and the best on-off schedule $195.90, found after 29 nodes and 15 branchings. The search ended with a gap of 0.00 %: once the tree is exhausted the lowest open bound is the incumbent itself, even though the root relaxation was 0.5 % lower. The schedule is within a dollar of the bound because the variable-speed pump fills the gaps the binaries leave. The relaxation cannot be run, but it proves that no schedule can be cheaper, so the search knows when to stop. The day's tile reads $504 · energy $128 (1577 kWh) · leakage 1252 m³ ($376).

Followed once a day, the plan meets a town that does not use exactly its forecast: the tank drifts from the plan and the day reads $520 · energy $144 (1703 kWh) · leakage 1254 m³ ($376) with the tank over 2.52–6.47 m · starts 2 / 0. Re-solved every slot, each plan starts from the measured level with the forecast rescaled by what the town used, and the day reads $500 · energy $124 (1524 kWh) · leakage 1251 m³ ($375) with 1.69–6.47 m · starts 2 / 1. Re-solving costs no more because each new plan is optimal for what is now known; the blind plan keeps paying for a day that is not happening.

Measured with the app build of December 3, 2026 by a scripted replay of the steps above. Numbers that no tile shows come from the replay's record; your readings from the trends will be close. A later app release may move the last digit.

Discrete Variables solves mixed-integer problems in GEKKO with APOPT. Write a 24-hour schedule for one on-off pump and a tank with a two-level tariff, solve it as an MINLP with `m.options.SOLVER = 1`, then relax the binary to `0 \le b \le 1` and compare the two costs.

Related

References

  1. Hedengren, J. D. (ed.), Model Predictive Control and Economic Optimization, Volume 9 of Interactive Control Engineering, Chapter 11, "Water Distribution Simulator That Schedules Integer Pumps Under a Pressure Floor", pp. 265–286, Advanced Process Solutions, 2026. PDF (CC BY 4.0).
  2. Bonvin, G., Demassey, S., Lodi, A., Pump scheduling in drinking water distribution networks with an LP/NLP-based branch and bound, Optimization and Engineering 22, 1275–1313, 2021.

Course Information

TCLab

Project

Applications

Advanced Control Exercises

Exams

Modeling

Machine Learning

Estimation

Control

Reinforcement Learning

Related Courses

Admin