0% found this document useful (0 votes)
64 views

Operational Research Notes

The document provides information about the simplex method for solving linear programming problems. It defines key terms related to the simplex method such as objective function, constraints, basic and non-basic variables, basis. It also summarizes the steps in the simplex method including choosing an entering variable based on optimality conditions and using Gauss-Jordan row operations to find a new basic feasible solution at each iteration until an optimal solution is found.

Uploaded by

Mayank Saini
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views

Operational Research Notes

The document provides information about the simplex method for solving linear programming problems. It defines key terms related to the simplex method such as objective function, constraints, basic and non-basic variables, basis. It also summarizes the steps in the simplex method including choosing an entering variable based on optimality conditions and using Gauss-Jordan row operations to find a new basic feasible solution at each iteration until an optimal solution is found.

Uploaded by

Mayank Saini
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

TUTORIALSDUNIYA.

COM

Operational Research
Notes
Delhi University
Contributor: Abhishek Sharma
[TutorialsDuniya.com]

Download TutorialsDuniya
App from PlayStore

Visit https://www.tutorialsduniya.com for Notes,


Tutorials, Programs, MCQs, Quiz etc.
 FaceBook: https://facebook.com/tutorialsduniya
 YouTube: https://www.youtube.com/user/tutorialsduniya
 LinkedIn: https://www.linkedin.com/company/tutorialsduniya
 InstaGram: https://www.instagram.com/tutorialsduniya
TUTORIALSDUNIYA.COM
Get FREE Compiled Books, Notes, Programs, Question Papers with Solution
etc of the following subjects at https://www.tutorialsduniya.com

 C and C++  Computer System Architecture


 Java  Discrete Structures
 Data Structures  Operating Systems
 Computer Networks  Algorithms
 Android Programming  DataBase Management Systems
 PHP Programming  Software Engineering
 JavaScript  Theory of Computation
 Java Server Pages  Operational Research
 Python  System Programming
 Microprocessor  Data Mining
 Artificial Intelligence  Computer Graphics
 Machine Learning  Data Science

 DU Programs: https://www.tutorialsduniya.com/programs
 TutorialsDuniya App: http://bit.ly/TutorialsDuniyaApp
 C++ Tutorial: https://www.tutorialsduniya.com/cplusplus
 Java Tutorial: https://www.tutorialsduniya.com/java
 JavaScript Tutorial: https://www.tutorialsduniya.com/javascript
 Python Tutorial: https://www.tutorialsduniya.com/python
 Kotlin Tutorial: https://www.tutorialsduniya.com/kotlin
 JSP Tutorial: https://www.tutorialsduniya.com/jsp
Operational Research Notes - TutorialsDuniya

LP model in equation form

There are 2 requirements on the constraints in Simplex method computation,

m
1. All the constraints are equations with non-negative right-hand side.
2. All the variables are non-negative

co
Converting Inequalities into Equations with Non-negative Right-Hand Side

a.
To convert a less than equals to inequality (<=) to an equation, a non-negative slack variable

iy
is added to the left-hand side of the inequality.

For example the inequality 6x1 + 4x2 <= 24 is converted into 6x1 + 4x2 + S1 = 24 by adding a
un
slack variable S1 where S1>=0.

To convert a greater than equals to inequality (<=) to an equation, a non-negative surplus


sD

variable is subtracted to the left-hand side of the inequality.

For example the inequality x1 + x2>=800 is converted into x1 + x2 – S1 = 800 by subtracting a


surplus variable S1 where S1>=0.
al

If the right hand side of an inequality is negative then it can be made non-negative by
ri

multiplying both sides by -1.

For example the inequality with negative RHS -x1 + x2 >= -25 is converted into x1 - x2 + S1 =
to

25 with non-negative RHS.


Tu

Dealing with Unrestricted Variables

If xi (>=0) is the workforce size in period i, then Xi+1 (>=0) the workforce size in period i + 1
can be expressed as xi+1 = xi + yi+1.

The variable yi+1 must be unrestricted in sign to allow xi+1 to increase or decrease relative to xi.
The simplex method computation requires all the variables to be non-negative. We can
always account for this requirement by using the substitution,

yi+1 = y-i+1 – y+i+1, where y-i+1 >= 0 and y+i+1 >= 0

It is impossible that both variables will assume positive values simultaneously.

Simplex Method

m
co
Introduction
The Simplex Method is a systematic procedure for generating and testing candidate vertex
solutions to a linear program. It starts at an arbitrary corner of the solution set.

a.
At each iteration, it selects the variable that will create the biggest change towards the

iy
minimum (or maximum) solution and that variable replaces one of its compatriots that is
most severely restricting it, so moving the Simplex Method to another corner of the solution
set and more closer to the final solution. In addition, the Simplex Method can also determine
un
if there is no solution actually exists.

Note that Simplex Algorithm is a greedy algorithm since it selects the best choice at each
iteration without needing any information from previous or future iterations.
sD

Three Cases of solution in simplex method:

(i) A solution may occur where no non-basic variable will decrease the cost, in which
al

case the current solution is the optimal solution.


(ii) A non-basic variable might increase to infinity without causing a basic-variable to
ri

become zero, resulting in an unbounded solution.


to

(iii) No solution may actually exist and the Simplex Method must abort.

Entering a variable will be in line with the variable negative coefficient of the objective
Tu

equation. This rule is known as optimal condition.

The entering variable in the objective equation will correspond to the variable with the most
negative coefficient. This rule is known as optimality condition.

Normally, the simplex method starts at the origin (point A) where Xl = X2 = O. At this
starting point, the value of objective function is 0.

The simplex method works alongside the edges of the solution space which means that the
method cannot cut across the solution space.
Definitions of some important terms in simplex method

Objective Function: The function that is either being minimized or maximized. For example,
it may represent the cost that you are trying to minimize.

Optimal Solution: A vector x, which is both feasible (satisfying the constraints) and optimal
(obtaining the largest or smallest objective value).

m
Constraints: A set of equalities and inequalities that the feasible solution must satisfy.

co
Feasible Solution: A solution vector, x, which satisfies the constraints.

Basic Solution: x of (Ax=b) is a basic solution if the n components of x can be partitioned

a.
into m “basic” and n-m “non-basic” variables in such a way that:

the m columns of A corresponding to the basic variables form a nonsingular basis and the
value of each “non-basic” variable is 0.

iy
un
The constraint matrix A has m rows (constraints) and n columns (variables).

Basis: The set of basic variables.


sD

Basic Variables: A variable in the basic solution (value is not 0).

Non-basic Variables: A variable not in the basic solution (value = 0).


al

Slack Variable: A variable added to the problem to eliminate less-than constraints.


ri

Surplus Variable: A variable added to the problem to eliminate greater-than constraints.


to

Artificial Variable: A variable added to a linear program in phase 1 to aid finding a feasible
solution.
Tu

Unbounded Solution: For some linear programs it is possible to make the objective
arbitrarily small (without bound). Such an LP is said to have an unbounded solution.

Gauss-Jordan row operations: It identifies the entering variable column as the pivot
column and the leaving variable row as the pivot row. The intersection of the pivot column
and the pivot row is called the pivot element.
New pivot row = Current pivot row / Pivot element.

For all other rows including z,


New Row = (Current row) – [(its pivot column coefficient) * (New pivot row)]

Entering variable in maximization problem, entering variable will correspond to the


variable with the most negative coefficient in the objective equation.

m
Entering variable in minimization problem, entering variable will correspond to the
variable with the most positive coefficient in the objective equation.

co
Leaving variable in maximization and minimization, is the variable with minimum (non-
negative) ratio of the right-hand side of the equations (solution column) to the corresponding
constraint coefficients under the entering variable.

a.
Optimality condition for maximization: The entering variable in a maximization problem is

iy
the non-basic variable having the most negative coefficient in the z-row. The optimum is
reached at the iteration where all the z-row coefficients of the non basic variables are non
negative.
un
Optimality condition for minimization: The entering variable in a minimization problem is
the non-basic variable having the most positive coefficient in the z-row. The optimum is
reached at the iteration where all the z-row coefficients of the non basic variables are
sD

negative.

Feasibility condition: For both the maximization and the minimization problems, the leaving
al

variable is the basic variable associated with the smallest non negative ratio.
ri
to
Tu
TUTORIALSDUNIYA.COM
Get FREE Compiled Books, Notes, Programs, Question Papers with Solution
etc of the following subjects at https://www.tutorialsduniya.com

 C and C++  Computer System Architecture


 Java  Discrete Structures
 Data Structures  Operating Systems
 Computer Networks  Algorithms
 Android Programming  DataBase Management Systems
 PHP Programming  Software Engineering
 JavaScript  Theory of Computation
 Java Server Pages  Operational Research
 Python  System Programming
 Microprocessor  Data Mining
 Artificial Intelligence  Computer Graphics
 Machine Learning  Data Science

 DU Programs: https://www.tutorialsduniya.com/programs
 TutorialsDuniya App: http://bit.ly/TutorialsDuniyaApp
 C++ Tutorial: https://www.tutorialsduniya.com/cplusplus
 Java Tutorial: https://www.tutorialsduniya.com/java
 JavaScript Tutorial: https://www.tutorialsduniya.com/javascript
 Python Tutorial: https://www.tutorialsduniya.com/python
 Kotlin Tutorial: https://www.tutorialsduniya.com/kotlin
 JSP Tutorial: https://www.tutorialsduniya.com/jsp
Algorithm of Simplex method

1) Insert the slack variables, and find the slack equations.


2) Rewrite the objective function to match the format of the slack equations.
3) Write the initial simplex tableau.

m
4) Determination of pivot element.
a) The most negative indicator in the z row of the tableau determines the pivot column.
b) The pivot row is selected from among the slack equations by using the smallest-

co
quotient rule.
c) The intersection of the pivot column and the pivot row determines the pivot element.

a.
5) Determine whether there is a negative variable in the z row.
6) If there is a negative number in the z row, determine the new basic solution by using the

iy
appropriate Gauss-Jordan computations then go back to Step 4.
7) If there isn’t a negative number is the z row, then the maximum has been reached.
un
Example: Maximize z = 5x1 + 4x2
sD

Subject to

6x1 + 4x2 <= 24

x1 + 2x2 <= 6
al

-x1 + x2 <= 1
ri

x2 <= 2

x1 , x2 >= 0
to
Tu

Step 1: Insert the slack variables, and find the slack equations.

6x1 + 4x2 + s1 <= 24

x1 + 2x2 + s2 <= 6

-x1 + x2 + s3 <= 1

x2 + s4 <= 2

x1 , x2 , s1 , s2, s3, s4 >= 0


Note: variables s1, s2, s3 and s4 are the slacks associated with the respective constraints.

Step 2: Rewrite the objective function to match the format of the slack equations.

Maximize z - 5x1 - 4x2 = 0

m
Step 3: Write the initial simplex tableau.

Non-basic (zero) variables: (X1 , X2)

co
Basic variables: (S1, S2, S3, S4)

Basic Z X1 X2 S1 S2 S3 S4 Solutio

a.
n
Z 1 -5 -4 0 0 0 0 0
S1 0 6 4 1 0 0 0 24
S2
S3
S4
0
0
0
1
-1
0
2
1
1
0
0
0
iy1
0
0
0
1
0
0
0
1
6
1
2
un
The tableau defines the current corner point by specifying its basic variables and their values,
as well as the corresponding value of the objective function, z.
sD

Note: Non-Basic variables always equal zero.


al

Step 4: Determination of pivot element.

In maximization, entering variable will correspond to the variable with the most negative
ri

coefficient in the objective equation.

The leaving variable is the variable with minimum (non-negative) ratio of the right-hand side
to

of the equations (Solution column) to the corresponding constraint coefficients under the
entering variable.
Tu

Basic X1 (Entering) Solution Ratio


S1 6 24 4 (min)
S2 1 6 6
S3 -1 1 -1
S4 0 2 Infinity

After Gauss-Jordan row operations,

Pivot column – x1
Pivot row – s1

Pivot element – 6

Step 5: Determine whether there is a negative variable in the z row.

There are negative variables in the z row hence we have to calculate new pivot row as well as
all other rows using Gauss-Jordan computation.

m
First replace the leaving variable in the Basic column with the entering variable.

co
New pivot row = Current pivot row / Pivot element

For all other rows, including z

a.
New Row = (Current row) – [(its pivot column coefficient) * (New pivot row)]

First replace s1 with x1 in basic column.

New x1 (pivot row) = current x1 row / 6 iy


un
= [0 , 6 , 4 , 1 , 0 , 0 , 0 , 24] / 6

= [0 , 1 , 2/3 , 1/6 , 0 , 0 , 0 , 4]
sD

New z-row = Current z-row - (-5) * New x1-row

= (1 -5 -4 0 0 0 0 0) - (-5) x [0 , 1 , 2/3 , 1/6 , 0 , 0 , 0 , 4]


al

= (1 0 -2/3 5/6 0 0 0 20)

New s2 row = Current S2-row - (1) * New x1-row


ri

= (0 1 2 0 1 0 0 6) - (1) * [0 , 1 , 2/3 , 1/6 , 0 , 0 , 0 , 4]


to

= (0 0 4/3 -1/6 1 0 0 2)

New s3 row = Current s3 row - (-1) x New X1 row


Tu

= (0 -1 1 0 0 1 0 1) - (-1) * [0 , 1 , 2/3 , 1/6 , 0 , 0 , 0 , 4]

=(0 0 5/3 1/6 0 1 0 5)

New s4 row = Current s4-row - (0) x New x1 row

= (0 0 1 0 0 0 1 2) - (0) * [0 , 1 , 2/3 , 1/6 , 0 , 0 , 0 , 4]

= (0 0 1 0 0 0 1 2)
The new basic solution is (x1 s2 s3 s4), and the new tableau becomes

Basic Z X1 X2 S1 S2 S3 S4 Solutio
n
Z 1 0 -2/3 5/6 0 0 0 20
X1 0 1 2/3 1/6 0 0 0 4
S2 0 0 4/3 -1/6 1 0 0 2
S3 0 0 5/3 1/6 0 1 0 5
S4 0 0 1 0 0 0 1 2

m
There are again negative variables in the z row hence we have to calculate new pivot row as

co
well as all other rows using Gauss-Jordan computation.

Basic X2 (Entering) Solution Ratio


X1 2/3 4 6

a.
S2 4/3 2 1.5 (min)
S3 5/3 5 3
S4 1 2 2

Pivot column – x2
iy
un
Pivot row – s2

Pivot element – 4/3


sD

First replace s2 with x2 in basic column.

New x2 (pivot row) = current x2 row / (4/3)

= [0 , 0 , 4/3 , -1/6 , 1 , 0 , 0 , 2] / (4/3)


al

= [0 , 0 , 1 , -1/8 , 3/4 , 0 , 0 , 3/2]


ri

New z-row = Current z-row - (-2/3) * New x1-row

= (1 0 -2/3 5/6 0 0 0 20) - (-2/3) x [0 , 0 , 1 , -1/8 , 3/4 , 0 , 0 , 3/2]


to

= (1 0 0 3/4 1/2 0 0 21)


Tu

New x1 row = Current x1-row - (2/3) * New x1-row

= (0 1 2/3 1/6 0 0 0 4) - (2/3) * [0 , 0 , 1 , -1/8 , 3/4 , 0 , 0 , 3/2]

= (0 1 0 1/4 -1/2 0 0 3)

New s3 row = Current s3 row - (5/3) x New X1 row

= (0 0 5/3 1/6 0 1 0 5) - (5/3) * [0 , 0 , 1 , -1/8 , 3/4 , 0 , 0 , 3/2]

=(0 0 0 3/8 -5/4 1 0 5/2)


New s4 row = Current s4-row - (1) x New x1 row

= (0 0 1 0 0 0 1 2) - (1) * [0 , 0 , 1 , -1/8 , 3/4 , 0 , 0 , 3/2]

= (0 0 0 1/8 -3/4 0 1 1/2)

The new basic solution is (x1 x2 s3 s4), and the new tableau becomes

m
Basic Z X1 X2 S1 S2 S3 S4 Solutio
n
Z 1 0 0 3/4 1/2 0 0 21

co
X1 0 1 0 1/4 -1/2 0 0 3
X2 0 0 1 -1/8 3/4 0 0 3/2
S3 0 0 0 3/8 -5/4 1 0 5/2
S4 0 0 0 1/8 -3/4 0 1 1/2

a.
Now, none of the z-row coefficients associated with the non-basic variables are negative.

iy
Hence, this tableau is optimal with x1 = 3 , x2 = 1.5 and z = 21.
un
Example: Maximize z=3x1+4x2+x3 subject to

x1 +2 x2 + x3 <= 6
sD

2x1 + 2x3 <= 4

3x1 + x2 + x3 <= 9
al

x1 , x2 , x3 >=0

The slack equations are:


ri

x1 + 2x2 + x3 + s1 = 6
to

2x1 + 2x3 + s2 = 4

3x1 + x2 + x3 + s3 = 9
Tu

x1 , x2 , x3 , s1 , s2 , s3 >=0

New objective function, Maximize z - 3x1-4x2-x3 = 0

Non-basic (zero) variables: (X1 , X2 , x3)

Basic variables: (S1, S2, S3)


Basic Z X1 X2 X3 S1 S2 S3 Solutio
n
Z 1 -3 -4 -1 0 0 0 0
S1 0 1 2 1 1 0 0 6
S2 0 2 0 2 0 1 0 4
S3 0 3 1 1 0 0 1 9

Entering variable (pivot column) : x2

m
Leaving variable (pivot row) : s1

Pivot element: 2

co
First replace the leaving variable in the Basic column with the entering variable.

a.
New pivot row = Current pivot row / Pivot element

For all other rows, including z

iy
New Row = (Current row) – [(its pivot column coefficient) * (New pivot row)]
un
First replace s1 with x2 in basic column.
sD

New x2 (pivot row) = current x2 row / 2

= [0 , 1 , 2 , 1 , 1 , 0 , 0 , 6] / 2
al

= [0 , 1/2 , 1 , 1/2 , 1/2 , 0 , 0 , 3]

New z-row = Current z-row - (-4) * New x2-row


ri

= (1 -3 -4 -1 0 0 0 0) - (-4) x [0 , 1/2 , 1 , 1/2 , 1/2 , 0 , 0 , 3]

= (1 -1 0 1 2 0 0 12)
to

New s2 row = Current S2-row - (0) * New x2-row


Tu

= (0 2 0 2 0 1 0 4) - (0) * [0 , 1/2 , 1 , 1/2 , 1/2 , 0 , 0 , 3]

= (0 2 0 2 0 1 0 4)

New s3 row = Current s3 row - (1) x New x2 row

= (0 3 1 1 0 0 1 9) - (1) * [0 , 1/2 , 1 , 1/2 , 1/2 , 0 , 0 , 3]

= (0 5/2 0 1/2 -1/2 0 1 6)


The new basic solution is (x2 S2 S3), and the new tableau becomes

Basic Z X1 X2 X3 S1 S2 S3 Solutio
n
Z 1 -1 0 1 2 0 0 12
X2 0 1/2 1 ½ 1/2 0 0 2
S2 0 2 0 2 0 1 0 4
S3 0 5/2 0 ½ -1/2 0 1 6

m
There are again negative variables in the z row hence we have to calculate new pivot row as

co
well as all other rows using Gauss-Jordan computation

Entering variable (pivot column) : x1

a.
Leaving variable (pivot row) : s2

Pivot element: 2

iy
un
First replace s2 with x1 in basic column.

New x1 (pivot row) = current x1 row / 2

= [0 , 2 , 0 , 2 , 0 , 1 , 0 , 4] / 2
sD

= [0 , 1 , 0 , 1 , 0 , 1/2 , 0 , 2]

New z-row = Current z-row - (-1) * New x2-row


al

= (1 -1 0 1 2 0 0 12) - (-1) x [0 , 1 , 0 , 1 , 0 , 1/2 , 0 , 2]


ri

= (1 0 0 2 2 1/2 0 14)

New x2 row = Current S2-row - (2) * New x2-row


to

= (0 1/2 1 1/2 1/2 0 0 2) - (2) * [0 , 1 , 0 , 1 , 0 , 1/2 , 0 , 2]

= (0 -3/2 1 -3/2 -3/2 -1 0 -2)


Tu

New s3 row = Current s3 row - (5/2) x New x2 row

= (0 5/2 0 1/2 -1/2 0 1 6) - (5/2) * [0 , 1 , 0 , 1 , 0 , 1/2 , 0 , 2]

= (0 0 0 -2 -1/2 -5/4 1 1)
The new basic solution is (x2, x1, s3), and the new tableau becomes

Basic Z X1 X2 X3 S1 S2 S3 Solutio
n
Z 1 0 0 2 2 1/2 0 14
X2 0 -3/2 1 -3/2 -3/2 -1 0 -2
X1 0 1 0 1 0 1/2 0 2
S3 0 0 0 -2 -1/2 -5/4 1 1

m
Now, none of the z-row coefficients associated with the non-basic variables are negative.
Hence, this tableau is optimal with x1 = 2 , x2 = 2 , x3 = 0 and z = 14.

co
ARTIFICIAL STARTING SOLUTION

a.
iy
The LPs in which all the constraints are (<=) with non negative right-hand sides offer a
convenient all-slack starting basic feasible solution whereas models involving (=) and/or (>=)
constraints do not.
un
The procedure for starting "ill-behaved" LPs with (=) and (>=) constraints is to use artificial
variables that play the role of slacks at the first iteration and then dispose of them at a later
iteration.
sD

There are 2 methods to solve these ill-behaved LPs:-

1. M-method
al

2. Two-phase method
ri

M-method
to

If equation i does not have a slack (or a variable that can play the role of a slack), an artificial
variable, Ri , is added to form a starting solution. However artificial variables are not part of
Tu

the original LP model, hence they are assigned a very high penalty in the objective function,
thus they are forced to equal 0 in the optimum solution. This will always be the case if the
problem has a feasible solution.

The desired goal is achieved by penalising these variables in objective function using penalty
rule.
TUTORIALSDUNIYA.COM
Get FREE Compiled Books, Notes, Programs, Question Papers with Solution
etc of the following subjects at https://www.tutorialsduniya.com

 C and C++  Computer System Architecture


 Java  Discrete Structures
 Data Structures  Operating Systems
 Computer Networks  Algorithms
 Android Programming  DataBase Management Systems
 PHP Programming  Software Engineering
 JavaScript  Theory of Computation
 Java Server Pages  Operational Research
 Python  System Programming
 Microprocessor  Data Mining
 Artificial Intelligence  Computer Graphics
 Machine Learning  Data Science

 DU Programs: https://www.tutorialsduniya.com/programs
 TutorialsDuniya App: http://bit.ly/TutorialsDuniyaApp
 C++ Tutorial: https://www.tutorialsduniya.com/cplusplus
 Java Tutorial: https://www.tutorialsduniya.com/java
 JavaScript Tutorial: https://www.tutorialsduniya.com/javascript
 Python Tutorial: https://www.tutorialsduniya.com/python
 Kotlin Tutorial: https://www.tutorialsduniya.com/kotlin
 JSP Tutorial: https://www.tutorialsduniya.com/jsp
Penalty Rule for Artificial Variables
Given M, a sufficiently large positive value, the objective coefficient of an artificial variable
represents an appropriate penalty if:

Artificial variable objective coefficient in maximization problems is –M

Artificial variable objective coefficient in minimization problems is M.

m
Example: Minimize z = 4x1 + x2 subject to

co
3x1 + x2 = 3

4x1 + 3x2 >= 6

a.
x1 + 2x2 <= 4

x1 , x2 >= 0

iy
un
Adding s1 as surplus and s2 as slack variable,

3x1 + x2 = 3

4x1 + 3x2 –s1 = 6


sD

x1 + 2x2 + s2 = 4

x1 , x2 , s1 , s2 >= 0
al

The third equation has its slack variable, s2, but the first and second equations do not. Thus,
we are adding the artificial variables R1 and R2 in the first and second equation respectively
ri

and penalizing them in the objective function with MR1 + MR2 (positive M because we are
minimizing).
to

New objective function, Minimize z - 4x1 - x2 - MR1 - MR2 = 0


Tu

3x1 + x2 + R1 = 3

4x1 + 3x2 –s1 + R2 = 6

x1 + 2x2 + s2 = 4

x1 , x2 , s1 , s2 , R1 , R2 >= 0
Basic variables: R1 , R2 , s2

Non basic variables: x1 , x2 , s1

From the computer’s standpoint, M must assume a sufficiently large numeric value.

So what value of M should we use?

m
It depends on the data of the original LP. It must be sufficiently large relative to the original
objective coefficients so it will act as a penalty that forces the artificial variables to zero level
in the optimal solution.

co
In the present example, the objective coefficients of X1 and X2 are 4 and 1, respectively. It
thus appears reasonable to set M = 100.

a.
Using M = 100, the starting simplex tableau is given as follows:

Basic Z X1 X2 S1
iyR1 R2 S2 Solutio
n
un
Z 1 -4 -1 0 -100 -100 0 0
R1 0 3 1 0 1 0 0 3
R2 0 4 3 -1 0 1 0 6
S2 0 1 2 0 0 0 1 4
sD

Before proceeding with the simplex method computations, we need to make the z-row
consistent with the rest of the tableau. In the tableau, X1 = X2 = X3 = 0, which yields the
al

starting basic solution R1 = 3, R2 = 6 and X4 = 4, this solution yields, z = 100 X 3 + 100 X 6


= 900. This inconsistency is because R1 and R2 have non zero coefficients in the z-row.
ri

We can eliminate this inconsistency by substituting out R1 and R2 in the z-row using the
appropriate constraint equations.
to

New z-row = Old z-row - [(coeff of R1 in z * R1 row) + (coeff of R2 in z * R2 row)]


Tu

New z row = [1 -4 -1 0 -100 -100 0 0] - [(0 -300 -100 0 -100 0 0 -300) + (0 -400 -300 100 0 -
100 0 -600)]

= [1 696 399 -100 0 0 0 900]

Now z = 900, which is consistent with the values of the starting basic feasible solution i.e. RI
= 3, R2 = 6, and X4 = 4.
Now we can apply simplex method to solve the problem.

We have to minimize the objective function, hence variable with most positive coefficient in
z row i.e.x1 and variable with min ratio i.e. R1 are selected as entering and leaving variables
respectively.

Entering variable (pivot column): x1

Leaving variable (pivot row): R1

m
Pivot element: 3

co
First replace R1 with x1 in basic column.

New x1 (pivot row) = current x1 row / 3

a.
= [0 , 3 , 1 , 0 , 1 , 0 , 0 , 3] / 3

New z-row = Current z-row - (696) * New x1-row


iy
= [0 , 1 , 1/3 , 0 , 1/3 , 0 , 0 , 1]
un
= (1 696 399 -100 0 0 0 900) - (-4) x [0 , 1 , 1/3 , 0 , 1/3 , 0 , 0 , 1]

= (1 0 167 -100 -232 0 0 204)


sD

New R2 row = Current R2-row - (4) * New x1-row

= (0 4 3 -1 0 1 0 6) - (4) * [0 , 1 , 1/3 , 0 , 1/3 , 0 , 0 , 1]

= (0 0 5/3 -1 -4/3 1 0 2)
al

New S2 row = Current s2 row - (1) x New x1 row


ri

= (0 1 2 0 0 0 1 4) - (1) * [0 , 1 , 1/3 , 0 , 1/3 , 0 , 0 , 1]

= (0 0 5/3 0 -1/3 0 1 3)
to
Tu

The new basic solution is (x1 R2 S2), and the new tableau becomes

Basic Z X1 X2 S1 R1 R2 S2 Solutio
n
Z 1 0 167 -100 -232 0 0 204
X1 0 1 1/3 0 1/3 0 0 1
R2 0 0 5/3 -1 -4/3 1 0 2
S2 0 0 5/3 0 -1/3 0 1 3
There are positive variables in the z row hence we have to calculate new pivot row as well as
all other rows using Gauss-Jordan computation

Entering variable (pivot column) : x2

Leaving variable (pivot row) : R2

Pivot element: 5/3

m
First replace R2 with x2 in basic column.

co
New x2 (pivot row) = current x2 row / (5/3)

= [0 , 0 , 5/3 , -1 , -4/3 , 1 , 0 , 2] / (5/3)

a.
= [0 , 0 , 1 , -3/5 , -4/5 , 3/5 , 0 , 6/5]

New z-row = Current z-row - (167) * New x2-row

iy
= (1 0 167 -100 -232 0 0 204) - (167) x [0 , 0 , 1 , -3/5 , -4/5 , 3/5 , 0 , 6/5]

= (1 0 0 0 -98 -100 0 4)
un
New x1 row = Current x1-row - (1/3) * New x2-row

= (0 1 1/3 0 1/3 0 0 1) - (1/3) * [0 , 0 , 1 , -3/5 , -4/5 , 3/5 , 0 , 6/5]


sD

= (0 1 0 1/5 3/5 -1/5 0 3/5)

New s2 row = Current s2 row - (5/3) x New x2 row


al

= (0 0 5/3 0 -1/3 0 1 3) - (5/3) * [0 , 0 , 1 , -3/5 , -4/5 , 3/5 , 0 , 6/5]

= (0 0 0 1 1 -1 1 1)
ri
to

The new basic solution is (x2, x1, s3), and the new tableau becomes

Basic Z X1 X2 S1 R1 R2 S2 Solutio
n
Tu

Z 1 0 0 0 -98 -100 0 4
X1 0 1 0 1/5 3/5 -1/5 0 3/5
X2 0 0 1 -3/5 -4/5 3/5 0 6/5
S2 0 0 0 1 1 -1 1 1
TUTORIALSDUNIYA.COM
Get FREE Compiled Books, Notes, Programs, Question Papers with Solution
etc of the following subjects at https://www.tutorialsduniya.com

 C and C++  Computer System Architecture


 Java  Discrete Structures
 Data Structures  Operating Systems
 Computer Networks  Algorithms
 Android Programming  DataBase Management Systems
 PHP Programming  Software Engineering
 JavaScript  Theory of Computation
 Java Server Pages  Operational Research
 Python  System Programming
 Microprocessor  Data Mining
 Artificial Intelligence  Computer Graphics
 Machine Learning  Data Science

 DU Programs: https://www.tutorialsduniya.com/programs
 TutorialsDuniya App: http://bit.ly/TutorialsDuniyaApp
 C++ Tutorial: https://www.tutorialsduniya.com/cplusplus
 Java Tutorial: https://www.tutorialsduniya.com/java
 JavaScript Tutorial: https://www.tutorialsduniya.com/javascript
 Python Tutorial: https://www.tutorialsduniya.com/python
 Kotlin Tutorial: https://www.tutorialsduniya.com/kotlin
 JSP Tutorial: https://www.tutorialsduniya.com/jsp
Two Phase method

This method solves the LP in 2 phases:

Phase 1 attempt to find a starting basic feasible solution

Phase 2 is invoked to solve the original problem

m
In phase 1,

co
First put the problem in equation form and add the necessary artificial variables to the
constraints.

a.
Next, find a basic solution of the resulting equations that always minimizes the sum of the
artificial variables, regardless of whether the LP is of maximization or minimization.

iy
If the minimum value of the sum is positive, the LP problem has no feasible solution,
otherwise proceed to Phase 2.
un
In phase 2,

We use the feasible solution from Phase 1 as a starting basic feasible solution for the original
sD

problem.
al

Example: Minimize z = 4x1 + x2 subject to

3x1 + x2 = 3
ri

4x1 + 3x2 >= 6

x1 + 2x2 <= 4
to

x1 , x2 >= 0
Tu

Adding s1 as surplus and s2 as slack variable,

3x1 + x2 = 3

4x1 + 3x2 –s1 = 6

x1 + 2x2 + s2 = 4

x1 , x2 , s1 , s2 >= 0
The third equation has its slack variable, s2, but the first and second equations do not. Thus,
we are adding the artificial variables R1 and R2 in the first and second equation respectively.

Phase 1,

Minimize r - R1 - R2 = 0

3x1 + x2 + R1 = 3

m
4x1 + 3x2 –s1 + R2 = 6

co
x1 + 2x2 + s2 = 4

x1 , x2 , s1 , s2 , R1 , R2 >= 0

a.
Basic variables: R1 , R2 , s2

Non basic variables: x1 , x2 , s1

iy
Using M = 100, the starting simplex tableau is given as follows:
un
Basic X1 X2 S1 R1 R2 S2 Solutio
n
R 0 0 0 -1 -1 0 0
sD

R1 3 1 0 1 0 0 3
R2 4 3 -1 0 1 0 6
S2 1 2 0 0 0 1 4
al

New r-row = Old r-row + [(coeff of R1 in r * R1 row) + (coeff of R2 in r * R2 row)]


ri

= [0 0 0 -1 -1 0 0] + [7 4 -1 1 1 0 9]

= [7 4 -1 0 0 0 9]
to

Entering variable (pivot column): x1

Leaving variable (pivot row): R1


Tu

Pivot element: 3

First replace R1 with x1 in basic column.

New x1 (pivot row) = current x1 row / 3

= [3 , 1 , 0 , 1 , 0 , 0 , 3] / 3

= [1 , 1/3 , 0 , 1/3 , 0 , 0 , 1]
New r-row = Current r-row - (7) * New x1-row

= (7 4 -1 0 0 0 9) - (7) x [1 , 1/3 , 0 , 1/3 , 0 , 0 , 1]

= (0 5/3 -1 -7/3 0 0 2)

New R2 row = Current R2-row - (4) * New x1-row

m
= (4 3 -1 0 1 0 6) - (4) * [1 , 1/3 , 0 , 1/3 , 0 , 0 , 1]

= (0 5/3 -1 -4/3 1 0 2)

co
New S2 row = Current s2 row - (1) * New x1 row

= (1 2 0 0 0 1 4) - (1) * [1 , 1/3 , 0 , 1/3 , 0 , 0 , 1]

a.
= (0 5/3 0 -1/3 0 1 3)

iy
The new basic solution is (x1 R2 S2), and the new tableau becomes
un
Basic X1 X2 S1 R1 R2 S2 Solutio
n
r 0 5/3 -1 -7/3 0 0 2
X1 1 1/3 0 1/3 0 0 1
sD

R2 0 5/3 -1 -4/3 1 0 2
S2 0 5/3 0 -1/3 0 1 3
al

There are positive variables in the z row hence we have to calculate new pivot row as well as
all other rows using Gauss-Jordan computation
ri

Entering variable (pivot column) : x2

Leaving variable (pivot row) : R2


to

Pivot element: 5/3


Tu

First replace R2 with x2 in basic column.

New x2 (pivot row) = current x2 row / (5/3)

= [0 5/3 -1 -4/3 1 0 2] / (5/3)

= [0 , 1 , -3/5 , -4/5 , 3/5 , 0 , 6/5]


New r-row = Current r-row - (5/3) * New x2-row

= (0 5/3 -1 -7/3 0 0 2) - (5/3) x [0 , 1 , -3/2 , -4/5 , 3/5 , 0 , 6/5]

= (0 0 0 -1 -1 0 0)

New x1 row = Current x1-row - (1/3) * New x2-row

= (1 , 1/3 , 0 , 1/3 , 0 , 0 , 1) - (1/3) * [0 , 1 , -3/2 , -4/5 , 3/5 , 0 , 6/5]

m
= (1 0 1/5 3/5 -1/5 0 3/5)

New S2 row = Current s2 row - (5/3) * New x2 row

co
= (0 5/3 0 -1/3 0 1 3) - (5/3) * [0 , 1 , -3/2 , -4/5 , 3/5 , 0 , 6/5]

= (0 0 1 1 -1 1 1)

a.
iy
The new basic solution is (x1 R2 S2), and the new tableau becomes

Basic X1 X2 S1 R1 R2 S2 Solutio
n
un
r 0 0 0 -1 -1 0 0
X1 1 0 1/5 3/5 -1/5 0 3/5
X2 0 1 -3/5 -4/5 3/5 0 6/5
S2 0 0 1 1 -1 1 1
sD

As the z row solution is not positive hence we can move to phase 2.


al

Phase 2,
ri

Basic X1 X2 S1 S2 Solutio
n
Z -4 -1 0 0 0
to

X1 1 0 1/5 0 3/5
X2 0 1 -3/5 0 6/5
S2 0 0 1 1 1
Tu

Now in z row, x1 and x2 have non zero values, hence we multiplied x1 row and x2 row by 4
and 1 respectively and added them to z row to make x1 and x2 coefficient as 0.

New z row = (-4 -1 0 0 0) + (4 0 4/5 0 12/5) + (0 1 -3/5 0 6/5)

= (0 0 1/5 0 18/5)
Entering variable (pivot column) : S1

Leaving variable (pivot row) : S2

Pivot element: 1

First replace S2 with S1 in basic column.

m
New S1 (pivot row) = current S1 row / (1)

= [0 , 0 , 1 , 1 , 1] / (1)

co
= [0 , 0 , 1 , 1 , 1]

New z-row = Current z-row - (0) * New s1-row

a.
= (0 0 1/5 0 18/5) - (0) x [0 , 0 , 1 , 1 , 1]

iy
= (0 0 0 -1/5 17/5)

New x1 row = Current x1-row - (1/5) * New s1-row


un
= (1 0 1/5 0 3/5) - (1/5) * [0 , 0 , 1 , 1 , 1]

= (1 0 0 -1/5 2/5)
sD

New x2 row = Current x2 row - (-3/5) * New s1 row

= (0 1 -3/5 0 6/5) - (-3/5) * [0 , 0 , 1 , 1 , 1]

= (0 1 0 3/5 9/5)
al
ri

The new basic solution is (x1 x2 S1), and the new tableau becomes

Basic X1 X2 S1 S2 Solutio
to

n
Z 0 0 0 -1/5 17/5
X1 1 0 0 -1/5 2/5
Tu

X2 0 1 0 3/5 9/5
S2 0 0 1 1 1

Optimum value of z is 17/5 at x1 = 2/5 and x2 = 9/5.


TUTORIALSDUNIYA.COM
Get FREE Compiled Books, Notes, Programs, Question Papers with Solution
etc of the following subjects at https://www.tutorialsduniya.com

 C and C++  Computer System Architecture


 Java  Discrete Structures
 Data Structures  Operating Systems
 Computer Networks  Algorithms
 Android Programming  DataBase Management Systems
 PHP Programming  Software Engineering
 JavaScript  Theory of Computation
 Java Server Pages  Operational Research
 Python  System Programming
 Microprocessor  Data Mining
 Artificial Intelligence  Computer Graphics
 Machine Learning  Data Science

 DU Programs: https://www.tutorialsduniya.com/programs
 TutorialsDuniya App: http://bit.ly/TutorialsDuniyaApp
 C++ Tutorial: https://www.tutorialsduniya.com/cplusplus
 Java Tutorial: https://www.tutorialsduniya.com/java
 JavaScript Tutorial: https://www.tutorialsduniya.com/javascript
 Python Tutorial: https://www.tutorialsduniya.com/python
 Kotlin Tutorial: https://www.tutorialsduniya.com/kotlin
 JSP Tutorial: https://www.tutorialsduniya.com/jsp
Duality

For every linear programming problem there is a corresponding linear programming problem
called the dual.

The dual problem is constructed from the primal as follows:

m
1. A dual variable is defined for each primal (constraint) equation.
2. A dual constraint is defined for each primal variable.
3. The constraint (column) coefficients of a primal variable define the left-hand side

co
coefficients of the dual constraint and its objective coefficients define the right-hand
side.

a.
4. The objective coefficients of the dual equal the right-hand side of the primal
constraint equations.

iy
un
Construction of the Dual from the Primal

Primal
variables
sD

X1 X2 ... Xj ... xn
Dual C1 C2 ... Cj ... cn RHS
variables
al

Y1 A11 A12 ... A1j ... A1n B1


Y2 A21 A22 ... A2j ... A2n B2
ri

... ... ... ... ... ... ... ...


Ym Am1 Am2 ... Amj ... Amn Bm
to

Jth dual Dual


constrain objective
t coefficie
Tu

nt

The sense of optimization in the dual is always opposite to that of the primal. If the original
problem is a maximum then its dual is a minimum and if the original problem is a minimum
then its dual is a maximum. In either case the final tableau of the dual will contain both the
solution to the dual and the solution to the original problem.
Rules for Constructing the Dual Problem

Maximization Problem Minimization problem


Constraints Variables
>= <=0
<= >=0
= Unrestricted

m
Variables Constraints
>=0 >=

co
<=0 <=
Unrestricted =

a.
Example: Write the dual for the following primal problem:

iy
Primal, Maximize Z = 5x1 + 12x2 + 4X3 subject to

X1 + 2X2 + x3 <= 10
un
2X1 - X2 + 3X3 = 8

X1, X2, X3 >= 0


sD

Primal in equation form, Maximize Z = 5x1 + 12x2 + 4x3 subject to

X1 + 2X2 + X3 + X4 = 10
al

2X1 - X2 + 3X3 + 0X4 = 8

X1, X2. X3, X4 >= 0


ri

Since there are 2 equations in primal problem hence there will be 2 dual variables.

Dual variables: Y1, Y2


to

Dual Problem
Tu

Minimize w = 10Y1 + 8Y2 subject to

Y1 + Y2 >= 5

2Y1 – Y2 >= 12

Y1 + 3Y2 >= 4

Y1 >= 0

Y1, Y2 unrestricted
Example: Write the dual for the following primal problem:

Primal, Minimize Z = 15x1 + 12x2 subject to

X1 + 2X2 >= 3

2X1 - 4X2 <= 5

X1, X2 >= 0

m
Primal in equation form, Minimize Z = 15X1 + 12x2 subject to

co
X1 + 2X2 - X3 = 3

2x1 - 4X2 + X4 = 5

a.
X1, X2. X3, X4 >= 0

iy
Since there are 2 equations in primal problem hence there will be 2 dual variables.

Dual variables: Y1, Y2


un
Dual Problem
sD

Maximize w = 3Y1 + 5Y2 subject to

2Y1 + Y2 <= 15

2Y1 – 4Y2 <= 12


al

-Y1 <= 0
ri

Y2 <= 0

Y1, Y2 unrestricted
to
Tu
TUTORIALSDUNIYA.COM
Get FREE Compiled Books, Notes, Programs, Question Papers with Solution
etc of the following subjects at https://www.tutorialsduniya.com

 C and C++  Computer System Architecture


 Java  Discrete Structures
 Data Structures  Operating Systems
 Computer Networks  Algorithms
 Android Programming  DataBase Management Systems
 PHP Programming  Software Engineering
 JavaScript  Theory of Computation
 Java Server Pages  Operational Research
 Python  System Programming
 Microprocessor  Data Mining
 Artificial Intelligence  Computer Graphics
 Machine Learning  Data Science

 DU Programs: https://www.tutorialsduniya.com/programs
 TutorialsDuniya App: http://bit.ly/TutorialsDuniyaApp
 C++ Tutorial: https://www.tutorialsduniya.com/cplusplus
 Java Tutorial: https://www.tutorialsduniya.com/java
 JavaScript Tutorial: https://www.tutorialsduniya.com/javascript
 Python Tutorial: https://www.tutorialsduniya.com/python
 Kotlin Tutorial: https://www.tutorialsduniya.com/kotlin
 JSP Tutorial: https://www.tutorialsduniya.com/jsp
PRIMAL-DUAL RELATIONSHIPS

Some matrix definitions:

A matrix, A, of size (m * n) is a rectangular array of elements with m rows and n columns.

A row vector, V, of size m is a (1 * m) matrix.

m
A column vector, P, of size n is an (n * 1) matrix.

V = (V1 , V2 , ... Vm)

co
A= (a11 , a12 , ... a1n)

(a21 , a22 , ... a2n)

a.
(am1 , am2 , ... amn)

P= (P1)

(P2)
iy
un
(Pn)
sD

The simplex tableau computation uses only three elementary matrix operations:

1. Row vector * matrix

The operation is defined only if the size of the row vector V equals the number of rows of
al

matrix A.

For example, (11 22 33)(1 2 ; 3 4 ; 5 6) = (1 * 11 + 3 * 22 + 5 * 33 , 2 * 11 + 4 * 22 + 6 * 33)


ri

= (242 308)
to

2. Matrix * Column vector


Tu

The operation is defined only if the number of columns of matrix A equals the size of column
vector P.

For example, (1 3 5 ; 2 4 6) (11 ; 22 ; 33) = (1 * 11 + 3 * 22 + 5 * 33 ; 2 * 11 + 4 * 22 + 6 *


33)

= (242 ; 308)
3. Scalar * Matrix

The scalar (or constant) quantity c, the multiplication operation (c * A) will result in a matrix
of the same size as A whose (i, j)th element equals c * aij.

For example, (10) (1 2 3) = (10 20 30)

In the starting tableau, the constraint coefficients under the starting variables form an identity
matrix (all main-diagonal elements equals 1 and all off-diagonal elements equals 0).

m
Optimal Dual Solution

co
The dual of a dual is itself the primal, which means that the dual solution can also be used to

a.
yield the optimal primal solution automatically.

Method 1:
iy
un
Optimal value of dual variable yi = Optimal primal z-coefficient of starting variable xi +
Original objective coefficient of xi
sD

Method 2:

Optimal values of dual variables = (Row vector of original objective coefficients of optimal
primal basic variables) * (Optimal primal inverse)
al

Note: The elements of the row vector must appear in the same order in which the basic
variables are listed in the Basic column of the simplex tableau.
ri
to

Example: Consider the LP, Maximize z = 5X1 + 12x2 + 4x3 subject to

X1 + 2X2 + x3 <= 10
Tu

2X1 - X2 + 3X3 = 8

X1 , x2 , x3 >= 0

Adding x4 as a surplus and R as an artificial variable,

X1 + 2x2 + x3 + x4 = 10
2x1 – x2 + 3x3 + R = 8

X1 , x2 , x3 , x4 , R >= 0

Now the dual of the above LP is,

Minimize w = 10y1 + 8y2

m
Y1 + 2y2 >= 5

2Y1 - y2 >= 12

co
Y1 + 3y2 >= 4

Y1 >= 0

a.
Y2 >= -M (y2 is unrestricted)

iy
Method 1: The starting primal variables X4 and R uniquely correspond to the dual variables
Y1 and Y2 respectively. Thus, we determine the optimum dual solution as follows:
un
Starting primal basic X4 R
sD

variables
z-equation coefficients 29/5 -2/5 + M
Original objective coefficient 0 -M
al

Dual variables Y1 Y2
Optimal dual values 29/5 + 0 = 29/5 -2/5 + M + (-M) = -2/5
ri
to

Method 2: Optimal Tableau of the Primal LP,


Tu

Basic X1 X2 X3 X4 R Solution
Z 0 0 3/5 29/5 -2/5 + M 274/5
X2 0 1 -1/5 2/5 -1/5 12/5
X1 1 0 7/5 1/5 2/5 26/5

The optimal inverse matrix = (2/5 -1/5 , 1/5 2/5)


Note: The optimal primal variables are listed in the tableau in row order as X2 and then XI.
This means that the elements of the original objective coefficients for the two variables must
appear in the same order.

Original objective coefficients = (Coefficient of X2, coefficient of X1)

= (12 , 5)

m
The optimal dual values are computed as,

(y1 , y2) = (Original objective coefficients of x2 , x1) * (Optimal inverse)

co
= (12 , 5) * (2/5 -1/5 , 1/5 2/5)

= (29/5, -2/5)

a.
iy
Relationship between the primal and dual objective values

For any pair of feasible primal and dual solutions,


un
Objective value in the maximization problem <= Objective value in the minimization
problem

Note: The above relationship does not specify which problem is primal and which is dual.
sD

Simplex Tableau Computations


al

Any iteration of the entire simplex tableau can be generated from the original data of the
ri

problem, inverse associated with the iteration, and the dual problem.

Using the layout of the simplex tableau, we can divide the computations into two types:
to

1. Constraint columns (left- and right-hand sides)


Tu

2. Objective z-row

Formula 1: Constraint Column Computations: In any simplex iteration, a left-hand or a


right-hand side column is computed as follows:

Constraint column in iteration i = (Inverse in iteration i) * (Original constraint column)


Formula 2: Objective z-row Computations: In any simplex iteration, the objective equation
coefficient of xi is computed as follows:

Primal z-equation coefficient of variable xj = (Left-hand side of jth dual constraint) -


(Right-hand side of jth dual constraint)

m
Example: Consider the LP, Maximize z = 5X1 + 12x2 + 4x3 subject to

X1 + 2X2 + x3 <= 10

co
2X1 - X2 + 3X3 = 8

X1 , x2 , x3 >= 0

a.
Optimal Tableau of the Primal LP,

Basic X1 X2 X3
iy X4 R Solution
un
Z 0 0 3/5 29/5 -2/5 + M 274/5
X2 0 1 -1/5 2/5 -1/5 12/5
X1 1 0 7/5 1/5 2/5 26/5
sD

From the above optimal tableau, we have

Optimal inverse = (2/5 -1/5 , 1/5 2/5)


al

Using formula 1, we can compute all the left and right hand side columns of the optimal
tableau as follows,
ri

(x1 column in optimal iteration) = (Inverse in optimal iteration) * (Original x1 column)

= (2/5 -1/5 , 1/5 2/5) * (1 2)


to

= (0 1)

(x2 column in optimal iteration) = (2/5 -1/5 , 1/5 2/5) * (2 -1)


Tu

= (1 0)

(x3 column in optimal iteration) = (2/5 -1/5 , 1/5 2/5) * (1 3)

= (-1/5 7/5)

(x4 column in optimal iteration) = (2/5 -1/5 , 1/5 2/5) * (1 0)

= (2/5 1/5)
(R column in optimal iteration) = (2/5 -1/5 , 1/5 2/5) * (0 1)

= (-1/5 2/5)

(RHS column in optimal iteration) = (2/5 -1/5 , 1/5 2/5) * (10 8)

= (12/5 26/5)

m
The optimal values of the dual variables,(Y1. Y2) = (29/5 , -2/5), were already computed
using two different methods. These values are used in Formula 2 to determine the associated
z coefficients of the optimum tableau,

co
Z coefficient of x1 = y1 + 2y2 – 5 = 29/5 + 2 * (-2/5) – 5 = 0

Z coefficient of x2 = 2y1 – y2 -12 = 2 * 29/5 – (-2/5) – 12 = 0

a.
Z coefficient of x3 = y1 + 3y2 -4 = 29/5 + 3 * (-2/5) – 4 = 3/5

Z coefficient of x4 = y1 – 0 = 29/5 – 0 = 29/5

iy
Z coefficient of R = y2 – (-M) = -2/5 – (-M) = -2/5 + M
un
sD
al
ri
to
Tu
TUTORIALSDUNIYA.COM
Get FREE Compiled Books, Notes, Programs, Question Papers with Solution
etc of the following subjects at https://www.tutorialsduniya.com

 C and C++  Computer System Architecture


 Java  Discrete Structures
 Data Structures  Operating Systems
 Computer Networks  Algorithms
 Android Programming  DataBase Management Systems
 PHP Programming  Software Engineering
 JavaScript  Theory of Computation
 Java Server Pages  Operational Research
 Python  System Programming
 Microprocessor  Data Mining
 Artificial Intelligence  Computer Graphics
 Machine Learning  Data Science

 DU Programs: https://www.tutorialsduniya.com/programs
 TutorialsDuniya App: http://bit.ly/TutorialsDuniyaApp
 C++ Tutorial: https://www.tutorialsduniya.com/cplusplus
 Java Tutorial: https://www.tutorialsduniya.com/java
 JavaScript Tutorial: https://www.tutorialsduniya.com/javascript
 Python Tutorial: https://www.tutorialsduniya.com/python
 Kotlin Tutorial: https://www.tutorialsduniya.com/kotlin
 JSP Tutorial: https://www.tutorialsduniya.com/jsp
Transportation Model

Introduction

The transportation problem is a special type of linear programming problem where the
objective is to minimize the cost of distributing a product from a number of sources to a

m
number of destinations.
Because of its special structure the usual simplex method is not suitable for solving these

co
transportation problems. So, these problems require a special method of solution.
In a transportation problem, origin is the location from which shipments are dispatched and
destination is the location to which shipments are transported.

a.
The unit transportation cost is the cost of transporting 1 unit of consignment from origin to a
destination.

iy
In the most general form, a transportation problem has a number of origins and a number of
destinations. A certain amount of a particular consignment is available in each origin and
each destination has a certain requirement.
un
Transportation problem refers to the amount of consignment to be transported from various
origins to different destinations so that the total transportation cost is minimized without
violating the availability constraints and the requirement constraints.
sD

The decision variables Xij of a transportation problem indicate the amount to be transported
from the ith origin to the jth destination. Two subscripts are necessary to describe these
decision variables. A transportation problem can be formulated as a linear programming
problem using decision variables with two subscripts.
al

Balanced Transportation Problem


ri

It is a transportation problem where the total availability at origins is equal to the total
requirements at the destinations.
to

For example, in case the total production of 4 factories is 1000 units and total requirements of
4 warehouses is also 1000 units, the transportation problem is said to be a balanced
transportation problem.
Tu

Unbalanced Transportation Problem


It is a transportation problem where the total availability at origins is not equal to the total
requirements at the destinations or vice-versa.
For example, in case the total production of 4 factories is 1000 units and total requirements of
4 warehouses is 900 units or 1,100 units, the transportation problem is said to be an
unbalanced transportation problem.
To make an unbalanced transportation problem, a balanced one, a dummy origins or a
dummy destination is introduced with 0 transportation cost per unit.

Dummy Origin/Destination
A dummy origin or destination is an imaginary origin or destination with zero cost introduced
to make an unbalanced transportation problem balanced.

m
If the total supply is more than the total demand we introduce an additional column which
will indicate the surplus supply with transportation cost zero.
If the total demand is more than the total supply, an additional row is introduced in the table

co
which represents unsatisfied demand with transportation cost zero.

a.
Transportation Algorithm

iy
The algorithm of solving a transportation problem is as follows:
un
1. Determine a starting basic feasible solution, and go to step 2.
2. Use the optimality condition of the simplex method to determine the entering variable
from among all the non basic variables. If the optimality condition is satisfied, stop.
sD

Otherwise, go to step 3.
3. Use the feasibility condition of the simplex method to determine the leaving variable
from among all the current basic variables, and find the new basic solution. Return to
al

step 2.
ri

Determination of Starting basic feasible solution


to

In general, a transportation model with m sources and n destinations has m + n constraint


equations, one for each source and each destination. However, as the transportation model is
always balanced (sum of the supply = sum of the demand), one of these equations is
Tu

redundant. Thus, the model has m + n - 1 independent constraint equations, which means that
the starting basic solution consists of m + n - 1 basic variable.
A transport problem is said to be a degenerate transport problem if it has a basic feasible
solution with number of non-zero basic variables less than m + n - 1.
We can determine the starting basic feasible solution by the following 3 methods:

1. Northwest-corner method
2. Least-cost method
3. Vogel approximation method
Northwest-corner method

The algorithm for solving the transportation problem using northwest corner method is as
follows:
1. Make maximum possible allocation to the North-West Corner Cell in the First Row

m
and adjust the associated amounts of supply and demand by subtracting the allocated
amount.
2. If the supply of that row is greater than 0, move to the next cell of the same row

co
otherwise move to the cell of the next row and cross out the row or column with 0
supply or demand to indicate that no further assignments can be made in that row or

a.
column.
3. Follow above steps till all the requirements are exhausted, i.e., the entire demand and
supply is exhausted.

iy
un
Example 1: Cost table is as follows,

C1 C2 C3 Supply
R1 0 2 1 6
sD

R2 2 1 5 7
R3 2 4 3 7
Demand 5 5 10
al

We first make maximum possible allocation i.e.5 to the north-west cell.


ri

Now, the demand of column C1 is exhausted but row R1 can still supply. So, we move to the
next cell (C2) in the same row and allocate maximum possible supply i.e.1.
to

Now, the supply of row R1 is exhausted but column C2 still demands supply. So, we move to
the next cell (R2) in the same column and allocate maximum possible supply i.e.4.
Tu

Now, the demand of column C2 is exhausted but row R2 can still supply. So, we move to the
next cell (C3) in the same row and allocate maximum possible supply i.e.3.

Now, the supply of row R2 is exhausted but column C3 still demands supply. So, we move to
the next cell (R3) in the same column and allocate maximum possible supply i.e.7.

Now, all the supply and demand is exhausted.


Northwest-corner starting basic solution,

C1 C2 C3 Supply
R1 5 1 0
R2 4 3 0
R3 7 0
Demand 0 0 0

m
Cost = 5*0 +1*2 + 4*1 + 3*5 + 7*3

= 0 + 2 + 4 + 15 + 21

co
= 42

a.
Example2: Cost table is as follows,

C1 C2 C3 Supply
R1
R2
R3
1
0
3
2
4
1 iy 6
2
5
7
12
11
un
Demand 10 10 10

We first make maximum possible allocation i.e.7 to the north-west cell.


sD

Now, the supply of row R1 is exhausted but column C1 still demands supply. So, we move to
the next cell (R2) in the same column and allocate maximum possible supply i.e.3.

Now, the demand of column C1 is exhausted but row R2 can still supply. So, we move to the
al

next cell (C2) in the same row and allocate maximum possible supply i.e.9.

Now, the supply of row R2 is exhausted but column C2 still demands supply. So, we move to
ri

the next cell (R3) in the same column and allocate maximum possible supply i.e.1.

Now, the demand of column C2 is exhausted but row R3 can still supply. So, we move to the
to

next cell (C3) in the same row and allocate maximum possible supply i.e.10.

Now, all the supply and demand is exhausted.


Tu

Northwest-corner starting solution,

C1 C2 C3 Supply
R1 7 0
R2 3 9 0
R3 1 10 0
Demand 0 0 0
Cost = 7*1 + 3*0 + 9*4 + 1*1 + 10*5

= 7 + 0 + 36 + 1 + 50

= 94

Least-cost method

m
The algorithm for solving the transportation problem using least cost method is as follows:

co
1. Make maximum possible Allocation to the Least Cost Cell and the satisfied row or
column is crossed out, if any, and the amounts of supply and demand are adjusted

a.
accordingly.
2. Make allocation to the uncrossed-out Lowest Cost Cell depending upon the remaining
demand/supply.
iy
3. Follow above step till all the requirements are exhausted, i.e., the entire demand and
un
supply is exhausted.
sD

Example1: Cost table is as follows,

C1 C2 C3 Supply
R1 0 2 1 6
R2 2 1 5 7
al

R3 2 4 3 7
Demand 5 5 10
ri

We first make maximum possible allocation i.e.5 to the least cost cell.
to

Now, the demand of column C1 is exhausted and hence we crossed out that column and find
the least cost cell from the remaining uncrossed cells i.e.R1C3 and allocated maximum
possible supply i.e.1.
Tu

Now, the supply of row R1 is exhausted and hence we crossed out that row and find the least
cost cell from the remaining uncrossed cells i.e.R2C2 and allocated maximum possible
supply i.e.5.

Now, both the supply of row R2 as well as the demand of column C2 is exhausted at the same
time. So, we can either cross out row R2 or column C2. Let us cross out column C2 and find
the least cost cell from the remaining uncrossed cells i.e.R3C3 and allocated maximum
possible supply i.e.7.
Now, the supply of row R3 is also exhausted and hence we crossed out that row and find the
least cost cell from the remaining uncrossed cells i.e.R2C3 and allocated maximum possible
supply i.e.2.

Now, all the supply and demand is exhausted.

Least cost starting solution,

m
C1 C2 C3 Supply
R1 5 1 0
R2 5 2 0

co
R3 7 0
Demand 0 0 0

a.
Cost = 5*0 + 1*1 + 5*1 + 2*5 + 7*3

iy
= 0 + 1 + 5 + 10 + 21

= 37
un
Example2: Cost table is as follows,
sD

C1 C2 C3 Supply
R1 1 2 6 7
R2 0 4 2 12
R3 3 1 5 11
Demand 10 10 10
al

We first make maximum possible allocation i.e.10 to the least cost cell (R2C1).
ri

Now, the demand of column C1 is exhausted and hence we crossed out that column and find
the least cost cell from the remaining uncrossed cells i.e.R3C2 and allocated maximum
to

possible supply i.e.10.

Now, the demand of column C2 is exhausted and hence we crossed out that column and find
Tu

the least cost cell from the remaining uncrossed cells i.e.R2C3 and allocated maximum
possible supply i.e.2.

As only one row is left uncrossed, we allocated maximum possible supply i.e.1 to column C3
and then supply 7 to column C1 in the same row.

Now, all the supply and demand is exhausted.


TUTORIALSDUNIYA.COM
Get FREE Compiled Books, Notes, Programs, Question Papers with Solution
etc of the following subjects at https://www.tutorialsduniya.com

 C and C++  Computer System Architecture


 Java  Discrete Structures
 Data Structures  Operating Systems
 Computer Networks  Algorithms
 Android Programming  DataBase Management Systems
 PHP Programming  Software Engineering
 JavaScript  Theory of Computation
 Java Server Pages  Operational Research
 Python  System Programming
 Microprocessor  Data Mining
 Artificial Intelligence  Computer Graphics
 Machine Learning  Data Science

 DU Programs: https://www.tutorialsduniya.com/programs
 TutorialsDuniya App: http://bit.ly/TutorialsDuniyaApp
 C++ Tutorial: https://www.tutorialsduniya.com/cplusplus
 Java Tutorial: https://www.tutorialsduniya.com/java
 JavaScript Tutorial: https://www.tutorialsduniya.com/javascript
 Python Tutorial: https://www.tutorialsduniya.com/python
 Kotlin Tutorial: https://www.tutorialsduniya.com/kotlin
 JSP Tutorial: https://www.tutorialsduniya.com/jsp
Least cost starting solution,

C1 C2 C3 Supply
R1 7 0
R2 10 2 0
R3 10 1 0
Demand 0 0 0

m
Cost = 7*6 + 10*0 + 2*2 + 10*1 + 1*5

= 42 + 0 + 4 + 10 + 5

co
= 61

a.
Vogel Approximation method

iy
The algorithm for solving the transportation problem using vogel approximation method is as
follows:
un
1. For each row/column, determine a penalty measure by subtracting the smallest unit
cost element in the row/column from the next smallest unit cost element in the same
sD

row/column. Now, identify the row or column with the largest penalty.
2. Allocate as much as possible to the cell with least unit cost in the selected row or
column.
al

3. Cross out the satisfied row or column and adjust the supply and demand. If both a row
and a column are satisfied simultaneously then only 1 of the two is crossed out and
ri

the remaining row/column is assigned zero supply/demand.


4. Follow above step and if 1 row/column with positive supply/demand remains
to

uncrossed out then determine the basic variables in the row/column by the least-cost
method.
Tu

Example1: Cost table is as follows,

C1 C2 C3 Supply Row penalty


R1 0 2 1 6 1
R2 2 1 5 7 1
R3 2 4 3 7 1
Demand 5 5 10
Column penalty 2 1 2
In this method, we first determine the penalty for each row [1, 1, 1] as well as for each
column [2, 1, 2]. We find columns C1 and C3 with largest penalty i.e.2. So we can select any
column. Let us select C1 column.

We allocated 5 to cell with least unit cost i.e. R1C1, in column C1. Now, the demand of
column C1 is exhausted and hence we crossed out that column.

m
We again calculated the penalty for row as [1, 1, 1] and for column as [0, 1, 2] and we find
that column C3 has the largest penalty.

co
So, we allocated 1 to cell with least unit cost i.e. R1C3, in column C3. Now, the supply of
row R1 is exhausted and hence we crossed out that row.

a.
We again calculated the penalty for row as [0, 1, 1] and for column as [0, 3, 2] and we find
that column C2 has the largest penalty.

iy
So, we allocated 5 to cell with least unit cost i.e. R2C2, in column C2. Now, the supply of
column C2 is exhausted and hence we crossed out that column.
un
Next, we again calculated the penalty for row as [0, 5, 3] and for column as [0, 0, 2] and we
find that row R2 has the largest penalty.
sD

So, we allocated 2 to cell with least unit cost i.e. R2C3, in row R2. Now, the supply of row
R2 is exhausted and hence we crossed out that column.
al

Now, we allocated 7 to the only uncrossed cell i.e.R3C3.


ri

Now, all the supply and demand is exhausted.


to

Vogel Approximation starting solution,

C1 C2 C3 Supply
Tu

R1 5 1 0
R2 5 2 0
R3 7 0
Demand 0 0 0

Cost = 5*0 + 5*1 + 1*1 + 2*5 + 7*3

= 0 + 5 + 1 + 10 + 21

= 37
Example2: Cost table is as follows,

C1 C2 C3 Supply Row penalty


R1 1 2 6 7 1
R2 0 4 2 12 2
R3 3 1 5 11 2
Demand 10 10 10
Column penalty 1 1 3

m
In this method, we first determine the penalty for each row [1, 2, 2] as well as for each
column [1, 1, 3]. We find that column C3 has the largest penalty.

co
We allocated 10 to cell with least unit cost i.e. R2C3, in column C3. Now, the demand of
column C3 is exhausted and hence we crossed out that column.

a.
We again calculated the penalty for row as [1, 4, 2] and for column as [1, 1, 0] and we find
that row R2 has the largest penalty.

iy
So, we allocated 2 to cell with least unit cost i.e. R2C1, in row R2. Now, the supply of row
R2 is exhausted and hence we crossed out that row.
un
We again calculated the penalty for row as [1, 0, 2] and for column as [2, 1, 0] and we find
row R3 and column C1 with largest penalty i.e.2. So we can select any one. Let us select C1
column.
sD

So, we allocated 7 to cell with least unit cost i.e. R1C1, in column C1. Now, the supply of
row R1 is exhausted and hence we crossed out that row.

Next, we again calculated the penalty for row as [0, 0, 2] and for column as [3, 1, 0] and we
find that column C1 has the largest penalty.
al

So, we allocated 1 to cell with least unit cost i.e. R3C1, in column C1. Now, the supply of
column C1 is exhausted and hence we crossed out that column.
ri

Now, we allocated 10 to the only uncrossed cell i.e.R3C2.


to

Now, all the supply and demand is exhausted.


Tu

Vogel Approximation starting solution,

C1 C2 C3 Supply
R1 7 0 0
R2 2 10 0
R3 1 10 0
Demand 0 0 0
Cost = 7*1 + 2*0 + 10*2 + 1*3 + 10*1

= 7 + 0 + 20 + 3 + 10

= 40

Iterative Computations of the Transportation Algorithm

m
To solve the transportation problem, we first determine the starting basic solution using any

co
of the 3 methods as discussed earlier then we determine the optimal solution using the
transportation algorithm.

a.
The basic nature of this algorithm is iterative as we have to repeat the steps of the algorithm
till we reach the optimal solution.

iy
We use the condition of simplex optimality and feasibility to determine the entering and
leaving variable respectively.
un
The determination of the entering variable is done by computing the non basic coefficients in
the z-row by using the method of multipliers.
sD

According to this method, we associate the multipliers ui and vj with row i and column j of
the transportation algorithm.
al

For each basic variable xij these multipliers satisfy the equation ui + vj = cij.

This equation can be used to determine the value of ui and vj and the basis of this equation is
ri

that basic variable has zero value in the z row.


to

The method of multiplier solves these equations by arbitrarily setting any ui=0 and then
calculating values of the remaining variables.
Tu

We used ui and vj to evaluate the non basic variables by computing ui + vj – cij for each non
basic xij.

Next we determine the entering variable as the most positive coefficient in the z row.

Now to determine the leaving variable, let θ units be shipped from the entering variable’s
route.
TUTORIALSDUNIYA.COM
Get FREE Compiled Books, Notes, Programs, Question Papers with Solution
etc of the following subjects at https://www.tutorialsduniya.com

 C and C++  Computer System Architecture


 Java  Discrete Structures
 Data Structures  Operating Systems
 Computer Networks  Algorithms
 Android Programming  DataBase Management Systems
 PHP Programming  Software Engineering
 JavaScript  Theory of Computation
 Java Server Pages  Operational Research
 Python  System Programming
 Microprocessor  Data Mining
 Artificial Intelligence  Computer Graphics
 Machine Learning  Data Science

 DU Programs: https://www.tutorialsduniya.com/programs
 TutorialsDuniya App: http://bit.ly/TutorialsDuniyaApp
 C++ Tutorial: https://www.tutorialsduniya.com/cplusplus
 Java Tutorial: https://www.tutorialsduniya.com/java
 JavaScript Tutorial: https://www.tutorialsduniya.com/javascript
 Python Tutorial: https://www.tutorialsduniya.com/python
 Kotlin Tutorial: https://www.tutorialsduniya.com/kotlin
 JSP Tutorial: https://www.tutorialsduniya.com/jsp
The maximum value of θ depends on the following 2 conditions,

a. Supply limits and demand requirements remain satisfied.


b. Shipments through all routes remain nonnegative.

We calculate the maximum value of θ by first constructing a closed loop that starts and ends
at the entering variable cell. This loop should not consist of any diagonal segment i.e. only

m
horizontal and vertical segments to be connected. Next, we assign θ amount to the entering
variable cell and alternatively added and subtracted θ amount at successive corners of the
loop to balance the supply and demand limits.

co
a.
Example1: Cost table is as follows,

C1 C2 C3 Supply
R1
R2
0
2
2
1
iy 1
5
6
9
un
R3 2 4 3 5
Demand 5 5 10
sD

First we determined the starting basic solution by Northwest-corner method as follows,

C1 C2 C3 Supply
al

R1 5 1 0
R2 4 5 0
ri

R3 5 0
to

Demand 0 0 0

Let’s consider u1=0 and calculate the values of the remaining variables.
Tu

Basic variables Ui + Vj = Cij Solution


X11 U1 + V1 = 0 U1 = 0, V1 = 0
X12 U1 + V2 = 2 U1 = 0, V2 = 2
X22 U2 + V2 = 1 U2 = -1, V2 = 2
X23 U2 + V3 = 5 U2 = -1, V3 = 6
X33 U3 + V3 = 2 U3 = -3, V3 = 6
Now we will use the above calculated values of ui and vj to evaluate the non basic variables
by computing ui + vj – cij for each non basic xij as follows,

Non basic variables,

X13 = 0 + 6 – 1 = 5

m
X21 = -1 + 0 – 2 = -3

co
X31 = -3 + 0 – 2 = -5

X32 = -3 + 2 – 4 = -5

a.
iy
Now the value of x13 is most positive and hence the entering variable is X13.

Next to determine the leaving variable, let amount be shipped from X13 then
un
X12 is 1 - θ >= 0

X22 is 4 + θ >= 0
sD

X23 is 5 - θ >= 0

From above equations, θ = 1 and leaving variable is X12.


al
ri

Now the basic solution becomes,


to

C1 C2 C3 Supply
R1 5 1 0
Tu

R2 5 4 0
R3 5 0
Demand 0 0 0

Let’s again consider u1=0 and calculate the values of the remaining variables.
Basic variables Ui + Vj = Cij Solution
X11 U1 + V1 = 0 U1 = 0, V1 = 0
X13 U1 + V3 = 1 U1 = 0, V3 = 1
X22 U2 + V2 = 1 U2 = -1, V2 = -3
X23 U2 + V3 = 5 U2 = -1, V3 = 1
X33 U3 + V3 = 3 U3 = -3, V3 = 1

m
Now we will use the above calculated values of ui and vj to evaluate the non basic variables

co
by computing ui + vj – cij for each non basic xij as follows,

a.
Non basic variables,

X12 = 0 - 3 - 2 = -5

iy
un
X21 = 4 + 0 – 2 = 2

X31 = 2 + 0 – 2 = 0
sD

X32 = 2 - 3 – 4 = -5
al

Now the value of x21 is most positive and hence the entering variable is X21.

Next to determine the leaving variable, let amount be shipped from X21 then
ri

X11 is 5 - θ >= 0
to

X13 is 1 + θ >= 0

X23 is 4 - θ >= 0
Tu

From above equations, θ = 4 and leaving variable is X23.

Now the basic solution becomes,


C1 C2 C3 Supply
R1 1 5 0
R2 4 5 0
R3 5 0
Demand 0 0 0

m
Let’s again consider u1=0 and calculate the values of the remaining variables.

co
Basic variables Ui + Vj = Cij Solution
X11 U1 + V1 = 0 U1 = 0, V1 = 0
X13 U1 + V3 = 1 U1 = 0, V3 = 1

a.
X21 U2 + V1 = 2 U2 = 2, V1 = 0
X22 U2 + V2 = 1 U2 = 2, V2 = -1
X33 U3 + V3 = 3

iy U3 = 2, V3 = 1
un
Now we will use the above calculated values of ui and vj to evaluate the non basic variables
by computing ui + vj – cij for each non basic xij as follows,
sD

Non basic variables,

X12 = 0 - 1 - 2 = -3
al

X23 = 4 + 1 – 5 = -2
ri

X31 = 2 + 0 – 2 = 0

X32 = 2 - 1 – 4 = -3
to

Now, none of the non basic variable is positive hence we terminate our iterations and
Tu

calculate the cost.

Cost =1*0+4*2+5*1+5*1+5*3

= 33
Hungarian Method

The Hungarian method is an algorithm that finds an optimal assignment for a given cost
matrix.
Theorem: If a number is added to or subtracted from all the entries of any 1 row or column of
a cost matrix then the optimal assignment for the resulting cost matrix is also an optimal
assignment for the original cost matrix.

m
The following algorithm implements the above theorem to a given n*n cost matrix to find the

co
optimal assignment.
1. Subtract the smallest entry in each row from all the entries of its row in the original

a.
cost matrix.
2. Now subtract the smallest entry in each column from all the entries of its column in
the new matrix obtained from step 1.

iy
3. Now we draw lines through appropriate rows and columns so that all the zero entries
un
of the cost matrix are covered with minimum number of such lines.
4. Test for optimality: If the minimum number of covering lines is n then we have
reached to the optimal solution and we can terminate here and if minimum number of
sD

covering lines is less than n, we have to further follow the below steps.
5. Now we determine the smallest entry that is not covered by any line and subtracts this
minimum entry from each uncovered row and adds it to each covered column. Return
al

to step 3.
ri

Example1: Let the cost matrix be as follows,


to

250 400 350


400 600 350
Tu

200 400 250

This is a 3*3 matrix and first we calculated the smallest entry in each row as 250 in R1, 350
in R2, 200 in R3 and subtracted these entries from respective rows. The new matrix becomes
TUTORIALSDUNIYA.COM
Get FREE Compiled Books, Notes, Programs, Question Papers with Solution
etc of the following subjects at https://www.tutorialsduniya.com

 C and C++  Computer System Architecture


 Java  Discrete Structures
 Data Structures  Operating Systems
 Computer Networks  Algorithms
 Android Programming  DataBase Management Systems
 PHP Programming  Software Engineering
 JavaScript  Theory of Computation
 Java Server Pages  Operational Research
 Python  System Programming
 Microprocessor  Data Mining
 Artificial Intelligence  Computer Graphics
 Machine Learning  Data Science

 DU Programs: https://www.tutorialsduniya.com/programs
 TutorialsDuniya App: http://bit.ly/TutorialsDuniyaApp
 C++ Tutorial: https://www.tutorialsduniya.com/cplusplus
 Java Tutorial: https://www.tutorialsduniya.com/java
 JavaScript Tutorial: https://www.tutorialsduniya.com/javascript
 Python Tutorial: https://www.tutorialsduniya.com/python
 Kotlin Tutorial: https://www.tutorialsduniya.com/kotlin
 JSP Tutorial: https://www.tutorialsduniya.com/jsp
0 150 100
50 250 0
0 200 50

Now we calculated the smallest entry in each column as 0 in C1, 150 in C2, 0 in C3 and
subtracted these entries from respective columns. The new matrix becomes

m
0 0 100

co
50 100 0
0 50 50

a.
Now we cover all the zeroes of the matrix by crossing R1, R2 and C1. Since the minimum
number of lines is 3 which is equals to n i.e.3, the optimal is reached and no further steps to
be followed.

iy
Since the total cost for this assignment is 0, it must be an optimal assignment with R1C2,
un
R2C3 and R3C1.

Now the same assignment is made to the original cost matrix and the cost is calculated.
sD

Cost = 400 + 350 + 200


= 950
al

Example2: Let the cost matrix be as follows,


ri

90 75 75 80
to

35 85 55 65
125 95 90 105
Tu

45 110 95 115

This is a 4*4 matrix and first we calculated the smallest entry in each row as 75 in R1, 35 in
R2, 90 in R3, 45 in R4 and subtracted these entries from the respective rows. The new matrix
becomes
15 0 0 5
0 50 20 30
35 5 0 15
0 65 50 70

Now we calculated the smallest entry in each column as 0 in C1, 0 in C2, 0 in C3, 5 in C4

m
and subtracted these entries from the respective columns. The new matrix becomes

co
15 0 0 0
0 50 20 25
35 5 0 10

a.
0 65 50 65

iy
Now we cover all the zeroes of the matrix by crossing R1, C1 and C3. Since the minimum
number of lines is 3 which is less than n i.e.4, hence we have to follow further steps to reach
un
the optimal solution.
Now the smallest entry that is not covered by any line is 5. So we subtracted 5 from each
uncovered row. The matrix becomes,
sD

15 0 0 0
-5 45 15 20
al

30 0 -5 5
-5 60 45 60
ri

Now we added 5 to each covered column. The matrix now becomes,


to

20 0 5 0
Tu

0 45 20 20
35 0 0 5
0 60 50 60

Now we again cover all the zeroes of the matrix by crossing R1, R3 and C1. Since the
minimum number of lines is 3 which is less than n i.e.4, hence we have to again follow
further steps to reach the optimal solution.
Now the smallest entry that is not covered by any line is 20. So we subtracted 20 from each
uncovered row. The matrix becomes,

20 0 5 0
-20 25 0 0
35 0 0 5

m
-20 40 30 40

Now we added 20 to each covered column. The matrix now becomes,

co
40 0 5 0

a.
0 45 20 20
55 0 0 5
0 60 50

iy 60
un
Now we again cover all the zeroes of the matrix by crossing R1, R2, R3 and R4. Since the
minimum number of lines is 4 which is equals to n i.e.4, hence the optimal is reached and no
further steps to be followed.
sD

Since the total cost for this assignment is 0, it must be an optimal assignment with R1C4,
R2C3, R3C2 and R4C1.
al

Now the same assignment is made to the original cost matrix and the cost is calculated.
Cost = 80 + 55 + 95 + 45
ri

= 275
to
Tu
Markov Chains

Introduction

Let Xt be a random variable that characterizes the state of the system at time t = 1, 2, ... The
collection of these random variables forms a stochastic process. The number of states in a

m
stochastic process may be finite or infinite.

co
A stochastic process (collection of random variables) is a Markov process if the occurrence of
a future state depends only on the state immediately preceding it.

a.
It is based on the principle of “memorylessness” which means that the next state of the
process depends only on the previous state and not the sequence of states.

iy
Given the chronological times t0, t1, ..., tn, collection of random variables {Xtn} = { x1, x2,...,
xn}is said to be a markov process if it possesses the following property:
un
P { Xtn = xn|Xtn-1 = xn-1, ..., Xt0 = x0 } = P { Xtn = xn|Xtn-1 = xn-1 }

In a Markov process with n exhaustive and mutually exclusive states, the probabilities at time
sD

t = 0, 1, 2, ..., T. This is known as one-step transition probability of moving from state i at t-1
to state j at t.
al

From above definition, we have ∑ pij = 1, i = 1,2,…,n and pij >= 0, (i,j) = 1,2,...,n.
ri

We can also represent the above one-step transition probabilities using the following matrix
notation:
to

p11 p12 ... p1n

P= p21 p22 ... p2n


Tu

... ... ... ...

pn1 pn2 ... pnn

The matrix P defines the Markov chain and has the property that all its transition probabilities
Pij are fixed and independent over time.
Classification of states in a Markov Chain

The states of a Markov chain can be classified based on the transition probability pij of P.

1. Absorbing state: A state j is absorbing if it returns to itself with certainty in one


transition that is Pij = 1.

m
2. Transient state: A state j is transient if it can reach another state but cannot return to
itself from another state.

co
3. Recurrent state: A state j is recurrent if the probability of one state being revisited
from other states is 1.
4. Periodic state: A state j is periodic with period t>1 if a return is possible only in t, 2t,

a.
3t, ..., nt steps.

iy
If a state is recurrent then it cannot be transient state but if a state is not transient then it is not
un
necessary that it is recurrent.

A finite Markov chain cannot consist of all the transient states.


sD

A closed Markov chain is an ergodic chain if all its states are recurrent and aperiodic.
al
ri
to
Tu
TUTORIALSDUNIYA.COM
Get FREE Compiled Books, Notes, Programs, Question Papers with Solution
etc of the following subjects at https://www.tutorialsduniya.com

 C and C++  Computer System Architecture


 Java  Discrete Structures
 Data Structures  Operating Systems
 Computer Networks  Algorithms
 Android Programming  DataBase Management Systems
 PHP Programming  Software Engineering
 JavaScript  Theory of Computation
 Java Server Pages  Operational Research
 Python  System Programming
 Microprocessor  Data Mining
 Artificial Intelligence  Computer Graphics
 Machine Learning  Data Science

 DU Programs: https://www.tutorialsduniya.com/programs
 TutorialsDuniya App: http://bit.ly/TutorialsDuniyaApp
 C++ Tutorial: https://www.tutorialsduniya.com/cplusplus
 Java Tutorial: https://www.tutorialsduniya.com/java
 JavaScript Tutorial: https://www.tutorialsduniya.com/javascript
 Python Tutorial: https://www.tutorialsduniya.com/python
 Kotlin Tutorial: https://www.tutorialsduniya.com/kotlin
 JSP Tutorial: https://www.tutorialsduniya.com/jsp

You might also like