optimization lecture 2
TRANSCRIPT
-
8/10/2019 optimization Lecture 2
1/36
Lecture 2 Simplex methodsbasic idea of the is to confine the
search to corner oints of the feasible re ion
o which
The simplex method
) in a most intelligent wthere are only finitely many ay.
see corner points;
simplex algorithe can be used to solve anthe must be converted into a problem where all the
thm ,
Before LPLP
constraints are and all variables are nonnegatiequati veons .
in this f standardorm is said formto be in a .
An LP
-
8/10/2019 optimization Lecture 2
2/36
Standard FoConvert the rmto theLP LP
not in standard form isTheLP
in isstandard formTheLP
1 2
Subject to
1 2
Subject to
.
.
1 2x x 40
2x
x 60
.
.
11 2x x 40
2x x 60
s
s
,1 2 x x , , ,1 21 20 x x 0s s
u y, vit to an constraint by adding a slack variable to the thequality
,
i is .
-
8/10/2019 optimization Lecture 2
3/36
an has both and constraints apply the previous ,If LP
an below:
.Consider LP
standarNon d form
Standard form
1 2ax
Sub ect to
z x x
1 2x xax
Sub ect to
1 x 1 1100 x 100 s
2
1 2
50x 35x 6000
2
1 2
2
3
x
50x 35x 6000
s
s
1 2 20x 15x 2000
-1 2 420x e15x 2000
,1 2 , , , , ,1 2 1 2 3 4
-
8/10/2019 optimization Lecture 2
4/36
2. Preview of the Simplex Algorithm
an with m constraints and n variableshas been converted into the standard form
.
Suppose LP
from of such an is:The LPor 1 1 2 2 n nc xax n
Sub ec
c x c x
t
o
11 1 12 2 1n n 1 a x a x a x a x a x a x b
m m mn
, .,
n m
i x 0, i = 1 n
-
8/10/2019 optimization Lecture 2
5/36
we define
If
11 12 1n 1 1a a a x b
,, ,
21 22 2n 2 2a a a x bA x b
m1 m2 mn n ma a a x b
. Ax b
a basic solution to is obtained by settingvariables equal to and solving for the remaining
,Ifn m Ax bn m 0
var a es
assumes that setting the variables equal to
.
This
m
n 0myields a value for the remaining variables orequivalently the columns for the remaining variables
unique ,,
mm
are near y n epen ent.
-
8/10/2019 optimization Lecture 2
6/36
find a basic solution to we choose a set ofvariables and set each of ,
the ornonbasic variablesTo A
Nx b n m
BV
these variables equal to
we solve for the values of the ( ) variabl
.
Then
0
n m mn es
nonbasic variables basic solutions
( ) that satisfy
lead to different
the , or .
.
basic variables
Different
Ax bBV
basic sothe to the following equations:lutionConsider
1 2 xx 3
number of nonbasic variables .The
2 3 - x x -13 2 1-
for example { } then { }
can obtain the values for th basic variableese b settis n
, , , , .Setting
e
3 1 2xNB x xVV B
,3x 0 that is
.1 2x x 3
- x -0 1
basic solutionand is a, , .Thus 1 2 3x 2 x 1 x 0
-
8/10/2019 optimization Lecture 2
7/36
{ }and { } the becomesbasic solution, ,If 1 2 3NBV BVx x x
basic solutionan
{ }and { } the becomes , .
, ,If
1 2 3
2 1 3NBx x xx x xBVV
and
set
, .
Some
1 2 3x 3 x 0 x -1
s of variables do not ield a basic solution .m
the following linear system:Consider
1 2 3
1 2 3 2x x x4
.3
sol
would satisfut on yi
, ,3 1 2
1 2x 2x 1
t
.
Since
1 2 2x 4x 3
basihis c sos stem h lutionas no solution, there is no
corresponding to { }, .1 2xB xV
-
8/10/2019 optimization Lecture 2
8/36
Preview of the Simplex Algorithm
basic solution in which all variables are
is called abasic feasible soluti
nonnegativ
o
e
n
or .
Any
b s
the basic solutions in the previous exa empl , ,For 1x 2,2x x an are as c eas e
solutions the basic solution fails
, ,
, , ,but3 1 2 3
1 2 3
x x x
x 3 x 0 x -1
to e a basic feasiblfollowin show that a e
ecause .two tThe heorems
3s x
is ofsolution great importance in .LP
-
8/10/2019 optimization Lecture 2
9/36
:Theorem 1
eas e reg on or any near programm ng pro emis a convex set
.
an as an , t ere must e an
extreme point
o
of
pt m
the
a so ut on
feasible region optimalthat is
,
.
so
Theoremuni ue extremean there is a oint of the
: , s
For L PP L
2
each basic feasibfeasible region corresponding to solutionle .
point in the fe
,
asible region.
-
8/10/2019 optimization Lecture 2
10/36
relationship between andextreme points basic feasibleThe
so u ons ou ne n s seen n( ) is:in the standard form
, . with slack variabl esThe
xamp eLP
eorem
X2
60 D
1 2Maximiz z 4x 3xe
50
Labor Constraint
.11 2x x 40s
3
4
0
Feasible Region
B
.
, , ,2
1
1
2
2
1 2
s
x x s 0
20
ELeather Constraintinequalities show the
.
Two shaded
area
10extrem of the
feasible region are
e points
, , ,
The
B C E .FX110 20 30 40 50F
-
8/10/2019 optimization Lecture 2
11/36
Table 1
, , , ( )
1 2 1 21 2 1 2s s s sx x 0 x x 20 E z 140
, , , , ( )1 2 2 11 2 2 1x x x 0 x 30 10 C z 120s s s s
, , ,1 22 1 11 2x x xs s s x -
-
,
, , , , (
2 2s s
s s s s s
s
b sx x x 0 x 60 20 0
no
no
, , , , ( )2 1 1 22 1 1 2s s s s x x x 0 x 40 20 B z 120
, , , , ( )1 2 1 21 2 1 2 s s x x x x 0 40 60 F z 0s s
to the and the extreme points of the feasible region .LP
in a natural fashion to the ex
sLP treme points.
-
8/10/2019 optimization Lecture 2
12/36
The Simplex Algorithm For MaxLPs
standathe to rd form
Convert LPStep 1
Deter
Step 3 whether the current is optimalmine bfst e current s not opt ma eterm ne w c
should be comnonbasic variable basice a andvariable ,step
to find a with a better objective function value
.
'
bfs
with a better objective function value b
. Go
ack to .Step 3
:s s mp ex a gor m e s n e orm
,n o ec ve unc no
1 1 2 2 n n
z c x c x c x 0.
.call this format the row version of the objective functionWe 0
-
8/10/2019 optimization Lecture 2
13/36
: 1 2 360x 30x 20xExamp maximizele 2
1 2 3
1 2 3
x x x4x 2x 1.5x 20
su ec o
1 2 3 2x 1.5x 0.
x
5 8
2x 5 , ,
Standar form1 2 3 x x x 0.
1 2 3maximi z 60x 30x 20x 8x 6x
zesub ect t
o
x 48s
1 2 23 4x 2x 1.5x 20s
1 2 3
2
3 . .
x
4 5s
, , , , , ,1 2 3 1 2 3 4
x x x s s s .s
-
8/10/2019 optimization Lecture 2
14/36
Solution
-
Example 2 - con
yields the equations and basic variables
.
1 2 3 z 60x 30x 20x 0 z 0
Row 0
1 2 3
1 2 3
1 1
2
x x xow s s
Ro 4x 2x 1.5xw 2 s
2s20 20
3 3
4
1
4
2 3
2
ow s sRow
x . x . xx 54 s 5s
we setIf 1 2 3x = x = x we can solve for the values
{ }and { }
, , , , .
, , , , , , .Thus
1 2 3 4
1 2 3 1 2 34
=
BV
0
=
s s s s
s s s NB = x x xVseach constraint is then in canonical form ( s have a coefficient
in one row and zeros in
Since = 1BV
right - hand side) r) with a nonnegative ( hsall other rows ,
.
-
8/10/2019 optimization Lecture 2
15/36
Solution -Example 2 - con Step 2
perform the simplex algorithm we need a basic ( , although .To
a n a as c eas e o u on
) variable for
a ears in w
not necessarily nonnegative .
Since
row 0
row 0z ith a coefficient of and does,1 znot appear in any other we use as thebasic variable, .row z
initial canonical form has:
= = ,
this initial
, , , , , .
, , , , , ,For 1 2 3 4z = 0 = 48 = 20 = 8 = 5bfs s s ss
this example indicates a can be used as aslack variable
.
,As
1 2 3
.
-
8/10/2019 optimization Lecture 2
16/36
we have obtained a we need to determine whether it is optimal:
, .Oncebfs
bfsDetermine if the Current is OptimalStep 3
do this we try to determine if there is any way can be increasedby inc ,To z
nonbasic variablereasing some from its current value of zeronon as c var aw e o ng a o er a e r curr es en va ues o
zero.
non
eachFor
1 2 3
basic variablenonbasic variab
we can use the equation above to determineif increasin a le
,but hold nonbasicin all other
nonbasic) will increase
any of the wvaria i lble lvari to .a l
b es
Increasing0 z
cause an increase in .z
increasing causes the greatest rate of increase in
increases from its current value of it will have to become a
.
,
However
If
1
1 zero
x
xas c var a
this reason is
e.
,For 1x called the entering variable.
as e mos nega ve coe c en n .serve 1 rowx
-
8/10/2019 optimization Lecture 2
17/36
:Step 4
choose the ( ) to thewith the most negative coefficient
entering variableinnonbasic variable
in a max problemWerow 0.
,current basi 1
c variables ( ) will change value, , , .1 2 3 4s s s s
., 1
RATIO
we have
, . ,
, . ,In Since
1 1
2
1 1
1 2 1
row 2 s s
-
= 20 - 4x 0 x 20 4 = 5
, . ,
,In
3 31 1 -
row 4
we have any will always be . , .For 414 5= xs s 0
means o eep a e as c var a es nonnega ve e argeswe can make is { } ,
, , .s
1 6 5 4 4m nx i
-
8/10/2019 optimization Lecture 2
18/36
The Ratio TeSolution - stExample 2 - con
entering a variable into the basis, compute the ratio:
of of enterin variable in row
When
rhs row coe icient
every constraint in which the enteringFor variable has a
constraint with the smallest ratio is called the winner
.
The
smallest ration is the large enterinst value of the g
.
The
nonnegative.
e en er ng var a e a as c var a e nsince this ( ) was the winner of the ratio test
constraint
a e 1x rowrow
.
-
8/10/2019 optimization Lecture 2
19/36
Solu Theti Ratio Teston -Example 2 - con
ma e a n we use e emen aryrow operations ( ) to make have a coefficient of
as c va er a ,s
o 11 1
rowxxero
row r
procedure is called pivoting on ; and
.
This
ows
row 3 row 3s ca e e
final result is that replaces as the basic variable
.
The 31
p vot row
sx
forterm in the that involves th
. The
row 3pivot row e entering basic
variable is called the .pivot term
-
8/10/2019 optimization Lecture 2
20/36
Gauss - Jordan method using and: sThe ero simplexStep 5
ero 1 z x1 x2 x3 s1 s2 s3 s4 rhs ero
0 1 -60 -30 -20
1 8 6 1 1 48
2 4 2 1.5 1 20
3 1 0.75 0.25 0.5 4 row 3 divided by 1/2
4 1 1 5ero z x x x s s s s r s
0 1 15 -5 30 240 60 times row 3 added to row 0
1 8 6 1 1 48
2 4 2 1.5 1 20
3 1 0.75 0.25 0.5 4
4 1 1 5
ero 3 z x1 x2 x3 s1 s2 s3 s4 rhs
-
1 -1 1 -4 16 - 8 times row 3 added to row 1
2 4 2 1.5 1 20
3 1 0.75 0.25 0.5 4
ero 4 z x1 x2 x3 s1 s2 s3 s4 rhs
0 1 15 -5 30 240
1 -1 1 -4 16
2 -1 0.5 1 -2 4 - 4 times row 3 added to row 2
3 1 0.75 0.25 0.5 44 1 1 5
-
8/10/2019 optimization Lecture 2
21/36
The ResultExample 2 - con
32 3
z 15x 5x 30 240 z 240Row 0 s
ow 1 3 1
2 3 2
3
2 3
x
x 0.5x 2 4 4
s s
Row 2 s s s
1 2 33 1 x 0.75x 0.25x 0.5 4 x 4
Row 3 s
Row 4 x
2 4 45s s 5
{ , , , , }and { }, , , .In 1 21 32 4 3BV NBVCanonical Form x x x1 s s s s
, , , ,
.1 2
3
1
2 3
4
x
0xs
called an iteration ( ) of the simplex algorithm
or sometime pivot .
-
8/10/2019 optimization Lecture 2
22/36
Example 2 - con.
is optimal
,.
2 3 3
z 240 15x 5
sx 30 current i os nThe bfs optimal because increasing to
( ) will increaset
while holding the other tononbasic variable3
1x0
the value ofeither or basic will caused the value of
. Making 2 3x zsto
- Reca
decre
ll
a
th
se.
Ste 4 e rule for determinin the enterin variable is the coefficient with the greatest negative value
is the onl variable with a coefficientne ative
.
Sincex x
row 0
should be entered into eth basis.
-
8/10/2019 optimization Lecture 2
23/36
iteration ivotBe in 2
Example 2 - con.
the ratio test using as the entering variablePerforming 3x
for all vaules of
,From31
row 1 0 xs since1 3
s = 16 x
,
,
From if
From if
2 3row 2 s
row 3
0 x 4 0.5 = 8
x 0 x 4 0.25 = 16
for all vaules of, .From since34 4row 4 s 0 x 5=s
means o eep a e as c var a es nonnega ve el
,sargest we can make is { } , .3x 8 16 =min 8
pivotbecomes the
use to make a basic variable in
, .
- s, .
So
Now 3
row 2 ro
er
w
Step 5 rx ow 2o
-
8/10/2019 optimization Lecture 2
24/36
use to make a basic variable in- s, .Now 3eroStep 5 row 2x
ero 1 z x1 x2 x3 s1 s2 s3 s4 rhs
0 1 15 -5 30 240
1 -1 1 -4 16
2 -2 1 2 -4 8 multiplied row 2 by 2
3 1 0.75 0.25 0.5 4
4 1 1 5
ero 2 z x1 x2 x3 s1 s2 s3 s4 rhs
0 1 5 10 10 280 add 5 times row 2 to row 0
1 -1 1 -4 16
2 -2 1 2 -4 8
. . .
4 1 1 5ero 3 z x1 x2 x3 s1 s2 s3 s4 rhs
0 1 5 10 10 280
1 -2 1 2 -8 24 add row 2 to row 1
2 -2 1 2 -4 8
3 1 0.75 0.25 0.5 4
4 1 1 5
ero 4 z x1 x2 x3 s1 s2 s3 s4 rhs
0 1 5 10 10 280
1 -2 1 2 -8 24
- -
3 1 1.25 -0.5 1.5 2 add -1/4 times row 2 to row 3
4 1 1 5
-
8/10/2019 optimization Lecture 2
25/36
The Result inExample 2 Canonical Form 2- con
Canonical Form 2z 5x 10 10 280 z 280
Basic VariableRow 0 s s
Row 1 1 2 3 12 2x 2 8 24 24s s s s
22 3 3
1
3
22 13
x 1.25x 0.5 1.5 2 x 2
Row 3 s s
ow
,In4 42
x s s
Canonical Form 2
{ , , , , }and { }
the and
, , .
Yieldin
1 4 3 23 21= z xBV NBV
b s
x = x
28
s s s s
s s0 24 x 8 x 2 5 .2 23s s x 0
-
8/10/2019 optimization Lecture 2
26/36
Example 2 - con.
for in yields:Solving z
row 0 z 280 5x 10 10
s
can see that increasing ( , , or while holding theWe 2 2 3s sx
solution at the end of is therefore optimal
.
.The iteration 2
following rule can be appliecanonical form d to determine whether aoptimals is : The bfs
optimalis ( for a max proAcanonical form ) if each
nonbasic variable has a nonnegative coefficient in the
blem
canonical form s . row 0
-
8/10/2019 optimization Lecture 2
27/36
The Big M Meth do
problems have found starting by using
.
Previous bfss ac var a ae as our
an have or constra
s c var a s
nts
e
i
es .
,If LP
however a starting,may no e rea y apparen
such a case the method may be used to solve
.
,In
s
Big M
t e 1 2
minimize z 2x 3x
.1 20.5x 0.25x 4subject to
..
2
1 2
x x 10
.,1 2 x x
-
8/10/2019 optimization Lecture 2
28/36
LP standard formThe in
= 1 2 z 2x 3x 0.5x 0.25x 4MinimizeSub ect to
s
21 2 x 3x 20e
1 2
0, , , 1 21 2 x x s e
order to use the simplex method a is needed , . In sbf
variables will be labeled accord
ing t
, .
The
o the row in which they
.
-
8/10/2019 optimization Lecture 2
29/36
Example 3 - con. rtificial Variables
1 2
Row 0 z 2x 3x 0
1 2ow s . x . x
2
1
21 2
x 3x 20Row 2 e a
31 2 x x 10Row a3
b
e set equal to zero.
to the objective functio artificial variablesn for each, ,
.i
ia
function , i-
for each .ia
represents some very arge num er.
-
8/10/2019 optimization Lecture 2
30/36
Example 3 - con.
modified in standard form then becomes
The1 2 2 3Row 0
LP z 2x 3x 0
- M - M a a
11 2Row 0.5x 0.25x 41 s
Row 2
e x 3x 20a
2 31Row x x3 1a 0
e o ec ve unc on s way ma esextremely costly for an a y
to be positivertificial variab sle .
optimal solution should force .The 2 3a a 0
-
8/10/2019 optimization Lecture 2
31/36
Initial TableauExample 3 - con.
Row z x1 x2 s1 e2 a2 a3 rhs
. - . - . - - .
1 0.50 0.25 1.00 4.00
. . . . .
3 1.00 1.00 1.00 10.00
2 3 in Row 0,To make = =0a a
Row 0+ M*(Row 2)+M*(Row 3)
-
8/10/2019 optimization Lecture 2
32/36
Pivot 1 z x1 x2 s1 e2 a2 a3 rhs ratio ero0 1.00 2M - 2 4M -3 -M 30M Row 0 + M(Row 2) + M(Row 3)
1 0.50 0.25 1.00 4.00 16
2 1.00 3 -1.00 1.00 20.00 6.67
3 1.00 1.00 1.00 10.00 10
ero 1 z x1 x2 s1 e2 a2 a3 rhs ero
0 1.00 2M-2 4M -3 -M 30M . . . .
2 0.33 1 -0.33 0.33 6.67 Row 2 divided by 3
3 1.00 1.00 1.00 10.00
ero 2 z x1 x2 s1 e2 a2 a3 rhs ero
0 1.00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/3 Row 0 - (4M-3)*(Row 2)
1 0.50 0.25 1.00 4.00
2 0.33 1 -0.33 0.33 6.673 1.00 1.00 1.00 10.00
ero 3 z x1 x2 s1 e2 a2 a3 rhs ero
0 . - - - +
1 0.42 1.00 0.08 -0.08 2.33 Row 1 - 0.25*(Row 2)
2 0.33 1 -0.33 0.33 6.67
3 1.00 1.00 1.00 10.00
0 1.00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/3
1 0.42 1.00 0.08 -0.08 2.33
2 0.33 1 -0.33 0.33 6.67
3 0.67 0.33 -0.33 1.00 3.33 Row 3 - Row 2
-
8/10/2019 optimization Lecture 2
33/36
The Solution - con
Pivot 2 z x1 x2 s1 e2 a2 a3 rhs ratio
0 1.00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/3
1 0.42 1.00 0.08 -0.08 2.33 5.60
2 0.33 1 -0.33 0.33 6.67 20.00
3 0.67 0.33 -0.33 1.00 3.33 5.00
ero 1 z x1 x2 s1 e2 a2 a3 rhs ero
0 1.00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/3-. . . . .
2 0.33 1 -0.33 0.33 6.67
3 1.00 0.50 -0.50 1.50 5.00 (Row 3)*(3/2)
ero 2 z x1 x2 s1 e2 a2 a3 rhs ero
0 1.00 -0.50 (1-2M)/2 (3-2M)/2 25.00 Row 0 + (3-2M)*(Row 3)/3
. . . - . .
2 0.33 1.00 -0.33 0.33 6.67
3 1.00 0.50 -0.50 1.50 5.00
ero 3 z x1 x2 s1 e2 a2 a3 rhs ero
0 1.00 -0.50 (1-2M)/2 (3-2M)/2 25.00
. - . . - . . ow - ow
2 0.33 1.00 -0.33 0.33 6.67
3 1.00 0.50 -0.50 1.50 5.00
ero 4 z x1 x2 s1 e2 a2 a3 rhs ero
0 1.00 -0.50 (1-2M)/2 (3-2M)/2 25.00 O timal Solution1 1.00 -0.13 0.13 -0.63 0.252 1.00 -0.50 0.50 -0.50 5.00 Row 2 -(1/3)*Row 3
3 1.00 0.50 -0.50 1.50 5.00
-
8/10/2019 optimization Lecture 2
34/36
The summary for the optimal solution
variable with the positive coefficient in rowshould enter the basis since this is a problem .
Themin
ratio test indicates that hould enter the sThe 2x
basis in which means the artificial variable,row 2will leave the basis.
2a
ratio test indicates that
.
should enter theThe 1
x
,
the basis.3
optimal solu is .tion ,The
e esu t
1 2z 25 x x 5
-
8/10/2019 optimization Lecture 2
35/36
Tutorial
the simplex method to solve the following Using LP
1 2ax m ze z x x
.
.1
x
2x 12
.1 2 3x 2x 18
,1 2 x x .
-
8/10/2019 optimization Lecture 2
36/36
LPsThe Simplex Algorithm for Min
the following :Consider LP
1 2 n m ze x x
.1 2 x x
.
,1 2
1 2
x x 0.