1 system planning 2013 lecture 7: optimization appendix a contents: –general about optimization...
TRANSCRIPT
![Page 1: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/1.jpg)
1
System Planning 2013
• Lecture 7: Optimization• Appendix A• Contents:
– General about optimization– Formulating optimization problems– Linear Programming (LP)– Mixed Integer Linear Programming (MILP)
![Page 2: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/2.jpg)
2
Optimization – General
• Discipline in applied mathematics
• Used when:– Want to maximize or minimize something
(e.g. profit or cost) under various conditions (e.g. generation capacities, transmission limits)
![Page 3: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/3.jpg)
3
Optimization – GeneralTypical problems• In what sequence should parts be produced on a
machine in order to minimize the change-over time?• How can a dress manufacturer lay out its patterns on
rolls of cloth to minimize wasted material?• How many elevators should be installed in a new office building to achieve an acceptable expected waiting
time?• What is the lowest-cost formula for chicken food which
will provide required quantities of necessary minerals and other nutrients?
• What is the generation plan for the power plants during the next six hours?
![Page 4: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/4.jpg)
4
Optimization - General
The general optimization problem:
min ( )
s.t. ( )
( )
f x
g x b
h x c
x x x
x x
• f(x): objective function• x: optimization variables (vector)• g(x), h(x): constraints (vectors) • and : variabel limits (vector)
Defines the feasible set
![Page 5: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/5.jpg)
5
Optimization – Formulation
Formulation of optimization problems:
1. Describe the problem in words:• Think through the problem
2. Define symbols• Review the parameters and variables
involved3. Write the problem mathematically
• Translate the problem defined in words to mathematics
![Page 6: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/6.jpg)
6
Optimization – Formulation
The problem:
A manufacturer owns a number of factories. How should the manufacturer ship his goods to the customers?
??
![Page 7: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/7.jpg)
7
Optimization – Formulation
1. The problem in words:
How should the merchandise be shipped in order to minimize the transportation costs? The following must be fulfilled:
• The factories cannot produce more than their production capacities.
• The customers must at least receive their demand
![Page 8: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/8.jpg)
8
2. Define symbols:
• Index and parameters:m factories, factory i has capacity ai
n customers, customer j demand bj units of the commodityThe transportation cost from factory i to customer j is cij per unit
• VariablesLet xij, i = 1...m, j = 1...n denote the number of units of the commodity shipped from factory i to customer j
Optimization – Formulation
![Page 9: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/9.jpg)
9
3. Mathematical formulation:
• Objective function
Transportation cost:
• Constraints
Production capacity:
Demand:
Variable limits:
m
i
n
jijij xc
1 1
miax i
n
jij ...1
1
njbx j
m
iij ...1
1
njmixij ...1,...10
Optimization – Formulation
![Page 10: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/10.jpg)
10
The optimization problem:
njmix
njbx
miax
xc
ij
j
m
iij
i
n
jij
m
i
n
jijij
...1,...1,0
...1,
...1,s.t.
min
1
1
1 1
Optimization – Formulation
![Page 11: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/11.jpg)
11
LP – General
Linear Programming problems (LP problems)• Class of optimization problems with linear objective
function and constraints• All LP problems can be written as (standard form):
0
s.t.
min
x
bAx
xcT
![Page 12: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/12.jpg)
12
LP – General
• LP problems will here be explained through examples (similar as in Appendix A)
• Will have to look at the following:– Extreme points– Slack variables– Non existing solution– Not active constraints– No finite solution or unbounded problems– Degenerated solution– Flat optimum– Duality– Solution methods
![Page 13: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/13.jpg)
13
LP – Example• The problem:
0,0
12124
2s.t.
105min
21
21
21
21
xx
xx
xx
xxz
![Page 14: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/14.jpg)
14
LP – Example
Optimum in:
x1+x2 2
4x1+12x2 12
x1 0
x2
0
z = 20
z = 30
z = 40
Objective:
5.0
5.1
2
1
x
x
5.12z
x2
1
2
3
4
x11 2 3 4
![Page 15: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/15.jpg)
15
LP – Extreme points
• The “corners” of the feasible set are called extreme points
• Optimum is always reached in one or more extreme points!
x1+x2 2
4x1+12x2 12
x1 0
x2
0
z = 20
z = 30
z = 40
x2
1
2
3
4
x11 2 3 4
![Page 16: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/16.jpg)
16
LP – Slack variables
• LP problem on standard form:
• Introduce slack variables in order to write inequality constraints using equality
0
s.t.
min
x
bAx
xcT
![Page 17: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/17.jpg)
17
LP – Slack variables• Without slack variables:
(Ax b)
0,0
12124
2
21
21
21
xx
xx
xx
0,0,0,0
12124
2
4321
421
321
xxxx
xxx
xxx• With slack variables:
(Ax = b)
![Page 18: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/18.jpg)
18
• Can happen that the constraints makes no solution feasible! (Bad formulation of problem)
0,0
1
12124
2s.t.
105min
21
21
21
21
21
xx
xx
xx
xx
xxz
New constraint
LP – Non existing solution
![Page 19: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/19.jpg)
19
B: Feasible set defined by (c)
A: Feasible set defined by (a) & (b)
x1+x2 2
4x1+12x2 12
x1 0
x2
0
x2
1
2
3
4
x11 2 3 4
(a) (b)
x1+x2 1(c)
Feasible set is empty!
LP – Non existing solution
A B
![Page 20: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/20.jpg)
20
LP – Not active constraints
• Some constraints might not be active in optimum.
0,0
7
12124
2s.t.
105min
21
21
21
21
21
xx
xx
xx
xx
xxz
New constraint
![Page 21: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/21.jpg)
21
x2
x1
1
2
3
4
1 2 3 4
x1+x2 2
x2
0
4x1+12x2 12
x1 0
z = 20
z = 30
z = 40
x1+x2 7
Not active constraints
Active constraints
LP – Not active constraints
![Page 22: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/22.jpg)
22
LP – No finite solution
• If the constraints don’t limit the objective: | z|
0,0
12124
2s.t.
min
21
21
21
21
xx
xx
xx
xxzNew objective function
![Page 23: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/23.jpg)
23
x1+x2 2
x2
0
4x1+12x2 12x1 0
x2
x1
1
2
3
4
1 2 3 4
z = -5
z = -4
z = -3
min z -
LP – No finite solution
![Page 24: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/24.jpg)
24
LP – Degenerated solution
• More than one extreme point can be optimal. All linear combinations of these points are then also optimal
0,0
12124
2s.t.
1010min
21
21
21
21
xx
xx
xx
xxzNew objective
![Page 25: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/25.jpg)
25
x1+x2 2
x2
0
4x1+12x2 12x1 0
x2
1
2
3
4
1 2 3 4
z = 30
z = 40
z = 50The line between the extreme points are also optimal solutions
x1
LP – Degenerated solution
![Page 26: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/26.jpg)
26
LP – Flat optimum
• A number of extreme points can have almost the same objective function value.
0,0
12124
2s.t.
99.910min
21
21
21
21
xx
xx
xx
xxzNew objective
![Page 27: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/27.jpg)
27
LP – Flat optimum
x1+x2 2
x2
0
4x1+12x2 12x1 0
x2
1
2
3
4
1 2 3 4
z = 30
z = 40
z = 50
x1
z = 19.980
z = 19.995
![Page 28: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/28.jpg)
28
LP – Duality• All LP problems (primal problem) have a corresponding dual
problem
are called dual variables
0
s.t.
min
x
bAx
xcT
0
s.t.
max
cA
bT
T
Primal problem: Dual problem:
![Page 29: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/29.jpg)
29
LP – Duality
Theorem (strong duality):
If the primal problem has an optimal solution, then also the dual problem has an optimal solution and the objective values of these solutions are the same.
![Page 30: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/30.jpg)
30
LP – Duality
• Q: What does the dual variables describe?• A: Dual variables = Marginal value of the
constraint that the dual variable represents, i.e. how the objective function value changes when the right-hand side of the constraint changes
0
s.t.
min
x
bAx
xcT
One dual variable for each constraint!
![Page 31: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/31.jpg)
31
LP – Dualityx2
x1
1
2
3
4
1 2 3 4
x1+x2 2
x2
0
4x1+12x2 12
x1 0
z = 20
z = 30
z = 40
12
x1+x2 73
In optimum:1 > 0 (active)2 > 0 (active)3 = 0 (not active)
![Page 32: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/32.jpg)
32
• Dual variables • Small changes in right-hand side b
• Change in objective function value z:
LP – Duality
z = Tb
![Page 33: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/33.jpg)
33
MILP – General
Mixed Integer Linear Programming problems (MILP problems)
• Class of optimization problems with linear objective function and constraints
• Some variables can only take integer values
1
2
1
2
1
2
min
s.t.
0
0,1,2,...
T xc
x
xA b
x
x
x
![Page 34: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/34.jpg)
34
MILP – Example
Optimum in:
x1+x2 2
4x1+12x2 12
x1 0
x2
0
Objective:
)5.0(1
)5.1(1
2
1
x
x
)5.12(15z
x2
1
2
3
4
x11 2 3 4
z = 20
z = 30
z = 40
![Page 35: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/35.jpg)
35
MILP – Solving
• Easy to implement integer variables.• Hard to solve the problems.
– Execution times can increase exponentially with the number of integer variables
• Avoid integer variables if possible!
• Special case of integer variables: Binary variables
x {0,1}
![Page 36: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/36.jpg)
36
MILP – Example
• Minimize the cost for buying ”something”• Variable, x: Quantity of ”something”, x 0.
• Not constant cost per unit - cost function.• For example: Discount when buying more than a
specified quantity:Cost [SEK]
Number of ”units”
xb
x1
x2 Split x into two different variables, x1 and x2. Observe that x1≤ xb. Also note that both x1 and x2 are 0.
![Page 37: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/37.jpg)
37
MILP – Example
• Cheaper to buy in segment 2 Must force the problem to fill the first segment before entering segment 2.
• Can be performed by introducing a binary variable.
Cost [SEK]
Number of ”units”
xb
x1
x2
![Page 38: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/38.jpg)
38
MILP – Example
• Introduce the following constraints:
0
0
2
1
Msx
sxx bs=0 s=1
Cost [SEK]
Number of ”units”
xb
x1
x2
Check if s=0: 000,0 2221 xxxx
Check if s=1:MxMx
xxxxxx bbb
22
111
0
,0
where M is an arbitrarely large number.
• Let s be an integer variable indicating whether being in segment 1 or 2.
![Page 39: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/39.jpg)
39
LP – Solution methods
• Simplex:Returns optimum in extreme point (also whendegenerated solution)
• Interior point methods:If degenerated solution: Returns solution between twoextreme points
![Page 40: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/40.jpg)
40
LP – Solution methods
x1+x2 2
x2
0
4x1+12x2 12x1 0
x2
1
2
3
4
1 2 3 4
z = 30
z = 40
z = 50
Simplex
Interior point method
![Page 41: 1 System Planning 2013 Lecture 7: Optimization Appendix A Contents: –General about optimization –Formulating optimization problems –Linear Programming](https://reader035.vdocuments.us/reader035/viewer/2022062804/5697bf8e1a28abf838c8c936/html5/thumbnails/41.jpg)
41
PROBLEM 11 - Solutions to LP problems
Assume that readymade software is used tosolve an LP problem. In which of the followingcases do you get an optimal solution to the LPproblem and in which cases do you have toreformulate the problem (or correct an error inthe code).
a) The problem has no feasible solution.b) The problem is degenerated.c) The problem does not have a finite solution.