optimization in modern power systemschatziva.com/31xxx/lectures/lecture3.pdfoptimization in modern...
TRANSCRIPT
Optimization in modern power systems
Lecture 3: Lagrangian and KKT
Spyros Chatzivasileiadis
Slides of this lecture have been in-spired or taken from the lecture slides ofGabriela Hug for the class 18-879 M: Op-timization in Energy Networks, CarnegieMellon University, USA, 2015.
The Goals for Today!
• Review of Day 2
• Questions and Clarifications on Assignment 1
• Assignment 2
• Formulating an optimization problem
• Finding the minimum in an unconstrained optimization
• Finding the minimum in an equality constrained optimization
• Method
• Lagrangian• Karush-Kuhn-Tacker conditions
2 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Reviewing Day 2 in Groups!
• For 10 minutes discuss with theperson sitting next to you about:
• Three main points we discussedin yesterday’s lecture• One topic or concept that is not
so clear to you and you wouldlike to hear again about it
3 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Points you would like to discuss?
Questions about Assignment 1?
4 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Assignment 2: Solution Methods
• Timeline
• Jan 4 (today): handing out the assignment• Monday, Jan 16: peer-review process• Wednesday, Jan 18, 9am - 11am: Presentation in front of the class
• 15-minute presentation + 5 minutes questions
• Goal of the presentation. At the end of the presentation, the audiencemust be able to:
• describe the basic principles of the solution method in 3 sentences• remember a key figure or a key equation that describes how the
method works• list 2 advantages and 2 disadvantages of the presented method
• The presenting group and the peer-review group are expected to have anequally good knowledge of the subject. Questions can be addressed toboth the presenting group and the group that reviewed it.
5 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Peer-review process
• Two groups meet and review their presentations for two hours. Duringthe first hour, the first group reviews the presentation of the secondgroup. In the second hour, the presenting group becomes the peer-reviewgroup and vice versa.
• Goal of the peer-review process: the peer-review group must help thepresenting group prepare a good presentation, that can be comprehensiblefrom the rest of the class. During this process, the peer-review group isexpected to gain a good understanding of the presentation topic(otherwise the peer-reviewing would not have been successful).
• You are free to spend as much time as you think necessary inpeer-reviewing, but one hour per group is the minimum.
6 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Timeline concerning Assignments and Exams
• Assignment 1 (DC-OPF) and Assignment 3 (AC-OPF) will be due onMonday, Jan 23.
• Assignment 2 (Presentation of Solution Methods) is due on Wed, Jan 18.
• Thu, Jan 19 is a lecture-free day. I will be in my office 1pm - 4pm forany questions you want to ask before the exam.
• The oral exam is on Fri, Jan 20.
7 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Solution Methods
Topics to be presented:
1 Primal-dual interior-point method (used both in linear and non-linearprogramming)
2 Simplex method (linear programming)
3 Newton’s method for optimization with equality constraints
4 Gradient descent method for unconstrained optimization
8 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Formulating an optimization problemExample: James, a CMU student, opens a new sandwich shop on CMUcampus to earn some money. He offers two types of sandwiches, tunaand chicken. His costs for the tuna sandwich are $4, his profit is $3.5and it takes him 8 minutes to make one. The costs for the chickensandwich are $6, his profit is $3 and it takes him 6 minutes to makeone. Besides studying, he is able to spend 3 hours per day preparingsandwiches and he has a budget of $120 per day. The universityregulations say that he has to sell at least 5 sandwiches of each type.
• Assuming that James can sell all his sandwiches, write down theoptimization problem to find the number of sandwiches of each typewhich maximize his profit.
• Is this optimization problem
• linear, quadratic or nonlinear?• continuous or discrete?• constrained or unconstrained?
9 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Formulating an optimization problemExample: James, a CMU student, opens a new sandwich shop on CMUcampus to earn some money. He offers two types of sandwiches, tunaand chicken. His costs for the tuna sandwich are $4, his profit is $3.5and it takes him 8 minutes to make one. The costs for the chickensandwich are $6, his profit is $3 and it takes him 6 minutes to makeone. Besides studying, he is able to spend 3 hours per day preparingsandwiches and he has a budget of $120 per day. The universityregulations say that he has to sell at least 5 sandwiches of each type.
• Assuming that James can sell all his sandwiches, write down theoptimization problem to find the number of sandwiches of each typewhich maximize his profit.
• Is this optimization problem
• linear, quadratic or nonlinear?• continuous or discrete?• constrained or unconstrained?
9 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Finding the minimum f(x)
x
f(x)
How do we find theminimum f(x)?
f(x) is a parabola
10 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Finding the minimum f(x)
x
f(x)
f ′(x) = 0
f ′′(x) > 0
• f ′(x∗) = 0 : findsthe local extrema(minimum ormaximum)
• f ′′(x∗) > 0 :ensures that x∗ isa minimum
11 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Convex vs. Non-convex Problem
Convex Problem Non-convex problem
x
Cost f(x)
x
Costf(x)
One global minimum Several local minima
12 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
3-slide “break”
DC-OPF: linear program = convex
AC-OPF: non-linear non-convex problem in its original form⇒ recent efforts to convexify the problem
Why?
13 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Several local minima: So what?
Example: Optimal Power Flow Problem• Assume that the difference in the
cost function of a local minimumversus a global minimum is 10%
• The total electric energy cost inthe US is ≈ 400 Billion$/year
• 10% amounts to 40 billion US$ ineconomic losses per year
• Even 1% difference is huge
• Convex problems guarantee thatwe find a global minimum ⇒convexify the OPF problem
x
Costf(x)
14 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Convexifying the Optimal Power Flow problem(OPF)
• Convex relaxations transform theOPF to a convex Semi-DefiniteProgram (SDP)
• Under certain conditions, theobtained solution is the globaloptimum to the original OPFproblem1
x
Costf(x)
Convex Relaxation
1Javad Lavaei and Steven H Low. “Zero duality gap in optimal power flow problem”. In:IEEE Transactions on Power Systems 27.1 (2012), pp. 92–10715 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Convexifying the Optimal Power Flow problem(OPF)
• Convex relaxations transform theOPF to a convex Semi-DefiniteProgram (SDP)
• Under certain conditions, theobtained solution is the globaloptimum to the original OPFproblem1
x
Costf(x)
f̃(x)
Convex Relaxation
1Javad Lavaei and Steven H Low. “Zero duality gap in optimal power flow problem”. In:IEEE Transactions on Power Systems 27.1 (2012), pp. 92–10715 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Convexifying the Optimal Power Flow problem(OPF)
• Convex relaxations transform theOPF to a convex Semi-DefiniteProgram (SDP)
• Under certain conditions, theobtained solution is the globaloptimum to the original OPFproblem1 x
Costf(x)
f̃(x)
Convex Relaxation
1Javad Lavaei and Steven H Low. “Zero duality gap in optimal power flow problem”. In:IEEE Transactions on Power Systems 27.1 (2012), pp. 92–10715 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Break is over... More in future lectures!
16 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Unconstrained Optimization
• Find a solution to:
minxf(x)
no constraints!
• First order optimality condition:
∇f(x∗) =
∂f∂x1...∂f∂xn
x=x∗
= 0
⇒ gradient: derivatives withrespect to variables must bezero
17 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Unconstrained Optimization
• 1-dimensional, i.e 1 variable, non-convex f(x)
• first order optimality condition:
∂f
∂x
∣∣∣∣x=x∗
= 0
• This condition holds for:
• both minima and maxima (i.e.all extrema),• both local and global extrema,• and saddle points
Carnegie Mellon
6
Unconstrained Optimization• 1-dimensional, i.e. only one variable x
=> sufficient condition for a local minimum is
0ˆ
ww
xxxf
but this holds for global and local minima and maxima as well as saddle points
0ˆ
2
2
!ww
xxxf
• sufficient condition for a local minimum is ∂2f∂x2
∣∣∣x=x∗
> 0
18 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Unconstrained Optimization
• 2-dimensional
Carnegie Mellon
7
Unconstrained Optimization• 2-dimensional
gradient corresponds to a vector and at any point represents the direction in which the function will increase the most
� � 0ˆ
ˆ2
1
»»»»
¼
º
««««
¬
ª
wwww
�
xxxfxf
xf
∇f(x∗) =
[∂f∂x1∂f∂x2
]x=x∗
= 0
• The gradient corresponds to a vector. At any point it represents thedirection in which the function will increase the most.
19 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Unconstrained Optimization
• Second order or sufficient condtion for local minima
∇2f(x∗) =
∂2f(x)
∂x21
. . . ∂2f(x)∂x1∂xn
......
∂2f(x)∂xn∂x1
. . . ∂2f(x)∂x2
n
x=x∗
Hessian matrix (matrix of sec-ond order derivatives) must bepositive definite, i.e. all eigen-values >0
• There are no general conditions for a global optimum; suchconditions exist only for certain classes of objective functions suchas convex functions
20 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Convexity
• A function is convex if:
f(αx+ βy) ≤ αf(x) + βf(y), for all x, y and α + β = 1, α, β ≥ 0
or equivalently
∇2f(x) ≥ 0 for all x, i.e. Hessian matrix is positive semidefinite
• A function is concave if:
f(αx+ βy) ≥ αf(x) + βf(y), for all x, y and α + β = 1, α, β ≥ 0
or equivalently
∇2f(x) ≤ 0 for all x, i.e. Hessian matrix is negative semidefinite
21 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Convexity
• One-dimensional example
Carnegie Mellon
Convexity
• One-dimensional example:
10
x y
)(yf
)(xf
yx ED �
)()( yfxf ED �
)( yxf ED �
22 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Convexity
Carnegie Mellon
7
Unconstrained Optimization• 2-dimensional
gradient corresponds to a vector and at any point represents the direction in which the function will increase the most
� � 0ˆ
ˆ2
1
»»»»
¼
º
««««
¬
ª
wwww
�
xxxfxf
xf
Carnegie Mellon
Convexity
• Which of these functions are convex? Which ones are concave?
11
2)( xxf
xxf sin)(
22
2121 ),( xxxxf ��
22
2121 ),( xxxxf �
3)( xxf
Carnegie Mellon
Convexity
• Which of these functions are convex? Which ones are concave?
11
2)( xxf
xxf sin)(
22
2121 ),( xxxxf ��
22
2121 ),( xxxxf �
3)( xxf
f(x) = x2
f(x) = sin x
f(x1, x2) = −x21 − x22f(x1, x2) = x21 + x22
f(x) = x3
23 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Equality Constrained Optimization
• Find a solution to:
minxf0(x)
s.t. hi(x) = 0 for i=1,. . . ,p
Carnegie Mellon
14
Equality Constrained Optimization• Find a solution to
in feasible points
0)(..
)(min
xgts
xfx
0)(z
wwxxf∂f0(x)
∂x6= 0 in feasible points
24 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Equality Constrained Optimization
• 2-dimensional example:
minx1,x2
x21 + x22 : f0(x)
s.t. − x1 − x2 + 4 = 0 : h1(x)
Carnegie Mellon
15
Equality Constrained Optimization• 2-dimensional example:
• Objective Function:
optimal solution without constraint at
04..
min
21
22
21
���
�
xxts
xxx
0)( � xf021 xx
without constraints, the optimalsolution is at:
∇f0(x) = 0⇒ x1 = x2 = 0
25 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Equality Constrained Optimization
• Objective Function and Constraint
Carnegie Mellon
16
Equality Constrained Optimization• Objective Function and Constraint
all feasible points lie on
What is special at the optimal point?
0)( xg
optimal solution all feasible points lie on h1(x) = 0
What is special at the optimalpoint?
26 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Equality Constrained Optimization
• Gradients
Carnegie Mellon
17
Equality Constrained Optimization• Gradients
in the optimal point:
=> gradients of the objective function and the constraints are parallel
)(xg�
)(xf� 0)(0)()(
����
xgxgxf TO
• in the optimal point
∇f0(x) + ν · ∇h1(x) = 0
h1(x) = 0
• Gradients of the objectivefunction and the constraints areparallel!
27 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Equality Constrained Optimization
• Lagrange Function
L = f0(x) +
p∑i=1
νihi(x) (1)
• Minimize Lagrange Function
∂L
∂x= 0⇒ ∂f0(x)
∂x+
p∑i=1
νi∂hi(x)
∂x= 0
∂L
∂ν= 0⇒ hi(x) = 0 for i = 1, . . . , p
• Equation system withn+p variables and n+pequations
n: # state variables
p: # equality constraints
• Solve equation system toobtain solution tooptimization problem
• Karush-Kuhn-Tacker (KKT) conditions first order or necessary optimalityconditions for equality constrained optimization
28 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Equality Constrained Optimization
• Meaning of Lagrange Multiplier
• in the optimal point
∆f(x)
∆x+ ν · ∆g(x)
∆x= 0
⇒ν = −∆f(x)
∆g(x)
Carnegie Mellon
17
Equality Constrained Optimization• Gradients
in the optimal point:
=> gradients of the objective function and the constraints are parallel
)(xg�
)(xf� 0)(0)()(
����
xgxgxf TO
• Lagrange multipliers correspond to the negative sensitivities of theoptimal objective function value with respect to a small change in theequality constraint.
29 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Equality Constrained Optimization
• Example:
minxx21 + x22
s.t. − x1 − x2 + 4 = 0
• Find the solution to this problem using KKT conditions.
30 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017
Lagrange multipliers on the web
Helpful website: http://www.slimy.com/~steuard/teaching/
tutorials/Lagrange.html
31 DTU Electrical Engineering Optimization in modern power systems Jan 4, 2017