10CS661_OR_UNIT 6

advertisement
Subject Name: Operation Research
Subject Code: 10CS661
Prepared By:Mrs.Pramela Devi, Mrs.Sindhuja.K
Mrs.Annapoorani
Department:CSE
3/16/2016
Slide 1
UNIT 6:Transportation
and Assignment Problems
1.The transportation problem
2.A streamlined simplex method for the transportation problem
3.The assignment problem
4.A special algorithm for the assignment problem.
Slide 2
Transportation Problem
The transportation problem seeks to minimize the total shipping costs of
transporting goods from m origins or sources (each with a supply si) to n
destinations (each with a demand dj), when the unit shipping cost from source,
i, to a destination, j, is cij.
Slide 3
Transportation Problem
LP Formulation
The linear programming formulation in terms of the amounts shipped from
the sources to the destinations, xij , can be written as:
m n
Min z=∑ ∑ cijxij
(total transportation cost)
i=0 j=0
s.t. ∑xij = si for each source i (supply constraints)
j
∑xij = dj
i
xij > 0
for each destination j (demand constraints)
for all i and j (nonnegativity constraints)
Slide 4
Transportation Problem
To solve the transportation problem by its special purpose algorithm, it is
required that the sum of the supplies at the sources equal the sum of
the demands at the destinations. If the total supply is greater than the
total demand, a dummy destination is added with demand equal to the
excess supply, and shipping costs from all sources are zero. Similarly,
if total supply is less than total demand, a dummy source is added.
When solving a transportation problem by its special purpose algorithm,
unacceptable shipping routes are given a cost of +M (a large number).
Slide 5
Transportation Problem
A transportation tableau is given below. Each cell represents a shipping
route (which is an arc on the network and a decision variable in the LP
formulation), and the unit shipping costs are given in an upper right
hand box in the cell.
D1
S1
S2
Demand
25
D2
D3
Supply
15
30
20
30
40
35
45
50
30
10
Slide 6
Problem formulation
The LP model for this problem is as follows:
Min Z = 15 X11 + 30 X12 + 20 X13 + 30 X21 + 40X22 + 35X23
S.t.
X11 + X12 + X13 ≤ 50
Supply constraints
X21 + X22 + X23 ≤ 30

X11 + X21 = 25
X12 + X22 = 45
X13 + X23 = 10
X11, …, X23  0
demand constraints
Slide 7
Transportation Problem





The transportation problem is solved in two phases:
Phase I -- Obtaining an initial feasible solution
Phase II -- Moving toward optimality
In Phase I, the Minimum-Cost Procedure can be used to establish an
initial basic feasible solution without doing numerous iterations of the
simplex method.
In Phase II, the Stepping Stone, by using the MODI method for
evaluating the reduced costs may be used to move from the initial
feasible solution to the optimal one.
Slide 8
Initial Tableau

1.
2.
3.
There are many method for finding the initial tableau for the
transportation problem which are:
Northwest corner
Vogle’s approximation method
Russell’s approximation method
Slide 9
Northwest corner

Northwest corner: Begin by selecting X11 (that is, start in the northwest corner
of the transportation tableau). Therefore, if Xij was the last basic variable
(occupied cell) selected, then select Xij+1 (that is, move one column to the right)
if source I has any supply remaining. Otherwise, next select Xi+1 j (that is,
move one row down).
D1
S1
15
25
30
S2
Demand
D2
25
D3
Supply
25
30
20
20
40
35
45
10
50
30
10
Slide 10
Northwest corner method
Steps:
1.
assign largest possible allocation to the cell in the upper left-hand corner
of the tableau
2.
Repeat step 1 until all allocations have been assigned
3.
Stop. Initial tableau is obtained
11
Slide 11
Northwest-Corner Rule
1.
Assign 100 tubs from Des Moines to Albuquerque (exhausting Des
Moines’s supply)
1.
Assign 200 tubs from Evansville to Albuquerque (exhausting
Albuquerque’s demand)
2.
Assign 100 tubs from Evansville to Boston (exhausting Evansville’s
supply)
3.
Assign 100 tubs from Fort Lauderdale to Boston (exhausting Boston’s
demand)
4.
Assign 200 tubs from Fort Lauderdale to Cleveland (exhausting
Cleveland’s demand and Fort Lauderdale’s supply)
Slide 12
Northwest-Corner Rule
To
From
(D) Des Moines
(E) Evansville
(A)
Albuquerque
100
200
Warehouse
requirement
300
$4
$3
$8
$4
$3
100
100
200
1.
(C)
Cleveland
$5
$9
(F) Fort Lauderdale
(B)
Boston
$7
200
200
$5
Factory
capacity
100
300
300
700
Means that the firm is shipping 100
bathtubs from Fort Lauderdale to
Boston
Slide 13
Vogel’s approximation method
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
Operational steps:
Step 1: for each column and row, determine its
penalty cost by subtracting their two of their
least cost
Step 2: select row/column that has the highest penalty cost
in step 1
Step 3: assign as much as allocation to the
selected row/column that has the least cost
Step 4: Block those cells that cannot be further allocated
Step 5: Repeat above steps until all allocations have been
assigned
(to p17)
14
Slide 14
subtracting their two of their least cost
Step 1
(8-6)
(11-7)
(5-4)
(6-4)
(8-5)
(11-10)
Slide 15
Steps 2 & 3
Step 2:
Highest penalty
cost
Step 3: this has the least cost
Slide 16
Step 4
---
---
Slide 17
Step 5
Second Iteration
----- ---
Slide 18
3rd Iteration of VAM
---
-----
---
(to p22)
Slide 19
1.
Initial tableau for VAM
Slide 20
Optimal solution?
1.
2.
3.
4.
Initial solution from:
Northeast cost, total cost =$5,925
The min cost, total cost =$4,550
VAM, total cost = $5,125
5.
6.
It shows that the second one has the min cost, but is it the
optimal solution?
21
Slide 21
Optimality Test:
Once an initial solution is obtained, the next step is to check its
optimality. An optimal solution is one where there is no other set of
transportation routes (allocations) that will further reduce the total
transportation cost. Thus, we have to evaluate each un-occupied cell in the
transportation table in terms of an opportunity of reducing total transportation
cost.
If we have a B.F.S. consisting of (m+ n–1) independent positive
allocations and a set of arbitrary number ui and vj (i=1,2,...m; j=1,2,...n) such
that cij = ui+vj for all occupied cells (i, j) then the evaluation dij corresponding
to each empty cell (i, j) is given by :
dij = cij – (ui+ vj)
This evaluation is also called the opportunity cost for un-occupied cells.
Slide 22
u-v Method
Step 1: Start with B.F.S. consisting of (m+ n–1) allocations in
independent positions.
Step 2: Determine a set of m+n numbers ui (i=1,2,....m) and
vj (j=1,2,...n) for all the rows and columns such that for each
occupied cell (i,j), the following condition is satisfied :
cij = ui+vj
Step 3: Calculate cell evaluations (opportunity cost) dij for
each empty cell (i,j) by using the formula :
dij = cij – ( ui+vj ) for all i & j.
Slide 23
Step 4: Examine the matrix of cell evaluation dij for negative
entries and conclude that
(i) If all dij > 0 , then solution is optimal and unique.
(ii)If at least one dij = 0 , then solution is optimal and alternate
solution also exists.
(iii)If at least one dij < 0 ,then solution is not optimal and an improved solution
can be obtained.
In this case, the un-occupied cell with the largest negative value of dij is
considered for the new transportation schedule.
Step 5: Construct a closed path (loop) for the unoccupied cell having largest
negative opportunity cost. Mark a (+) sign in this cell and move along the rows
(or columns) to find an occupied cell. Mark a (-) sign in this cell and find out
another occupied cell. Repeat the process and mark the occupied cells with (+)
and (-) signs alternatively. Close the path back to the selected unoccupied cell.
Slide 24
Step 6: Select the smallest quantity amongst the cells marked with (-) sign.
Allocate this value to the unoccupied cell of the loop and add and subtract
it in the occupied cells as per their signs.
Thus an improved solution is obtained by calculating the total
transportation cost by this method.
Step 7: Test the revised solution further for optimality. The procedure
terminates when all dij ≥ 0 , for unoccupied cells.
Slide 25
Assignment Problem
Network Representation
c11
1
c12
1
c13
c21
c22
2
2
c23
c31
3
c33
WORKERS
c32
3
JOBS
Slide 26
•
•
•
•
•
Assignment Problem
An assignment problem seeks to minimize the total cost assignment of m
workers to m jobs, given that the cost of worker i performing job j is cij.
It assumes all workers are assigned and each job is performed.
An assignment problem is a special case of a transportation problem in
which all supplies and all demands are equal to 1; hence assignment
problems may be solved as linear programs.
The network representation of an assignment problem with three workers
and three jobs is shown on the next slide.
Slide 27
Introduction



28
Assignment problem is a particular class of transportation linear
programming problems
Supplies and demands will be integers (often 1)
Traveling salesman problem is a special type of assignment problem
D Nagesh
Optimization
Slide 28
Objectives



29
To structure and formulate a basic assignment problem
To demonstrate the formulation and solution with a numerical example
To formulate and solve traveling salesman problem as an assignment
problem
D Nagesh
Optimization
Slide 29
Structure of Assignment Problem





30
Assignment problem is a special type of transportation problem in which
Number of supply and demand nodes are equal.
Supply from every supply node is one.
Every demand node has a demand for one.
Solution is required to be all integers.
Slide 30
Structure of Assignment Problem …contd.





31
Goal of an general assignment problem: Find an optimal assignment of
machines (laborers) to jobs without assigning an agent more than once
and ensuring that all jobs are completed
The objective might be to minimize the total time to complete a set of
jobs, or to maximize skill ratings, maximize the total satisfaction of the
group or to minimize the cost of the assignments
This is subjected to the following requirements:
Each machine is assigned no more than one job.
Each job is assigned to exactly one machine.
Slide 31
Formulation of Assignment Problem






32
Consider m laborers to whom n tasks are assigned
No laborer can either sit idle or do more than one task
Every pair of person and assigned work has a rating
Rating may be cost, satisfaction, penalty involved or time taken to finish
the job
N2 such combinations of persons and jobs assigned
Optimization problem: Find such job-man combinations that optimize the
sum of ratings among all.
D Nagesh
Optimization
Slide 32
Formulation of Assignment Problem …contd.








33
Representation of this problem as a special case of transportation
problem
laborers as sources
tasks as destinations
Supply available at each source is 1
Demand required at each destination is 1
Cost of assigning (transporting) laborer i to task j is cij.
It is necessary to first balance this problem by adding a dummy laborer
or task depending on whether m < n or m > n, respectively
Cost coefficient cij for this dummy will be zero.
D Nagesh
Optimization
Slide 33
Formulation of Assignment Problem …contd.

Let xij be the decision variable

The objective function this
th

0, if the j job is not assigned to the i machine
xij  
th
th

1, if the j job is assigned to the i machine
m
Minimize
n
 c
i 1 j 1
34
ij
xij
Slide 34
Formulation of Assignment Problem …contd.


Since each task is assigned to exactly one laborer and each laborer is
assigned only one job, the constraints are
n
x
i 1
ij
n
x
j 1
ij
1
for j  1, 2,...n
1
for i  1, 2,...m
xij  0 or 1

35
Due to the special structure of the assignment problem, the solution can be
found out using a more convenient method called Hungarian method.
Slide 35
Example: Hungry Owner







A contractor pays his subcontractors a fixed fee
plus mileage for work performed. On a given day the contractor is faced
with three electrical jobs associated with various projects. Given below
are the distances between the subcontractors and the projects.
Project
A B C
Westside 50 36 16
Subcontractors Federated 28 30 18
Goliath 35 32 20
Universal 25 25 14
How should the contractors be assigned to minimize total
distance (and total cost)?
Slide 36
Example: Hungry Owner

Network Representation
West.
50
A
36
16
28
Fed.
18
35
25
B
32
20
Gol.
Univ.
30
C
25
14
Slide 37
Example: Hungry Owner




LP Formulation
Decision Variables Defined
xij = 1 if subcontractor i is assigned to project j
= 0 otherwise
where: i = 1 (Westside), 2 (Federated),
3 (Goliath), and 4


(Universal)

j = 1 (A), 2 (B), and 3 (C)
Slide 38
Example: Hungry Owner





LP Formulation
Objective Function
Minimize total distance:
Min 50x11 + 36x12 + 16x13 + 28x21 + 30x22 + 18x23
+ 35x31 + 32x32 + 20x33 + 25x41 + 25x42 +
14x43
Slide 39
Example: Hungry Owner


LP Formulation
Constraints
x11 + x12 + x13 < 1 (no more than one
x21 + x22 + x23 < 1 project assigned
x31 + x32 + x33 < 1
to any one
x41 + x42 + x43 < 1
subcontractor)
x11 + x21 + x31 + x41 = 1 (each project must
x12 + x22 + x32 + x42 = 1 be assigned to just
x13 + x23 + x33 + x43 = 1 one







subcontractor)
all xij > 0 (non-

negativity)
Slide 40
Example: Hungry Owner







Optimal Assignment
Subcontractor Project Distance
Westside
C
16
Federated
A
28
Universal
B
25
Goliath
(unassigned)
Total Distance = 69 miles
Slide 41
Variations of Assignment Problem



Total number of agents not equal to total number of tasks
Maximization objective function
Unacceptable assignments
Slide 42
Hungarian Method





The Hungarian method solves minimization assignment problems with m
workers and m jobs.
Special considerations can include:
number of workers does not equal the number of jobs -- add dummy
workers or jobs with 0 assignment costs as needed
worker i cannot do job j -- assign cij = +M
maximization objective -- create an opportunity loss matrix subtracting all
profits for each job from the maximum profit for that job before beginning
the Hungarian method
Slide 43
Hungarian Method








Step 1: For each row, subtract the minimum number in that row from all
numbers in that row.
Step 2: For each column, subtract the minimum number in that column
from all numbers in that column.
Step 3: Draw the minimum number of lines to cover all zeroes. If this
number = m, STOP -- an assignment can be made.
Step 4: Determine the minimum uncovered number (call it d).
Subtract d from uncovered numbers.
Add d to numbers covered by two lines.
Numbers covered by one line remain the same.
Then, GO TO STEP 3.
Slide 44
Hungarian Method




Finding the Minimum Number of Lines and Determining the Optimal
Solution
Step 1: Find a row or column with only one unlined zero and circle it. (If
all rows/columns have two or more unlined zeroes choose an arbitrary
zero.)
Step 2: If the circle is in a row with one zero, draw a line through its
column. If the circle is in a column with one zero, draw a line through its
row. One approach, when all rows and columns have two or more zeroes,
is to draw a line through one with the most zeroes, breaking ties
arbitrarily.
Step 3: Repeat step 2 until all circles are lined. If this minimum number
of lines equals m, the circles provide the optimal assignment.
Slide 45
Example: Hungry Owner


A contractor pays his subcontractors a fixed fee
plus mileage for work performed. On a given day the contractor is faced
with three electrical jobs associated with various projects. Given below
are the distances between the subcontractors and the projects.
Projects

A
B
C

Westside
50 36
Goliath
35 32
16
Subcontractors Federated

28
30 18

20
Universal

25 25 14

How should the contractors be assigned to

minimize total costs?
Slide 46
Example: Hungry Owner
Network Representation (note the dummy project)
50
West.
A
36
16
0
28
Fed.
30
18
B
Projects
Subcontractors

0
32
35
20
Gol.
C
0
25
25
Univ.
14
0
Dum.
Slide 47
Example: Hungry Owner

Initial Tableau Setup

Since the Hungarian algorithm requires that there
be the same number of rows as columns, add a Dummy column so that the
first tableau is:
A





0
Federated
Goliath
Universal
B
C Dummy
Westside
28 30 18
35 32 20
25 25 14
50 36 16
0
0
0
Slide 48
Example: Hungry Owner


Step 1: Subtract minimum number in each row from all numbers in that
row. Since each row has a zero, we would simply generate the same
matrix above.
Step 2: Subtract the minimum number in each column from all numbers
in the column. For A it is 25, for B it is 25, for C it is 14, for Dummy it is
0. This yields:





Westside
Federated
Goliath
Universal
A
25
3
10
0
B
11
5
7
0
C Dummy
2
0
4
0
6
0
0
0
Slide 49
Example: Hungry Owner

Step 3: Draw the minimum number of lines to cover all zeroes. Although
one can "eyeball" this minimum, use the following algorithm. If a
"remaining" row has only one zero, draw a line through the column. If a
remaining column has only one zero in it, draw a line through the row.
A

B

C Dummy
Westside
25
11
2
Federated
3
5
4
10
7
6
0
0
0
0

0
Goliath

0
Universal

0

Step 4: The minimum uncovered number is 2 (circled).
Slide 50
Example: Hungry Owner

Step 5: Subtract 2 from uncovered numbers; add 2 to all numbers covered
by two lines. This gives:





Federated
Goliath
Universal
Westside
1 3 2
8 5 4
0 0 0
A B
23 9
0
0
2
C Dummy
0
0
Slide 51
Example: Hungry Owner

Step 3: Draw the minimum number of lines to cover all zeroes.
A
B
Dummy
Westside
23
9
0
0
Federated
1
3
2
0
Goliath
8
5
4
0
Universal
0
0
0
2

Step 4: The minimum uncovered number is 1 (circled).





C
Slide 52
Example: Hungry Owner

Step 5: Subtract 1 from uncovered numbers. Add 1 to numbers covered
by two lines. This gives:
A

B
C
Dummy




Westside
Federated
Goliath
Universal
23
0
7
0
9
2
4
0
0
1
3
0
1
0
0
3
Slide 53
Example (1)

54
Consider three jobs to be assigned to three machines. The cost for
each combination is shown in the table below. Determine the minimal
job – machine combinations
Slide 54
Example (1)… contd.




55
Solution:
Step 1:
Create zero elements in the cost matrix (zero assignment) by
subtracting the smallest element in each row (column) from the
corresponding row (column).
Considering the rows first, the resulting cost matrix is obtained by
subtracting 5 from row 1, 10 from row 2 and 13 from row 3
Slide 55
Example (1)… contd.




56

Step 2:
Repeating the same with columns, the final cost matrix is
The italicized zero elements represent a feasible solution
Thus the optimal assignment is (1,1), (2,3) and (3,2)
The total cost is equal to (5 +12+13) = 60
Slide 56
Example (2)




57
In the above example, it was possible to obtain the feasible
assignment
But in more complicate problems, additional rules are required which
are explained in the next example.
Example 2 (Taha, 1982)
Consider four jobs to be assigned to four machines. Determine the
minimal job – machine combinations.
Slide 57
Example (2) …contd.

58
The cost for each combination is shown in the table below
Slide 58
Example (2) …contd.



59
Solution:
Step 1: Create zero elements in the cost matrix by subtracting the
smallest element in each row from the corresponding row.
Slide 59
Example (2) …contd.

Step 2: Repeating the same with columns, the final cost matrix is

Rows 1 and 3 have only one zero element
Both of these are in column 1, which means that both jobs 1 and 3
should be assigned to machine 1

60
Slide 60
Example (2) …contd.


61
As one machine can be assigned with only one job, a feasible
assignment to the zero elements is not as in the previous example
Step 3: Draw a minimum number of lines through some of the rows
and columns so that all the zeros are crossed out
Slide 61
Example (2) …contd.


62
Step 4: Select the smallest uncrossed element (which is 1 here).
Subtract it from every uncrossed element and also add it to every
element at the intersection of the two lines.
This will give the following table
Slide 62
Example (2) …contd.



63
This gives a feasible assignment (1,1), (2,3), (3,2) and (4,4)
And the total cost is 1+10+5+5 = 21.
If the optimal solution had not been obtained in the last step, then the
procedure of drawing lines has to be repeated until a feasible solution
is achieved.
Slide 63
Formulation of Traveling Salesman Problem
(TSP) as an Assignment Problem





A traveling 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.
Suppose he starts from the kth city and the last city he visited is m
Let the cost of travel from ith city to jth city be cij.
Then the objective function is
m
Minimize
n
 c
i 1 j 1
64
x
ij ij
Slide 64
Formulation of Traveling Salesman Problem (TSP) as
an Assignment Problem …contd.

subject to the constraints
n
x
i 1
ij
n
x
j 1
ij
1
for j  1, 2,...n, i  j , i  m
1
for i  1, 2,...m, i  j , i  m
xmk  1



65
xij  Procedure:
0 or 1
Solution
Solve the problem as an assignment problem using the method used
to solve the above examples
If the solutions thus found out are cyclic in nature, then that is the
final solution
Slide 65
Formulation of Traveling Salesman Problem (TSP) as
an Assignment Problem …contd.





66
Solution Procedure …contd.
If it is not cyclic, then 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
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.
Slide 66
Traveling Salesman Problem (TSP) - 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.
Cost matrix
67
Slide 67
Traveling Salesman Problem (TSP) – Example
…contd.



68
Solution:
Step 1: The optimal solution after using the Hungarian method is
shown below.
The optimal assignment is 1→ 4, 2→ 3, 3→ 2, 4→ 1 which is not
cyclic
Slide 68
Traveling Salesman Problem (TSP) – Example
…contd.





69
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 2nd row and 1st column
Do the zero assignment in the remaining matrix
Slide 69
Traveling Salesman Problem (TSP) – Example
…contd.

The resulting table is

Next optimal assignment is 1→ 4, 2→1, 3→ 2, 4→ 3 which is cyclic
Required tour is 1→ 4→3→ 2→ 1
Optimal total travel cost is 5 + 9 + 4 + 6 = 24


70
Slide 70
Download