Sie sind auf Seite 1von 62

Simplex method

An iterative method for solving LPP

Algebraic Solution of LPPs - Simplex


Method

To develop simplex method, we impose two


requirements on the constraints of the problem:

• All decision variables are nonnegative.

• All constraints (other than the nonnegativity


restrictions) are equations with nonnegative RHS.

Anil Kumar, Mathematics, BITS-Goa 2

BITS Pilani, Goa Campus 1


Changing inequalities into equations
(using SLACK and SURPLUS variables)

SLACK VARIABLE: A slack variable is used to change a “”


inequality to equation.

SURPLUS VARIABLE: A surplus variable to change a “≥”


inequality to equation.

Note:
• The slack and surplus variables are always non-negative.

• If the RHS of the equation is negative then multiply both


sides of the equation by -1.

Anil Kumar, Mathematics, BITS-Goa 3

Dealing with Unrestricted Variables

The simplex method computations require all the variables to


be nonnegative.

In an LPP, if a decision variable xi is unrestricted (in sign) i.e. it


can take positive as well as negative values, then we can write

xi  xi  xi ,
are nonnegative.
 
where x , x .
i i

Anil Kumar, Mathematics, BITS-Goa 4

BITS Pilani, Goa Campus 2


Convex sets, Extreme Points, and LP

A set of points S is a convex set if the line segment joining any


two pairs of points in S is wholly contained in S.

For any convex set S, a point p in S is an extreme point if each


line segment that lies completely in S and contains the point p,
has p as an endpoint of the line segment.
i.e. p is an extreme point of a convex set S if p ϵ S and there do
not exist distinct x, y ϵ S and 0 < λ < 1 such that p = λx+(1- λ)y.

Extreme points are sometimes called corner points, because if the


set S is a polygon, the extreme points will be the vertices, or
corners, of the polygon.

Anil Kumar, Mathematics, BITS-Goa 5

 The feasible region of a linear programming problem is a


convex set.

Also,
 The feasible region for any LPP has only a finite number
of extreme point.
 Any LPP that has an optimal solution, has an extreme
point that is optimal.

Anil Kumar, Mathematics, BITS-Goa 6

BITS Pilani, Goa Campus 3


Example:
Convert the following optimization problem into a LPP:
Maximize
z  max{| 2 x1  3 x2 |, | 3 x1  7 x2 |}
Subject to
x1  x 2  2
 x1  x 2  4
x1 , x 2  0

Anil Kumar, Mathematics, BITS-Goa 7

Example…

Note that here the objective function is NOT linear.


Let us put
y  max{| 2 x1  3 x2 |, | 3 x1  7 x2 |}
Hence
y  | 2 x1  3 x2 | and y  | 3 x1  7 x2 |
Which is equivalent to

y  2 x1  3 x2 , y   (2 x1  3 x2 )
y  3 x1  7 x2 , y    3 x1  7 x2 
Anil Kumar, Mathematics, BITS-Goa 8

BITS Pilani, Goa Campus 4


Example:
Hence the given optimization problem is equivalent to the LPP:
Maximize z  y
Subject to x1  x 2  2
 x1  x 2  4
2x1  3x2  y  0
2x1  3x2  y  0
3x1  7x2  y  0
3x1  7x2  y  0 and x1, x2 , y  0.

Anil Kumar, Mathematics, BITS-Goa 9

How to Solve an LPP of higher dimension ?

• The constraints of an LPP give rise to a geometrical shape - a


polyhedron.

• If we can determine all the corner points of the polyhedron,


then we can calculate the objective function value at these
points and take the best one as our optimal solution.

• The Simplex Method moves from corner to corner until it can


prove that it has found the optimal solution.

Anil Kumar, Mathematics, BITS-Goa 10

BITS Pilani, Goa Campus 5


Basic variables, Basic feasible Solutions

Consider an LPP (in standard form) with m constraints and n


decision variables. We assume m  n.

We choose n – m variables and set them equal to zero.

Thus we will be left with a system of m equations in m variables.

If this square system has a unique solution, this solution is called


a basic solution.

Further if it is feasible, it is called a Basic Feasible Solution


(BFS).

Anil Kumar, Mathematics, BITS-Goa 11

Note that a system may have a maximum of nCm basic


solutions

The n – m variables set to zero are called nonbasic and the m


variables which we are solving for are known as basic
variables.

Thus, a basic solution is of the form x = (x1, x2, …, xn) where


n – m “components” are zero and the remaining m variables
form the unique solution of the square system (formed by the
m constraint equations).

Anil Kumar, Mathematics, BITS-Goa 12

BITS Pilani, Goa Campus 6


Any values of x1, x2,… that satisfy all the constraints of the
model is called a feasible solution.

The set of all feasible solutions is known as the feasible


region.

Optimum feasible solution is the one that gives the maximum


value while satisfying all the constraints.

Anil Kumar, Mathematics, BITS-Goa 13

Example:

Anil Kumar, Mathematics, BITS-Goa 14

BITS Pilani, Goa Campus 7


Example…

Anil Kumar, Mathematics, BITS-Goa 15

Graphical solution of the above LPP


x2
(0,3) E Every Basic Feasible Solution
corresponds to a corner (= vertex) of
the set SF of all feasible solutions.
(0,2) B
C (6/7, 12/7)

Optimal point
SF

x1
O
A D
(0,0) (2,0) (6,0)
Anil Kumar, Mathematics, BITS-Goa 16

BITS Pilani, Goa Campus 8


Example…

(2, 0, 4, 0)

(6/7,12/7,0,0) C

Anil Kumar, Mathematics, BITS-Goa 17

The Simplex algorithm: Example

Consider the LPP

Maximize z  8 x1  9 x 2

Subject to the constraints 2 x 1  3 x 2  50


2 x 1  6 x 2  80
3 x 1  3 x 2  70
x1 , x 2  0
Anil Kumar, Mathematics, BITS-Goa 18

BITS Pilani, Goa Campus 9


Example…
Introducing slack variables, the standard LPP is
Maximize z  8 x1  9 x2  0 s1  0 s2  0 s3
subject to the constraints
2 x1  3 x 2  s1  50
2 x1  6 x 2  s2  80 (*)
3 x1  3 x 2  s 3  70
x1 , x 2 , s1 , s 2 , s 3  0

Anil Kumar, Mathematics, BITS-Goa 19

Points to remember

1. The coefficients of the starting basic variables in the


constraint equations form an identity matrix which
gives the starting BFS.

2. Put the objective function and the constraint


equations in a table (usually referred to as a simplex
tableau).

3. Write the objective function also as an equation.

Anil Kumar, Mathematics, BITS-Goa 20

BITS Pilani, Goa Campus 10


Example…

We see that if we take x1, x2 as nonbasic variables, a BFS


can be got immediately as (0,0,50,80,70).
Remember the first two components refer to x1, x2 and
the last three components refer to s1, s2, s3.
This is possible because in the LHS of the constraint
equations (*) the coefficients of the basic variables s1, s2,
s3 form an Identity matrix (of size 3 × 3).

Anil Kumar, Mathematics, BITS-Goa 21

Example…

Next we put the objective function and the constraint


equations in a table (usually referred to as a Simplex
tableau). For this we write the objective function also
as an equation:

z  8 x1  9 x2  0s1  0s2  0s3  0

Anil Kumar, Mathematics, BITS-Goa 22

BITS Pilani, Goa Campus 11


Example… Simplex tableau (Starting tableau)

Anil Kumar, Mathematics, BITS-Goa 23

Example… (Some Remarks)

 Z-row is the objective equation row.


 The remaining 3 rows are the basic variable rows.
 Each row corresponds to a basic variable.
 The left most variable denotes the basic variable
corresponding to that row.
 Except for the legends (the topmost row and the leftmost
column), all the other 4 rows are the objective function
row and the constraint equations.

Anil Kumar, Mathematics, BITS-Goa 24

BITS Pilani, Goa Campus 12


Example… (Some Remarks)

• In the objective function row, the coefficients of the


basic variables are zero.

• This is the second requirement to start the simplex


algorithm.

• Note that in each column, corresponding to a basic


variable, only that basic variable has a non zero
coefficient, namely 1, and all the other basic variables
have zero coefficients.

Anil Kumar, Mathematics, BITS-Goa 25

Example… (Some Remarks)

 The nonbasic variable that will become basic is


referred to as entering variable.

 The basic variable that will become nonbasic is


referred to as leaving variable.

Anil Kumar, Mathematics, BITS-Goa 26

BITS Pilani, Goa Campus 13


Criterion for entering variable:
(Optimality Condition)

Choose that variable as the “entering” variable which


has
 the most –ve coefficient in the z-row in case it is a
maximization problem

 the most +ve coefficient in the z-row in case it is a


minimization problem).

(Break the ties arbitrarily)

Anil Kumar, Mathematics, BITS-Goa 27

Criterion for leaving variable


(Feasibility Condition)
 Let bi be the RHS of the ith row. Let aij be the
coefficient of the entering variable xj in the ith row.

The following “minimum ratio test” decides the


leaving variable:
where aij is
the coefficient of the entering
 bi 
min  : aij  0  variable xj in
the ith row.
 aij 
(avoid division by zero or a negative value)

(Break the ties arbitrarily.)


Anil Kumar, Mathematics, BITS-Goa 28

BITS Pilani, Goa Campus 14


• The entering variable column is called the pivot
column.

• The leaving variable row is called the pivot row.

• The coefficient in the intersection of the two is


referred to as the pivot element.

• Apply elementary row operations to modify the


simplex tableau so that the pivot column has 1 at the
pivot element and zero in all other places.

Anil Kumar, Mathematics, BITS-Goa 29

Simplex tableau (Starting tableau)

Enters
Basic z x1 x  s
2 1 s2 s3 Solution

z 1 -8 -9 0 0 0 0

s1 0 2 3 1 0 0 50

s2 0 2 6 0 1 0 80

s3 0 3 3 0 0 1 70
Leaves Pivot element
Anil Kumar, Mathematics, BITS-Goa 30

BITS Pilani, Goa Campus 15


Performing the elementary Row operations, we
get the new Simplex tableau below
 Enters
Basic z x1 x2 s1 s2 s3 Solution

z 1 -5 0 0 3/2 0 120

s1 0 1 0 1 -1/2 0 10

x2 0 1/3 1 0 1/6 0 40/3

s3 0 2 0 0 -1/2 1 30
Pivot element
Leaves Anil Kumar, Mathematics, BITS-Goa 31

Performing the elementary Row operations, we


get the new Simplex tableau below

 Enters
Basic z x1 x2 s1 s2 s3 Solution

z 1 0 0 5 -1 0 170

x1 0 1 0 1 -1/2 0 10

x2 0 0 1 -1/3 1/3 0 10

s3 0 0 0 -2 1/2 1 10

Pivot element
Leaves Anil Kumar, Mathematics, BITS-Goa 32

BITS Pilani, Goa Campus 16


Performing the elementary Row operations, we
get the new Simplex tableau below.
This is optimal as all entries in z row are  0.
Optimum value = 190 at x1=20, x2=10/3.

Basic z x1 x2 s1 s2 s3 Solution
z 1 0 0 5 0 0 190
x1 0 1 0 -1 0 0 20
x2 0 0 1 1 0 0 10/3
s2 0 0 0 -4 1 2 20

Anil Kumar, Mathematics, BITS-Goa 33

Graphical Solution of the problem

(0,40/3) (10,10)
Optimal at Direction of
(20,10/3) increasing z

(0,0) (70/3,0)
Anil Kumar, Mathematics, BITS-Goa 34

BITS Pilani, Goa Campus 17


Example 2

Consider the LPP


Maximize
z  2 x1  x2  3 x3  5 x4
Subject to the constraints
x1  2 x 2  2 x3  4 x4  40
2 x1  x2  x3  2 x 4  8
4 x1  2 x 2  x3  x4  10
x1 , x2 , x3 , x4  0
Anil Kumar, Mathematics, BITS-Goa 35

Example 2… the standard LPP becomes

Maximize
z  2 x1  x2  3x3  5 x4  0s1  0s2  0 s3
Subject to the constraints
x1  2 x2  2 x3  4 x4  s1  40
2 x1  x2  x3  2 x4  s2  8
4 x1  2 x2  x3  x4  s3  10
x1 , x2 , x3 , x4 , s1 , s2 , s3  0
Anil Kumar, Mathematics, BITS-Goa 36

BITS Pilani, Goa Campus 18


Basic z x1 x2 x3 x4 s1 s2 s3 Sol.

z 1 -2 -1 3 -5 0 0 0 0
s1 0 1 2 -2 4 1 0 0 40
s2 0 2 -1 1 2 0 1 0 8
s3 0 4 -2 1 -1 0 0 1 10
z 1 3 -7/2 11/2 0 0 5/2 0 20
s1 0 -3 4 -4 0 1 -2 0 24
x4 0 1 -1/2 1/2 1 0 1/2 0 4
s3 0 5 -5/2 3/2 0 0 1/2 1 14
z 1 3/8 0 2 0 7/8 3/4 0 41
x2 0 -3/4 1 -1 0 1/4 -1/2 0 6
x4 0 5/8 0 0 1 1/8 1/4 0 7
s3 0 25/8 0 -1 0 5/8 -3/4 1 29
37

Example 2…

The last tableau is the optimal tableau as all entries in


the objective function row are ≥ 0 and the LPP is a
maximization problem.

Optimal Solution is
x1 = 0, x2 = 6, x3 = 0, x4 = 7
and the optimal z (= Maximum z) = 41

Anil Kumar, Mathematics, BITS-Goa 38

BITS Pilani, Goa Campus 19


Example 3:

Use simplex method to find the solution for the following


linear programming problem

Max Z  x1  2 x2  x3
s.t.
2 x1  x2  x3  14
4 x1  2 x2  3x3  28
2 x1  5 x2  5 x3  30
x1 , x2 , x3  0

Anil Kumar, Mathematics, BITS-Goa 39

Min
Basic Z x1 x2 x3 s1 s2 s3 Sol
ratio
Z 1 -1 -2 1 0 0 0 0
s1 0 2 1 1 1 0 0 14 14
s2 0 4 2 3 0 1 0 28 14
s3 0 2 5 5 0 0 1 30 6
Z 1 -1/5 0 3 0 0 2/5 12
s1 0 8/5 0 0 1 0 -1/5 8 5
s2 0 16/5 0 1 0 1 -2/5 16 5
x2 0 2/5 1 1 0 0 1/5 6 15
Z 1 0 0 3 1/8 0 3/8 13
x1 0 1 0 0 5/8 0 -1/8 5
s2 0 0 0 1 -2 1 0 0
x2 0 0 1 1 -1/4 0 1/4 4
Anil Kumar, Mathematics, BITS-Goa 40

BITS Pilani, Goa Campus 20


Example 3…

The last tableau is the optimal tableau as all entries


in the objective function row are ≥ 0 and the LPP is
a maximization problem.

Therefore, the optimal solution is


x1 = 5, x2 = 4, x3 = 0
and the optimal z (= Maximum z) = 13

Anil Kumar, Mathematics, BITS-Goa 41

Artificial Variable Techniques

Big M-method

Anil Kumar, Mathematics, BITS-Goa 42

BITS Pilani, Goa Campus 21


Artificial Variable Techniques
If in a starting simplex tableau, we don’t have an
identity sub matrix (i.e. an obvious starting BFS),
then we introduce artificial variables to have a
starting BFS.

This is known as artificial variable technique.

There are two methods to find the starting BFS and


solve the problem – the Big M and Two - phase
method.
Anil Kumar, Mathematics, BITS-Goa 43

Artificial Variable Techniques…


 Suppose that ith constraint equation doesn't have a
slack variable. i.e.
there is no ith unit vector column in the LHS of the
constraint equations. (e.g. this happens when the
ith constraint in the original LPP is either ≥ or =) .
 Then an artificial variable Ri is added to form the ith
unit vector column.
 Since the artificial variables are not part of the
original LPP, they are assigned a very high penalty in
the objective function and thus forcing them to equal
zero in the optimum solution.

Anil Kumar, Mathematics, BITS-Goa 44

BITS Pilani, Goa Campus 22


Artificial Variable Techniques…

Artificial variable objective coefficient


= - M in a maximization problem,
= M in a minimization problem
where M is a very large positive number.

Anil Kumar, Mathematics, BITS-Goa 45

Example-1

Consider the LPP:

Minimize z  2 x1  x2

Subject to the constraints 3 x1  x  9


2

x1  x 2  6
x1 , x 2  0

Anil Kumar, Mathematics, BITS-Goa 46

BITS Pilani, Goa Campus 23


Example-1…
Putting this in the standard form, the LPP is:
Minimize
z  2 x1  x2
Subject to the constraints
3 x1  x 2  s1  9
x1  x 2  s2  6
x1 , x 2 , s1 , s 2  0
Here s1, s2 are surplus variables.
Note that we do NOT have a 2 ×2 identity submatrix in the LHS.

Anil Kumar, Mathematics, BITS-Goa 47

Example-1…
Introducing the artificial variables, R1, R2, the LPP is modified
as follows:
Minimize
z  2 x1  x2  M R1  M R2
Subject to the constraints
3 x 1  x 2  s1  R1 9
x1  x 2  s2  R2  6
x 1 , x 2 , s1 , s 2 , R 1 , R 2  0

Note that we now have a (2 × 2) identity submatrix in the


coefficient matrix of the constraint equations.
Anil Kumar, Mathematics, BITS-Goa 48

BITS Pilani, Goa Campus 24


Example-1…

• Solve the above LPP by the Simplex method.

Anil Kumar, Mathematics, BITS-Goa 49

Basic z x1 x2 s1 s2 R1 R2 Sol.

-2+4M -1+2M -M -M 0 0 15M


z 1 -2 -1 0 0 -M -M 0
R1 0 3 1 -1 0 1 0 9
R2 0 1 1 0 -1 0 1 6
z 1 0 -1/3+ -2/3+ -M 2/3- 0 6+3M
2M/3 M/3 4M/3
x1 0 1 1/3 -1/3 0 1/3 0 3
R2 0 0 2/3 1/3 -1 -1/3 1 3
z 1 0 0 -1/2 -1/2 1/2–M 1/2-M 15/2

x1 0 1 0 -1/2 1/2 1/2 -1/2 3/2


x2 0 0 1 1/2 -3/2 -1/2 3/2 9/250

BITS Pilani, Goa Campus 25


Example-1…
Note that we have got the optimal solution to the
given problem as
3 9
x1  , x2 
2 2
Optimal z = Minimum
15
z
2
It is illuminating to look at the graphical solution also.

Anil Kumar, Mathematics, BITS-Goa 51

(0.9)
SF
(0,6)
3 9
( , )
2 2

(0,0) (3,0) (6,0) 3 9


z minimum at ( , )
Anil Kumar, Mathematics, BITS-Goa 2 252

BITS Pilani, Goa Campus 26


Example-2

Consider the following LPP:

Maximize z  2 x1  3 x 2  5 x3

Subject to the constraints


x1  x2  x3  7
2 x1  5 x 2  x3  10
x1 , x2 , x3  0

Anil Kumar, Mathematics, BITS-Goa 53

Example-2…
Introducing surplus and artificial variables, s2, R1and R2, the
LPP is modified as follows:
Maximize
z  2 x1  3 x 2  5 x3  MR1  MR 2
Subject to the constraints
x1  x 2  x3  R1  7
2 x1  5 x 2  x 3  s 2  R2  10
x1 , x 2 , x 3 , s 2 , R 1 , R 2  0
Now we solve the above LPP by the Simplex method.

Anil Kumar, Mathematics, BITS-Goa 54

BITS Pilani, Goa Campus 27


Basic z x1 x2 x3 s2 R1 R2 Sol.

-2-3M -3+4M 5-2M M 0 0 -17M


z 1 -2 -3 5 0 M M 0
R1 0 1 1 1 0 1 0 7
R2 0 2 -5 1 -1 0 1 10
z 1 0 -8 - 6- -1 - 0 1 + 10 -
7M/2 M/2 M/2 3M/2 2M
R1 0 0 7/2 1/2 1/2 1 -1/2 2
x1 0 1 -5/2 1/2 -1/2 0 1/2 5
z 1 0 0 50/7 1/7 16/7 + -1/7 102/7
M +M
x2 0 0 1 1/7 1/7 2/7 -1/7 4/7
x1 0 1 0 6/7 -1/7 5/7 1/7 45/7
55

Example-2…

The optimum (Maximum) value of


z = 102/7
and it occurs at
x1 = 45/7, x2 = 4/7, x3 = 0

Anil Kumar, Mathematics, BITS-Goa 56

BITS Pilani, Goa Campus 28


Remarks

 If in any iteration, there is a tie for entering variable


between an artificial variable and other variable
(decision, surplus or slack), we must prefer the non-
artificial variable to enter the basis.

 If in any iteration, there is a tie for leaving variable


between an artificial variable and other variable
(decision, surplus or slack), we must prefer the
artificial variable to leave the basis.

Anil Kumar, Mathematics, BITS-Goa 57

Remarks…

• If in the final optimal tableau, an artificial variable is


present in the basis at a non-zero level, this means
our original problem has no feasible solution.

Anil Kumar, Mathematics, BITS-Goa 58

BITS Pilani, Goa Campus 29


Example 3
Consider the following LPP:

Maximize
z  5 x1  6 x 2
Subject to the constraints  2 x1  3 x 2  3
x1  2 x 2  5
6 x1  7 x 2  3
x1 , x 2  0

Anil Kumar, Mathematics, BITS-Goa 59

Example 3…
Introducing slack and artificial variables, s2, s3, and
R1, the LPP is modified as follows:

Maximize z  5 x1  6 x 2  MR1
Subject to the constraints
 2 x1  3 x 2  R 1  3
x1  2 x 2  s2 5
6 x1  7 x 2  s3  3
x1 , x 2 , R 1 , s 2 , s 3  0
Anil Kumar, Mathematics, BITS-Goa 60

BITS Pilani, Goa Campus 30


Basic z x1 x2 R1 s2 s3 Sol

-5+2M -6-3M 0 0 0 -3M


z 1 -5 -6 M 0 0 0
R1 0 -2 3 1 0 0 3
s2 0 1 2 0 1 0 5

s3 0 6 7 0 0 1 3
z 1 1/7+ 0 0 0 6/7+ 18/7-
32M/7 3M/7 12M/7
R1 0 -32/7 0 1 0 -3/7 12/7
s2 0 -12/7 0 0 1 -2/7 29/7
x2 0 6/7 1 0 0 1/7 3/7
This is the optimal tableau. As R1 is not zero, there is NO feasible solution.61

Example-4
Consider the following LPP:

Minimize z  6 x1  4 x 2

Subject to the constraints


3 x1  0 .5 x 2  1 2
2 x1  x2  16
x1 , x 2  0

Anil Kumar, Mathematics, BITS-Goa 62

BITS Pilani, Goa Campus 31


Example-4…
Introducing the artificial variables, R1, R2, the modified LPP is
as follows:
Minimize
z  6 x1  4 x2  M R1  M R2
Subject to the constraints
3 x1  0 .5 x 2  s1  R1  12
2 x1  x2  s2  R2  16
x 1 , x 2 , s1 , s 2 , R 1 , R 2  0

Note that we now have a (2 × 2) identity submatrix in the


coefficient matrix of the constraint equations.
63

Basic z x1 x2 s1 s2 R1 R2 Sol.

-6+5M -4+1.5M -M -M 0 0 28M


z 1 -6 -4 0 0 -M -M 0
R1 0 3 0.5 -1 0 1 0 12
R2 0 2 1 0 -1 0 1 16
z 1 0 -3+ -2 + -M 2- 0 24+
2M/3 2M/3 5M/3 8M
x1 0 1 1/6 -1/3 0 1/3 0 4
R2 0 0 2/3 2/3 -1 -2/3 1 8
z 1 0 -1 0 -3 –M 3-M 48

x1 0 1 1/2 0 -1/2 0 1/2 8


x2 0 0 1 1 -3/2 -1 3/2 1264

BITS Pilani, Goa Campus 32


Example-4…

The optimum (minimum) value of


z = 48
and it occurs at
x1 = 8, x2 = 0.

Anil Kumar, Mathematics, BITS-Goa 65

Artificial Variable Techniques

Two-Phase Method

Anil Kumar, Mathematics, BITS-Goa 66

BITS Pilani, Goa Campus 33


Two-Phase Method

 The Big M method involves manipulation with large numbers


and so is not suited to a computer.
 As the name suggests, the method consists of two phases:

 In phase I, all the artificial variables are eliminated from the


basis. If a feasible solution is obtained in this phase, which
has no artificial variables in the basis in the final tableau,
then we proceed to phase II.
 In Phase II, we use the solution from phase I as the initial
basic feasible solution and use the simplex method to
determine the optimal solution.

Anil Kumar, Mathematics, BITS-Goa 67

Two-Phase Method:

Phase-I:

 Put the problem in standard form and add the necessary


artificial variables to the constraints to secure a starting basic
solution.
 Find a basic solution of the resulting equations that, regardless
of whether the LP is maximization or minimization.
 Always minimizes the sum of the artificial variables.

 If the minimum value of the sum is positive, the LPP


has no feasible solution, which ends the process.
 Otherwise, proceed to Phase II.

Anil Kumar, Mathematics, BITS-Goa 68

BITS Pilani, Goa Campus 34


Two-Phase Method

Phase-II:

 Use the feasible solution from Phase I as a starting


basic feasible solution for the original problem.

Anil Kumar, Mathematics, BITS-Goa 69

Example-1

Consider the LPP:

Minimize z  2 x1  x2

Subject to the constraints 3 x1  x 2  9


x1  x 2  6
x1 , x 2  0

Anil Kumar, Mathematics, BITS-Goa 70

BITS Pilani, Goa Campus 35


Example-1…

Phase I:
Minimize r  R1  R2
Subject to the constraints
3 x1  x 2  s1  R1  9
x1  x 2  s2  R2  6
x 1 , x 2 , s1 , s 2 , R 1 , R 2  0

We now solve it by Simplex method.

Anil Kumar, Mathematics, BITS-Goa 71

Basic r x1 x2 s1 s2 R1 R2 Sol.

4 2 -1 -1 0 0 15
r 1 0 0 0 0 -1 -1 0
R1 0 3 1 -1 0 1 0 9
R2 0 1 1 0 -1 0 1 6
r 1 0 2/3 1/3 -1 -4/3 0 3
x1 0 1 1/3 -1/3 0 1/3 0 3
R2 0 0 2/3 1/3 -1 -1/3 1 3
r 1 0 0 0 0 -1 -1 0

x1 0 1 0 -1/2 1/2 1/2 -1/2 3/2

x2 0 0 1 1/2 -3/2 -1/2 3/2 9/272

BITS Pilani, Goa Campus 36


Example-1
Note that Phase I has ended as min r =0.
Therefore, we solve the original LPP with the starting
BFS:
3 9
x1  , x2 
2 2

Note that the starting Simplex tableau is same as the


last tableau except for the first row which is our z-
Row. Since R1, R2 have served their purpose (of
giving a starting BFS), we suppress their columns.
Anil Kumar, Mathematics, BITS-Goa 73

Basic z x1 x2 s1 s2 Sol.
0 0 -1/2 -1/2 15/2
z 1 -2 -1 0 0 0
x1 0 1 0 -1/2 1/2 3/2
x2 0 0 1 1/2 -3/2 9/2

This is the optimal tableau.


Optimal solution: x1 = 3/2, x2 = 9/2
Optimal value : Min z = 15/2

Anil Kumar, Mathematics, BITS-Goa 74

BITS Pilani, Goa Campus 37


Example-2

Consider the LPP:


Minimize
z  2 x1  5 x 2  3 x3
Subject to the constraints
x1  2 x 2  x 3  2 0
2 x1  4 x 2  x 3  5 0
x1 , x 2 , x 3  0

Anil Kumar, Mathematics, BITS-Goa 75

Example-2…
Phase I:
Minimize
r  R1  R2
Subject to the constraints
x1  2 x 2  x 3  s1  R 1  20
2 x1  4 x 2  x 3  R2  50
x 1 , x 2 , x 3 , s1 , R 1 , R 2  0
Here s1 is a surplus variable; R1, R2 are artificial
variables.
Anil Kumar, Mathematics, BITS-Goa 76

BITS Pilani, Goa Campus 38


Basic r x1 x2 x3 s1 R1 R2 Sol
3 2 2 -1 0 0 70
r 1 0 0 0 0 -1 -1 0
R1 0 1 -2 1 -1 1 0 20
R2 0 2 4 1 0 0 1 50
r 1 0 8 -1 2 -3 0 10

x1 0 1 -2 1 -1 1 0 20

R2 0 0 8 -1 2 -2 1 10

Anil Kumar, Mathematics, BITS-Goa 77

Basic r x1 x2 x3 s1 R1 R2 Sol

r 1 0 8 -1 2 -3 0 10
x1 0 1 -2 1 -1 1 0 20
R2 0 0 8 -1 2 -2 1 10
r 1 0 0 0 0 -1 -1 0

x1 0 1 0 3/4 -1/2 1/2 1/4 45/2

x2 0 0 1 -1/8 1/4 -1/4 1/8 5/4

Anil Kumar, Mathematics, BITS-Goa 78

BITS Pilani, Goa Campus 39


Example-2
This is optimal tableau. Thus Phase I has ended and
we now start Phase II with the starting BFS as the
optimal solution of Phase I.
Phase II:

Minimize
z  2 x1  5 x2  3x3

subject to the same constraints as given in the original


problem.

Anil Kumar, Mathematics, BITS-Goa 79

Basic z x1 x2 x3 s1 R1 R2 Sol
0 0 -17/8 1/4 205/4
z 1 -2 -5 -3 0 0
x1 0 1 0 3/4 -1/2 45/2
x2 0 0 1 -1/8 1/4 5/4
z 1 0 -1 -2 0 50

x1 0 1 2 1/2 0 25

s1 0 0 4 -1/2 1 5

Thus the optimal solution is : x1 = 25, x2 = 0, x3 = 0 and the


optimal z = Min z = 50.
Anil Kumar, Mathematics, BITS-Goa 80

BITS Pilani, Goa Campus 40


Example-3

Consider the LPP:


Maximize
z  2 x1  2 x2  4 x3
Subject to the constraints
2 x1  x 2  x 3  2
3 x1  4 x 2  2 x 3  8
x1 , x 2 , x 3  0

Anil Kumar, Mathematics, BITS-Goa 81

Remark: Two Phase Method

 The removal of the artificial variables and their


columns at the end of Phase I can take place only
when they are all nonbasic.

 If one or more artificial variables are basic (at zero


level) at the end of Phase I, then the following
additional steps must be undertaken to remove them
prior to the start of Phase II.

Anil Kumar, Mathematics, BITS-Goa 82

BITS Pilani, Goa Campus 41


Remark: Two Phase Method…
Step 1:
 Select a zero artificial variable to leave the basic solution
and designate its row as the pivot row.
 The entering variable can be any nonbasic (nonartificial)
variable with a nonzero (positive or negative) coefficients
in the pivot row.
 Perform the associated simplex iteration.
Step 2:
 Remove the column of the (just leaving) artificial variable
from the tableau. If all the zero artificial variables have
been removed, go to Phase II. Otherwise go to step 1.

Anil Kumar, Mathematics, BITS-Goa 83

Example-3
Maximize
z  2 x1  2 x2  4 x3
Subject to the constraints
2 x1  x2  x3  2
3 x1  4 x2  2 x3  8
x1 , x2 , x3  0

• Solve this problem by two phase method.

Anil Kumar, Mathematics, BITS-Goa 84

BITS Pilani, Goa Campus 42


Example-3…
Phase I

Minimize r  R2

Subject to the constraints 2 x1  x2  x3  s1 2


3x1  4 x2  2 x3  s2  R2  8
x1 , x2 , x3 , s1 , s2 , R2  0
Here s1 is a slack variable, s2 is a surplus variable and
R2 artificial variable.

Anil Kumar, Mathematics, BITS-Goa 85

Basic r x1 x2 x3 s1 s2 R2 Sol. Ratio


3 4 2 0 -1 0 8
r 1 0 0 0 0 0 -1 0
S1 0 2 1 1 1 0 0 2 2

R2 0 3 4 2 0 -1 1 8 2
r 1 0 0 0 0 0 -1 0
s1 0 5/4 0 1/2 1 1/4 -1/4 0

x2 0 3/4 1 1/2 0 -1/4 1/4 2

Phase I has ended. Now start Phase II:


Anil Kumar, Mathematics, BITS-Goa 86

BITS Pilani, Goa Campus 43


Basic z x1 x2 x3 s1 s2 R2 Sol. Ratio
-1/2 0 -3 0 -1/2 4
z 1 -2 -2 -4 0 0 0

s1 0 5/4 0 1/2 1 1/4 0 0


x2 0 3/4 1 1/2 0 -1/4 2 4
z 1 7 0 0 6 1 4
x3 0 5/2 0 1 2 1/2 0

x2 0 -1/2 1 0 -1 -1/2 2
This is the optimal tableau and the optimal solution is:
x1 = 0, x2 = 2, x3 = 0 and Max z = 4
Anil Kumar, Mathematics, BITS-Goa 87

Example-3…

We saw in Phase I, in the starting iteration, there was


a tie for the leaving variable: namely s1 and R2. We
rightly chose R2 to leave the basis. Now we shall see
what happens if s1 was allowed to leave the basis.

Anil Kumar, Mathematics, BITS-Goa 88

BITS Pilani, Goa Campus 44


Phase I

Basic r x1 x2 x3 s1 s2 R2 Sol. Ratio


3 4 2 0 -1 0 8
r 1 0 0 0 0 0 -1 0
s1 0 2 1 1 1 0 0 2 2
R2 0 3 4 2 0 -1 1 8 2
r 1 -5 0 -2 -4 -1 0 0
x2 0 2 1 1 1 0 0 2
R2 0 -5 0 -2 -4 -1 1 0

Anil Kumar, Mathematics, BITS-Goa 89

 Note that optimality condition are satisfied but still R2 is


sitting as a basic variable at the zero level.
 Phase-1 will continue by choosing R2 as a leaving variable
and any one from x1, x3, s1, s2 as an entering variable.

Basic r x1 x2 x3 s1 s2 R2 sol

r 1 -5 0 -2 -4 -1 0 0

x2 0 2 1 1 0 0 0 2

R2 0 -5 0 -2 -4 -1 1 0

r 1 0 0 0 0 0 -1 0

x2 0 0 1 1/5 -3/5 -2/5 2/5 2

x1 0 1 0 2/5 4/5 1/5 -1/5 0

Anil Kumar, Mathematics, BITS-Goa 90

BITS Pilani, Goa Campus 45


 Here, optimality condition is satisfied and hence, min r = 0
and Phase-I produces the solution

x1  0, x2  2, x3  0
 Now Phase-II starts

Anil Kumar, Mathematics, BITS-Goa 91

Phase II
Basic z x1 x2 x3 s1 s2 sol
0 0 -14/5 2/5 -2/5 0
z 1 -2 -2 -4 0 0 0

x2 0 0 1 1/5 -3/5 -2/5 2

x1 0 1 0 2/5 4/5 1/5 0

z 1 7 0 0 6 1 4

x2 0 -1/2 1 0 -1 -1/2 2

x3 0 5/2 0 1 2 1/2 0

Optimality condition is satisfied. Hence, the optimal solution is:


x1 = 0, x2 = 2, x3 = 0
and the optimum value z = 4 (as before).
Anil Kumar, Mathematics, BITS-Goa 92

BITS Pilani, Goa Campus 46


Example 4

Maximize
z  2 x1  4 x2  4 x3  3 x4
Subject to the constraints
x1  x2  x3 4
x1  4 x2  x4  8
x1 , x2 , x3 , x4  0

Anil Kumar, Mathematics, BITS-Goa 93

Example 4…

Normally, when there are equality constraints,


we add artificial variables and use either Big M
method or Two Phase method.
But in this problem we already have a 2×2 identity
submatrix in the coefficient matrix of the constraint
equations.
Hence there is no need to add artificial variables. We can
start the Simplex algorithm with x3, x4 as basic variables.

Anil Kumar, Mathematics, BITS-Goa 94

BITS Pilani, Goa Campus 47


Basic z x1 x2 x3 x4 Sol
-1 -12 0 0 -8
z 1 -2 -4 -4 3 0
x3 0 1 1 1 0 4
x4 0 1 4 0 1 8
z 1 2 0 0 3 16

x3 0 3/4 0 1 -1/4 2

x2 0 1/4 1 0 1/4 2
This is the optimal tableau and the optimal solution is
x1=0, x2=2, x3=2, x4=0 and Max z = 16
95
Anil Kumar, Mathematics, BITS-Goa

Example 5

Maximize
z  3 x1  5 x2  3 x3
Subject to the constraints

x1  4 x2  x3  7
2 x1  x2  x4  10
x1 , x2 , x3 , x4  0

Anil Kumar, Mathematics, BITS-Goa 96

BITS Pilani, Goa Campus 48


Example 5…

Introducing surplus variables, the problem is:

Minimize z  3 x1  5 x2  3x3
Subject to the constraints
x1  4 x2  x3  s1  7
2x1  x2  x4  s2  10
x1, x2, x3, x4, s1, s2  0

Anil Kumar, Mathematics, BITS-Goa 97

Example 5…

Since in this problem as we already have a 2×2


identity submatrix below the variables x3, x4 in the
coefficient matrix of the constraint equations, there
is no need to add artificial variables. We can start
the Simplex algorithm with x3, x4 as basic variables.

Anil Kumar, Mathematics, BITS-Goa 98

BITS Pilani, Goa Campus 49


Basic z x1 x2 x3 x4 s1 s2 Sol.

0 7 0 0 -3 0 21
z 1 -3 -5 -3 0 0 0 0
x3 0 1 4 1 0 -1 0 7
x4 0 2 1 0 1 0 -1 10
z 1 -7/4 0 -7/4 0 -5/4 0 35/4

x2 0 1/4 1 1/4 0 -1/4 0 7/4


x4 0 7/4 0 -1/4 1 1/4 -1 33/4
This is the Optimal tableau and the optimal solution is
x1=0, x2=7/4, x3=0, x4=33/4, Min z = 35/4
Anil Kumar, Mathematics, BITS-Goa 99

Example 6

Maximize z  x1  5 x2  3 x3

Subject to the constraints

x1  2 x2  x3  3
2 x1  x2 4
x1 , x2 , x3  0

Anil Kumar, Mathematics, BITS-Goa 100

BITS Pilani, Goa Campus 50


Example 6…

There is a unit vector column (coefficients of x3); so


we will not add an artificial variable to the first
constraint equation.
However, to get a starting BFS (= for getting a 2×2
identity submatrix) we have to add an artificial
variable to the second constraint equation and then
we solve it by big M method.

Anil Kumar, Mathematics, BITS-Goa 101

Example 6…

Thus we have to
Maximize
z  x1  5 x2  3 x3  MR2
Subject to the constraints
x1  2 x2  x3 3
2 x1  x2  R2  4
x1 , x2 , x3 , R2  0

Anil Kumar, Mathematics, BITS-Goa 102

BITS Pilani, Goa Campus 51


Basic z x1 x2 x3 R2 Sol

-1-2M -5+M 0 0 -4M


z 1 -1 -5 -3 M 0
x3 0 1 2 1 0 3
R2 0 2 -1 0 1 4
z 1 0 -11/2 0 ½ +M 2

x3 0 0 5/2 1 -1/2 1

x1 0 1 -1/2 0 1/2 2

Anil Kumar, Mathematics, BITS-Goa 103

Basic z x1 x2 x3 R2 Sol

z 1 0 -11/2 0 ½ +M 2
x3 0 0 5/2 1 -1/2 1
x1 0 1 -1/2 0 1/2 2
z 1 0 0 11/5 -3/5 +M 21/5

x2 0 0 1 2/5 -1/5 2/5

x1 0 1 0 1/5 2/5 11/5


This is the Optimal tableau and the optimal solution:
x1=11/5, x2=2/5, x3=0 and Max z = 21/5
Anil Kumar, Mathematics, BITS-Goa 104

BITS Pilani, Goa Campus 52


Special Case:

Now we shall look at four special cases that arise


in the application of Simplex method.

 Degeneracy
 Alternative optimum solutions
 Unbounded solutions
 Infeasible solutions

Anil Kumar, Mathematics, BITS-Goa 105

Degeneracy
 A basic solution is called degenerate if the value of at least one
of the basic variables is zero (otherwise non-degenerate).
 In simplex method, a tie for the minimum ratio may occur and
can be broken arbitrarily.
 When this happens, at least one basic variable will be zero in
the next iteration, and the new solution is said to be degenerate.
 Degeneracy can cause the simplex iterations to cycle
indefinitely, thus never terminating the algorithms (i.e. the
solution which we have obtained in one iteration may repeat
after few iterations).
 The condition also reveals that the model has at least one
redundant constraint.
Anil Kumar, Mathematics, BITS-Goa 106

BITS Pilani, Goa Campus 53


Example: Degenerate Optimal Solution

 Solve the following LPP

max z  3 x1  9 x2
subject to
x1  4 x2  8
x1  2 x2  4
x1 , x2  0

Anil Kumar, Mathematics, BITS-Goa 107

Optimal degenerate solution

Redundant constraint

Anil Kumar, Mathematics, BITS-Goa 108

BITS Pilani, Goa Campus 54


Basic z x1 x2 s1 s2 sol Ratio
z 1 -3 -9 0 0 0
s1 0 1 4 1 0 8 2
s2 0 1 2 0 1 4 2
z 1 -3/4 0 9/4 0 18
x2 0 1/4 1 1/4 0 2 8
s2 0 1/2 0 -1/2 1 0 0
z 1 0 0 3/2 3/2 18
x2 0 0 1 1/2 -1/2 2
x1 0 1 0 -1 2 0

Optimal solution: x1 = 0, x2 = 2, Max. z = 18

Anil Kumar, Mathematics, BITS-Goa 109

Method to Resolve Degeneracy (Tie)

 Find out the rows for which the minimum non-negative ratio
is the same (tie).
 Find the minimum ration
elements of first column of unit matrix

corresponding elements of key column
 If this minimum is attained for 2nd row (say), then this row
will determine the key element by intersecting with the
key column
 Otherwise, take the minimum ratio with the 2nd column of
the unit matrix and continue till we get unique minimum.

Anil Kumar, Mathematics, BITS-Goa 110

BITS Pilani, Goa Campus 55


Example
Consider the LPP

Maximize z  3 x1  2 x 2
Subject to the constraints 4 x 1  x2  8
4 x1  3 x 2  1 2
4 x1  x2  8
x1 , x 2  0
 Solve it by Simplex method.

Anil Kumar, Mathematics, BITS-Goa 111

Basic z x1 x2 s1 s2 s3 Sol. Ratio


z 1 -3 -2 0 0 0 0
s1 0 4 -1 1 0 0 8 2
s2 0 4 3 0 1 0 12 3
s3 0 4 1 0 0 1 8 2
z 1 0 -11/4 3/4 0 0 6
x1 0 1 -1/4 1/4 0 0 2 --
s2 0 0 4 -1 1 0 4 1
s3 0 0 2 -1 0 1 0 0
Note that the BFS obtained is degenerate as s3 = 0. (We also
observe that there was a tie for the leaving variable.) 112

BITS Pilani, Goa Campus 56


Basic z x1 x2 s1 s2 s3 Sol. Ratio
z 1 0 0 -5/8 0 11/8 6
x1 0 1 0 1/8 0 1/8 2 16
s2 0 0 0 1 1 -2 4 4
x2 0 0 1 -1/2 0 1/2 0 --
z 1 0 0 0 5/8 1/8 17/2
x1 0 1 0 0 -1/8 3/8 3/2
s1 0 0 0 1 1 -2 4
x2 0 0 1 0 1/2 -3/2 2
This is the optimal tableau. Note that the optimal BFS obtained
is NOT degenerate. Anil Kumar, Mathematics, BITS-Goa
113

An example where cycling happens

Consider the LPP

Maximize 3 1
z x1  20 x2  x3  6 x4
4 2
1
Subject to the constraints x1  8 x2  x3  9 x4  0
4
1 1
x1  12 x2  x3  3 x4  0
2 2
x3 1
x1 , x2 , x3 , x4  0

Anil Kumar, Mathematics, BITS-Goa 114

BITS Pilani, Goa Campus 57


Alternative Optimal Solutions

When the objective function is parallel to a non-


redundant binding constraint (i.e. a constraint that is
satisfied as an equation at the optimal solution), then the
objective function will assume the same optimal value at
more than one corner point.
We say the problem has alternative optimal solutions.
In this case there also will be an infinity of (non-basic)
feasible solutions where the objective function has the
same optimum value.

Anil Kumar, Mathematics, BITS-Goa 115

Alternative Optimal Solutions

Criterion for the existence of alternative optimal


solutions from the optimal tableau:
 If in the optimal tableau, the coefficient of a non-
basic variable in the z-row is zero, then there are
alternative optimal solutions.
 Another basic solution can be obtained by making
such non-basic variable enter the basis.
 Thus we shall have alternative optimal solutions as
the following example illustrates.

Anil Kumar, Mathematics, BITS-Goa 116

BITS Pilani, Goa Campus 58


Example 1:

Consider the LPP

Maximize z  x1  x2
Subject to the constraints x1  x2  6
x1  2 x 2  1 0
x1 , x 2  0

 Solve it by Simplex method.

Anil Kumar, Mathematics, BITS-Goa 117

Basic z x1 x2 s1 s2 Sol.
z 1 -1 -1 0 0 0
s1 0 1 1 1 0 6
S2 0 1 2 0 1 10
z 1 0 0 1 0 6 This is the opt.
tableau. Since
x1 0 1 1 1 0 6 coefficient of the
s2 0 0 1 -1 1 4 non-basic variable
x2 is 0, alt. opt.
z 1 0 0 1 0 6 soln. exists.
x1 0 1 0 2 -1 2
x2 0 0 1 -1 1 4
Note that we have got an alternate optimal solution. We understand
this graphically also in the next slide. Anil Kumar, Mathematics, BITS-Goa 118

BITS Pilani, Goa Campus 59


(0,6) Optimal BFSs
(0,5)
(2,4)

(6,0) (10,0)
Note that the objective function line is parallel to the first
(binding) constraint line.
Anil Kumar, Mathematics, BITS-Goa 119

Unbounded solutions
In some LPPs, the values of some decision variables
can be increased indefinitely without violating any of
the constraints, that is, the solution space is
unbounded in at least one direction.
As a result the objective value may increase
(maximization case) or decrease (minimization case)
indefinitely.
Thus both the feasible solution space and the
objective function are unbounded.

Anil Kumar, Mathematics, BITS-Goa 120

BITS Pilani, Goa Campus 60


Unbounded solutions
 The solution space is unbounded if in a Simplex
iteration,
all the entries in a column corresponding to a non-
basic variable are negative (or zero) in all the
constraint rows and in the objective function row,
the entry is:
 (a) negative (or zero) in the case of a maximization
problem
 (b) positive (or zero) in the case of a minimization
problem
Anil Kumar, Mathematics, BITS-Goa 121

Example
Consider the LPP
Maximize z  20 x  10 x  x
1 2 3

Subject to the constraints 3 x1  3 x 2  5 x 3  5 0


x1  x3  10
x1  x2  4 x3  2 0
x1 , x 2 , x 3  0
 Solve it by Simplex method.
 It is clear that the solution space is unbounded in
the x2 direction.
Anil Kumar, Mathematics, BITS-Goa 122

BITS Pilani, Goa Campus 61


Infeasible Solution
 LP models with inconsistent constraints have no feasible
solution (i.e. when no points satisfies all the constraints).
 This situation can never occur if all the constraints are of the
type ≤ with nonnegative right-hand sides because the slack
variables provide a feasible solution.
 For other type of constraints, we use artificial variables.
 Although the artificial variables are penalized in the objective
function to force them to zero at the optimum, this can occur
only if the model has a feasible space.
 Otherwise, at least one artificial variable will be positive in
the optimum iteration.

Anil Kumar, Mathematics, BITS-Goa 123

Example
Consider the LPP
Maximize z  3 x1  2 x2
Subject to the constraints
2 x1  x 2  2
3 x1  4 x 2  1 2
x1 , x 2  0

 Solve it by Two Phase method.

Anil Kumar, Mathematics, BITS-Goa 124

BITS Pilani, Goa Campus 62