EPE821 Lecture2 4P
EPE821 Lecture2 4P
EPE821 Lecture2 4P
Basics of Optimization
Power systems basics
Review of Matlab
Examples of Optimization in Power systems
Graphical Optimization
Dr. Muhammad Naeem Optimization Types Constraint and Unconstraint
Optimization Problem Types Linear NonLinear etc
Linear Optimization and Power Systems Applications
Non Linear Optimization and Power Systems Applications
Integer and Mixed integer programming and Power Systems Applications
Complexity Analysis
A⊂ B A is a proper subset of B. (If A is a subset of B, but A is not A⊂ B A is a proper subset of B. (If A is a subset of B, but A is not
equal to B (i.e. there exists at least one element of B which is not an equal to B (i.e. there exists at least one element of B which is not an
element of A) element of A)
A ⊆ B ⇔ ∀x[ x ∈ A x ∈ B]
C⊆B C is a subset of B. A ⊄ B ⇔ ¬∀x[ x ∈ A x ∈ B] C⊆B C is a subset of B.
⇔ ∃x[ x ∈ A ∧ x ∉ B ] The power set is the set of all subsets of a given set.
The power set is the set of all subsets of a given set. For the set S = {1,2,3} this means:
For the set S = {1,2,3} this means: P(S) = {0, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3} }
P(S) = {0, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3} } |S|=n then |P(S)| = 2n
|S|=n then |P(S)| = 2n
Conceptually, sets may be infinite (i.e., not finite, without end). For real numbers a,b with a<b
Symbols for some special infinite sets: [ a, b] = {x ∈ R | a ≤ x ≤ b} closed interval
N = {0, 1, 2, …} The natural numbers.
Z = {…, -2, -1, 0, 1, 2, …} The integers. ( a, b) = {x ∈ R | a < x < b} open interval
R = The “real” numbers, such as 374.1828… [ a, b) = {x ∈ R | a ≤ x < b} half-open interval
( a, b] = {x ∈ R | a < x ≤ b} half-open interval
For real numbers a,b with a<b
[ a, b] = {x ∈ R | a ≤ x ≤ b} closed interval x∈S (“x is in S”) is the proposition that object x is an element or member
of set S.
( a, b) = {x ∈ R | a < x < b} open interval e.g. 3∈N, “a”∈{x | x is a letter of the alphabet}
Can define set equality in terms of ∈ relation:
[ a, b) = {x ∈ R | a ≤ x < b} half-open interval ∀S,T: S=T ↔ (∀x: x∈S ↔ x∈T)
“Two sets are equal iff they have all the same members.”
( a, b] = {x ∈ R | a < x ≤ b} half-open interval x∉S :≡ ¬(x∈S) “x is not in S”
! !
Let X and Y be two nonempty sets. Let X and Y be two nonempty sets.
A function from X into Y is a relation that associates with each element of A function from X into Y is a relation that associates with each element of
X exactly one element of Y. X exactly one element of Y.
Domain: In a set of ordered pairs, (x, y), the domain is the set of all x- Domain: In a set of ordered pairs, (x, y), the domain is the set of all x-
coordinates. coordinates.
Range: In a set of ordered pairs, (x, y), the range is the set of all y- Range: In a set of ordered pairs, (x, y), the range is the set of all y-
coordinates. coordinates.
Example: f ( x) = x 2 − 5 Example: f ( x ) = x2 − 5
Domain: All Real
Range: {y: y -5}
! ! " #
Let X and Y be two nonempty sets.
For n a natural number, There are 8 choices for the first position,
A function from X into Y is a relation that associates with each element of n! = n(n - 1)(n - 2)·...·3·2·1 leaving 7 choices for the second slot, 6
X exactly one element of Y. 0! = 1 choices for the third slot and so on.
n! = n(n - 1)! The number of different orderings is
Domain: In a set of ordered pairs, (x, y), the domain is the set of all x- 1! = 1
coordinates. 2! = 2 8(7)(6)(5)(4)(3)(2)(1)=8! =40,320
Range: In a set of ordered pairs, (x, y), the range is the set of all y- 3! = 6
coordinates. 4!= 3!*4 = 24
What about 10! =
Example: f (x) = x−5
Domain: {x: x 5} Permutations are “arrangements”.
Range: {y: y 0} In a permutation, the order of the books is important.
Each different permutation is a different arrangement.
Example: f ( x ) = x2 − 5
Domain: All Real The arrangement ABC is different from the arrangement CBA, even
though they are the same 3 books.
Range: {y: y -5}
The number of r-permutations of a set S with n=|S| elements is
P(n,r) = n(n−1)…(n−r+1) = n!/(n−r)
! " # ! " #
! "# $ %&'&
There are some problems where the order of the items is NOT
important. These are called combinations.
You are just making selections, not making different arrangements. n n!
C (n, r ) = =
Example: A committee of 3 students must be selected from a group of 5 r r !(n − r )!
people. How many possible different committees could be formed?
Let’s call the 5 people A,B,C,D,and E.
Suppose the selected committee consists of students E, C, and A. If Essentially unordered permutations …
you re-arrange the names to C, A, and E, it’s still the same group of
people. This is why the order is not important. P (n, r ) = C (n, r ) P (r , r )
Because we’re not going to use all the possible combinations of ECA, like EAC,
CAE, CEA, ACE, and AEC, there will be a lot fewer committees. Therefore instead of Note that C(n,r) = C(n, n−r)
using only 5x4x3, to get the fewer committees, we must divide n P (n, r ) n! /(n − r )! n!
(Always divide by the C ( n, r ) = = = =
5x4x3 Answer: factorial of the number of r P(r , r ) r! r!(n − r )!
3x2x1 10 committees digits on top of the fraction.)
$ % # $ % #
“Algebra” means, roughly, “relationships”. Vector in Rn is an ordered 1
“Linear Algebra” means, roughly, “line-like relationships”. set of n real numbers. 6
e.g. v = (1,6,3,4) is in R4 3
If 3 feet forward has a 1-foot rise, then going 10x as far should give a 10x
“(1,6,3,4)” is a column
rise (30 feet forward is a 10-foot rise) 4
vector:
Think of a vector as a directed line segment y a as opposed to a row vector:
in N-dimensions! (has “length” and m-by-n matrix is an object
(1 6 3 4)
“direction”) v v= b with m rows and n columns,
Basic idea: convert geometry in higher each entry fill with a real
dimensions into algebra! x
c number:
1 2 8
Once you define a “nice” basis along 4 78 6
each dimension: x-, y-, z-axis …
Vector becomes a 1 x N matrix!
9 3 2
v = [a b c]T
Geometry starts to become linear
algebra on vectors like v!
$ % # $ % #
Line equation: y = mx + c use the head-to-tail method A & '( )$ * ) *
Matrix equation: y = Mx + c to combine vectors
$ % # $ % #
x
( x+ y+ z =1 1 1 1 1 .
y =
2 −1 1 2
2x − y + z = 2 z Example +- /
a 0 0 a b c a b 0 0 1 0 0
a 0 0
c d e 0 0 1 0
3 5 3 5
0 b 0 0 d e
b c 0 0 f g h
A= det A = = (3)( 2) − (5)(1) = 6 − 5 = 1
0 0 c 0 0 f d e f
0 0 1 1 2 1 2
0 0 i j
19 20
$ % # $ % #
Def: Cofactors
Let A =[aij] be an nxn matrix . The ijth cofactor of A ( or the
0 2 1
cofactor of aij) is defined to be Aij = ( −1) i + j M ij A = 3 −1 2
Example Find A23 , A32 , A33 , signs 4 0 1
1 0 2 + − +
A= 4 3 1 − + −
3 5 1 + − +
−1 2 3 2 3 −1
M 11 = = −1, M 12 = = −5, M 13 = =4
Def: Cofactor matrix
0 1 4 1 4 0
C11 = −1 C12 = 5 C13 = −4
Let A =[aij] be an nxn matrix . The cofactor matrix = [Aij] M 21 = 2, M 22 = −4, M 23 = −8, C21 = −2, C22 = −4, C23 = 8,
Example Find the cofactor matrix signs M 31 = 5, M 32 = −3, M 33 = −6. C31 = 5, C32 = 3, C33 = −6.
+ − +
1 0 2
− + − A = a11C11 + a12C12 + a13C13 = 0(−1) + 2(5) + 1(4) = 14
A= 4 3 1
+ − + = a21C21 + a22C22 + a23C23 = 3(−2) + (−1)(−4) + 2(8) = 14
3 5 1
= a11C11 + a21C21 + a31C31 = 0(−1) + 3(−2) + 4(5) = 14
22
$ % # $ % #
Principal Minor Leading Principal Minor
The leading principal minor of order k of an n x n matrix is obtained
Principal minor of order k: A sub-matrix obtained by deleting any n-k by deleting the last n-k rows and their corresponding columns.
rows and their corresponding columns from an n x n matrix Q. 1 2 3
1 2 3 Q= 4 5 6
Consider
Q= 4 5 6 7 8 9
7 8 9
Leading principal minor of order 1 is 1.
Leading principal minor of order 2 is 1 2
Principal minors of order 1 are diagonal elements 1, 5, and 9.
1 2 1 3 5 6 4 5
Principal minors of order 2 are
, and Leading principal minor of order 3 is Q itself.
4 5 7 9 8 9 No. of leading principal determinants of an n x n matrix is n.
Principal minor of order 3 is Q.
$ % # $ % #
$ % # $ % #
Eigenvalues Computation of eigenvalues, and the characteristic equation
If the action of a matrix on a (nonzero) vector changes its magnitude but When a transformation is represented by a square matrix A, the
not its direction, then the vector is called an eigenvector of that matrix. A eigenvalue equation can be expressed as
vector which is "flipped" to point in the opposite direction is also
considered an eigenvector. Each eigenvector is, in effect, multiplied by a
scalar, called the eigenvalue corresponding to that eigenvector. The AX − λ IX = 0
eigenspace corresponding to one eigenvalue of a given matrix is the set of
all eigenvectors of the matrix with that eigenvalue Solve det(A − I) = 0.
Given a linear transformation A, a non-zero vector x is defined to be an
eigenvector of the transformation if it satisfies the eigenvalue equation
AX = λ X
for some scalar . In this situation, the scalar is called an eigenvalue of
A corresponding to the eigenvector x.
$ % # $ % #
$ % # $ % #
$ % # $ % #
+
/ - - " / - / !,# / / 0!,#
/ / ,
f ( x + h) − f ( x )
f `( x) = lim If k ( x) = f ( x).g ( x) , then: k `( x) = f `( x) g ( x) + g `( x) f ( x)
h→0 h
2 If y = f ( x).g ( x), then:
1 dy df dg dy
= .g ( x ) + . f ( x ) 45 = f `g + g ` f
dx dx dx dx
f ( x + h) − f ( x )
( f ( x + h) − f ( x ) 1. Differentiate y = x 2 sin x
mPQ =
h
f ( x) = x 2 g ( x) = sin x dy
, = f `g + g ` f = 2 x sin x + x 2 cos x
, ,3 dx
f `( x) = 2 x g `( x) = cos x
δy dy
Leibniz Notation: f `( x) = lim =
h→o δx dx
d x3
1. Find
dx sin x
f ( x) = x3 g ( x) = sin x
f `( x) = 3 x 2 g `( x) = cos x A tangent line is a straight line that touches a function at only one point.
The tangent line represents the instantaneous rate of change of the
function at that one point. The slope of the tangent line at a point on the
dy f `g − g ` f 3 x 2 sin x − x 3 cos x function is equal to the derivative of the function at the same point.
= =
dx g2 sin 2 x
y
x2 − 2 ≤ x <1 2x − 2 ≤ x <1
Local extreme values occur either at the end points of the function, turning
f ( x) = x 1≤ x < 2 f `( x) = 1 1≤ x < 2 points or critical points within the interval of the domain.
y
x +1 2 ≤ x < 4 2≤ x<4
2 2 x2 + 2 x − 3 ≤ x < −1 4
y f ( x) = x 3 −1 ≤ x < 1 3
5
2
A (-2,4) f `(-2) does not exist. −2 x 2 + 8 x − 5 1 ≤ x < 3
6 4
(Right differentiable at x = -2) 1
3
+ Domain [−3,3)
–3 –2 –1 1 2 3 x
– 1
D (2,2) f `(2) does not exist. Left (i) Local maximum / minimum turning points
– 2 derivative = 1, right derivative = 0.5 (ii) End point values
(iii) Critical points
E is not a critical point as it is not in the domain of f.
-
Network = graph
The Nature of Stationary Points. 1 2 3 1 2 3
Informally a graph is a set of nodes joined
If f `(a) = 0 then a table of values over a suitable interval centred at a by a set of lines or arrows.
provides evidence of the nature of the stationary point that must exist at a. Nodes and edges 4 5 6
4 5 6
G(V, E)
A simpler test does exist. Undirected graph
Directed graph
It is the second derivative test.
V:={1,2,3,4,5,6}
E:={{1,2},{1,5},{2,3},{2,5},{3,4},{4,5},{4,6}}
f `( x ) = 0 and f ``( x ) > 0 then minimum turning point. Many problems can be stated in terms of a graph
The properties of graphs are well-studied
f `( x ) = 0 and f ``( x ) < 0 then maximum turning point.
Many algorithms exists to solve graph problems
f `( x ) = 0 and f ``( x ) = 0 then draw a table of signs. Many problems are already known to be intractable
If the second derivative test is easier to determine than making a table of By reducing an instance of a problem to a standard graph problem, we may
signs then this provides an efficient technique to finding the nature of be able to use well-known graph algorithms to provide an optimal solution
stationary points. Graphs are excellent structures for storing, searching, and retrieving large
amounts of data
Graph theoretic techniques play an important role in increasing the
storage/search efficiency of computational techniques.
- -
Undirected graph Directed graph
loop loop
G=(V,E)
, 2
isolated vertex path: no vertex can be repeated
adjacent example path: a-b-c-d-e
multiple
trail: no edge can be repeated
edges
example trail: a-b-c-d-e-b-d
incidence: an edge (directed or undirected) is incident to a vertex that is walk: no restriction
one of its end points.
example walk: a-b-d-a-b-c /
degree of a vertex: number of edges incident to it
Nodes of a digraph can also be said to have an indegree and an closed: if starting vertex is also ending
outdegree vertex
adjacency: two vertices connected by an edge are adjacent length: number of edges in the path, trail,
or walk
d e f
6
c d
Disconnected graph
with two components c