25
EE/Econ 458 Introduction to Linear Programming J. McCalley 1

EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Embed Size (px)

Citation preview

Page 1: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

EE/Econ 458Introduction to Linear Programming

J. McCalley

1

Page 2: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Security Constrained Economic Dispatch*

2

Gen resource & demand response resourceDemand response resourceExternal asynchronous constraintsStored energy reserve constraintsEnergy transaction constraintsOPF constraintsReliability constraints

- System reserves- transmission - watchlist transmission flowgates- contingencies

*From Chapter 6 of the MISO Energy & Operating Reserve Markets, Business Practices Manual, BPM-002-r10, JUN-29-2011.

SUBJECT TO constraints on

Page 3: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Security Constrained Economic Dispatch

3

The SCED algorithm uses a Linear Programming (LP) solver, and so we will study LP to understand this optimization method.

This problem may be simplified to the following

GIVEN:•A number of gens make price-quantity offers to sell•A number of LSEs make price-quantity bids to buyMAXIMIZE social surplus U(P)-C(P), where U(P) is the composite utility (value) function for consumers, C(P) is the composite cost function for suppliers, and P is real power injection vector of network nodes (+ for gen, - for load).SUBJECT TO constraints:

- Pmin<P<Pmax

- Sum of generation = sum of demand- Flows on each circuit <= maximum flow for circuit

Page 4: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Some preliminaries

4

1. Maximization of a function is equivalent to minimization of the negated function,

maximize f(x) is the same as minimize (-f(x))

2. An inequality constraint may be equivalently written as g(x)>b or -g(x)<-b

bxg

c)x(h s.t.

xf

)(

)(min

And so any of the following problems are equivalent:

bxg

c)x(h s.t.

xf

)(

)(max

bxg

c)x(h s.t.

xf

)(

)(min

bxg

c)x(h s.t.

xf

)(

)(max

Page 5: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Linear Program – Standard Form

5

Requirements: f(x) is a linear function in x, i.e., a1x1+a2x2+…+anx3

All equalities hj(x)=cj are linear functions in x.All inequalities gk(x)=bk are linear functions in x.

bxg

c)x(h s.t.

xf

)(

)(min

Then Problem P is a linear program.

Problem P:

Page 6: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Linear Program – A Convex Program

6

bxg

c)x(h s.t.

xf

)(

)(minProblem P:

A linear program is a convex programming problem.

Recall: If f(x) is a convex function, and if S is a convex set, then the above problem is a convex programming problem. f(x) is linear, therefore a convex function. If S is formed by inequalities, it is polyhedral, therefore convex.

S

Sx

xf

subject to

)(min

Feasible set

One linear equality reduces feasible set S to the line. More than one reduces feasible set S to their intersections. S is convex in both cases.

If we find a locally optimal solution, it will be globally optimal.

Page 7: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Example 1

7

4

16

3)(max

21

2

21

xx

xx s.t.

xxxf

1

)16x(3),( 2121 xxxxF Ignore inequality. Form Lagrangian: Apply first-order conditions:

016

101

303

21

2

1

xxF

x

F

x

F

What happened?

Page 8: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Example 1

8

16

3)(max

2

21

xx s.t.

xxxf

1

We can push f(x) as far negative as we like and there will always be an intersection point with the equality constraint.

This problem is unbounded. This can happen with linear programs.But what about the inequality constraints?

Page 9: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Example 1

9

4

16

3)(max

21

2

21

xx

xx s.t.

xxxf

1

Form Lagrangian: )4()16(3),( 21221 xxxxxxxF 1

Observe g(x)<b implies to add this term.

KKT Conditions04

016

01

03

21

21

2

1

xxF

xxF

x

F

x

F

0

0)4( 21

xx

Page 10: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Example 1

10

4

16

3)(max

21

2

21

xx

xx s.t.

xxxf

1

4

16

1

3

0011

0011

1100

1100

2

1

x

x

1

2

10

6

2

1

x

x

The feasible region associated with the inequality constraint is below the dotted line

The feasible region for the problem includes everything on the thick line to the right of the intersection point (red dot).

The feasible region for the problem is below the dotted line and on the thick one (the equality constraint).

Page 11: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Example

11

4

16

3)(max

21

2

21

xx

xx s.t.

xxxf

1

4

16

1

3

0011

0011

1100

1100

2

1

x

x

1

2

10

6

2

1

x

x

Minimize the objective:Choose solution that has smallest value of f(x) but is in the feasible region. Choose lowest contour touching the feasible (red) line.

This is shown by the dashed line at the end of its animation.

Graphical analysis reveals the solution is: x1=6, x2=10 (red dot) 2810)6(33)( 21 xxxf

Page 12: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Example 1

12

4

16

3)(max

21

2

21

xx

xx s.t.

xxxf

1

Definition: Any constraint comprising the feasible region boundary is an active constraint.

Observation: The solution occurred at a point where two active constraints intersect.

Page 13: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Example 2

13

Resource allocation: Optimize an objective through allocating resources to activities subject to constraints on resources.

Objective: Maximize profitsResource: Time of each personActivities: Producing materials X and Y.

Material

Person1 2 3

X 40 min 24 min 20 minY 30 min 32 min 24 min

Three people work 8 hours/day (480 min) making materials X and Y. Their company makes $5 profit per unit X, $8 profit per unit Y. The times required for each person’s contribution towards making a unit are below.Note: A unit of material requires contributions from all three people,

i.e., no individual may make either material on their own.

Page 14: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Example 2

14

Material

Person1 2 3

X 40 min 24 min 20 minY 30 min 32 min 24 min

yxyxf 85),(max

4803040 yx

4803224 yx

4802420 yx

(person 1)

(person 2)

(person 3)

Subject to

0

0

y

x

1248040 xx2048024 xx2448020 xx

Produce only X

60)0(8)12(585),( yxyxfProduce only Y

1648030 yy1548032 yy2048024 yy

120)15(8)0(585),( yxyxf

Three people work 8 hours/day (480 min) making materials X and Y. Their company makes $5 profit per unit X, $8 profit per unit Y. The times required for each person’s contribution towards making a unit are below.

Page 15: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Example 2

15

Conclusion: Producing only Y is better than producing only X, and if we have only these two options, we will produce only Y.

yxyxf 85),(max

4803040 yx

4803224 yx

4802420 yx

(person 1)

(person 2)

(person 3)

Subject to

0

0

y

x

Where on the plot are the solutions we just found?

Can we increase profits beyond $120 by producing some of each?

Page 16: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Example 2

16

Plot the contours of increasing objective function.

yxyxf 85),(

The contour f=60 passes through the point (12,0).The contour f=120 passes through the point (0,15).

No. All other points on the f=120 contour occur above the feasible region; all other contours touching the feasible region are below 120.

8

585

xfyyxf

Is it possible for any point to be better than the red one?

Optimal solution is again at a point where 2 active constraints intersect.

Page 17: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Example 3

17

Same constraints but slightly different objective.

4803040 yx

4803224 yx

4802420 yx

(person 1)

(person 2)

(person 3)

Subject to

0

0

y

x

Which of the points is optimal?

The blue one is optimal since there must be a contour between f=120 and f=130 that just touches it, and any contour with higher f will not touch the feasible region.

yxyxf 89),(max

Optimal solution is again at a point where 2 active constraints intersect.

Page 18: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Example 4

18

Same constraints but slightly different objective.

4803040 yx

4803224 yx

4802420 yx

(person 1)

(person 2)

(person 3)

Subject to

0

0

y

x

Which of the points is optimal?

The yellow one is optimal since there must the contour f=180 just touches it, and any contour with higher f will not touch the feasible region.Optimal solution is again at a point where 2 active constraints intersect.

yxyxf 815),(max

Page 19: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Conclusion

19

The optimal solution was always at a point where two active constraints intersect (corner points). This always happens in an LP.

The solution to an LP, if one exists, is always at a corner point.

Solution strategy: Search the corner points!

Page 20: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

A consideration

20

How many corner points does our problem have?

But what about (0,16), (0,20), (20,0), and (24,0) and the two more outside the plot?

(0,0), (12,0), (1.7143, 13.7143), (0,15)

The first set are feasible corner points.The second set are infeasible corner points.

Revised solution strategy: Search the feasible corner points!

Page 21: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

Why is our revision important?

21

Assuming none of our constraints are parallel, the number of corner points is obtained as a combination of 5 distinct things (constraints) taken 2 at a time. In our case:

With 40 constraints, there would be 780 corner points to check.

Some problems have millions of constraints!

10)1*2*3)(1*2(

1*2*3*4*5

)!25(!2

!5

2

5

Page 22: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

An approach

22

1

2

32

42

52

62

72

82

9

10

20

30

40

50

60

70

80

90

100

5 102

Page 23: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

An approach

23

1

2

32

42

52

62

72

82

9

10

20

30

40

50

60

70

80

90

100

5 102

Page 24: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

An approach

24

1. Pick a corner point at random. 2. Move to an adjacent corner point that is better.

a. If there are two that are better, move to the one that is best.b. If there are no better adjacent corner points, the current

corner point is the solution to the problem.

Optimality (stopping) condition: If a corner point feasible solution is equal to or better than all its adjacent corner point feasible solutions, then it is equal to or better than all other corner point feasible solutions, i.e., it is optimal. Main ideas of proof: 1.If objective function monotonically increases (decreases) in some direction within the decision-vector space, then each adjacent corner point will become progressively better in the direction of objective function increase (decrease) such that the last corner point must have two adjacent corner points that are worse. 2.The monotonicity of objective function increase (decrease) is guaranteed by its linearity.

Page 25: EE/Econ 458 Introduction to Linear Programming J. McCalley 1

High-Level Version of Simplex Method

25

1. Initialization: Start at a corner point solution.2. Iterative step: Move to a better adjacent corner point

feasible solution. 3. Optimality test: Determine if the current feasible

corner point is optimal using our optimality test (if none of its adjacent feasible corner points are better, then the current feasible corner point is optimal).

a. If the current feasible corner point is optimal, the solution has been found, and the method terminates.

b. If the current feasible corner point is not optimal, then go to 2.