投影片 1 - COMP ENG

Outline


Simplex algorithm
The initial basic feasible solution
18/03/2009
Ch.29 Linear Programming
1
An example of simplex algorithm

Linear program in standard form
18/03/2009
Ch.29 Linear Programming
2
An example of simplex algorithm

Putting the linear program into slack form(29.1)

The system of constraints (29.62)-(29.64) has 3 equations and
6 variables. Any setting of the variables x1 , x2 , x3 defines
values for x4 , x5 , x6; therefore an infinite number of
solutions to this system of equations.
18/03/2009
Ch.29 Linear Programming
3
Basic solution

Set all the (nonbasic) variables on the righthand to 0 and then compute the values of the
(basic) variables on the left-hand side. In this
example,the basic solution is
 x1, x2 , x3 , x4 , x5 , x6   (0,0,0,30,24,36)

If a basic solution is also feasible, we call a
basic feasible solution.
18/03/2209
Ch.29 Linear Programming
4
Our goal


Our goal in each iteration is to reformulate the
linear program so that the basic solution has a
greater objective value.
We select a nonbasic variable x whose
coefficient in the objective function is positive
and we increase the value of x as much as
possible without violating any of the
constraints
18/03/2009
Ch.29 Linear Programming
5
Example

To continue the example let us think about
increasing the value of x1 As we increase x1
the values of x4 , x5 , x6 all decrease. Because
we have a nonnegativity constraint for each
variable we cannot allow the any of them to
become negative. If x1 increases above 30,
then x4 becomes negative,while x 5 , x6
become negative when x1 increases above
12,and 9 respectively
18/03/2009
Ch.29 Linear Programming
6
An example of simplex algorithm

Switch the role of x1 and x6

Rewrite other equations
18/03/2009
Ch.29 Linear Programming
7
An example of simplex algorithm

After rewrite the linear program
New basic solution
( x1 , x2 , x3 , x4 , x5 , x6 )  (9, 0, 0, 21, 6, 0)
objective value z  27
This operation is pivot. Choose a nonbasic variable-entering
variable,and a basic variable-leaving variable, exchanges roles.
18/03/2009
Ch.29 Linear Programming
8
An example of simplex algorithm



After x3 entering and x5 leaving
Basic solution (33/4, 0, 3/2, 69/4, 0, 0)
Objective value = 111/4
18/03/2009
Ch.29 Linear Programming
9
An example of simplex algorithm



After x2 entering and x3 leaving
Basic solution (8,4,0,18,0,0)
Objective value = 28
18/03/2009
Ch.29 Linear Programming
10
Basic solutions

The objective function variable P is always
selected a basic variables and never selected
as a nonbasic varaible
18/03/2009
Ch.29 Linear Programming
11
Selecting Basic and Nonbasic
variables



Determine the number of basic variables.
These numbers do nıt change during simplex
process
Basic varaibles: A variable can be selected as
a basic variable only if it correspondes to a
column in the tableu that has exactly one
nonzero element(usually 1)
Nonbasic variables: Remaining variables
18/03/2009
Ch.29 Linear Programming
12
Example
P  50 x1  80 x2  max
x1  2 x2  32
3x1  4 x2  84
x1 , x2  0
18/03/2009
Ch.29 Linear Programming
13
Example
P  50 x1  80 x2  max
x1  2 x2  s1  32
3x1  4 x2  s2  84
x1 , x2 , s1 , s2  0
18/03/2009
Ch.29 Linear Programming
14
Example
x1  2 x2  s1  32
3 x1  4 x2  s2  84
50 x1  80 x2  P  0
x1 , x2 , s1 , s2  0
18/03/2009
Ch.29 Linear Programming
15
Initial simplex tableu

Initial simplex tableu
x1
s1 1
s2 3
x2
2
4
P -50 -80
s1 s2
1
0
0
0
1
0
P RHS
0
0
1
32
84
0

18/03/2009
Ch.29 Linear Programming
16
Pivot operation

Entering variable x2
x1
s1 1
s2 3
x2
s1 s2
2
1
4
0
P -50 -80 0
32:2=16 small
84:4=21
18/03/2009
0
1
0
P RHS
0
0
1
Ch.29 Linear Programming
32
84
0
17
Simplex tableu
x1
1
R1  R1
2
x2
s1 1/2 1
4
s2 3
-50
-80
P
18/03/2009
s1 s2
P RHS
1/2 0
0 1
0 0
0
0
1
Ch.29 Linear Programming
16
84
0
18
Simplex tableu
(4) R1  R2  R2 ,80 R1  R3  R3
x1
x2
s1 s2
P RHS
0
1/2 0
-2 1
40 0
0
0
1
x 2 1/2 1
0
s2 1
-10
P
18/03/2009
Ch.29 Linear Programming
16
20
1280
19
Simplex tableu
x1
x2
s1 s2
P RHS
0
1/2 0
-2 1
40 0
0
0
1
x 2 1/2 1
0
s2 1
-10
P
16
20
1280

18/03/2009
Ch.29 Linear Programming
20
Simplex tableu
x1
x2
s1 s2
P RHS
0
1/2 0
-2 1
0 40
0
0
1
s1 1/2 1
0
x2 1
-10
P
16
20
1280

16:1/2=32
18/03/2009
20:1=20 pivot 1
Ch.29 Linear Programming
21
Simplex tableu
x1
x1 0
x2 1
0
P
1
( ) R2  R1  R1 ,10 R2  R3  R3
2
x2
s1 s2
P RHS
1
0
0
3/2 -1/2
-2 1
20 10
0
0
1
6
20
1480
x1  20, x2  6, s1  0, s2  0
P  1480
18/03/2009
Ch.29 Linear Programming
22
Pivoting

The procedure PIVOT takes an input a slack
form,given by the tuple (N,B,A,b,c,v) the
index l of the living variable xl and the index
e of the entering variable xe
18/03/2009
Ch.29 Linear Programming
23
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The formal simplex algorithm
Assume that we have a procedure INITIALIZESIMPLEX(A,b,c) that takes as inpur a linear
program in standart form,that is an m x n
matrix A, an m dimensional vector b and ndimensinal vector c. If the problem infeasible
it returns a message that the program
infeasible and then terminates.Otherwise it
returns a slack form for which the initial basic
solution is feasible.
18/03/2009
Ch.29 Linear Programming
25
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The initial basic feasible solution

In this section we first describe how test if a
linear program is feasible, and it is how to
produce a slack form for which the basic
solution is feasible. We conclude fundamental
theorem of linear programming, which says
that the SIMPLEX procedure always produces
the correct result.
18/03/2009
Ch.29 Linear Programming
27
Example

Consider the following linear program
18/03/2009
Ch.29 Linear Programming
28
Example

If we were convert this linear program to
slack form the basic solution would set x1  0
and x2  0 . This solution violates constraint
(29.107) and it is not a feasible solution. Thus
INITIALIZE-SIMPLEX cannot just returns
the obvious slack form. By inspection it is not
clear whether this linear program even has
any feasible solutions
18/03/2009
Ch.29 Linear Programming
29
Auxiliary linear program

In order to determine whether it does we can
formulate an auxilary linear program . For this
auxiliary program we will be able to find a
slack form for which the basic solution is
feasible. Furtermore, the solution of auxilary
linear program will determine whether the
initial linear program is feasible and if so it
will provide a feasible solution with which we
can initialize SIMPLEX
18/03/2009
Ch.29 Linear Programming
30
Auxiliary linear program

Lemma.
Let L be a linear program in standart form .
Let Laux be the following linear program
with n+1 variables:

x0  max
n
a x
j 1
ij
j
 x0  bi , i  1, 2,...m
x j  0, j  0,1,...n
Then L is feasible if and only if the optimal
objective value of Laux is 0
18/03/2009
Ch.29 Linear Programming
31
Auxiliary linear program

Proof of lemma. Suppose that L has a feasible
solution x  ( x1, x2 ,...xn )
Then the solution x0  0 combined with x is a
feasible solution Laux with objective value 0.
Since x0  0 is a constraint of Laux this
solution be optimal for Laux.Conversely,
suppose that the optimal objective value of
Laux is 0. Then remaining variables satisfy L
18/03/2009
Ch.29 Linear Programming
32
Example.

We now demonstrate the operation
INITIALIZE-SIMPLEX on the example.
 x0  max
2 x1  x2  x0  2
x1  5 x2  x0  4
x1 , x2 , x0  0
18/03/2009
Ch.29 Linear Programming
33
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example

We write this linear program in slack
form,obtaining
18/03/2009
Ch.29 Linear Programming
35
Example
18/03/2009
Ch.29 Linear Programming
36
Example
4 x0 x1 x4
2 x1  x2  2 x1  (    )
5 5 5 5
Set x0=0 and simplifying
4 9 x1 x4
 
5 5 5
18/03/2009
Ch.29 Linear Programming
37
Example.
4 9 x1 x4
z  

5 5
5
4 x1 x4
x2   
5 5 5
14 9 x1 x4
x3  

5
5
5
18/03/2009
Ch.29 Linear Programming
38
Fundamental theorem of linear
programming

Any linear program L, given in standard form,
either:



18/03/2009
Has an optimal solution with a finite objective
value
Is infeasible
Is unbounded
Ch.29 Linear Programming
39
Background




18/03/2009
The Simplex Algorithm
George Dantzig
born 8.11.1914,
Portland
invented "Simplex
Method of
Optimisation" in
1947
this grew out of his
work with the USAF
40