Uploaded by ankitachan.ac

Algorithms in OR (Practical)

advertisement
Algorithm for North-West Corner Method:
Step 1: Start
Step 2: Check if the transportation problem is balanced i.e. ∑ai =∑bj. If not then any one of the following
two cases may arise:
a. ∑ai > ∑bj : we add a dummy destination (an additional column)
b. ∑ai < ∑bj : we add a dummy source (an additional row)
Step 3: Select the upper left (north-west) corner cell of the transportation matrix & assign the minimum
value of supply or demand, i.e., min(ai, bj).
Step 4: Subtract the above minimum value from a i and bj of the corresponding row and column. Here,
we may get three possibilities as given below:
a. If the supply is equal to 0, strike that row and move down to the next cell.
b. If the demand equals 0, strike that column and move right to the next cell.
c. If supply and demand are 0, then strike both row and column and move diagonally to
the next cell.
Step 5: Repeat steps 3 and 4 until all the supply and demand values are 0.
Step 6: Stop.
Algorithm for Least-Cost Method:
C[M X N] - Transportation cost matrix
M, N - no. of sources and destinations respectively
a[M],b[N] - supply, demand values respectively
TC - total cost (intially 0)
Alloc - stores the value allocated to the least cost cellINF 99999
Step 1: Start
Step 2: Check if the transportation problem is balanced i.e. ∑ai =∑bj. If yes, add a dummy row if
∑ai <∑bj else a column.
Step 3: Find the cell with the least (C[i][j]) cost. In case of multiple such cells, choose the one with
maximum allocation. In case of tie between these allocations, choose the one with the max. nonallocated supply/demand.
Step 4: Allocate this cell, the lesser of its corresponding supply-demand values.
Step 5: Eliminate the corresponding row or column. Adjust the demand or supply accordingly.Step 6:
Calculate the Total Cost :TC=TC+C[i][j]*
AllocStep 7: Set C[i][j] to
INF.
Step 8: Repeat steps 3-7 until all the supply and demand values are 0.Step 9:
Stop
Algorithm for Vogel Approximation Method:
Step 1: Start
Step 2: Check if the transportation problem is balanced i.e. ∑ai =∑bj. If not then any one of the following
two cases may arise:
a. ∑ai > ∑bj : we add a dummy destination (an additional column)
b. ∑ai < ∑bj : we add a dummy source (an additional row)
Step 3: Find the smallest and next-to-smallest costs of each row and each column in the transportation
table. Calculate the difference (called penalty) between them for every row and every column.
Step 4: Determine the row or column which has the highest penalty and find the cell that has the least
cost. Allocate as much as possible in this cell i.e. xij = min(ai, bj).
If there is a tie in the values of penalties then select a row or column that contains minimum
unit cost. If there is a tie again, select the cell where maximum allocation is possible. If there
still exits a tie between two or more cells, select a cell arbitrarily.
Step 5: Adjust the supply and demand values and eliminate the satisfied row or column.
Step 6: Repeat steps 3 to 5 until all supply and demand values are zero.
Step 7: Stop.
Algorithm for Assignment Problem:
Step 1:Start
Step 2:i).Subtract the smallest element of each row of the cost matrix from all the elements of that row.
ii).Subtract the smallest element of each column of the cost matrix from all the elements of
that column.
Step 3:Connect all the 0s in the matrix using the minimum number of horizontal and vertical lines.
Step 4:Calculate the minimum number of lines needed to strike off all the zeros in the cost matrix.
Step 5:If total number of lines=total number of rows
then,
Calculate and display the assignment from the cost table.
Else
Goto Step 5.
Endif
Step 5:Select the smallest element that is not covered by lines.
i). Subtract it from the rest of the elements that are not covered by lines.
ii).Add it to the element present in the junction of two lines.
Step 6:Goto Step 3
Step 7:Stop.
Algorithm for Simplex Problem:
Step 1: Start
Step 2: Given a LPP in standard form
Step 3: Determine the initial basic feasible solution
Step 4: Create initial simplex table
Step 5: [Test the solution for optimality]
Calculate Zj - Cj = ( CB . Xj ) - Cj
If all ( Zj - Cj ) ≥ 0
Then
Solution is optimum. Go to step 9
Else
Select key column (C K) by finding the most negative ( Zj - Cj ) value
Step 6: Calculate replacement ratio
Ratio = 𝑋𝐡/𝐢𝐾
Step 7: Select incoming vector by finding minimum ratio
Step 8: Construct new simplex table with incoming vector. Go to step 5
Step 9: Display final simplex table and optimal solution
Step 10: Stop
Download