# About

Graphics processing units (**GPUs**)
nowadays possess unprecedented computational capabilities to accommodate
the increasing requirements of video games, computer vision and other relevant applications.
It has become evident that this computational power can be harnessed for general purpose computations and,
even more recently, to solve **large-scale optimisation problems**.

# Description

**Drinking water networks** are large-scale systems whose operation is characterised by complex
uncertainty patterns. Pressures across the network need to be kept in certain limits, tanks
must not overflow and water demand requirements must be met, while unexpectedly high demands
and electricity prices may signal the alarm in the control centre of the network.
Water demand and energy price are fluctuating uncertain parameters that deem the control
of these systems rather challenging and dictate computationally intense operations for
the determination of how valves and pumps need to be operated for a smooth, economic and
safe operation of the whole infrastructure.

We have proposed as optimisation-based control scheme which accounts for the aforementioned
uncertainty. The resulting optimisation problems involve **more than 1 million decision variables**
and has to be solved in real time. Modern high-end CPUs require up to several minutes for their
solution; We employed an **accelerated proximal gradient** (APG) algorithm which can be vastly parallelised
and solved on a GPU to afford computation times down to a few tens of a second!
These developments pave the way for the use of optimisation-based control algorithms
(such as stochastic model predictive control) in large-scale water networks which - as
simulations show - can lead to a significant reduction of energy consumption, higher quality of
service and a smoother operation of the network.

# Problem statement

The main control objectives for the smooth operation of a water facility are the following:

- To operate the water network in an
**economic**way which, since pumping is an energy-intensive process, strongly depends on how and when we choose to pump. - To retain a minimum amount of water in each reservoir, known as
**safety storage water**which serves as a buffer and is necessary for the maintenance of a minimum perssure. - To administer
**smooth control actions**to avoid the fatigue and wear out of the actuator. - To not violate the maximum capacity constraints of the network,
*i.e.*, to not overflow the tanks, and to be aware of the physical pumping limitations of the pumping stations (maximum pumping capacity).

# Proposed solution

The proposed solution is based on an extension of the accelerated proximal gradient algorithm which we presented in [1]. In the proposed algorithm, we properly decompose the optimisation problem taking the Fenchel-dual of the original problem and we apply the accelerated proximal gradient (APG) method to solve it. The computation of the dual gradient at each iteration of the algorithm defines the most computationally demanding step of the procedure, which, however, we are able to decompose and parallelise. An offline factrisation allows us to speed up our computations and effect the results which are are presenting in the following section. For technical details refer to [1] and [2].

The structure of the closed loop system with the SMPC controller is illustrated in the figure above. A *demand prediction module* provides nominal predictions of upcoming water demand values to the SMPC along with an estimation of their uncertainty in the form of a (large) scenario tree. At the same time, an *lectricity price watchdog* monitors the fluctuating energy prices and provides the upcoming charge rates to the controller (or predictions of those rates, if relevant).

# Results

We compared the runtimes of our GPU-based solution with the execution time using Gurobi, a popular optimisation software. CPU-based computations were performed on a quad-core Intel i5 machine running 64-bit Ubuntu 14.04 and 8GB RAM. GPU-based computations were executed on an NVIDIA Tesla C2075. As you can see in the following figure, our GPU-based implementation strongly outperforms the CPU-based solution and scaled-up linearly whereas the CPU software scales super-linearly.

Apart from its unparalled speed, the proposed algorithm leads to quantifiable
benefit for the controlled operation of the water network. As we may observe in the
following figure, the introduction of increasingly more scenarios leads to a both
**more economic** and **safer** operation -
here KPI_{E} stands for the average operating
cost due to pumping and KPI_{S} quantifies how risky the operation is.

These results have been recently submitted for publication [2].

# Acknowledgement

This work was financially supported by the EU under the FP7 research project EFFINET, *Efficient Integrated Real-time monitoring and Control of Drinking Water Networks*, grant agreement no. 318556.

# References

- A. K. Sampathirao, P. Sopasakis, A. Bemporad and P. Patrinos (2015), Distributed solution of stochastic optimal control problems on GPUs, 54 IEEE Conf. Decision and Control, Osaka, Japan, Dec 2015 (pdf, bibtex, slides).
- A. K. Sampathirao, P. Sopasakis, A. Bemporad and P. Patrinos (2015), Stochastic predictive control of drinking water networks: large-scale optimisation and GPUs, submitted for publication.