# Energy Optimization (Rain Is Free, or Isn’t It?)

Readers of *SIAM News* are presumably well aware of the importance of applied mathematics in the advancement of science and industry. Mathematics not only enhances scientific progress, but also hides within simple gestures we instinctively repeat every day. Such is the case when we turn on the lights. What does it take to ensure that every time we enter a dark room and flip the light switch, electricity is available and waiting for us to use?

Sophisticated mathematical optimization tools must be put in place to ensure that we can light our rooms at will. While other forms of energy—such as gas—can be kept stored until consumed, such storage, at least in amounts that can sufficiently meet the needs of a city, is impossible for electricity. (Batteries do keep power, but at a very small scale). Electricity poses a difficult challenge, as the electrical network should carry power in an amount that is “enough” without being “too much,” because any excess is wasted.

Given these constraints, how can one generate electricity in a manner that is both satisfactory for consumers and efficient from the network point of view?

Optimization provides an answer to this question and involves establishing a goal, called an objective function, to be minimized while respecting certain constraints. The cost of producing electricity, roughly given by the price of burnt coal if energy is generated by a thermal power plant, becomes the objective function. Constraints include several technical rules representing the process of transforming the burnt fuel into megawatts. One constraint of paramount importance relates to energy demand; ideally, power plants should provide as much electricity as consumers request.

**Figure 1.**Itaipu, a hydroelectric power plant located between Brazil and Paraguay on the Paraná River. Photo credit: International Hydropower Association.

On one side of the issue is the demand constraint, and on the other is the cost of generating the required power. From an energy optimization perspective, estimating consumer demand is a difficult task, one that calls for econometric models and statistical tools. Fortunately, using past consumption records to calibrate a stochastic model makes recurrent events like peak and off-peak hours relatively easy to foresee. Yet even when estimates are conducted from one day to the next, other indeterminate factors—much harder to predict or model—affect electricity demand and consumption. Consider for example an important soccer match, one deciding the outcome of the FIFA World Cup. In Brazil, a large majority of the population will open the refrigerator during half time to get a beer. This action produces a huge spike in energy consumption that the electrical system must face (shutting down power in the middle of the match would be quite unappreciated). This specific type of extreme event happens only once every four years and thus can be addressed by exceptionally over-generating and creating a (larger than usual) reserve of electricity in the network. This reserve, called *spinning reserve*, is also useful should the system face a minor production failure or the breakdown of a line.

An example of a more frequent demand uncertainty relates to temperature. In France, many households have electrical heating. During the winter, if the actual temperature for a given day happens to be even 1^{o}C lower than the forecast predicts, it would require adding the full generation of one nuclear power plant to the system!

The aforementioned examples address coal and nuclear power plants. For environmental reasons, other sources of renewable energy are gaining more weight in the power mix worldwide. Nowadays most power systems include significant percentages of clean technologies that generate electricity from hydraulic and wind-driven sources.

**Figure 2.**The reservoir volume \(x\) decreases due to evaporation and to water released, either by spillage \(SP\) or passing through the turbines \(Q\), to generate power \(u^0\). The stored volume of water can increase with the inflows \({\xi}\), which are unknown.

The impact of inflow uncertainty in hydrogeneration is very different from other kinds of energy generation. As long as the hydro plant has a reservoir, the volume of available water can be considered known from one day to the next; contrary to wind power, there is no uncertainty in this data. Uncertainty is instead in the production cost: how much does it cost to generate hydropower? If we consider the fuel price, like with thermal plants, hydroelectricity costs nothing; water is free!

Here arises a curious phenomenon, resulting from the model itself and not from the data. We can refer to it as the “end-of-the-world” effect. Consider a simple setting with only two power plants: one thermal and one hydro plant with a reservoir. Generating thermal power is expensive due to the coal price, while hydropower costs nothing. Since the optimization problem attempts to minimize cost, its solution will fatally deplete the reservoir whilst trying to generate as much hydraulic power as possible. This solution may very well be the best one for the optimization problem, but it is certainly not desirable in the long term. The optimization problem is short-sighted and does not realize it can be problematic if, after its decision horizon, there is no more water in the reservoir.

**Figure 3.**Wind turbines harness clean energy from wind and convert it to electricity.

In mathematical optimization terms, those calculations amount to the approximate computation of the value function of a multistage stochastic linear program. This is by no means an easy task, because often such linear programs are simply intractable. For the Brazilian power system, for example, the linear programming problem must consider 20^{119} possible scenarios for uncertainty. Only by suitably combining decomposition and sampling methods is it possible to define lower and upper bounds that sandwich the future cost function up to some confidence level. Thanks to this sophisticated machinery, the future cost of water can replace the zero cost for hydrogeneration in the optimization problem. The new objective function will prevent reservoirs from experiencing depletion at the end of the decision horizon. This strategy makes it possible for us to get power when we turn on the lights. It should also prevent unwelcome blackouts during massively popular events like the Super Bowl or the next FIFA World Cup final.

This article is based, in part, on Claudia Sagastizábal’s invited lecture at the 8th International Congress on Industrial and Applied Mathematics (ICIAM) held in Beijing, China, in August 2015.