Balaji-opt-lecture5

Water Resources Development and Management
Optimization
(Linear Programming)
CVEN 5393
Mar 14, 2011
Acknowledgements
• Dr. Yicheng Wang (Visiting
Researcher, CADSWES during Fall
2009 – early Spring 2010) for
slides from his Optimization
course during Fall 2009
• Introduction to Operations
Research by Hillier and Lieberman,
McGraw Hill
Today’s Lecture
• Simplex Method in Matrix form
– Basics of Matrix Algebra
– Revised Simplex
• Dual Simplex
• Network Flow Problems
• R-resources / demonstration
NETWORKFLOW PROBLEMS
Network Flow Models
• Shortest-Path Problem
•
•
•
•
Transportation Problem
Transshipment Problem
Maximum Flow problem
Assignment Problem
• Travelling Salesman Problem
Shortest Path Problem
• Find the shortest path between points A and B
DIJKSTRA’S ALGORITHM FOR
SHORTEST PATH
NETWORK-ALGORITHM-DEMO.PDF
Transportation and assignment Problems
The transportation problem received this name because many
of its applications involve determining how to optimally
transport goods. However, some of its important applications
actually have nothing to do with transportation.
The assignment problem involves such applications as
assigning people to tasks. It can be viewed as a special type of
transportation problem.
The Transportation Problem
Prototype Example
One of the main products of the P & T Company is canned peas. The peas
are prepared at 3 canneries : Bellingham, Washington; Eugene, Oregon;
Albert Lea, Minnesota and then shipped by truck to 4 distributing
warehouses in the western United States (Sacramento, California; Salt Lake
City, Utah; Rapid City, South Dakota; Albuquerque, New Mexico).
The Output from each cannery, the amount allocated to each warehouse, the
shipping cost per truckload for each cannery-warehouse combination are
given in the table.
Because the shipping costs are a
major expense, management
objective is to reduce them as much
as possible.
Table 8.3 shows the
constraint coefficients.
The Transportation Model
∑ Supply = ∑ Demand
Or
∑Shipments <= ∑ Supply
∑ Shipments >= ∑ Demand
The Assignment Problem
Prototype Example
An English document needs to be translated into Chinese, Japanese, German
and Russian (denoted by C, J, G, R, respectively). 4 people are assigned to
translate the document. Each of them can translate all the 4 languages, but
everyone is assigned to translate the document into one language. The time
required for each person to translate the document into each language is
shown in the following table. The objective is to use the least total time to
finish the translation.
Person 1
People Person 2
Person 3
Person 4
C
2
10
9
7
Tasks
J
G
15
13
4
14
14
16
8
11
R
4
15
13
9
The assignment problem is a special type of linear programming problem
where assignees are being assigned to perform tasks. Assigning people to
tasks is a common application of the assignment problem. However, the
assignees need not be people. They also could be machines, or vehicles, or
plants, or even time slots to be assigned tasks.
To fit the definition of an assignment problem, these kinds of applications
need to be formulated in a way that satisfy the following assumptions.
The Assignment Problem Model
A feasible solution for the
translation example is
Assignment Problem
Min.
4X11+6X12+5X13+5X14
+7X21+4X22+5X23+6X24
+4X31+7X32+6X33+4X34
+5X41+3X42+4X43+7X44
St.
X11+X12+X13+X14=1
X21+X22+X24+X24=1
X31+X32+X33+X34=1
X41+X42+X43+X44=1
X11+X21+X31+X41=1
X12+X22+X32+X42=1
X13+X23+X33+X43=1
X14+X24+X34+X44=1
HUNGARIAN ALGORITHM
HTTP://WWW.EE.OULU.FI/~MPA/
MATRENG/EEM1_2-1.HTM
Example
• We must determine how jobs should be assigned to machines
to minimize setup times, which are given below:
Job 1
Job 2
Job 3
Job 4
Machine 1
14
5
8
7
Machine 2
2
12
6
5
Machine 3
7
8
3
9
Machine 4
2
4
6
10
Hungarian Algorithm
• Step 1: (a) Find the minimum element in each
row of the cost matrix. Form a new matrix by
subtracting this cost from each row. (b) Find
the minimum cost in each column of the new
matrix, and subtract this from each column.
This is the reduced cost matrix.
Example: Step 1(a)
Job 1
Job 2
Job 3
Job 4
Machine 1
14
5
8
7
Machine 2
2
12
6
5
Machine 3
7
8
3
9
Machine 4
2
4
6
10
Row Reduction
Job 1
Job 2
Job 3
Job 4
Machine 1
9
0
3
2
Machine 2
0
10
4
3
Machine 3
4
5
0
6
Machine 4
0
2
4
8
Example: Step 1(b)
Job 1
Job 2
Job 3
Job 4
Machine 1
9
0
3
2
Machine 2
0
10
4
3
Machine 3
4
5
0
6
Machine 4
0
2
4
8
Column Reduction
Job 1
Job 2
Job 3
Job 4
Machine 1
9
0
3
0
Machine 2
0
10
4
1
Machine 3
4
5
0
4
Machine 4
0
2
4
6
Hungarian Algorithm
• Step 2: Draw the minimum number of lines
that are needed to cover all the zeros in the
reduced cost matrix. If m lines are required,
then an optimal solution is available among
the covered zeros in the matrix. Otherwise,
continue to Step 3.
How do we find
the minimum
number of lines?!
Example: Step 2
Job 1
Job 2
Job 3
Job 4
Machine 1
9
0
3
0
Machine 2
0
10
4
1
Machine 3
4
5
0
4
Machine 4
0
2
4
6
We need 3<4 lines, so
continue to Step 3
Hungarian Algorithm
• Step 3: Find the smallest nonzero element
(say, k) in the reduced cost matrix that is
uncovered by the lines. Subtract k from each
uncovered element, and add k to each
element that is covered by two lines. Return
to Step 2.
Example: Step 3
Job 1
Job 2
Job 3
Job 4
Machine 1
9
0
3
0
Machine 2
0
10
4
1
Machine 3
4
5
0
4
Machine 4
0
2
4
6
Job 1
Job 2
Job 3
Job 4
Machine 1
10
0
3
0
Machine 2
0
9
3
0
Machine 3
5
5
0
4
Machine 4
0
1
3
5
Example: Step 2 (again)
Zero Assignment
Job 1
Job 2
Job 3
Job 4
Machine 1
10
0
3
0
Machine 2
0
9
3
0
Machine 3
5
5
0
4
Machine 4
0
1
3
5
Need 4 lines, so we have the optimal
assignment and we stop
Example: Final Solution
Job 1
Machine 1
10
Machine 2
Machine 3
Machine 4
Job 2
0
0
5
9
Job 3
3
0
3
0
5
0
1
Job 4
0
4
3
5
Optimal assignment
x12  1, x33  1, x41  1, x24  1
How did we know
which 0’s to
choose?!
Transshipment Problem
Maximum Flow Problem
• Flow enters at node 2
• Flow exits at node 13
• Cij are maximum flow
Limit in each arc
Maximum Flow Problem
DIJKSTRA’S ALGORITHM FOR
SHORTEST PATH
NETWORK-PROGRAMMING.PDF