# Numerical Methods for Optimization Problems Arising in Energetic Districts

## Abstract

This paper deals with the optimization of energy resources management of industrial districts, with the aim of minimizing the customer energy bill. Taking into account real time information on energy needs and production and on energy market prices, a cost function is built that should be minimized. Here we focus on the solution of the arising nonlinear constrained optimization problem. We describe the two solvers that have been employed for its solution: a Sequential Linear Programming and a Particle Swarm Optimization.

## 1 Introduction

This paper is realized in collaboration with the research centre ‘Enel Ingegneria e Innovazione - Ricerca’ in Pisa, Italy and it is related to an Enel project devoted to the realization of a software tool for the numerical solution of optimization problems arising in energetic districts, [4]. An energetic district is a complex that comprises machines able to generate, absorb or accumulate energy and that is interlaced with the electrical grid with which it can exchange energy. Different machines can be part of a district: generators (electrical, photovoltaic), accumulators, electrical or thermal loads.

Enel research centre aim is to develop a software tool able to find the best asset of the machines in a district, i.e. the one that guarantees the lowest expenses for the district management. The software tool builds the district model, an objective function that measures the costs related to the district management, and functions modelling the physical constraints on the machines. A nonlinear minimization problem with nonlinear constraints arises from this modelling. In this paper we focus on the solution of this optimization problem.

In finding the optimal solution a compromise between two needs should be found. On one hand one aims at finding the machine asset corresponding to the lowest possible value of the objective function. On the other hand the optimization process should be as quick as possible, as it needs to be performed several times in a day, when the needs of the district or the weather conditions affecting the renewable resources change.

For this reason two different solvers were employed and compared: a Sequential Linear Programming (SLP) and a Particle Swarm Optimization (PSO).

SLP is an iterative solver that generates a sequence of linear approximations of the original nonlinear problem. It is supported by theoretical results and it is ensured to converge to a local minimum. With this method it is not guaranteed to find the global minimum, actually the generated sequence usually converges to the local minimum nearer to the starting guess.

PSO is an heuristic research algorithm designed to find a global minimum of the problem. It is a derivative free algorithm that requires just function values. For this reason it is characterized by a slower convergence than SLP that is a first order method.

PSO solver is then expected to find a better solution than SLP, but the optimization process is expected to be longer. To investigate on this, the solvers were tested on many different realistic examples of energetic districts, and on a real energetic district provided by Enel.

## 2 Optimization Problem

The variables that need to be optimized are the physical parameters of the machine that affect their functioning (such as the electrical power produced by generators, that stored by batteries, the thermal power provided by boilers). The aim of the optimization process is to build a plan of the machines parameters for the following day to minimize the expenses related to the district management. The objective function *f* represents the overall daily cost of energy obtained as a result of the difference between purchase costs (fuel and electric energy) and incomings (incentives and sales revenues).

If *n* is the problem dimension, \(f:\mathbb {R}^n\rightarrow \mathbb {R}\) is a nonlinear function. The optimization problems is a constrained problem, with both nonlinear constraints and bound constraints. The first ones represent physical constraints on the machines and are modelled by a nonlinear function \(g:\mathbb {R}^n\rightarrow \mathbb {R}^p\). Bound constraints arise from the fact that the variables are normalized in the interval [0, 1] or [−1, 1].

## 3 Sequential Linear Programming (SLP)

*f*that is positive if the constraints are not satisfied, and is zero otherwise. The resulting function is used as the new objective function. Following [1, 5] the

*l*

_{1}penalty function was chosen:

*ν*> 0 is the penalty parameter. Then, at each iteration

*k*, linear models of function

*f*and of the constraints are computed, approximating them in a neighbourhood of the current solution approximation

*x*

_{ k }with first order Taylor series:

*d*=

*x*−

*x*

_{ k }is the step. To obtain a globally convergent method, SLP approach is usually coupled with a trust-region strategy, [2]. Then, a new constraint is added to the bound constraints, that consists of a bound on the step-length:

*Δ*

_{ k }is called the trust-region radius. The linearized functions replace the nonlinear ones in the penalty function and the following linear minimization problem is solved:

At each iteration the computed solution *d*_{ k } is used as a step to define the new solution approximation: *x*_{k+1} = *x*_{ k } + *d*_{ k } and the trust-region radius is updated. The step is accepted if a sufficient decrease in the objective function *f* is obtained, and in this case the trust-region radius is possibly enlarged, otherwise the step is rejected, the trust-region radius is reduced and the subproblem is solved again.

This second theoretical results allows us to implement a reliable stopping criterion, as it provides a measure of the distance of the solution approximation found to a KKT point of the original system.

## 4 Particle Swarm Optimization (PSO)

*s*particles, each of them represents a solution of the optimization problem and it is represented by a vector \(x\in \mathbb {R}^n\). To each particle it is associated a velocity vector

*v*too. The method is based on an iterative algorithm and at each step

*k*vectors

*x*and

*v*are updated:

*i*-th particle,

*i*= 1, …,

*s*, at the

*k*-th iteration, \(p^i_{best,k}\) and \(p^g_{best,k}\) are respectively the best position reached by the

*i*-th particle so far and the best position reached by the whole swarm (the best position is the one that corresponds to the lowest value of the objective function),

*c*

_{1},

*c*

_{2}and

*w*are positive weights,

*r*

_{1}and

*r*

_{2}are random variables with uniform distribution in [0, 1].

The process is stopped as soon as a maximum number of iterations is reached or when the objective function is not sufficiently decreased within a fixed number of iterations. The computed approximate solution is \(p^g_{best,k*}\) where *k*^{∗} is the last iteration index.

Bound constraints are handled bringing back on the nearest boundary a particle *x* that has left the search space and changing the sign of the particle velocity, to avoid a new violation on the next iteration.

*τ*

_{ k }penalty parameter that is decreased at each iteration to penalize with increasing severity constraints violations.

The main advantage of PSO methods is that they do not require neither regularity assumptions on the objective function nor to compute the first derivatives and are so suitable when few information on the objective function are available. Clearly the fact that few information on *f* are used, leads to a really slow method that requires many iterations to converge. Furthermore these methods are heuristic and there are not theoretical results that ensure convergence of the method.

## 5 Numerical Tests

The software tool equipped with the two solvers was tested on 13 different models of synthetic energetic districts and on an existing district in Pisa, provided by Enel.

The numerical experimentation has been carried out on a PC equipped with a AMD Phenom(tm)II X4 965 Processor 3.40 GHz, 8.00 GB RAM, Windows 7 Professional 64 bit and using Matlab R2012a.

Results shown in the following tables are the average of those obtained over 10 runs, varying the starting point for SLP solver. In the headings of the following tables **f** and **k** are the arithmetic mean of the function values and the number of iterations, **σ**_{ f }, **σ**_{ k } are the standard deviations, \(\min \mathbf {f}\), \(\max \mathbf {f}\) are the minimum and maximum function values obtained, **time/it**(*s*) is the time for an iteration in seconds, **time**(*m*) is the total time in minutes.

Comparison of solvers on an example of energetic district

Solver | | | \(\max \mathbf {f}\) | \(\min \mathbf {f}\) | | | | |
---|---|---|---|---|---|---|---|---|

PSO | 27.2 | 0.2 | 27.6 | 26.9 | 1004 | 881 | 0.5 | 9 |

SLP | 26.9 | 0.3 | 27.5 | 26.6 | 51 | 12 | 1.4 | 1.2 |

From this test it is possible to deduce the following remarks.

The convergence rate of SLP algorithm is really higher than that of PSO, as it employs first order informations on *f*. PSO method requires a very high number of iterations to find the minimum and so the computational time is higher. As expected SLP is more suitable for real time optimization.

On the other hand in the test performed on the real example of energetic district, that is much less constrained, PSO gains better performance than SLP.

This is a real district in Pisa that comprises: a CHP characterized by rated power 25 kWe and rated thermal power 75 kWt, a gas boiler with rated thermal power 35 kWt, a tank for the storage of hot water with capacity 9400 kJ/ ^{∘}C, a photovoltaic generator with rated power 14 kWe, a wind farm with rated power 3 kWe, 2 loads. The arising optimization problem has 288 variables, 576 bound constraints and 1 physical constraint.

*f*

_{0}, that is computed using those data and represents the cost of the actual management.

Results of the optimization of the energetic district of Pisa, **f**_{ 0 } is the cost function for the actual management (without optimization by our procedures)

Solver | | | | \(\max \mathbf {f}\) | \(\min \mathbf {f}\) | | | | |
---|---|---|---|---|---|---|---|---|---|

PSO | 89.3 | 73.5 | 0.08 | 73.6 | 73.4 | 377 | 34 | 0.4 | 2.7 |

SLP | 89.3 | 74.9 | 2.8 | 80.6 | 73.4 | 23 | 9 | 2.6 | 1 |

In this case PSO algorithm performs better than SLP algorithm, providing a lower value of the objective function and also a really smaller standard deviation. In this case there is just one mild nonlinear constraint so the constraint handling strategy does not have a strong impact on the search process and the capability of the evolutionary algorithm to search for the global minimum appears as in an unconstrained test case. We can also notice that in this case the execution time is reasonable also for PSO algorithm.

Comparing the unoptimized management of local resources to the optimized one, we can see that the employment of the software tool guarantees considerable savings in the energy bill, about 18*%* daily saving.

## Notes

### Acknowledgements

Work partially supported by INdAM-GNCS.

## References

- 1.Byrd, R.H., Gould, N.I.M., Nocedal, J., Waltz, R.A.: An algorithm for nonlinear optimization using linear programming and equality constrained subproblems. Math. Program.
**100**, 27–48 (2003)Google Scholar - 2.Conn, A.R., Gould, N.I.M., Toint, P.L.: Trust-Region Methods., SMPS/SIAM Series on Optimization, SIAM, Philadelphia (2000)Google Scholar
- 3.Eberhart, R.C., Kennedy, J.: Particle swarm optimization. In: Proceedings of the IEEE International Conference on Neural Networks, pp. 1942–1948 (1995)Google Scholar
- 4.Ferrara, W., Riccardi, J., Sello, S.: Enel customer optimization service expert system development, Technical Report, Enel Ingegneria e Ricerca, Pisa (2014)Google Scholar
- 5.Fletcher, R., Sainz de la Maza, E.: Nonlinear programming and nonsmooth optimization by successive linear programming. Math. Program.
**43**, 235–256 (1989)Google Scholar - 6.Parsopoulos K.E., Vrahatis, M.N.: Particle swarm optimization method for constrained optimization problems. In: Intelligent Technologies - Theory and Applications: New Trends in Intelligent Technologies, pp. 214–220. IOS Press, Amsterdam (2002)Google Scholar