Unit - V Aem
Unit - V Aem
Optimization Techniques
III Sem CS ( 3CS2-01)
Unit V
RESTRICTION IN LPP
DUALITY OF LPP
CONCLUSION
INTRODUCTION AND DEFINATION
Mathematical programming is used to find the best or
optimal solution to a problem that requires a decision
or set of decisions about how best to use a set of limited
resources to achieve a state goal of objectives.
Steps involved in mathematical programming
….Eq (2)
….Eq (3)
Two products
1. Shader X-pod, a portable music player
2. Shader BlueBerry, an internet-connected
color telephone
Determine the mix of products that will produce
the maximum profit
Formulating LP Problems
Hours Required
to Produce 1 Unit
X-pods BlueBerrys Available Hours
Department (X1) (X2) This Week
Electronic 4 3 240
Assembly 2 1 100
Profit per unit $7 $5
Decision Variables:
X1 = number of X-pods to be produced
X2 = number of Blue Berrys to be produced
Formulating LP Problems
Objective Function:
Maximize Profit = 7X1 + 5X2
There are three types of constraints
Upper limits where the amount used is ≤ the
amount of a resource
Lower limits where the amount used is ≥ the
amount of the resource
Equalities where the amount used is = the amount
of the resource
Formulating LP Problems
First Constraint:
Electronic Electronic
time used is ≤ time available
Second Constraint:
Assembly Assembly
is ≤
time used time available
X2
100 –
–
Number of Blue Berrys
80 –
Assembly (constraint B)
–
60 –
–
40 –
– Electronics (constraint A)
20 – Feasible
–
region
|– | | | | | | | | | | X1
0 20 40 60 80 100
Number of X-pods
Graphical Solution
Iso-Profit
X
Line Solution Method
2
Choose a100
possible
– value for the objective function
–
80 –
Number of Watch TVs
Assembly (constraint B)
– $210 = 7X1 + 5X2
60 –
Solve for the axis
– intercepts of the function and plot the line
40 –
– Electronics (constraint A)
X = 42
20 – Feasible
2 X1 = 30
region
–
|– | | | | | | | | | | X1
0 20 40 60 80 100
Number of X-pods
Graphical solution
X2
100 –
–
Number of Blue Berrys
80 –
–
60 – $210 = $7X1 + $5X2
–
(0, 42)
40 –
–
20 – (30, 0)
–
|– | | | | | | | | | | X1
0 20 40 60 80 100
Number of X-pods
Graphical solution
X2
100 –
– $350 = $7X1 + $5X2
Number of Blue Beryys
80 –
$280 = $7X1 + $5X2
–
60 – $210 = $7X1 + $5X2
–
40 –
–
$420 = $7X1 + $5X2
20 –
–
|– | | | | | | | | | | X1
0 20 40 60 80 100
Number of X-pods
Graphical solution
X2
100 –
– Maximum profit line
80 –
Number of Blue Berrys
–
60 – Optimal solution point
– (X1 = 30, X2 = 40)
40 –
–
$410 = $7X1 + $5X2
20 –
–
|– | | | | | | | | | | X1
0 20 40 60 80 100
Number of X-pods
Corner point method
X2
100 –
2 –
Number of Blue Berrys
80 –
–
60 –
–
3
40 –
–
20 –
–
|– | | | | | | | | | | X1
1
0 20 40 60 80 100
4
Number of X-pods
Corner-Point Method
The optimal value will always be at a corner
point
Find the objective function value at each
corner point and choose the one with the
highest profit
x1, x2 ,..., xn 0
Slack Variables
If a constraint has a sign , then in order to make it an
equality we have to add some positive quantity to the left
hand side .
The positive variables which are added to left hand side of the
constraints to convert into equations are called the slack
variables.
Ex . x1 x2 x3 5 x1 , x2 , x3 0
Can be converted to
Ex . x1 x2 x3 x4 5 x1 , x2 , x3 , x4 0
x2 + x3 ≤ 4,
3x1 + x2 ≤ 7,
x1, x2, x3 ≥ 0.
Step-1 covert into standard form
a11 x1 + a12 x2 + ••• + a1n xn ≤ b1, a11 x1 + a12 x2 + ••• + a1n xn + xn+1 = b1,
a21 x1 + a22 x2 + ••• + a2n xn ≥ b2, a21 x1 + a22 x2 + ••• + a2n xn - xn+2 = b2,
am1 x1 + am2 x2 + ••• + amn xn ≤ bm, am1 x1 + am2 x2 + ••• + amn xn + xn+k = bm,
x1 + 3x2 - x3 + x4 = 6,
x2 + x3 + x5 = 4,
3x1 + x2 + x6 = 7,
cB Basis cj Constants
x1, x2, x3, x4, x5, x6 ≥ 0. 5 2 1 0 0 0
x1 x2 x3 x4 x5 x6
0 x4 1 3 -1 1 0 0 6
0 x5 0 1 1 0 1 0 4
0 x6 3 1 0 0 0 1 7
c row 5 2 1 0 0 0 Z=0
Step 2: Explanation
Adjacent Basic Feasible Solution
If we bring a non basic variable xs into the basis, our system
changes from the basis, xb, to the following (same notation as the
book):
x1 + ā1sxs= b
1
xi = bi a is for i =1, …, m
xr + ārsxr= b r xs = 1
cB Basis cj Constants
5 2 1 0 0 0
x1 x2 x3 x4 x5 x6
0 x4 1 3 -1 1 0 0 6
0 x5 0 1 1 0 1 0 4
0 x6 3 1 0 0 0 1 7
c row 5 2 1 0 0 0 Z=0
c j c j cB Pj
c1 = 5 - 0(1) - 0(0) - 0(3) = 5 -> largest positive
c2 = ….
c3 = ….
Step 4: Is this an optimal basic feasible solution?
31
Simplex: Step 4
Apply the minimum ratio rule to determine the basic variable to
leave the basis.
The new values of the basis variables:
xi = bi a is x s for i = 1, ..., m
bi
max x s min
a is 0 a is
In our example:
cB Basis cj Constants
5 2 1 0 0 0 Row Basic Variable Ratio
x1 x2 x3 x4 x5 x6 1 x4 6
0 x4 1 3 -1 1 0 0 6 2 x5 -
0 x5 0 1 1 0 1 0 4 3 x6 7/3
0 x6 3 1 0 0 0 1 7
c row 5 2 1 0 0 0 Z=0
32
Simplex: Step 5
Perform the pivot operation to get the new tableau and the b.f.s.
cB Basis cj Constants
5 2 1 0 0 0
x1 x2 x3 x4 x5 x6
0 x4 1 3 -1 1 0 0 6 Key element is 3
0 x5 0 1 1 0 1 0 4
0 x6 3 1 0 0 0 1 7
c row 5 2 1 0 0 0 Z=0
New iteration:
find entering
cB Basis cj Constants
variable: 5 2 1 0 0 0
c j c j c B Pj x1 x2 x3 x4 x5 x6
0 x4 0 8/3 -1 1 0 0 11/3
0 x5 0 1 1 0 1 0 4
cB = (0 0 5)
5 x1 1 1/3 0 0 0 1/3 7/3
c2 = 2 - (0) 8/3 - (0) 1 - (5) 1/3 = 1/3 c row 0 1/3 1 0 0 -5/3 Z=35/3
c3 = 1 - (0) (-1) - (0) 1 - (5) 0 = 1
c6 = 0 - (0) 0 - (0) 0 - (5) 1/3 = -5/3
33
Final Table
cB Basis cj Constants x3 enters basis,
5 2 1 0 0 0 x5 leaves basis
x1 x2 x3 x4 x5 x6
0 x4 0 8/3 -1 1 0 0 11/3
0 x5 0 1 1 0 1 0 4
5 x1 1 1/3 0 0 0 1/3 7/3
c row 0 1/3 1 0 0 -5/3 Z=35/3
cB Basis cj Constants
5 2 1 0 0 0
x1 x2 x3 x4 x5 x6
0 x4 0 11/3 0 1 1 0 23/3
1 x3 0 1 1 0 1 0 4
5 x1 1 1/3 0 0 0 1/3 7/3
c row 0 -2/3 0 0 -1 -5/3 Z=47/3
Cj 600 500 0 0 M M
Min.Ratio
Basic
Basic (XB/Pivotal
CB Variab X1 X2 S1 S2 A1 A2 Col.)
Soln(XB)
le (B)
M A1 80 2 1 -1 0 1 0 80
M A2 60 1 2 0 -1 0 1 60
Zj 3M 3M M M M M
Cj - Zj 600-3M 500-3M M M 0 0
It is clear from the tableau that X2 will enter and A2 will leave
the basis. Hence 2 is the key element in pivotal column. Now ,
the new row operations are as follows:
R2(New) = R2(Old)/2
R1(New) = R1(Old) - 1*R2(New)
Cj 600 500 0 0 M
Min.Ratio
Basic
Basic (XB/Pivota
CB Variab X1 X2 S1 S2 A1 l Col.)
Soln(XB)
le (B)
M A1 50 3 2 0 -1 1 2 1 100/3
500 X2 30 1 2 1 0 - 1/2 0 60
Zj 3M/2+250 500 M M/2-250 M
Cj - Zj 350-3M/2 0 M 250-M/2 0
It is clear from the tableau that X1 will enter and A1 will leave
the basis. Hence 2 is the key element in pivotal column.
Now,the new row operations are as follows:
R1(New) = R1(Old)*2/3
R2(New) = R2(Old) – (1/2)*R1(New)
Cj 600 500 0 0 Min.
Basic Ratio
Varia Basic (XB/P
CB X1 X2 S1 S2 ivotal
ble Soln(XB)
Col.)
(B)
600 X1 100/3 1 0 2 3 1 3
500 X2 40/3 0 1 1 3 2 3
Zj 600 500 700 3 400 3
Cj - Zj 0 0 700 3 400 3
Since all the values of (Cj-Zj) are either zero or positive and also
both the artificial variables have been removed, an optimum
solution has been arrived at with X1=100/3 X2=40/3
Z=80,000/3
Two –Phase Method
Min.z x1 x2
s.to
2 x1 x2 4
x1 7 x2 7
x1 , x2 0
Solution: we first convert the minimization problem to
maximization Max.z Min.z
s.to
2 x1 x2 x3 x5 4
x1 7 x2 x4 x6 7
xi 0, i 1to6
Phase –I The problem of phase –I is
Max.z 0.x1 0.x2 0.x3 0.x4 x5 x6
-1 X5 4 2 1 -1 0 1 0 4/1
-1 X6 7 1 70 -1 0 1 7/7
Z j CJ -3 -8 1 1 0 0
Simplex table(2)
cj 0 0 0 0 -1 -1
Z j CJ 0 0 0 0 1 1
Z j CJ 0 0 6/13 1/13
b1
b
2
b .
.
bm
m1
Then attached to it , there exist another problem,
Min .Z D b W T
s.to
Eq.(II)
A W c
T T
W 0
Where T , stands for the transpose of the matrix/vector and
w1
w
2
W :
:
wm
m1
if (I) represent the primal problem, then (II) is the dual . In fact it
is immaterial , which problem is designated as the primal , since
the dual of a dual is primal. If the optimal solution of one is
known , the optimal solution to the other can be obtained from it
(without solving ) . These two problem possess very closely
related properties.
Note: if one of the constraints , in the primal , appear with an
equality sign.(say i th ) , then the corresponding variable wi will
be unrestricted in sign .
i.e. if ai1 x1 ai 2 x2 .........ain xn bi then wi is unrestricted in
sign . We can give the following relationship between the primal
and its dual.
Relation between the primal and dual
Primal problem Dual problem
x1
w2
Its dual is
Min.Z D w1
s.to
w1 w2 3
w1 w2 4 w1
w1 , w2 0
The dual is
Min.Z D 48w1 42 w2 21w3
s.to
2 w1 w2 w3 2
3w1 w2 w3 4
w1 , w2 , w3 0
https://www.youtube.com/watch?v=zDch07vVBxI
https://www.youtube.com/watch?v=8IRrgDoV8Eo
https://www.youtube.com/watch?v=aw7NBSje2iM
https://www.youtube.com/watch?v=MZ843Vvia0A
https://www.youtube.com/watch?v=oZqVDGFckZE
https://www.youtube.com/watch?v=UsqtzA9XmQE
https://www.youtube.com/watch?v=gmDwUCvOJQ8
Conclusion
INTRODUCTION
OPTIMALITY TEST
ASSIGNMENT PROBLEM
CONCLUSION
Introduction and definition
Distributing any commodity from any group of supply centers, called
sources, to any group of receiving centers, called destinations, in such a
way as to minimize the total distribution cost (shipping cost).
Total supply must equal total demand.
If total supply exceeds total demand, a dummy destination, whose
demand equals the difference between the total supply and total
demand is created. Similarly if total supply is less than total demand, a
dummy source is created, whose supply
equals the difference.
All unit shipping costs into a dummy destination or out of a dummy
source are 0.
Example :1
Transportation Table:
Initial Solution of transportation problem
1. North-west Corner rule
1. Select the remaining variable in the upper left (northwest) corner
and note the supply remaining in the row, s, and the demand
remaining in the column, d.
2. Allocate the minimum of s or d to this variable. If this minimum is s,
eliminate all variables in its row from future consideration and reduce
the demand in its column by s; if the minimum is d, eliminate all
variables in the column from future consideration and reduce the
supply in its row by d.
REPEAT THESE STEPS UNTIL ALL SUPPLIES HAVE BEEN
ALLOCATED.
Total sipping cost = 2250
2. Lowest Cost entry method
1. For the remaining variable with the lowest unit cost,
determine the remaining supply left in its row, s, and the
remaining demand left in its column, d (break ties
arbitrarily).
2. Allocate the minimum of s or d to this variable. If this
minimum is s, eliminate all variables in its row from future
consideration and reduce the demand in its column by s;
if the minimum is d, eliminate all variables in the column
from future consideration and reduce the supply in its row
by d.
REPEAT THESE STEPS UNTIL ALL SUPPLIES HAVE
BEEN ALLOCATED.
Total sipping cost = 2065
3. Vogel’s Approximation Method (VAM)
1. For each remaining row and column, determine the difference
between the lowest two remaining costs; these are called the row
and column penalties.
2. Select the row or column with the largest penalty found in step 1
and note the supply remaining for its row, s, and the demand
remaining in its column, d.
3. Allocate the minimum of s or d to the variable in the selected row
or column with the lowest remaining unit cost. If this minimum is s,
eliminate all variables in its row from future consideration and reduce
the demand in its column by s; if the minimum is d, eliminate all
variables in the column from future consideration and reduce the
supply in its row by d.
REPEAT THESE STEPS UNTIL ALL SUPPLIES HAVE BEEN
ALLOCATED.
Total sipping cost = 2030
The Stepping-Stone Method
1. Find the current Cij–Zij values for each nonbasic variable
and select the one with the most negative Cij–Zij value as
the entering variable; if all Cij–Zij values are nonnegative,
the current solution is optimal.
3. Since the Cij–Zij values for basic variables are 0 (i.e., Cij -
Ui + Vj = 0 for basic variables), we can easily solve for the
remaining values of the Ui’s and Vj’s from the m + n - 1
equations for the basic variables.
4. Once the Ui’s and Vj’s have been determined, the Cij–Zij
values for the nonbasic variables can be calculated by
Cij - Zij = Cij - Ui + Vj
Non-basic cells:
30 40 42 0
Plant 2 50
Demand 25 45 10 20
Example:
Lowest cost entry method
Iteration 1: Tie for least cost (0), arbitrarily select x14.
Allocate 20. Reduce s1 by 20 to 30 and delete the
Dummy column.
Iteration 2: Of the remaining cells the least cost is 24 for
x11. Allocate 25. Reduce s1 by 25 to 5 and eliminate the
Northwood column.
Iteration 3: Of the remaining cells the least cost is 30 for
x12. Allocate 5. Reduce the Westwood column to 40 and
eliminate the Plant 1 row.
Iteration 4: Since there is only one row with two cells
left, make the final allocations of 40 and 10 to x22 and
x23, respectively.
Example:
Initial table
30 40 42 0
Plant 2 40 10 50
Demand 25 45 10 20
Plant 1 24 30 40 0 0
25 5 +8 20
30 40 42 0
Plant 2 10
-4 40 10 -10
vj 24 30 32 0
Iteration 1
Stepping Stone Method
The stepping stone path for cell (2,4) is (2,4), (1,4),
(1,2), (2,2). The allocations in the subtraction cells are
20 and 40, respectively. The minimum is 20, and
hence reallocate 20 along this path. Thus for the next
tableau:
x24 = 0 + 20 = 20 (0 is its current allocation)
x14 = 20 - 20 = 0 (blank for the next tableau)
x12 = 5 + 20 = 25
x22 = 40 - 20 = 20
The other occupied cells remain the same.
Northwood Westwood Eastwood Dummy Supply
24 30 40 0
Plant 1 50
25 25
30 40 42 0
Plant 2 50
20 10 20
Demand 25 45 10 20
Plant 1 24 30 40 0 0
25 25 +8 +10
30 40 42 0
Plant 2 10
-4 20 10 20
vj 24 30 36 -6
Iteration 2
Stepping Stone Method
The most negative reduced cost is = -4
determined by x21. The stepping stone path for this
cell is (2,1),(1,1),(1,2),(2,2). The allocations in the
subtraction cells are 25 and 20 respectively. Thus the
new solution is obtained by reallocating 20 on the
stepping stone path. Thus for the next tableau:
x21 = 0 + 20 = 20 (0 is its current allocation)
x11 = 25 - 20 = 5
x12 = 25 + 20 = 45
x22 = 20 - 20 = 0 (blank for the next tableau)
The other occupied cells remain the same.
Northwood Westwood Eastwood Dummy Supply
24 30 40 0
Plant 1 50
5 45
30 40 42 0
Plant 2 50
20 10 20
Demand 25 45 10 20
30 40 42 0
Plant 2 20 +4 10 20 6
vj 24 30 36 -6
Optimal Solution
https://www.youtube.com/watch?v=Q31jKiEXxdc
UNIT-III
ASSIGNMENT PROBLEM
CONTENTS
Introduction
Exercises
The Assignment Problem (AP)
Assignment problem is a special case of
Transportation problem with m=n and si=dj for all
i, and j.
Machine A B C D E
jobs
1 10 20 4 24 8
2 8 20 6 28 12
3 12 26 8 32 12
4 14 28 8 36 18
5 16 28 12 36 24
Q.3 solve the following assignment problems
(unbalanced problems)
Resources J1 J2 J3 J4
and
workers
W1 7 5 8 4
W2 5 6 7 4
W3 8 7 9 8
Problems of maxmization
A maximization assignment problem can be converted to a
minimization problem by creating a lost opportunity matrix
using any of the following methods. The problem then is to
minimize the total lost opportunity. The first method is by
putting a negative sign before the values in the assignment
matrix and then solves the sum as a minimization case using
Hungarian methods.
Second method is to locate the largest value in the given
matrix and subtract each element in the matrix from this value
.then one can solve this problem as a minimization case using
the new modified matrix .
Example:
A company has a team of four salespersons and there are
four districts where the company wants to start its business
.after taking into account the capabilities of salesman and
nature of districts, the company estimates the profit per
day in rupees for each salesman for each district given in
the following table:
District I II III IV
and
salesman
A 16 10 14 11
B 14 11 15 15
C 15 15 13 12
D 13 12 14 15
Travelling salesman problem(TSP)
Travelling salesman problem is a routine problem. It can be
considered as a typical assignment problem with certain
restrictions . Consider a salesman who is assigned the job
of visiting n different cities . He knows(is given) the
distance (or time) between all pairs of cities . He is asked to
visit each of the cities only once. The trip should be
continuous and he should come back to the city from
where he started using the shortest route . It does not
matter , from which city he starts. These restrictions imply:
(i) no assignment should be made along the diagonal
,going directly from city i to j is not permitted . Therefore
diagonal elements are generally taken very large i.e.
Mathematical formulation
A travelling salesman has to visit n cities and return to the starting
point. He has to start from any one city and visit each city only once .
The objective is to select the sequence which the cities are visited in
such a way that the total travelling distance(or time) is minimized .
Suppose he starts from the kth , city and the last he visited is m. let the
cost of travel from ith , city to jth city be Cij .then the objective function
is m n
Minimize cij xij
i 1 j 1
x
i 1
ij 1, for, i 1,2,......m, i j ,i m
x
j 1
ij 1, for, j 1,2,......n, i j , j n
xmk 1
xij 0or1
Working procedure
Step-1 solve the problem as an assignment problem using the
method used to solve the above examples.
Step-2 (a) if the solution thus found out are cyclic in nature
,then that is the final solution.
(b) if it is not cyclic ,then go to step-3.
Step-3 select the lowest entry in the table ( other than zero).
Delete the row and column of this lowest entry and again do
the zero assignment in the remaining matrix.
Step-4 check whether cyclic assignment is available.If not,
include the next higher entry in the table and the procedure is
repeated until a cyclic assignment is obtained.
Example
Consider a four city TSP for which the cost between the city
pairs are as shown in the figure below. Find the tour of the
salesman so that the cost of travel is minimal.
2
6 8
4
1 5 4
9 9
3
Solution
Construct the cost matrix as follows:
1 2 3 4
1 6 9 5
2 6 4 8
3 9 4 9
4
5 8 9
Step-1
1 2 3 4
1 0 5 0
2
2 4 8
3 9 4 9
4 0 3 4
The optimal assignment is 1 4,2 3,3 2,4 1
Which is not cyclic.
Step-2 consider the lowest entry ‘2’ of the cell (2,1) . If there is
a tie in selecting the lowest entry, then break the tie
arbitrarily. Delete the II row and I column . Do the zero
assignment in the remaining matrix . The resulting table is
:-
1 2 3 4
1 0 4 0
2 2 0 3
3 5 0 4
4 0 3 0
Next optimal assignment is
1 4,2 1,3 2,4 3
Which is cyclic.
https://www.youtube.com/watch?v=q7VMzOTZvqM
https://www.youtube.com/watch?v=BUGIhEecipE
Conclusion
The transportation problem is a special class of the linear
programming problem. It deals with the situation in which a
commodity is transported from sources(origins) to
destinations. The objective is to determine the amount of
commodity to be transported from each source to each
destination so that the total transportation cost is minimum.
The Assignment problem is special from of the transportation
problem with equal number of sources and destination and
supply at each source and demand at each destination is limited
to one unit.
The name “assignment problem” originates from the classical
problem where the objective is to assign a number of
origins(job) to the equal number of destinations(persons) at
minimum cost(or maximum profit) travelling salesman
problem is a special type of assignment problem.
Thank you