You are on page 1of 24

Simplex Method

George Dantzig

(FEUP | DEGI)

Operations Research

March 3, 2014

1 / 24

Simplex Method Learning Objectives I


Ability to transform any linear program to a canonical form:
with nonnegative variables
by replacing each decision variable unconstrained in sign by a difference between two nonnegative variables. This
replacement applies to all equations including the objective function.

with equality constraints


by changing inequalities to equalities by the introduction of slack and surplus variables.
by multiplying equations with a negative righthand side coefficient by -1.

with one basic variable isolated in each constraint


by adding a (nonnegative) artificial variable to any equation that does not have an isolated variable readily apparent, and
construct the BIG M objective function.

Ability to use the Simplex Method in tableau form to solve a linear program represented in the
Canonical Form, i.e.:
Ability to determine the starting point to initiate the simplex method.
Ability to write the linear program in tableau form.
Ability to use the improvement mechanism for moving from a point to another point with a
better value of the objective function.
Improvement Criterion
In a maximization (minimization) problem, choose the nonbasic variable that has the most positive (negative) coefficient in
the objective function of a canonical form.
If that variable has a positive coefficient in some constraint, then a new basic feasible solution may be obtained by pivoting.
Ratio and Pivoting Criterion
When improving a given canonical form by introducing variable xs into the basis, pivot in a constraint that gives the
minimum ratio of righthand-side coefficient to the corresponding xs coefficient. Compute these ratios only for constraints
that have a positive coefficient for xs .
(FEUP | DEGI)

Operations Research

March 3, 2014

2 / 24

Simplex Method Learning Objectives II

Ability to detect termination criteria to indicate when a solution has been obtained by
demonstrating that:
there is no feasible solution;
the solution is optimal;
there is more than one optimal solution;
the objective function is unbounded over the feasible region.

(FEUP | DEGI)

Operations Research

March 3, 2014

3 / 24

http://www.cccblog.org/2012/08/20/the-algorithm-that-runs-the-world/
(FEUP | DEGI)

Operations Research

March 3, 2014

4 / 24

The method proceeds by


moving from one feasible solution to another, at each step
improving the value of the
objective function and terminates after a finite number of
such transitions.

http://en.wikipedia.org/wiki/File:Simplex-method-3dimensions.png
(FEUP | DEGI)

Operations Research

March 3, 2014

5 / 24

Simplex method: A systematic procedure for solving linear


programs
Two important characteristics of the simplex method:
The method is robust

it solves any linear program;


it detects redundant constraints in the problem formulation;
it identifies instances when the objective value is unbounded over
the feasible region;
it solves problems with one or more optimal solutions;
the method is also self-initiating: it uses itself either to generate
an appropriate feasible solution, as required, to start the method,
or to show that the problem has no feasible solution.

The method provides much more than just optimal solutions. .


it indicates how the optimal solution varies as a function of the
problem data (cost coefficients, constraint coefficients, and
righthand-side data).
it gives information intimately related with a linear program called
the dual of the given problem: the simplex method automatically
solves this dual problem along with the given problem.

(FEUP | DEGI)

Operations Research

March 3, 2014

6 / 24

The canonical form

Objective:
max
0x1
Subject to:
1x1
0x1
x1 ,

(FEUP | DEGI)

+0x2

3x3

x4

+20

+0x2
+1x2
x2 ,

3x3
8x3
x3 ,

+3x4
+4x4
x4

=6
=4
0

Operations Research

March 3, 2014

7 / 24

The canonical form Unbounded objective value

Objective:
max
0x1
Subject to:
1x1
0x1
x1 ,

(FEUP | DEGI)

+0x2

+3x3

x4

+20

+0x2
+1x2
x2 ,

3x3
8x3
x3 ,

+3x4
+4x4
x4

=6
=4
0

Operations Research

March 3, 2014

8 / 24

The canonical form Improving a nonoptimal solution

Objective:
max
0x1
Subject to:
1x1
0x1
x1 ,
Objective:
max
0x1
Subject to:
1x1
0x1
x1 ,

(FEUP | DEGI)

+0x2

3x3

+x4

+20

+0x2
+1x2
x2 ,

3x3
8x3
x3 ,

+3x4
+4x4
x4

=6
=4
0

+ 14 x2

x3

+0x4

+21

34 x2
+ 14 x2
x2 ,

3x3
2x3
x3 ,

+0x4
+1x4
x4

=3
=1
0

Operations Research

March 3, 2014

9 / 24

Production Planning at BA
Linear Programming Model
Objective:
max

Z = 50xVP + 60xA

Subject to:
50xVP +

30xA

2000

6xVP +

5xA

300

(space in the warehouse)

3xVP +

5xA

200

(capacity in the decoration sector)

xVP ,

xA

(time in the oven)

Adding slack variables s1 , s2 and s3 :


Objective:
max 50xVP + 60xA
Subject to:
50xVP
+30xA
6xVP
+5xA
3xVP
+5xA
xVP ,
xA ,
(FEUP | DEGI)

+s1
+s2
s1 ,

s2 ,

Operations Research

+s3
s3

=
=
=

2000
300
200
0
March 3, 2014

10 / 24

XA

80

70

50XVP + 30XA = 2000

Objective:
max Z = 50xVP + 60xA
Subject to:
50xVP
+30xA
6xVP
+5xA
3xVP
+5xA
xVP ,
xA ,

60

50

Z = 50XVP + 60XA

40

+s1
+s2
s1 ,

s2 ,

+s3
s3

=
=
=

2000
300
200
0

Basic (admissible) solution:

Basic variables:

20

10

3XVP + 5XA = 200

0
0


Non-basic variables:

30

xVP
xA

s1
s2
s
3

10

20

30

40

50

60

70

6XVP + 5XA = 300

=0
=0
= 2000
= 300
= 200

Z=0

80
XVP

Objective: maximize Z ; choose the variable


with the most positive coeficient in the
objective function: xA
s3 is the first variable that turns zero when
xA grows.
xA grows from 0 until 40, a value such that
s3 = 0; s1 and s2 remain 0

(FEUP | DEGI)

Operations Research

March 3, 2014

11 / 24

XA

Objective:
max Z = 50xVP
= 50xVP
=
2400

80

70

50XVP + 30XA = 2000

+60xA
+60(40 53 xVP 15 s3 )
+14xVP
12s3

60

50

Z = 50XVP + 60XA

40

Subject to:
32xVP
3xVP
3
+xA
5 xVP
xVP ,
xA ,

30

+s1
+s2
s1 ,

s2 ,

6s3
s3
+ 15 s3
s3

=
=
=

800
100
40
0

xVP
s3

s1
s2
x
A

=0
=0
= 800
= 100
= 40

Z = 2400

(FEUP | DEGI)

3XVP + 5XA = 200

0
10

20

30

40

50

60

70

6XVP + 5XA = 300

Basic variables:

10

Basic (admissible) solution:


Non-basic variables:

20

80
XVP

Objective: maximize Z ; choose the variable


with maximum coeficient in the objective
function: xVP
s1 is the first variable that turns zero when
xVP grows.
xVP grows from 0 until 25, a value such that
s1 = 0; xA and s2 remain 0

Operations Research

March 3, 2014

12 / 24

Objective:
max Z = 2400
= 2400
= 2750

+14xVP
12s3
1
+14(25 32
s1 +
7
16 s1 75
8 s3

3
16 s3 )

12s3

XA

80

70

50XVP + 30XA = 2000

Subject to:
xVP

60

1
+ 32
s1

3
16
s3

25

3
32
s1

5
16
s3

25

+s2

50

Z = 50XVP + 60XA

40

30

xVP ,

+xA
xA ,

3
s1
160
s1 ,

71
80 s3
s3

s2 ,

25
0

20

10

3XVP + 5XA = 200

Basic (admissible) solution:


0


Non-basic variables:

Basic variables:

s1
s3


xVP
s
x2
A

=0
=0

10

20

30

40

50

60

70

6XVP + 5XA = 300

= 25
= 25
= 25

80
XVP

This solution is optimal because an increase


in s1 or s3 reduction of Z .

Z = 2750

(FEUP | DEGI)

Operations Research

March 3, 2014

13 / 24

Simplex Method
Steps of the algorithm

Initial Basic Admissible Solution (BAS) :


Obtain an initial Basic Admissible Solution (BAS).
Optimality Test 1
Maximization if all the marginal costs are negative then the solution is optimal;
Minimization if all the marginal costs are positive then the solution is optimal.
If the BAS is not optimal then ITERATE.
ITERATE :
1 Choose the variable that enters the basis:2
Maximization the non-basic variable with the most positive marginal cost.
Minimization the non-basic variable with the most negative marginal cost.
2 Choose the variable that leaves the basis:
divide the RHS of all the equations by the positive coefficients of the variable that will
enter the basis;
the variable that will leave the basis will be the basic variable of the equation with the
lowest ratio;
if all the coefficients of the variable that will enter the basis are negative or zero then
the solution is non-limited.
3

Change the lines in the tableau in order to obtain coeficient equal to one for the
pivot element and zero for all the other elements of the column, including the
objective function.
Go To Optimality Test

There are alternative optimal solutions when, in the optimal solution, one non-basic variable has a zero marginal
cost.
2
If there is more than one variable that fulfills the criterion choose one arbitrarilly.
(FEUP | DEGI)

Operations Research

March 3, 2014

14 / 24

Production Planning at BA
Simplex method
Objective:
max
Subject to:

Objective:
max
Subject to:

(FEUP | DEGI)

Z =

Z =

50xVP +

60xA

50xVP +
6xVP +
3xVP +
xVP ,

30xA
5xA
5xA
xA

50xVP +

60xA

50xVP +
6xVP +
3xVP +
xVP ,

30xA +
5xA +
5xA +
xA ,

2000
300
200
0

s1
s2
s1 ,

Operations Research

s2 ,

s3
s3

= 2000
= 300
= 200
0

March 3, 2014

15 / 24

xVP
50
6
3
50

s1
s2
s3
Z

xVP
s1

xVP
s2
xA
Z

xA

160
5

s2
xA
Z

3
5

14

xVP
1
0
0
0

xA
30
5
5
60


xA
0
0
1
0

s1
1
0
0
0

s1

s2
0
1
0
0

s3
0
0
1
0

s2

s3
800
100
40
2400

30
5

0
1
0

0
0
0

1
0
0

s1
5
160
15
160
3
160
7
16

s2
0
1
0
0

(FEUP | DEGI)

xA enters the basis because


max(50, 60) = 60

2000
300
200
0

1
5

12

s3
3
16
7
16
5
16
75
8

25
25
25
2750

s3 leaves the basis because


, 300
, 200
) = 200
min( 2000
30
5
5
5

xVP enters the basis because


max(14) = 14
s1 leaves the basis because
100 40
800
min( 800
150 , 3 , 3 ) = 150
5

All the coefficients of the objective


function are 0.
Optimal solution:
(xVP , xA ) = (25, 25) and Z =
2750
What does s2 = 25 mean?

Operations Research

March 3, 2014

16 / 24

Finding an initial Basic Admissible Solution (BAS)

An important condition for the Simplex method is the availability of an initial Basic
Admissible Solution in the canonical form.
Sometimes this initial BAS is not evident or it may evn not exist (and sometimes there is no
Basic Admissible Solution!).
Solutions:
Trial and error solve the system for different sets of variables, reduce it to the canonical form and
test if the resulting solution is admissible.
Using artificial variables.

(FEUP | DEGI)

Operations Research

March 3, 2014

17 / 24

Using artificial variables


max

Pn

j=1

cj xj

Subject to:
n
X

1. Convert the LP problem to a normalized form.

aij xj

= bi

i{1,...,m}

xj

j{1,...,n}

j=1

2. Examine each constraint and verify if there is


some variable that can be basic for that constraint.
If it does not exist, then sum an artificial variable
yi , yi 0.

max

Pn

aij xj

= bi

i{1,...,k}

aij xj + yi

= bi

i{k+1,...,m}

xj

j{1,...,n}

yi

i{k+1,...,m}

j=1

cj xj

Subject to:

Obs: The articial variables do not have any meaning in the


original problem, that is why they are called artificial. They
are only used to built an initial basis for the problem.

n
X
j=1
n
X
j=1

3. The artificial problem will only be equivalent to the original one if all the artificial variables have value zero.
Objective: All the artificial variables must leave the basis. Big M method.

(FEUP | DEGI)

Operations Research

March 3, 2014

18 / 24

Big M method

Assign a very high cost (M) (minimization problem) in the objective function to the artificial
variables .
The simplex method will take care, by improving the objective function, to expel the arficicial
variables from the basis artificial variables equal to zero.
min

Pn

j=1 cj xj

Pm

i=k+1

Myi

Subject to:
n
X

aij xj

= bi

i{1,...,k}

aij xj + yi

= bi

i{k+1,...,m}

xj

j{1,...,n}

yi

i{k+1,...,m}

j=1
n
X
j=1

(FEUP | DEGI)

Operations Research

March 3, 2014

19 / 24

Big M method
example

Objective:
min
Z
Subject to:
x1
4x1
2x1
x1

Objective:
min
Z
Subject to:
x1
4x1
2x1
x1

(FEUP | DEGI)

3x1

x2

2x2
x2

x2

+
+
+
,

x3
2x3
x3
x3

3x1

x2

x3

2x2
x2

s1

x2

x3
2x3
x3
x3

+
+
+
,

Operations Research

x3

s1

s2

s2

11
3
1
0

=
=
=

11
3
1
0

March 3, 2014

20 / 24

Objective:
min
Z
Subject to:
x1
4x1
2x1
x1

3x1

x2

x3

2x2
x2

s1

x2

x3
2x3
x3
x3

+
+
+
,

s1

My1

My2

s2

y1

s2

y1

+
,

y2
y2

=
=
=

3x1 + x2 + x3 + M(3 + 4x1 x2 2x3 + s2 ) + M(1 + 2x1 x3 )

4M + (3 + 6M)x1 + (1 M)x2 + (1 3M)x3 + Ms2

(FEUP | DEGI)

Operations Research

March 3, 2014

11
3
1
0

21 / 24

s1
y1
y2
Z

x1
1
4
2
3
6M

x2
2
1
0
1
M

x3
1
2
1
1
3M


s1
1
0
0
0
0

s2
0
1
0
0
M

y1
0
1
0
0
0

y2
0
0
1
0
0

11
3
1
0
4M

s1
y1
x3
Z

x1
3
0
2
1
0

x2
2
1
0
1
M


x3
0
0
1
0
0

s1
1
0
0
0
0

s2
0
1
0
0
M

y1
0
1
0
0
0

y2
1
2
1
1
3M

10
1
1
1
M

(FEUP | DEGI)

Operations Research

March 3, 2014

22 / 24

s1
x2
x3
Z

x1
x2
x3
Z

x1
3
0
2
1
0


x2
0
1
0
0
0

x3
0
0
1
0
0

s1
1
0
0
0
0

s2
2
1
0
1
0

x1
1
0
0
0

x2
0
1
0
0

x3
0
0
1
0

s1

s2
32
1
34

1
3

0
2
3
1
3

y1
2
1
0
1
M

y2
5
2
1
+1
M

1
3

12
1
1
2
0

4
1
9
2

Optimal solution: (x1 , x2 , x3 , s1 , s2 )? = (4, 1, 9, 0, 0) with Z ? = 2

(FEUP | DEGI)

Operations Research

March 3, 2014

23 / 24

Some remarks

The artificial variables are only used to serve as basic variables in a given equation. Once replaced
in the base by the original variables, the artificial variables can be eliminated from the simplex
tableau (eliminating the respective columns).

If, in the optimal simplex tableau, some artificial variables have a value > 0, it means that the
original problem has no admissible solution, and therefore it is an impossible problem.

(FEUP | DEGI)

Operations Research

March 3, 2014

24 / 24

You might also like