Using Robust Optimisation and Mixed Integer Programming to manage Singapore’s water resources — Part I

Kai Wei 凯玮
AI Practice GovTech
6 min readFeb 28, 2020

Data Science Artificial Intelligence Division (DSAID) is excited to share our implementation and impact of Data Science projects in the public sector.

Data Scientists: Dr Loke Gar Goei, Chin Chii Yeh, Tan Kai Wei
PUB Engineers: Ashley Ng, Daniel John Tan, Hariharan Ramasamy
Visual Designer: Glenn Goh

Image credit: Dawn at MacRitchie

Have you ever wondered how data science could be applied to how our precious water resources are managed whenever you turn on your tap?

In this first quarterly issue, DSAID will be sharing one of our data science projects. Earlier last year, we worked with the national water agency, the Public Utilities Board (PUB), to build a prescriptive optimisation model to help with managing Singapore’s water resources. The model allowed PUB to quickly derive optimal solutions for the water system to meet water demand islandwide, factoring in the constraints of the system. In addition to building a base optimisation model on mixed integer linear programming, the team also explored the use of Robust Optimisation to improve the way uncertainty is dealt with in operational decision-making.

We have split the blog post into three parts to cater to different interests.

  • Part I is for readers who want to know how the project was conceived and how Data Science is employed to help PUB operators with their daily water management.
  • Part II skips over the mathematical detail and focuses on the process of programming the model. We will share how the project is translated into a program, using declarative-style programming.
  • Part III is for the technical audience who wants to know more about Robust Optimisation, one of the key areas explored in this project.

Ground-up initiative

The water planning project was conceived over a casual coffee chat between two officers, Gar Goei and Ashley, from two agencies, GovTech and PUB respectively.

Ashley was previously a senior engineer overseeing systems-level operations at the Joint Operations Department in PUB. Having gone through daily operations planning first-hand for a number of years, he had been searching for ways to streamline the many time-consuming steps in the process. Gar Goei was in the midst of wrapping up his PhD in Operations Research, and had just recently joined DSAID as a quantitative analyst. At a gathering, Ashley had a chat with Gar Goei on Operations Research and shared his idea of developing an optimisation tool to streamline systems operations planning and the challenges that he faced in finding a vendor to implement the project. Incidentally, Gar Goei had developed a technique during his PhD days and was searching for an application that could illustrate its strength in practice. After a short discussion, they both agreed to check in with their bosses on a potential collaboration.

Within a short period of time, their bosses were able to allocate the resources required and the project was scoped into a formal collaboration between PUB and GovTech; all this, resulting from a serendipitous conversation at a gathering!

Background Info: National Water System

Singapore has built a robust, diversified and sustainable water supply from four sources known as the Four National Taps — Water from Local Catchment, Imported Water, high-grade reclaimed water known as NEWater and Desalinated Water.

From the four national taps, water is processed at the PUB’s water treatment plants before it reaches a household. On a daily basis, PUB operators will need to determine how to allocate water from these four sources to satisfy water demand islandwide.

There are also multiple operational constraints to consider, and planning time can take hours before final decisions are made on the allocation. With climate change, there are also more frequent prolonged periods of dry spells. While PUB is constantly seeking out the best way to allocate our scarce water resources, the prolonged dry spells add to the challenges faced by PUB operators in managing our water resources.

Image credit: Drought at MacRitchie

Building the model

With the project on hand, Gar Goei went around DSAID to find fellow colleagues who would be keen to join him on this journey. Coincidentally, Chii Yeh and Kai Wei had just concluded another project and decided to join the modelling process.

To build the model, the team needed to prescribe three requirements:

  • Decisions — What can we control?
  • Objective function — What is the goal we hope to do better in?
  • Constraints — What are the limitations (e.g. budget) in implementing our solution for this goal?

The model would then determine the optimal solution that maximised the objective function given the constraints.

Take for example, before you travel:

  • Decisions — You have to choose what to pack in your luggage.
  • Objective function — You like to dress up a lot and hence you want to maximise the number of clothes you can have over the trip.
  • Constraints — However, you are also constrained by the size of your bag and the check-in weight.

You are trying your best to fit as many valuable items in your bag, deliberating which style of clothes to pack while considering other necessities. At the end of the process, you have the best mix of your favourite clothes and necessities, also known as the optimal solution, packed in your bag.

Similar to the illustrated example, for water management we have:

  • Decisions — How much water to pump around Singapore and how much water to produce?
  • Objective function — We need to reduce the overall operating cost.
  • Constraints — We need to satisfy the water demand and operational constraints.

Note: The decisions, objectives, and constraints do not reflect the actual model in production but are meant to give an example of the types of decisions, objectives, and constraints faced in the water system for the readers to understand the concept.

Conclusion: Coding the model

The explanation above forms the basis of a mathematical model — a way of encoding the real-life problem in mathematical language. With this model, the team can proceed to the next part of the project, which is to write actual code that solves this model.

After two months of sprints (pair and sometimes trio coding), shredding of paper and oftentimes hair-tugging experiences, we built a planning tool that would support operators in finding the best way to achieve their objectives.

One night, anxious about how the model would perform, Gar Goei roped in Ashley and together they ran the model through different scenarios, testing the model using historical cases. The model took in the data and generated feasible solutions, many of which were close to the operational plans that had been implemented during those cases.

Today, the model assists PUB operators in water management, reducing planning time from 2 hours to as low as 15 minutes.

Image credit: Beautiful sunset at MacRitchie Reservoir

So the next time you enjoy this beautiful scenery at MacRitchie reservoir, you can better appreciate the numbers and codes behind-the-scenes which ensures a sustainable and reliable supply of water for Singapore!

If you are keen to learn more about the deterministic model and risk-based modeling approach, click on the respective links.

If you’re passionate about using tech to help the public, do follow us on Medium and join our team. We are hiring Data Scientists, Software Engineers, and DevOps Engineers. Send your resume to us at recruit@dsaid.gov.sg!

--

--