Lecture 22 Linear Programming and Optimal Power Flow
Lecture 22 Linear Programming and Optimal Power Flow
2
Aside: Matrix Singular Value
Decomposition (SVD)
• The SVD is a factorization of a matrix that
generalizes the eigendecomposition to any m by n
matrix to produce The original concept is more than
100 years old, but has founds lots
Y UΣV T of recent applications
where S is a diagonal matrix of the singular values
• The singular values are non-negative real numbers
that can be used to indicate the major components
of a matrix (the gist is they provide a way to
decrease the rank of a matrix
• A key application is image compression
3
Aside: SVD Image Compression
Example
Images can be
represented with
matrices. When
an SVD is applied
and only the
largest singular
values are retained
the image is
compressed.
Computationally the
SVD is order m2n
(with n m)
5
Least Squares Matrix
Pseudoinverse Example
• Assume we wish to fix a line (mx + b = y) to three
data points: (1,1), (2,4), (6,4)
• Two unknowns, m and b; hence x = [m b]T
• Setup in form of Ax = b
1 1 1 1 1
2 1 m 4 so A = 2 1
b
6 1 4 6 1
6
Least Squares Matrix
Pseudoinverse Example, cont.
• Doing an economy SVD
0.182 0.765
6.559 0 0.976 0.219
A UΣV 0.331 0.543
T
0.219 0.976
0 0.988
0.926 0.345
8
Quick Coverage of Linear Programming
• LP is probably the most widely used mathematical
programming technique
• It is used to solve linear, constrained minimization
(or maximization) problems in which the objective
function and the constraints can be written as linear
functions
9
Example Problem 1
• Assume that you operate a lumber mill which
makes both construction-grade and finish-grade
boards from the logs it receives. Suppose it takes 2
hours to rough-saw and 3 hours to plane each 1000
board feet of construction-grade boards. Finish-
grade boards take 2 hours to rough-saw and 5
hours to plane for each 1000 board feet. Assume
that the saw is available 8 hours per day, while the
plane is available 15 hours per day. If the profit
per 1000 board feet is $100 for construction-grade
and $120 for finish-grade, how many board feet of
each should you make per day to maximize your
10
profit?
Problem 1 Setup
Let x1 =amount of cg, x 2 = amount of fg
Maximize 100 x1 120 x2
s.t. 2 x1 2 x2 8
3x1 5 x2 15
x1, x2 0
Notice that all of the equations are linear, but
they are inequality, as opposed to equality, constraints;
we are seeking to determine the values of x1 and x2
11
Example Problem 2
• A nutritionist is planning a meal with 2 foods: A
and B. Each ounce of A costs $ 0.20, and has 2
units of fat, 1 of carbohydrate, and 4 of protein.
Each ounce of B costs $0.25, and has 3 units of fat,
3 of carbohydrate, and 3 of protein. Provide the
least cost meal which has no more than 20 units of
fat, but with at least 12 units of carbohydrates and
24 units of protein.
12
Problem 2 Setup
Let x1 =ounces of A, x 2 = ounces of B
Minimize 0.20x1 0.25 x2
s.t. 2 x1 3 x2 20
x1 3 x2 12
4x1 3 x2 24
x2 0 are linear, but
x1,equations
Again all of the
they are inequality, as opposed to equality, constraints;
we are again seeking to determine the values of x1 and x2;
notice there are also more constraints then solution
variables
13
Three Bus Case Formulation
• For the earlier three bus system given the initial
condition of an overloaded transmission line,
minimize the cost of generation such that the
change in generation Bus 2
60 MW 60 MW
Bus 1
15
LP Standard Form
The standard form of the LP problem is
Minimize cx Maximum problems can
s.t. Ax b be treated as minimizing
the negative
x0
where x n-dimensional column vector
c n-dimensional row vector
b m-dimensional column vector
A m×n matrix
For the LP problem usually n>> m
The previous examples were not in this form!
16
Replacing Inequality Constraints
with Equality Constraints
• The LP standard form does not allow inequality
constraints
• Inequality constraints can be replaced with equality
constraints through the introduction of slack variables,
each of which must be greater than or equal to zero
bi yi bi with yi 0
bi yi bi with yi 0
18
LP Definitions
A vector x is said to be basic if
1. Ax b
2. At most m components of x are non-zero; these
are called the basic variables; the rest are non basic
variables; if there as less than m non-zeros then
x is called degenerate AB is called the basis matrix
xB
Define x (with x B basic) and A A B A N
xN
xB
With A B A N b so x B A B 1 b A N x N
xN
19
Fundamental LP Theorem
• Given an LP in standard form with A of rank m
then
– If there is a feasible solution, there is a basic feasible
solution
– If there is an optimal, feasible solution, then there is an
optimal, basic feasible solution
• Note, there could be a LARGE number of basic,
feasible solutions
– Simplex algorithm determines the optimal,
basic feasible solution usually very quickly
20
LP Graphical Interpretation
• The LP constraints define a polyhedron in the
solution space
– This is a polytope if the polyhedron is bounded and
nonempty
– The basic, feasible
solutions are
vertices of this
polyhedron
– With the linear cost
function the solution
will be at one of
vertices
22
Determination of Variable to
Enter the Basis
• To determine which non-basic variable should
enter the basis (i.e., one which currently 0), look at
how the cost function changes w.r.t. to a change in
a non-basic variable (i.e., one that is currently zero)
xB Elements of xn
Define z c x [c B cN ] are all zero, but
x N we are looking
With x B A B1 b A N x N to change one
to decrease the
Then z c B A B1b c N c B A B1A N x N cost
23
Determination of Variable to
Enter the Basis
• Define the reduced (or relative) cost coefficients as
r is an n-m dimensional
r c N c B A B1A N
row vector
24
Determination of Variable
to Exit Basis
• The new variable entering the basis, say a position j,
causes the values of all the other basic variables to
change. In order to retain a basic, feasible solution, we
need to insure no basic variables become negative.
The change in the basic variables is given by
1
x B xB AB a j
where is the value of the variable entering the
basis, and a j is its associated column in A
25
Determination of Variable
to Exit Basis
We find the largest value such
x B x B A B1a j 0
If no such exists then the problem is unbounded;
otherwise at least one component of x B equals zero.
The associated variable exits the basis.
26
Canonical Form
• The Simplex Method works by having the problem in
what is known as canonical form
• Canonical form is defined as having the m basic
variables with the property that each appears in only
one equation, its coefficient in that equation is unity,
and none of the other basic variables appear in the
same equation
• Sometime canonical form is readily apparent
Minimize -(100 x1 120 x2 ) Note that with x3 and
s.t. 2 x1 2 x2 x3 8 x4 as basic variables
3x1 5 x2 x4 15 AB is the identity
x1, x2 , x3 , x4 0 matrix 27
Canonical Form
• Other times canonical form is achieved by initially
adding artificial variables to get an initial solution
• Example of the nutrition problem in canonical form
with slack and artificial variables (denoted as y) used
to get an initial basic feasible solution
Let x1 =ounces of A, x 2 = ounces of B Note that with y1, y2,
Minimize y1 +y 2 +y3 and y3 as basic
s.t. 2 x1 3 x2 x 3 y1 20 variables AB is the
x1 3 x2 x4 y2 12 identity matrix
4x1 3 x2 x5 y3 24
x1, x2 , x3 , x4 , x5 , y1, y2 , y3 0
28
LP Tableau
• With the system in canonical form, the Simplex
solution process can be illustrated by forming what is
known as the LP tableau
– Initially this corresponds to the A matrix, with a column
appended to include the b vector, and a row added to give the
relative cost coefficients; the last element is the negative of the
cost function value
– Define the tableau as Y, with elements Yij
– In canonical form the last column of the tableau gives the
values of the basic variables
• During the solution the tableau is updated by pivoting
29
LP Tableau for the Nutrition
Problem with Artificial Variables
• When in canonical form the relative costs vector is
r c N c B A B1A N c B A N
T T
0 7
0 2 3 1 0 0 9
r 0 1 1 1 1 3 0 1 0 1
0
4 3 0 0 1 1
0 1
• The initial tableau for the artificial problem is then
x1 x2 x3 x4 x5 y1 y2 y3 Note the last column
2 3 1 0 0 1 0 0 20 gives the values of
1 3 0 1 0 0 1 0 12 the basic variables
4 3 0 0 1 0 0 1 24
7 9 1 1 1 0 0 0 56
30
LP Tableau Pivoting
• Pivoting is used to move from one basic feasible
solution to another
– Select the pivot column (i.e., the variable coming into the
basis, say q) as the one with the most negative relative cost
– Select the pivot row (i.e., the variable going out of the basis) as
the one with the smallest ratio of xi/Yiq for Yiq >0; define this as
row p (xi is given in the last column)
That is, we find the largest value such
x B x B A B1a q 0
If no such exists then the problem is unbounded;
otherwise at least one component of x B equals zero.
The associated variable exits the basis.
31
LP Tableau Pivoting for Nutrition
Problem
• Starting at
x1 x2 x3 x4 x5 y1 y2 y3
2 3 1 0 0 1 0 0 20
1 3 0 1 0 0 1 0 12
4 3 0 0 1 0 0 1 24
7 9 1 1 1 0 0 0 56
32
LP Tableau Pivoting
41
LP Optimal Power Flow
• LP OPF was introduced in
– B. Stott, E. Hobson, “Power System Security Control
Calculations using Linear Programming,” (Parts 1 and 2)
IEEE Trans. Power App and Syst., Sept/Oct 1978
– O. Alsac, J. Bright, M. Prais, B. Stott, “Further Developments
in LP-based Optimal Power Flow,” IEEE Trans. Power
Systems, August 1990
• It is a widely used technique, particularly for real power
optimization; it is the technique used in PowerWorld
42