Скачать книгу

many cases, the forecast has an error that introduces uncertainty in the model. Either stochastic or robust optimization is a suitable option to face this uncertainty. Chapter 6 presents the latter option.

      1.5 Using Python

      We use a module named CvxPy (cvxpy) [10] that allows to solve convex and mixed-integer convex optimization problems; this module, together with NumPy, MatplotLib, and Pandas, forms a robust platform for solving all types of optimization problems in power systems applications. Let us consider, for instance, the following optimization problem:

      

(1.11)

      where x

6 and c = (5, 3, 2, 4, 8, 7). A model in CvxPy for this problem looks as follows:

      import numpy as np import cvxpy as cvx c = np.array([5,3,2,4,8,7]) x = cvx.Variable(6) objective = cvx.Minimize(c.T * x) constraints = [ sum(x) == 1, x >= 0] Model = cvx.Problem(objective,constraints) Model.solve()

      We made a great effort in making the examples as simple as possible (we call them toy-models). This approach allows us to understand each problem individually and do numerical experiments. Real operation models may include different aspects of these toy-models; for instance, they may combine economic dispatch, optimal power flow, and state estimation. These models are highly involved with thousands of variables and constraints. Nevertheless, they can be solved using the same paradigm presented in this book.

      Notes

      1 1 We incorporate uncertainty in the models using robust optimization. Chapter 6 is dedicated to this aspect.

      2 2 It is usual to consider the Frobenius norm as explained in Chapter 12.

      3 3 See appendix C for a brief introduction to Python.

Part I Mathematical programming

       Learning outcomes

      By the end of this chapter, the student will be able to:

       Establish first-order conditions for locally optimal solutions.

       Solve unconstrained optimization problems, using the gradient method, implemented in Python.

       Solve equality-constrained optimization problems, using Newton’s method implemented in Python.

      2.1 About sets and functions

      Figure 2.1 Representation of the sets related to a general optimization problem.

      Solving an optimization problem implies not only to find the value of the objective function (e.g., fmin or fmax) but also the value x, at the input set Ω (e.g.,xmin, xmax). These values are represented as follows:

      

(2.1)

      

(2.2)

      Example 2.1

      Let us consider four simple optimization problems and their respective solution, namely1:

      

(2.3)

      

(2.4)

       Скачать книгу