You are on page 1of 153

Linear Programming

Simplex method and some important points

Note
In some cases there can be more than 1 optimal
solution
A constraint whose removal does not change the
feasible region is called redundant constraint

Assumptions in LP
Certainity - contribution of the decision variable to the
objective function has to be known.
Additivity Value of the objective function and the total
amount of each of the resources used must be equal to
the sum of the respective individual contribution. Total
profit=sum of the individual profits.
Linearity : There has to be proportionality
Divisibility.

Simplex Method

Advantages
Gives improving answers
Should not solve infeasible solutions
Terminate when optimum is reached

Points to remember
Inequalities are converted into equalities by adding
slack variables
We assume that there is a solution and start the
problem
The slack variables dont affect the objective function
Even the slack variables take up a value greater than or
equal to zero value.
Initially we will start with a basic feasible solution and
after iterations get the optimum value.

Problem No. 2 in Question paper


Complete Linear Programming Model:
MaximizeZ = 6x1 + 5x2
subject to: x1 + x2 5
3x1 + 2x2 12
x1, x2 0

Step 1
Convert the in equalities to equalities

Formulation of the Simplex tableStep 1


6

X1

X2

X3

X4

Coefficients
correspondi
ng to
variables in
Obj. Fn.
variables

STEP 2

Coefficients
of Basic
Variables in
Objective
function

X1

X2

X3

X4

RHS

X3

X4

12

Basic
Variables

Coefficients
of Variables
in the
constraints

Right hand
side in the
constraints
Correspondi
ng to the
basic
variables
we have a
identity

X1

X2

X3

X4

RHS

X3

X4

12

Cj-Zj

Calculate Cj-Zj

{C1Z1}

{C2-Z2
}

{ C3-Z3
}

{C4-Z4
}

{Zj }

Step 3
6

X1

X2

X3

X4

RHS

X3

X4

12

Cj-Zj

{C1Z1}

{C2-Z2
}

{ C3-Z3
}

{C4-Z4
}

{Zj }

Cj - Coefficients belonging to Xj variable in the objective function. In this


case j is 1,2,3,4
In this case

Z1 = [(0*1)+(0*3] hence C -Z = 6 1

[(0*1)+(0*3]= 6
Similarly calculate the other values of the cells

Resulting Table after step 3


6

X1

X2

X3

X4

RHS

X3

X4

12

Cj-Zj

Step 4

Entering Variable

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

Among Cj-Zj identify the greatest positive value. The


variable corresponding to that variable is the entering
variable
Now we have to calculate the value. Divide the RHS by
the coefficients in the cells of the column of the entering
variable

Step 4

Entering Variable

Leaving Variable
6

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

5
0
Pivot
Element
Among Cj-Zj identify the greatest positive value. The
variable corresponding to that variable is the entering
variable

Pivot Row

Indentify the cell with the lowest


value. The row corresponding to that
value is called the Pivot row and the
variable is called the leaving
Now we have to calculate the value. Divide the RHS by
variable.
the coefficients in the cells of the column of the entering
variable

Step 5
Replace the variable X4 by X1 and change the
coefficients. The table after modification looks like the
following
6

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

X1

Next step is to fill the values for the Variable X1 in the Table

Step 6
Divide the Pivot row by the Pivot element
6

X1

X2

X3

X4

RHS

X3

X4

12

2/3

1/3

CJ-ZJ

X3

X1

We have to get the identity matrix corresponding to the basic


variable so operate the row corresponding to the variable X3 using
the elements in the row corresponding to X1. Let us assume the
first element is A ,then A = B-C.

Step 6
Divide the Pivot row by the Pivot element
6

X1

X2

X3

X4

RHS

X3

1 (B)

X4

12

2/3

1/3

CJ-ZJ

X3

X1

A
1 (C)

We have to get the identity matrix corresponding to the basic


variable so operate the row corresponding the variable X3 using the
elements in the row corresponding to X1. Let us assume the first
element is A ,then A = B-C.

Step 6 continued
6

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

X1

Similarly do for the other elements

2/3

1/3

Step 6 continued
6

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

1/3

-1/3

X1

2/3

1/3

CJ-ZJ
Now calculate Cj-Zj and value

Step 6 continued
6

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

1/3

-1/3

X1

2/3

1/3

-2

24

CJ-ZJ

Step 7
6

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

1/3

-1/3

X1

2/3

1/3

CJ-ZJ
0
1
0
Among Cj-Zj identify
the greatest positive value. The
variable corresponding to that variable is the entering
variable

-2

Now we have to calculate the value. Divide the RHS by


the coefficients in the cells of the column of the entering
variable

24

Step 8
6

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

1/3

-1/3

X1

2/3

1/3

CJ-ZJ

Indentify the cell with the lowest


value. The row corresponding to that
value is called the Pivot row and the
variable is called the leaving
variable. Repeat step 5, 6 ,7

-2

24

Step 9
Replace the variable X3 by X2 and change the
coefficients. The table after modification looks like the
following
6
5
0
0
X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

1/3

-1/3

X1

2/3

1/3

CJ-ZJ

X2

X1

-2

Next step is to fill the values for the Variable X2 in the Table

24

Step 10
Divide the Pivot row by the
Pivot element

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

1/3

-1/3

X1

2/3

1/3

CJ-ZJ

X2

X1

1
0

0
1

-2
3

24
-1

Step 10
6

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

1/3

-1/3

X1

2/3 (B)

1/3

CJ-ZJ
5

X2

-2

24

1 (C)

-1

6
X1
(A )
We have to get the identity matrix corresponding to the basic
variable so operate the row corresponding the variable X2 using the
elements in the row corresponding to X1. Let us assume the
element is A then A = [ B-(2/3*C)]

Step 11
6

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

1/3

-1/3

X1

2/3

1/3

CJ-ZJ
5

X2

X1

-2

24

-1

Step 11
6

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

1/3

-1/3

X1

2/3

1/3

CJ-ZJ
5

X2

X1

CJ-ZJ
Now calculate Cj-Zj

-2

24

-1

-2

X1

X2

X3

X4

RHS

Step 120

X3

X4

12

CJ-ZJ

X3

1/3

-1/3

X1

2/3

1/3

CJ-ZJ

-2

24

X2

-1

X1

-2

CJ-ZJ

Among Cj-Zj identify the greatest positive value. The


variable corresponding to that variable is the entering
variable . In this case we dont have a positive value and
the algorithm terminates. No need to calculate the
value.

-3

-1

27

The Solution is
X1=
2
X2=3
Z=
27

Conclusion
6

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

1/3

-1/3

X1

2/3

1/3

-2

24

CJ-ZJ

X2

-1

X1

-2

CJ-ZJ

-3

-1

27

The algorithm did not


evaluate an infeasible
solution.
The algorithm gives
improving solution
The algorithm
terminates when
optimum value is
reached

Problem 2
Complete Linear Programming Model:
MaximizeZ = 6x1 + 8x2
subject to: x1 + x2 10
2x1 + 3x2 25
x1 + 5x2 35
x1, x2 0

Add slack variables


MaximizeZ = 6x1 + 8x2
subject to: x1 + x2 + x3 10
2x1 + 3x2 + x4 25
x1 + 5x2 + x5 35
x1, x2,,x3 , x4 , x5 0

Step 1
6

X3

X4

X5

0
RHS

X1

X2

X3

X4

X5

10

25

35

X3

X4

X5
Cj-Zj

0
RHS

X1

X2

X3

X4

X5

10

25

35

0
RHS

X3

X4

X5
Cj-Zj

X1

X2

X3

X4

X5

10

25

35

X1

X2

X3

X4

X5

RHS

X3

10

10

X4

25

25/3

X5

35

Cj-Zj
0

X3

X4

X2

X1

X2

X3

X4

X5

RHS

X3

10

10

X4

25

25/3

X5

35

Cj-Zj
0

X3

X4

X2

1/5

1/5

X1

X2

X3

X4

X5

RHS

X3

10

10

X4

25

25/3

X5

35

Cj-Zj
0

X3

X4

7/5

-3/5

X2

1/5

1/5

X1

X2

X3

X4

X5

RHS

X3

10

10

X4

25

25/3

X5

35

Cj-Zj
0

X3

4/5

-1/5

X4

7/5

-3/5

X2

1/5

1/5

X1

X2

X3

X4

X5

RHS

X3

10

10

X4

25

25/3

X5

35

Cj-Zj
0

X3

4/5

-1/5

X4

7/5

-3/5

X2

1/5

1/5

X1

X2

X3

X4

X5

RHS

X3

10

10

X4

25

25/3

X5

35

Cj-Zj
0

X3

4/5

-1/5

X4

-3/5

X2

1/5

1/5

Cj-Zj

X1

X2

X3

X4

X5

RHS

X3

10

10

X4

25

25/3

X5

35

Cj-Zj
0

X3

4/5

-1/5

X4

7/5

-3/5

X2

1/5

1/5

22/5

-8/5

56

Cj-Zj

X1

X2

X3

X4

X5

RHS

X3

10

10

X4

25

25/3

X5

35

Cj-Zj
0

X3

4/5

-1/5

15/4

X4

-3/5

20/7

X2

1/5

1/5

35

22/5

-8/5

56

Cj-Zj


0
0
0

X3
X4
X5
Cj-Zj

0
0
8

X3
X4
X2
Cj-Zj

X3

X1

X2

6
X1
1
2
1
6
4/5

1/5
22/5

8
X2
1
3
5
8
0
0
1
0

0
X3
1
0
0
0
1
0
0
0

0
X4
0
1
0
0
0
1
0
0

0
X5
0
0
1
0
-1/5
-3/5
1/5
-8/5

RHS

10
25
35
0
3
4
7
56

10
25/3
7

15/4
20/7
35


0
0
0

X3
X4
X5
Cj-Zj

0
0
8

X3
X4
X2
Cj-Zj

X3

X1

X2

6
X1
1
2
1
6
4/5

1/5
22/5

8
X2
1
3
5
8
0
0
1
0

0
X3
1
0
0
0
1
0
0
0

0
X4
0
1
0
0
0
1
0
0

0
X5
0
0
1
0
-1/5
-3/5
1/5

5/7

-3/7

RHS

10
25
35
0
3
4
7
56

10
25/3
7

15/4
20/7
35

20/7


0
0
0

X3
X4
X5
Cj-Zj

0
0
8

X3
X4
X2
Cj-Zj

6
X1
1
2
1
6
4/5

1/5
22/5

8
X2
1
3
5
8
0
0
1
0

0
X3
1
0
0
0
1
0
0
0

0
X4
0
1
0
0
0
1
0
0

0
X5
0
0
1
0
-1/5
-3/5
1/5

RHS

10
25
35
0
3
4
7
56

10
25/3
7

15/4
20/7
35

X3

-4/7

1/7

5/7

X1

5/7

-3/7

20/7

X2


0
0
0

X3
X4
X5
Cj-Zj

0
0
8

X3
X4
X2
Cj-Zj

6
X1
1
2
1
6
4/5

1/5
22/5

8
X2
1
3
5
8
0
0
1
0

0
X3
1
0
0
0
1
0
0
0

0
X4
0
1
0
0
0
1
0
0

0
X5
0
0
1
0
-1/5
-3/5
1/5

RHS

10
25
35
0
3
4
7
56

10
25/3
7

15/4
20/7
35

X3

-4/7

1/7

5/7

X1

5/7

-3/7

20/7

X2

-1/7

2/7

45/7


0
0
0

X3
X4
X5
Cj-Zj

0
0
8

X3
X4
X2
Cj-Zj

6
X1
1
2
1
6
4/5

1/5
22/5

8
X2
1
3
5
8
0
0
1
0

0
X3
1
0
0
0
1
0
0
0

0
X4
0
1
0
0
0
1
0
0

0
X5
0
0
1
0
-1/5
-3/5
1/5

RHS

10
25
35
0
3
4
7
56

10
25/3
7

15/4
20/7
35

X3

-4/7

1/7

5/7

X1

5/7

-3/7

20/7

X2

-1/7

2/7

45/7

Cj-Zj


0
0
0

X3
X4
X5
Cj-Zj

0
0
8

X3
X4
X2
Cj-Zj

6
X1
1
2
1
6
4/5

1/5
22/5

8
X2
1
3
5
8
0
0
1
0

0
X3
1
0
0
0
1
0
0
0

0
X4
0
1
0
0
0
1
0
0

0
X5
0
0
1
0
-1/5
-3/5
1/5

RHS

10
25
35
0
3
4
7
56

10
25/3
7

15/4
20/7
35

X3

-4/7

1/7

5/7

X1

5/7

-3/7

20/7

X2

0
0

1
0

0
0

-1/7
-22/7

2/7
2/7

45/7
480/7

Cj-Zj


0
0
0

X3
X4
X5
Cj-Zj

0
0
8

X3
X4
X2
Cj-Zj

0
6
8

X3
X1
X2
Cj-Zj

6
X1
1
2
1
6
4/5

1/5
22/5
0
1
0
0

8
X2
1
3
5
8
0
0
1
0
0
0
1
0

0
X3
1
0
0
0
1
0
0
0
1
0
0
0

0
X4
0
1
0
0
0
1
0
0
-4/7
5/7
-1/7
-22/7

0
X5
0
0
1
0
-1/5
-3/5
1/5

1/7
-3/7
2/7
2/7

RHS

10
25
35
0
3
4
7
56
5/7
20/7
45/7
480/7

10
25/3
7

15/4
20/7
35

5
-45/2

to be calculated only when it is positive. When it is negative or zero we need not


calculate


0
0
0

X3
X4
X5

6
X1
1
2
1
6
4/5

1/5
22/5
0
1
0
0

8
X2
1
3
5
8
0
0
1
0
0
0
1
0

0
X3
1
0
0
0
1
0
0
0
1
0
0
0

0
X4
0
1
0
0
0
1
0
0
-4/7
5/7
-1/7
-31/7

0
X5
0
0
1
0
-1/5
-3/5
1/5

1/7
-3/7
2/7
2/7

RHS

10
25
35
0
3
4
7
56
5/7
20/7
45/7
480/7

X5

10
25/3
7

15/4
20/7
35

5
-45/2

X1

X2

Cj-Zj
0
0
8

X3
X4
X2
Cj-Zj

0
6
8

X3
X1
X2
Cj-Zj


0
0
0

X3
X4
X5
Cj-Zj

0
0
8

X3
X4
X2
Cj-Zj

0
6
8

X3
X1
X2
Cj-Zj

0
6

X5
X1

X2

6
X1
1
2
1
6
4/5

1/5
22/5
0
1
0
0
0

8
X2
1
3
5
8
0
0
1
0
0
0
1
0
0

0
X3
1
0
0
0
1
0
0
0
1
0
0
0
7

0
X4
0
1
0
0
0
1
0
0
-4/7
5/7
-1/7
-31/7
-4

0
X5
0
0
1
0
-1/5
-3/5
1/5

1/7
-3/7
2/7
2/7
1

RHS

10
25
35
0
3
4
7
56
5/7
20/7
45/7
480/7
5

10
25/3
7

15/4
20/7
35

5
-45/2


0
0
0

X3
X4
X5
Cj-Zj

0
0
8

X3
X4
X2
Cj-Zj

0
6
8

X3
X1
X2
Cj-Zj

0
6
8

X5
X1
X2

6
X1
1
2
1
6
4/5

1/5
22/5
0
1
0
0
0
1

8
X2
1
3
5
8
0
0
1
0
0
0
1
0
0
0

0
X3
1
0
0
0
1
0
0
0
1
0
0
0
7
3

0
X4
0
1
0
0
0
1
0
0
-4/7
5/7
-1/7
-31/7
-4
-1

0
X5
0
0
1
0
-1/5
-3/5
1/5

1/7
-3/7
2/7
2/7
1
0

RHS

10
25
35
0
3
4
7
56
5/7
20/7
45/7
480/7
5
5

10
25/3
7

15/4
20/7
35

5
-45/2


0
0
0

X3
X4
X5
Cj-Zj

0
0
8

X3
X4
X2
Cj-Zj

0
6
8

X3
X1
X2
Cj-Zj

0
6
8

X5
X1
X2

6
X1
1
2
1
6
4/5

1/5
22/5
0
1
0
0
0
1
0

8
X2
1
3
5
8
0
0
1
0
0
0
1
0
0
0
1

0
X3
1
0
0
0
1
0
0
0
1
0
0
0
7
3
-2

0
X4
0
1
0
0
0
1
0
0
-4/7
5/7
-1/7
-31/7
-4
-1
1

0
X5
0
0
1
0
-1/5
-3/5
1/5

1/7
-3/7
2/7
2/7
1
0
0

RHS

10
25
35
0
3
4
7
56
5/7
20/7
45/7
480/7
5
5
5

10
25/3
7

15/4
20/7
35

5
-45/2


0
0
0

X3
X4
X5
Cj-Zj

0
0
8

X3
X4
X2
Cj-Zj

0
6
8

X3
X1
X2
Cj-Zj

0
6
8

X5
X1
X2
Cj-Zj

6
X1
1
2
1
6
4/5

1/5
22/5
0
1
0
0
0
1
0

8
X2
1
3
5
8
0
0
1
0
0
0
1
0
0
0
1

0
X3
1
0
0
0
1
0
0
0
1
0
0
0
7
3
-2

0
X4
0
1
0
0
0
1
0
0
-4/7
5/7
-1/7
-31/7
-4
-1
1

0
X5
0
0
1
0
-1/5
-3/5
1/5

1/7
-3/7
2/7
2/7
1
0
0

RHS

10
25
35
0
3
4
7
56
5/7
20/7
45/7
480/7
5
5
5

10
25/3
7

15/4
20/7
35

5
-45/2


0
0
0

X3
X4
X5
Cj-Zj

0
0
8

X3
X4
X2
Cj-Zj

0
6
8

X3
X1
X2
Cj-Zj

0
6
8

X5
X1
X2
Cj-Zj

6
X1
1
2
1
6
4/5

1/5
22/5
0
1
0
0
0
1
0
0

8
X2
1
3
5
8
0
0
1
0
0
0
1
0
0
0
1
0

0
X3
1
0
0
0
1
0
0
0
1
0
0
0
7
3
-2
-2

0
X4
0
1
0
0
0
1
0
0
-4/7
5/7
-1/7
-31/7
-4
-1
1
-2

0
X5
0
0
1
0
-1/5
-3/5
1/5

1/7
-3/7
2/7
2/7
1
0
0
0

RHS

10
25
35
0
3
4
7
56
5/7
20/7
45/7
480/7
5
5
5
70

10
25/3
7

15/4
20/7
35

5
-45/2

Solution
Algorithm terminates with
X1=5
X2=5
Z=70
Avariablethatleavescanre-enter
Everyiterationhasuniquevariables
Wedontcomputewhendividingnumberisnegativeor0
Dontwritethecellvaluesindecimalform,writeonlyinfractionalform.

Important stages in the LP simplex


method
Initialization
Iteration
Termination

Minimization Problems

Problem 1
Minimize Z = 3x1 + 4x2
subject to:

2x1 + 3x2 8

5x1 + 2x2 12
x1, x2 0

Change the constraints to equality


constraints
Hence the problem changes to
Minimize Z = 3x1 + 4x2+0x3+0x4
subject to:

2x1 + 3x2 x3 = 8

5x1 + 2x2 x4 = 12
x1, x2,x3,x4 0
x3,x4 are called surplus variables.

We are used to solving maximization problems so


convert the minimization objective to maximization
objective.
Max Z = -3x1 - 4x2-0x3-0x4
subject to:

2x1 + 3x2 x3 = 8

5x1 + 2x2 x4 = 12
x1, x2,x3,x4 0

Surplus variables dont qualify for basic feasible solution


because they will violate the constraints.
In order to start the simplex algorithm we need to have
a basic feasible solution. So in this case we add
something called as artificial variables.
For a maximization problem we give a very small value
to these variables.

So the problem becomes


Max Z = -3x1 - 4x2-0x3-0x4-Ma1-Ma2
subject to:

2x1 + 3x2 x3 +a1= 8

5x1 + 2x2 x4 +a2= 12


x1, x2,x3,x4 0
Where M is a very large positive value which tends to infinity.
First we have to ensure that the optimum solution doesnt have these
variables as part of the solution.
a1,a2 are not part of the problem, no clear definition, no physical
meaning. The are called as artificial variable.

This method of solving is called Big


M method

-3

-4

-M

-M

X1

X2

X3

X4

a1

a2

RHS

-M

a1

-M

a2

-3

-4

-M

-M

X1

X2

X3

X4

a1

a2

RHS

-M

a1

-1

-M

a2

-1

12

Cj-Zj

-3

-4

-M

-M

X1

X2

X3

X4

a1

a2

RHS

-M

a1

-1

-M

a2

-1

12

7M-3

5M-4

-M

-M

Cj-Zj

-3

-4

-M

-M

X1

X2

X3

X4

a1

a2

RHS

-M

a1

-1

-M

a2

-1

12

7M-3

5M-4

-M

-M

Cj-Zj

-3

-4

-M

-M

X1

X2

X3

X4

a1

a2

RHS

-M

a1

-1

-M

a2

-1

12

12/5

7M-3

5M-4

-M

-M

Cj-Zj

*We dont calculate Z because we still have the artificial variable in the
solution

-3

-4

-M

-M
RHS

-M

a1

-M

a2

Cj-Zj
-M

a1

-3

X1

X1

X2

X3

X4

a1

a2

-1

-1

12

7M-3

5M-4

-M

-M

4
12/5

-3

-4

-M

-M
RHS

-M

a1

-M

a2

Cj-Zj

X1

X2

X3

X4

a1

a2

-1

-1

12

7M-3

5M-4

-M

-M

-M

a1

11/5

-1

2/5

-2/5

16/5

-3

X1

2/5

-1/5

1/5

12/5

Cj-Zj

4
12/5

-3

-4

-M

-M
RHS

-M

a1

-M

a2

Cj-Zj

X1

X2

X3

X4

a1

a2

-1

-1

12

7M-3

5M-4

-M

-M

-M

a1

11/5

-1

2/5

-2/5

16/5

-3

X1

2/5

-1/5

1/5

12/5

11M/5-14/5

-M

2M/5-3/5

-7M/5+3/5

Cj-Zj

*We dont calculate Z because we still have the artificial variable in the
solution

4
12/5

-3

-4

-M

-M
RHS

-M

a1

-M

a2

Cj-Zj

X1

X2

X3

X4

a1

a2

-1

-1

12

7M-3

5M-4

-M

-M

-M

a1

11/5

-1

2/5

-2/5

16/5

-3

X1

2/5

-1/5

1/5

12/5

11M/5-14/5

-M

2M/5-3/5

-7M/5+3/5

Cj-Zj

4
12/5

-3

-4

-M

-M
RHS

-M

a1

-M

a2

Cj-Zj

X1

X2

X3

X4

a1

a2

-1

-1

12

7M-3

5M-4

-M

-M

4
12/5

-M

a1

11/5

-1

2/5

-2/5

16/5

16/11

-3

X1

2/5

-1/5

1/5

12/5

11M/5-14/5

-M

2M/5-3/5

-7M/5+3/5

Cj-Zj

-3

-4

-M

-M
RHS

X1

-M

a1

-M

a2

Cj-Zj

X2

X3

X4

a1

a2

-1

-1

12

7M-3

5M-4

-M

-M

4
12/5

-M

a1

11/5

-1

2/5

-2/5

16/5

16/11

-3

X1

2/5

-1/5

1/5

12/5

11M/5-14/5

-M

2M/5-3/5

-7M/5+3/5

Cj-Zj
-4

X2

-3

X1

-3

-M

a1

-M

a2

Cj-Zj

-4

-M

-M
RHS

X1

X2

X3

X4

a1

a2

-1

-1

12

12/5

7M-3

5M-4

-M

-M

-M

a1

11/5

-1

2/5

-2/5

16/5

16/11

-3

X1

2/5

-1/5

1/5

12/5

11M/5-14/5

-M

2M/5-3/5

-7M/5+3/5

Cj-Zj
-4

X2

-5/11

2/11

5/11

-2/11

16/11

-3

X1

2/11

-3/11

-2/11

3/11

20/11

Cj-Zj

-3

-M

a1

-M

a2

Cj-Zj

-4

-M

-M
RHS

X1

X2

X3

X4

a1

a2

-1

-1

12

12/5

7M-3

5M-4

-M

-M

-M

a1

11/5

-1

2/5

-2/5

16/5

16/11

-3

X1

2/5

-1/5

1/5

12/5

11M/5-14/5

-M

2M/5-3/5

-7M/5+3/5

Cj-Zj
-4

X2

-5/11

2/11

5/11

-2/11

16/11

-3

X1

2/11

-3/11

-2/11

3/11

20/11

-14/11

-1/11

-M+14/11

-M+1/11

-124/11

Cj-Zj

Solution
X1=16/11
X2=20/11
Z=124/11

Next is 2-Phase method


In this method first we will eliminate the artificial
variables by making some modification to the objective
function variables and then we will try to solve by the
regular simplex method

-1

-1
RHS

X1

-1

a1

-1

a2

Cj-Zj

X2

X3

X4

a1

a2

-1

-1
RHS

-1

a1

-1

a2

Cj-Zj

X1

X2

X3

X4

a1

a2

-1

-1

12

-3

-M

a1

-M

a2

Cj-Zj

-4

-M

-M
RHS

X1

X2

X3

X4

a1

a2

-1

-1

12

12/5

-1

-1

-20

-1

a1

-1

a2

Cj-Zj
-1

a1

-0

X1

Cj-Zj

-1

-1
RHS

X1

X2

X3

X4

a1

a2

-1

-1

12

12/5

-1

-1

-1

a1

-1

a2

Cj-Zj

-1

-1
RHS

X1

X2

X3

X4

a1

a2

-1

-1

12

12/5

-1

-1

-1

a1

11/5

-1

2/5

-2/5

16/5

-0

X1

2/5

-1/5

1/5

12/5

Cj-Zj

-1

a1

-1

a2

Cj-Zj

-1

-1
RHS

X1

X2

X3

X4

a1

a2

-1

-1

12

12/5

-1

-1

-1

a1

11/5

-1

2/5

-2/5

16/5

16/11

-0

X1

2/5

-1/5

1/5

12/5

11/5

-1

-2/5

-7/5

-16/5

Cj-Zj

-1

a1

-1

a2

Cj-Zj

-1

-1
RHS

X1

X2

X3

X4

a1

a2

-1

-1

12

12/5

-1

-1

-1

a1

11/5

-1

2/5

-2/5

16/5

16/11

-0

X1

2/5

-1/5

1/5

12/5

11/5

-1

-2/5

-7/5

-16/5

Cj-Zj
0

X2

-5/11

2/11

5/11

-2/11

16/11

X1

2/11

-3/11

-2/11

3/11

20/11

-1

-1

Cj-Zj

End of Phase I

Phase II
-3

-4

0
RHS

X1

-4

X2

-3

X1

Cj-Zj

X2

X3

X4

-3

-4

0
RHS

X1

X2

X3

X4

-4

X2

-5/11

2/11

16/11

-3

X1

2/11

-3/11

20/11

Cj-Zj

-3

-4

0
RHS

X1

X2

X3

X4

-4

X2

-5/11

2/11

16/11

-3

X1

2/11

-3/11

20/11

-14/11

-1/11

-124/11

Cj-Zj

Solution is
X1=20/11
X2=16/11
Z=124/11
Why 2 phase method? It eliminates the Big M and it is easy for computer programming.

Important point regarding the


artificial variables
Ensure that the RHS is greater than or equal to zero
Lesser than constraints add slack variables. The slack variables
qualify for the basic feasible solution
Greater than constraints add surplus variables. The Surplus
variables do not qualify for the basic feasible solution. In such
cases add minimum artificial variables to get the basic feasible
solution.
Dont add artificial variables just to add it, do only if there is no
basic feasible solution.
Finally ensure that the optimum solution does not contain the
artificial variable.

Important stages in Simplex method


Initialization
Iteration
Termination
So far we have seen different ways of initiating a problem. Now we shall focus on
the Iteration Part for which we shall consider different examples.

Example 1
Complete Linear Programming Model:
MaximizeZ = 4x1 + 3x2
subject to:
2x1 + 3x2 8
3x1 + 2x2 12
x1, x2 0

Change the problem to the required


form
MaximizeZ = 4x1 + 3x2 +0x3 +0x4
subject to:
2x1 + 3x2 +x3 =8
3x1 + 2x2 +x4 =12
x1, x2 0

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

Assuming there is no tie breaking rule, let us arbitrarily leave one of the
variable

There is
a tie

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

5/3

-2

X1

2/3

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

5/3

-2

X1

2/3

1/3

-4

16

CJ-ZJ

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

5/3

-2/3

X1

2/3

1/3

1/3

-4

16

CJ-ZJ

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

5/3

-2

X1

2/3

1/3

-4

16

CJ-ZJ
3

X2

X1
CJ-ZJ

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

5/3

-2/3

X1

2/3

1/3

1/3

-4

16

CJ-ZJ
3

X2

3/5

-2/5

X1

-2/5

3/5

CJ-ZJ

X1

X2

X3

X4

RHS

X3

X4

12

CJ-ZJ

X3

5/3

-2

X1

2/3

1/3

-4

16

CJ-ZJ
3

X2

3/5

-6/5

X1

-2/5

9/5

-1/5

-18/5

16

CJ-ZJ

Comparison of solution
Solution 1
X1=4,X2=X3=X4=0 and Z=16

Solution 2
X1=4,X2=X3=X4=0 and Z=16
When you end up doing more than the required number of iterations then the condition
is called degeneracy.
When there is tie condition in the theta value then degeneracy will occur.
Degeneracy can happen in the middle of the iterations also.
Degeneracy do not prevent you from getting a optimal solution
In case of Tie we can use the minimum subscript rule, but it is not necessary that you
will avoid degeneracy.
Degeneracy is a Limitation of the Simplex method.

Some things to be noted about


Termination
Alternate solution
Unboundedness
Infeasibility
Cycling

Example for alternate optimum


Complete Linear Programming Model:
MaximizeZ = 4x1 + 3x2
subject to:
8x1 + 6x2 25
3x1 + 4x2 15
x1, x2 0

Change the problem to the required


form
Complete Linear Programming Model:
MaximizeZ = 4x1 + 3x2
subject to:
8x1 + 6x2 + x3 =25
3x1 + 4x2 + x4 =15
x1, x2,x3, x4 0

X1

X2

X3

X4

RHS

X3

25

X4

15

CJ-ZJ

X1

X2

X3

X4

RHS

X3

25

X4

15

CJ-ZJ

X1

X2

X3

X4

RHS

X3

25

25/8

X4

15

15/3

CJ-ZJ

X1

X2

X3

X4

RHS

X3

25

25/8

X4

15

15/3

CJ-ZJ

X1

3/4

1/8

25/8

X4

7/4

-3/8

45/8

X1

X2

X3

X4

RHS

X3

25

25/8

X4

15

15/3

CJ-ZJ

X1

3/4

1/8

25/8

X4

7/4

-3/8

45/8

CJ-ZJ

X1

X2

X3

X4

RHS

X3

25

25/8

X4

15

15/3

CJ-ZJ

X1

3/4

1/8

25/8

X4

7/4

-3/8

45/8

-1/2

100/8

CJ-ZJ

X1

X2

X3

X4

RHS

X3

25

25/8

X4

15

15/3

CJ-ZJ

X1

3/4

1/8

25/8

25/6

X4

7/4

-3/8

45/8

45/14

-1/2

100/8

CJ-ZJ

X1

X2

X3

X4

RHS

X3

25

25/8

X4

15

15/3

CJ-ZJ

X1

3/4

1/8

25/8

25/6

X4

7/4

-3/8

45/8

45/14

-1/2

100/8

CJ-ZJ
4

X1

X2
CJ-ZJ

X1

X2

X3

X4

RHS

X3

25

25/8

X4

15

15/3

CJ-ZJ

X1

3/4

1/8

25/8

25/6

X4

7/4

-3/8

45/8

45/14

-1/2

100/8

CJ-ZJ
4

X1

2/7

-3/7

5/7

X2

-3/14

4/7

45/14

CJ-ZJ

X1

X2

X3

X4

RHS

X3

25

25/8

X4

15

15/3

CJ-ZJ

X1

3/4

1/8

25/8

25/6

X4

7/4

-3/8

45/8

45/14

-1/2

100/8

CJ-ZJ
4

X1

2/7

-3/7

5/7

X2

-3/14

4/7

45/14

-1/2

25/2

CJ-ZJ

*Note that now X4 can again enter the solution

Comparison of solution
Solution 1
X1=25/8,X2=X3=0,X4=45/8 and Z=16

Solution 2
X1=5/7,X2=45/14, X3=X4=0 and Z=16
There is an alternative solution.
When maximum Cj-Zj value is 0 then it indicates that there is an alternative solution.
This happens when the objective function is parallel to one of the constraint and it is
binding.
This can be better explained with the help of a graph
In fact there are more than 2 solutions. But Simplex switches between the corner
points.

Example for Unboundedness


Complete Linear Programming Model:
MaximizeZ = 4x1 + 3x2
subject to:
x1 - 6x2 5
3x1
15
x1, x2 0

Complete Linear Programming Model:


MaximizeZ = 4x1 + 3x2+0x3+0x4
subject to:
x1 - 6x2+x45
3x1+x4 15
x1, x2, x3, x4 0

X1

X2

X3

X4

RHS

X3

-6

X4

11

CJ-ZJ

X1

X2

X3

X4

RHS

X3

-6

X4

11

CJ-ZJ

X1

X2

X3

X4

RHS

X3

-6

X4

11

CJ-ZJ

5
11/3

X1

X2

X3

X4

RHS

X3

-6

X4

11

CJ-ZJ

X3

X1

5
11/3

X1

X2

X3

X4

RHS

X3

-6

X4

11

CJ-ZJ

X3

-6

-1/3

4/3

X1

1/3

11/3

11/3

X1

X2

X3

X4

RHS

X3

-6

X4

11

CJ-ZJ

5
11/3

X3

-6

-1/3

4/3

--

X1

1/3

11/3

--

-4/3

CJ-ZJ

Here we are not able to calculate . This indicates unboundedness.


There is a variable that can enter but there is no variable that can leave since we
are not able to calculate .
This can be explained with the graphical solution.

Entering variable condition


Any Cj-Zj can improve a solution but not give optimum
solution.
In this case if we have entered the variable
corresponding to 3 in the first iteration we could have
concluded the unboundedness.
Other rules include
Largest increasing rule-product of (Cj-Zj)*
First positive rule-When large number of variables are there.
Randomly choose positive Cj-Zj value.

Example for infeasibility


Complete Linear Programming Model:
MaximizeZ = 4x1 + 3x2
subject to:
x1 - 6x23
3x1 12
x1, x2 0

Example for infeasibility


Complete Linear Programming Model:
MaximizeZ = 4x1 + 3x2+0x3+0x4
subject to:
x1 - 6x2+x33
3x1+x4 12
x1, x2, x3, x4 0

Complete Linear Programming Model:


MaximizeZ = 4x1 + 3x2+0x3-0x4Ma1
subject to:
x1+4x2+x3=3
3x1+x2-x4+a1 =12
x1, x2, x3, x4 0

-M

X1

X2

X3

X4

a1

RHS

X3

a1

-1

12

CJ-ZJ

-M

X1

X2

X3

X4

a1

RHS

X3

a1

-1

12

3M+4

M+3

-M

CJ-ZJ

-M

X1

X2

X3

X4

a1

RHS

X3

a1

-1

12

3M+4

M+3

-M

CJ-ZJ

-M

X1

X2

X3

X4

a1

RHS

X3

a1

-1

12

3M+4

M+3

-M

CJ-ZJ

X3

-M

a1

-11

-3

-1

-11-13

-3M-4

-M

Cj-Zj

Problem is infeasible

The solution is infeasible. The value of the artificial


variable is important. It says how much the RHS has to
be adjusted to get a optimal solution.
Simplex say the solution is infeasible but it gives a hint
about what need to be done.
This can be best explained by a graph.

Termination condition
All non basic variables have a negative value for Cj-Zj
All the basic variables have a Cj-Zj=0
At least one basic variable has Cj-Zj=0 indicates
alternate solution.
Algorith finds a entering variable but not a leaving
variable, then it is unboundedness.
All the non basic variable has a value less than 0 for
Cj-Zj, also artificial variable exists then it is infeasible
If simples algorithm fails to terminate then it is called
cycling- very rare condition.

Problem involving unrestricted


variable
Unrestricted variable - variable which can take either
positive value or negative value
When such a variable exists say Xj then replace the
variable Xj with Xj- Xj (X1=X2-X3) where Xj, Xj are
both positive.

Example
MaximizeZ = 4x1 + 5x2
subject to:
2x1 + 3x2 8
x1 + 4x2 10
x1 is unrestricted, x2 0

Convert to Standard form


MaximizeZ = 4(x3-x4) + 5x2
subject to:
2(x3-x4) + 3x2 8
(x3-x4) + 4x2 10
x3,x4 ,x2 0

Rewrite using slack variables


MaximizeZ = 5x2+4x3-4x4+0X5+0x6
subject to:
3x2+2x3-2x4+x5 = 8
4x2 + x3- x4 +x6 = 10
x2, x3,x4 , x5,x6 0

-4

0
RHS

X5

X6
Cj-Zj

X2

X3

X4

X5

X6

-2

-1

10

-4

0
RHS

X5

X6
Cj-Zj

X2

X3

X4

X5

X6

-2

-1

10

-4

-4

0
RHS

X2

X5

X6

Cj-Zj

X3

X4

X5

X6

-2

-1

10

-4

8/3
10/4


0
0

X5
X6
Cj-Zj

X5

X2
Cj-Zj

5
X2

4
X3

-4
X4

0
X5

0
X6

RHS

3
4

2
1

-2
-1

1
0

0
1

8
10

8/3
10/4

-4


0
0

X5
X6
Cj-Zj

5
X2

4
X3

-4
X4

0
X5

0
X6

RHS

3
4

2
1

-2
-1

1
0

0
1

8
10

8/3
10/4

-4

X5

5/4

-5/4

-3/4

X2

-1/4

5/2

Cj-Zj


0
0

X5
X6
Cj-Zj

5
X2

4
X3

-4
X4

0
X5

0
X6

RHS

3
4

2
1

-2
-1

1
0

0
1

8
10

8/3
10/4

-4

X5

5/4

-5/4

-3/4

X2

-1/4

5/2

11/4

-11/4

-5/4

25/2

Cj-Zj

X5

X6
Cj-Zj

X5

X2
Cj-Zj

-4

X2

X3

X4

X5

X6

-2

-1

10

-4

5/4

-5/4

-3/4

2/5

-1/4

5/2

10

11/4

-11/4

-5/4

25/2

RHS

8/3
10/4


0
0

X5
X6
Cj-Zj

0
5

X5
X2
Cj-Zj

X3

X2
Cj-Zj

5
X2

4
X3

-4
X4

0
X5

3
4

2
1

-2
-1

1
0

0
X6
0
1

5
0

4
5/4

-4
-5/4

0
1

-1/4

11/4

-11/4

RHS

8
10

8/3
10/4

0
-3/4

2/5

5/2

10

-5/4

25/2

-4

X2

X3

X4

X5

X6

RHS

X5

-2

8/3

X6

-1

10

10/4

-4

5/4

-5/4

-3/4

2/5

-1/4

5/2

10

11/4

-11/4

-5/4

25/2

Cj-Zj
0

X5

X2
Cj-Zj

X3

-1

4/5

-3/5

2/5

X2

-1/5

2/5

12/5

Cj-Zj

-4

X2

X3

X4

X5

X6

RHS

X5

-2

8/3

X6

-1

10

10/4

-4

5/4

-5/4

-3/4

2/5

-1/4

5/2

10

11/4

-11/4

-5/4

25/2

Cj-Zj
0

X5

X2
Cj-Zj

X3

-1

4/5

-3/5

2/5

X2

-1/5

2/5

15/5

-11/5

2/5

68/5

Cj-Zj


0
0

X5
X6
Cj-Zj

0
5

X5
X2
Cj-Zj

4
5

X3
X2
Cj-Zj

5
X2

4
X3

-4
X4

0
X5

0
X6

RHS

3
4

2
1

-2
-1

1
0

0
1

8
10

8/3
10/4

5
0

4
5/4

-4
-5/4

0
1

0
-3/4

2/5

-1/4

5/2

10

0
0
1

11/4
1
0

-11/4
-1
0

0
4/5
-1/5

-5/4
-3/5
2/5

25/2
2/5
15/5

-6

-11/5

2/5

68/5


0
0

X5
X6
Cj-Zj

0
5

X5
X2
Cj-Zj

4
5

X3
X2
Cj-Zj

X3

X6

5
X2

4
X3

-4
X4

0
X5

3
4

2
1

-2
-1

1
0

0
X6
0
1

5
0

4
5/4

-4
-5/4

0
1

-1/4

0
0
1

11/4
1
0

RHS

8
10

8/3
10/4

0
-3/4

2/5

5/2

10

-11/4
-1
0

0
4/5
-1/5

-5/4
-3/5
2/5

25/2
2/5
15/5

-6

-11/5

2/5

68/5


0
0

X5
X6
Cj-Zj

0
5

X5
X2
Cj-Zj

4
5

X3
X2
Cj-Zj

5
X2

4
X3

-4
X4

0
X5

3
4

2
1

-2
-1

1
0

0
X6
0
1

5
0

4
5/4

-4
-5/4

0
1

-1/4

0
0
1

11/4
1
0

RHS

8
10

8/3
10/4

0
-3/4

2/5

5/2

10

-11/4
-1
0

0
4/5
-1/5

-5/4
-3/5
2/5

25/2
2/5
15/5

-6

-11/5

2/5

68/5

X3

3/2

-1

X6

5/2

-1/2

Cj-Zj


0
0

X5
X6
Cj-Zj

0
5

X5
X2
Cj-Zj

4
5

X3
X2
Cj-Zj

5
X2

4
X3

-4
X4

0
X5

0
X6

RHS

3
4

2
1

-2
-1

1
0

0
1

8
10

8/3
10/4

5
0

4
5/4

-4
-5/4

0
1

0
-3/4

2/5

-1/4

5/2

10

0
0
1

11/4
1
0

-11/4
-1
0

0
4/5
-1/5

-5/4
-3/5
2/5

25/2
2/5
15/5

-6

-11/5

2/5

68/5

X3

3/2

-1

X6

5/2
-1

0
0

0
0

-1/2
-2

1
0

6
16

Cj-Zj

Solution
X1=4
Z=16 and all other variables 0

You might also like