Operational Research Notes
Operational Research Notes
COM
Operational Research
Notes
Delhi University
Contributor: Abhishek Sharma
[TutorialsDuniya.com]
Download TutorialsDuniya
App from PlayStore
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
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.
If the right hand side of an inequality is negative then it can be made non-negative by
ri
For example the inequality with negative RHS -x1 + x2 >= -25 is converted into x1 - x2 + S1 =
to
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,
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
(i) A solution may occur where no non-basic variable will decrease the cost, in which
al
(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
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.
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).
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.
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
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
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
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.
x1 + 2x2 + s2 <= 6
-x1 + x2 + s3 <= 1
x2 + s4 <= 2
Step 2: Rewrite the objective function to match the format of the slack equations.
m
Step 3: Write the initial simplex tableau.
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
In maximization, entering variable will correspond to the variable with the most negative
ri
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
Pivot column – x1
Pivot row – s1
Pivot element – 6
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
a.
New Row = (Current row) – [(its pivot column coefficient) * (New pivot row)]
= [0 , 1 , 2/3 , 1/6 , 0 , 0 , 0 , 4]
sD
= (0 0 4/3 -1/6 1 0 0 2)
= (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.
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
= (0 1 0 1/4 -1/2 0 0 3)
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
3x1 + x2 + x3 <= 9
al
x1 , x2 , x3 >=0
x1 + 2x2 + x3 + s1 = 6
to
2x1 + 2x3 + s2 = 4
3x1 + x2 + x3 + s3 = 9
Tu
x1 , x2 , x3 , s1 , s2 , s3 >=0
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
iy
New Row = (Current row) – [(its pivot column coefficient) * (New pivot row)]
un
First replace s1 with x2 in basic column.
sD
= [0 , 1 , 2 , 1 , 1 , 0 , 0 , 6] / 2
al
= (1 -1 0 1 2 0 0 12)
to
= (0 2 0 2 0 1 0 4)
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
a.
Leaving variable (pivot row) : s2
Pivot element: 2
iy
un
First replace s2 with x1 in basic column.
= [0 , 2 , 0 , 2 , 0 , 1 , 0 , 4] / 2
sD
= [0 , 1 , 0 , 1 , 0 , 1/2 , 0 , 2]
= (1 0 0 2 2 1/2 0 14)
= (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
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
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:
m
Example: Minimize z = 4x1 + x2 subject to
co
3x1 + x2 = 3
a.
x1 + 2x2 <= 4
x1 , x2 >= 0
iy
un
Adding s1 as surplus and s2 as slack variable,
3x1 + x2 = 3
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
3x1 + x2 + R1 = 3
x1 + 2x2 + s2 = 4
x1 , x2 , s1 , s2 , R1 , R2 >= 0
Basic variables: R1 , R2 , s2
From the computer’s standpoint, M must assume a sufficiently large numeric value.
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
We can eliminate this inconsistency by substituting out R1 and R2 in the z-row using the
appropriate constraint equations.
to
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)]
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.
m
Pivot element: 3
co
First replace R1 with x1 in basic column.
a.
= [0 , 3 , 1 , 0 , 1 , 0 , 0 , 3] / 3
= (0 0 5/3 -1 -4/3 1 0 2)
al
= (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
m
First replace R2 with x2 in basic column.
co
New x2 (pivot row) = current x2 row / (5/3)
a.
= [0 , 0 , 1 , -3/5 , -4/5 , 3/5 , 0 , 6/5]
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 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
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
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
3x1 + x2 = 3
ri
x1 + 2x2 <= 4
to
x1 , x2 >= 0
Tu
3x1 + x2 = 3
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
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
= [0 0 0 -1 -1 0 0] + [7 4 -1 1 1 0 9]
= [7 4 -1 0 0 0 9]
to
Pivot element: 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
= (0 5/3 -1 -7/3 0 0 2)
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
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
= (0 0 0 -1 -1 0 0)
m
= (1 0 1/5 3/5 -1/5 0 3/5)
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
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.
= (0 0 1/5 0 18/5)
Entering variable (pivot column) : S1
Pivot element: 1
m
New S1 (pivot row) = current S1 row / (1)
= [0 , 0 , 1 , 1 , 1] / (1)
co
= [0 , 0 , 1 , 1 , 1]
a.
= (0 0 1/5 0 18/5) - (0) x [0 , 0 , 1 , 1 , 1]
iy
= (0 0 0 -1/5 17/5)
= (1 0 0 -1/5 2/5)
sD
= (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
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.
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
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
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 + 2X2 + X3 + X4 = 10
al
Since there are 2 equations in primal problem hence there will be 2 dual variables.
Dual Problem
Tu
Y1 + Y2 >= 5
2Y1 – Y2 >= 12
Y1 + 3Y2 >= 4
Y1 >= 0
Y1, Y2 unrestricted
Example: Write the dual for the following primal problem:
X1 + 2X2 >= 3
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.
2Y1 + Y2 <= 15
-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
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
m
A column vector, P, of size n is an (n * 1) matrix.
co
A= (a11 , a12 , ... a1n)
a.
(am1 , am2 , ... amn)
P= (P1)
(P2)
iy
un
(Pn)
sD
The simplex tableau computation uses only three elementary matrix operations:
The operation is defined only if the size of the row vector V equals the number of rows of
al
matrix A.
= (242 308)
to
The operation is defined only if the number of columns of matrix A equals the size of column
vector P.
= (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.
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
X1 + 2X2 + x3 <= 10
Tu
2X1 - X2 + 3X3 = 8
X1 , x2 , x3 >= 0
X1 + 2x2 + x3 + x4 = 10
2x1 – x2 + 3x3 + R = 8
X1 , x2 , x3 , x4 , R >= 0
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
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
= (12 , 5)
m
The optimal dual values are computed as,
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
Note: The above relationship does not specify which problem is primal and which is dual.
sD
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
2. Objective z-row
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
Using formula 1, we can compute all the left and right hand side columns of the optimal
tableau as follows,
ri
= (0 1)
= (1 0)
= (-1/5 7/5)
= (2/5 1/5)
(R column in optimal iteration) = (2/5 -1/5 , 1/5 2/5) * (0 1)
= (-1/5 2/5)
= (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
a.
Z coefficient of x3 = y1 + 3y2 -4 = 29/5 + 3 * (-2/5) – 4 = 3/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
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
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
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
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
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.
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
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.
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
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.
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
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.
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
uncrossed out then determine the basic variables in the row/column by the least-cost
method.
Tu
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
C1 C2 C3 Supply
Tu
R1 5 1 0
R2 5 2 0
R3 7 0
Demand 0 0 0
= 0 + 5 + 1 + 10 + 21
= 37
Example2: Cost table is as follows,
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
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
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
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
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,
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
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
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
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
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
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
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
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
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
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
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
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
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.
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 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
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