0% found this document useful (0 votes)
92 views138 pages

INDE6372 Lec12 Network

The document summarizes Dijkstra's algorithm for finding the shortest path between two nodes in a network. It provides examples to illustrate the step-by-step process of the algorithm. The algorithm works by iteratively finding and updating the shortest path from the origin node to neighboring nodes, until reaching the destination node. Each iteration adds the neighboring node with the shortest path to the set of solved nodes.

Uploaded by

rick
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views138 pages

INDE6372 Lec12 Network

The document summarizes Dijkstra's algorithm for finding the shortest path between two nodes in a network. It provides examples to illustrate the step-by-step process of the algorithm. The algorithm works by iteratively finding and updating the shortest path from the origin node to neighboring nodes, until reaching the destination node. Each iteration adds the neighboring node with the shortest path to the set of solved nodes.

Uploaded by

rick
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 138

INDE6372: Lecture 12

Network Models
Jiming Peng
Department of Industrial Engineering
University of Houston

1
.
Outline
• Basic introduction to network models/applications
– Graph, nodes, arcs
• Shortest path problem, maximum flow problem,
minimum spanning tree problem
– Algorithms and Modeling
• Applications in production control and project
management

2
.
Networks are Everywhere
• Physical Networks
– Road Networks; Railway Networks; Airline
Traffic Networks; Electrical Networks, e.g., the
power grid
• Abstract networks
– organizational charts; Precedence relationships
in projects; Social networks;
• Others?

3
.
Description
Network models provide a powerful tool for many important
optimization problems and help to design effective
algorithm that are easy to use. In this chapter we discuss the
following network models:
1. Shortest path problems
2. Maximum flow problems
3. CPM-PERT project scheduling models
4. Minimum Cost Network Flow Problems
5. Minimum spanning tree problems

4
.
Shortest path problem
• Most efficient way to go from one point to another in a
distance network or non-distance networks such as the
cost/time network from production
– To be discussed:
• Find the shortest path between two points in a network
• Dijkstra algorithm;
• Dynamic programming;
• LP formulation and extensions;
– Some application examples: Minimum production and
inventory cost in the context of dynamic programming.

5
.
8.1 Basic Definitions
A graph or network is defined by two sets of symbols:
• Nodes: A set of points or vertices(call it V) are called
nodes of a graph or network.
Nodes
1 2

• Arcs/Edges: An arc consists of an ordered pair of vertices


and represents a possible direction of motion that may
occur between vertices.
Arc
1 2

6
.
• Chain: A sequence of arcs such that every arc has
exactly one vertex in common with the previous arc is
called a chain.
Common vertex
between two arcs

1 2

7
.
• Path: A path is a chain in which the terminal node of each arc is
identical to the initial node of next arc.
For example in the figure below (1,2)-(2,3)-(4,3) is a chain but not
a path; (1,2)-(2,3)-(3,4) is a chain and a path, which represents a
way to travel from node 1 to node 4.

1 4

2 3

8
.
Dijkstra’s Shortest- Path Algorithm
• Key Points:
– In each iteration, the shortest path from the origin
to some node in the neighborhood of the “solved”
nodes is found; called neighborhood searching
method;
– There may also exist multiple shortest paths from
the origin to some nodes;
– The algorithm stops when the shortest path to the
destination is found

9
.
Dijkstra’s Shortest- Path Algorithm
• General process:
– Let S be the current set of “solved nodes” i.e, the set
of nodes whose shortest paths from the origin have
been found, N be the set of all nodes, and N – S be
the set of “unsolved nodes”
• The new “solved” node should be reachable directly
from one of the solved nodes via one direct arc (called
neighboring nodes of the current solved nodes);
• We need only to find some neighboring node with the
shortest distance in each iteration (called new solved
node).

10
.
Algorithm Scheme
• Input: the set of nodes and arcs of a network with the origin
and terminal nodes (O & T);
• Iteration 1: k=0, Sk={O},
• Iteration 2: Update k:=k+1.
– 2.1 Search the neighborhood of Sk, which includes all the nodes that are
reachable from the solved node in Sk via one arc;
– 2.2 Find all the nodes that can be reached with the minimal distance;
– 2.3 Add all these new solved nodes to Sk;
• Iteration 3: Repeat the Iteration 2 until the shortest path to the
terminal is found.

11
.
Houston Zoo

12
.
The Road System for Seervada Park
• Cars are not allowed into the park
• There is a narrow winding road system for trams and
for jeeps driven by the park rangers
– The road system is shown without curves in the next slide
– Location O is the entrance into the park
– Other letters designate the locations of the ranger stations
– The scenic wonder is at location T
– The numbers give the distance of these winding roads in
miles
• The park management wishes to determine which
route from the park entrance to station T has the
smallest total distance for the operation of the trams

13
.
The Road System for Seervada Park

7
A
D 5
2
2
4 T
1
5
O B 7
3
4 1
E
4
C

14
.
Dijkstra’s Algorithm: Example
• O-th iteration: Shortest distance from node O to Node
O. S = {O}.
• I-st iteration:
– Step 1: Neighboring Nodes = {A, B, C}
– Step 2: Find the shortest path from O to neighboring
nodes that traverse through the current set of solved
nodes S. Min {2,4,5} = 2 (corresponding to node A).
– Step 3: Update the set of solved nodes: S = {O, A}

15
.
Dijkstra’s Algorithm: Example

A
Solved Nodes
2

O 5 B

4
C

16
.
Dijkstra’s Algorithm: Example
• 2nd Iteration:
– Step 1: Old S={O,A}. Neighboring nodes = {B, C, D}
– Step 2: Min (Min (2 + 2, 5), 4, (2 + 7)) = 4.
– Step 3: Shortest paths to both B and C have been found.
Update S = {O, A, B, C}

Set of Solved Nodes 7 D
A
(2) 2
B
(0) 5
C
O
4
17
.
Dijkstra’s Algorithm: Example

• 3rd Iteration:
– Step 1: Old S={O,A,B,C}. Neighboring nodes = {D, E}. Only
AD, BD, BE, and CE
– Step 2: Min(Min(2 + 7, 4+4), Min(4 + 3, 4+4)) = 7
– Step 3: The shortest path to E has been found.
Update S = {O, A, B, C, E}
Solved Nodes (2) A D
7

4
O (4) B
3 E

C 4
(4)
18
.
Dijkstra’s Algorithm: Example
• Iteration 4
– Step 1: Include (only) Nodes D and T. Include only arcs AD,
BD, ED, & ET
– Step 2: Min((min(2+7, 4+4, 7+1), (7+7))) = 8
– Step 3: Shortest path from node O to Node D has been
found. Update S = {O, A, B, C, D, E}

(2) A 7

D
O (4) B 4

1
Solved nodes E T
(4) C (7)

7
19
.
Dijkstra’s Algorithm for Shortest Path on a
Network with Positive Arc Lengths
• Iteration 5
– Step 1: Include only node T and include arcs DT and ET
– Step 2: Min(8+5, 7+7) = 13 (no other competing nodes)
– Step 3: The shortest path from the origin to T, the
destination, has been found, with a distance of 13

A (2)
Solved nodes
D
(8)
B (4) 5
O T
(0)
E 7
C (4) (7)
20
.
Dijkstra’s Algorithm for Shortest Path on a
Network with Positive Arc Lengths
• Final Solution
• Incidentally, we have also found the nth nearest
node from the origin sequentially

(2)
A
(8)
2
2 D 5

O 4 T
B
(0)
(4) 1 (13)
4 3

C E
(7)
(4)

21
.
Shortest-Path Algorithm Applied to Seervada
Park Problem
n Solved Nodes Closest Total Nth Minimum Last
Directly Connected Connected Distance Nearest Distance Connection
to Unsolved Nodes Unsolved Involved Node
Node
1 O A 2 A 2 OA
2, 3 O C 4 C 4 OC
A B 2+2=4 B 4 AB
4 A D 2+7=9
B E 4+3=7 E 7 BE
C E 4+4=8
5 A D 2+7=9
B D 4+4=8 D 8 BD
E D 7+1=8 D 8 ED
6 D T 8+5=13 T 13 DT
E T 7+7=14
22
.
The Road System for Seervada Park

7
A
D 5
2
2
4 T
1
5
O B 7
3
4 1
E
4
C

23
.
Dynamic Programming: I

24
.
Dynamic Programming: II
The formula for distance in stage i+1
d(s,t, i+1)=minv [ d(s,v,i)+d(v,t)]
Stage 2: Shortest distance of paths with at most 2
arcs in the path

[0 2 4 4 9 8 ∞]

Stage 3: paths with at most 3 arcs

[0 2 4 4 8 7 14 ]

25
.
Dynamic Programming: III
The formula for distance in stage i+1
d(s,t, i+1)=minv [ d(s,v,i)+d(v,t)]

Final Stage 4: paths with at most 4 arcs

[0 2 4 4 8 7 13 ]

26
.
LP Formulation
• Consider the following shortest path problem
from node 1 to node 6
• : denotes a link
3
2 4 2
4
x3
x6
x1 2 6
1
x4
3 2

x2 3
3 5 x7

x5

27 • Send one unit of flow from node 1 to node 6


.
LP Formulation
• Use flow conservation constraints
– (Outflow from any node – inflow to that node) = 0
– For origin = 1
– For destination = -1
– For all other nodes = 0 (Flow conservation law);
– Let xj denote the flow along link j, j = 1, 2, .., 7, xj =
0 or 1
– It turns out that this 0-1 constraints can be
replaced by 0  xj  1, which can in turn be
replaced by xj  0

28
.
LP Formulation of the Shortest Path Problem

• Min 4x1 + 3x2 + 3x3 + 2x4 + 3x5 + 2x6 + 2x7


• S.t. x1 + x2 =1
• -x1 + x 3 + x4 =0
• - x2 + x5 =0
• - x3 + x6 =0
• - x4 – x 5 + x7 = 0
• - x6 – x7 = -1
• Xj  0, j = 1, 2, …, 7 (xj integers)
• Extra constraints can be added.
29
.
Shortest path in undirected graph
• Dijkestra’s algorithm works well for
undirected graph
• The LP model needs change as well:
– We can replace the undirected arc between i and j
by two directed arcs (i,j) and (j,i) and define a
binary variable x(i,j) associated with arc (i,j);
– Then construct the constraints and derive the LP
accordingly.

30
.
An Example of Car Replacement
• Let’s assume that we have just purchased a new car for
$12,000 at time 0. The cost of maintaining the car during a year
depends on the age of the car at the beginning of the year, as
given in the table below. What is the best plan for five years.

31
.
Constructing the graph

+9

32
.
Final Solution

From the figure below we can see that both path 1-3-5-6 and
1-2-4-6 will give us the shortest path with a value of 31.
44

31 31

21 21

12
12

1 7
2 7
3 7
4 7
5 7
6
12 12
21

33
.
Dynamic Lot Sizing
• K periods of demand for a product. The demand is dj in period
j for j = 1,…,K.
• Cost of producing pj units in period j:
– aj + bj pj, bj the number of units to be produced in period j;
– hj: unit cost of carrying inventory from period j
• Question: what is the minimum cost way of meeting
demand?
– Tradeoff: more production per period leads to reduced
production costs but higher inventory costs.

34
.
Dynamic Lot Sizing: II
D
0

1 2 3 4 K-1 K
-d1 -d2 -d3 -d4 -dK-1 -dK
Flow on arc (0, j): amount produced in period j
Flow on arc (j, j+1): amount carried in inventory from period j

35
. 35
Dynamic Lot Sizing: III
Theorem: There is production in period j or there is inventory carried
over from period j-1, but not both.
Suppose now that there is inventory from period j-1 and production in
period j. Let period i be the last period in which there was production
prior to period j, e.g., j = 7 and i = 4.
Claim: There is inventory stored in periods i, i+1, …, j-1

D
0

4 5 6 7 K-1 K
-d4 -d5 -d6 -d7 -dK-1 -dK
36
. 36
Corollary. Production in period i satisfies demands exactly in
periods i, i+1, …, j-1 for some j.

Consider 2 consecutive production periods i and j. Then


production in period i must meet demands in i+1 to j-1.

0 D

i i+1 i+2 j-1 j


-di -di+1 -di+2 -dj-1 -dj

Let cij be the (total) cost of this flow.


cij = ai + bi(di + di+1 + … + dj-1)
+ hi(di+1 + di+2 + … + dj-1)
37 + hi+1(di+2 + di+3. + … + dj-1) + … hj-2(dj-1)
Let cij be the cost of producing in period i to meet demands
in periods i, i+1, …, j-1 (include cost of inventory). Create
a graph on nodes 1 to K+1, where the cost of (i,j) is cij.

1 2 3 4 K K+1

Each path from 1 to K+1 gives a production and


inventory schedule. The cost of the path is the cost of
the schedule.

1 6 8 11 K+1

Interpretation: produce in periods 1, 6, 8 and 11.

Conclusion: The minimum cost path from node 1 to node


38
K+1 gives the minimum .cost lot-sizing solution.
From Previous Lecture Note
• Basic introduction to network models
– Shortest-path problem
– Dijkstra’s algorithm and dynamic programming
– LO modeling and two application examples
• Today’s topics:
– Maximum flow problem
– Residual network, and augmenting path algorithm
– One application example

39
.
Maximum Flow Problem
• Maximum flow problem description
– All flow through a directed and connected network
originates at one node (source) and terminates at one
another node (sink)
– All the remaining nodes are transshipment nodes
– Flow through an arc is allowed only in the direction
indicated by the arrowhead, where the maximum amount
of flow is given by the capacity of that arc. At the source,
all arcs point away from the node. At the sink, all arcs
point into the node
– The objective is to maximize the total amount of flow from
the source to the sink (measured as the amount leaving
the source or the amount entering the sink)
40
.
Max. Flow Problem: Applications
– Maximize the flow through a company’s distribution
network from its factories to its customers;
– Maximize the flow through a company’s supply
network from its vendors to its factories;
– Maximize the flow of oil through a system of
pipelines: Shipping origin oil to downstream refinery;
– Maximize the flow of water through a system of
aqueducts: Flood control;
– Maximize the flow of vehicles through a
transportation network: Evacuation.

41
.
Maximum Flow Algorithm
• The residual network shows the remaining arc
capacities for assigning additional flows after some
flows have been assigned to the arcs, and the flow
capacity in the opposite direction
The residual capacity for assigning some flow from node B to node O

(5,7) or (0,2)
O B

(0,5)
The residual network/capacity, original capacity constraint (0,7)

42
.
Maximum Flow Algorithm
– An augmenting path is a directed path from the source to
the sink in the residual network such that every arc on this
path has strictly positive residual capacity
– The capacity of the augmenting path is the minimum of
the arc capacities on the path
– Example: C(1234)=min(5,3,6)=3.
– 1 5 2 3 3 6 4
• Basic ideas: Repeatedly select some augmenting path and
add a flow equal the capacity of that path in the original
network. This process continues until there are no more
augmenting paths, so that the flow from the source to the
sink cannot be increased further.

43
.
Maximum Flow Algorithm
• The Augmenting Path Algorithm
– Assume that the arc capacities are either integers or
rational numbers
• 1. identify an augmenting path by finding some directed
path with the maximal capacity from the source to the
sink in the residual network. If such a path has a zero
capacity, then the net flows already assigned is the
maximal flow from source to sink.
• 2. To find some augmenting path with a capacity c*, we
can first remove all the arcs whose capacity is below c*.
Then we can find such a path in the reduced residual
network.

44
.
Maximum Flow Example
• Question: During the peak season, the manager of
the Seervada park needs to determine how to route
the tram trips from the entrance (O) to the scenic (T)
to maximize the number of trips per day.
– Each tram will follow the same outgoing/return route so
the analysis focuses on outgoing trips only;
– To avoid unduly disturbing the ecology and wildlife of the
region, strict upper limits have been imposed on the
number of outgoing trips allowed per day in the outbound
direction on each individual road;
– For each road the direction of travel for outgoing trips is
indicated by an arrow in the next slide. The number at the
base of the arrow gives the upper limit on the number of
outgoing trips allowed per day.

45
.
Maximum Flow Example
• Consider the problem of sending as many units from node O
to node T for the following network (current flow, capacity):
(0,3)
A
D (0,9)
(0,5)
(0,1)
(0,4) T
(0,1)
(0,7)
B (0,6)
O
(0,5)
(0,4) (0,2)
(0,4) E

46
.
Find Augmenting Path with Max. Capacity
• Iteration 0: Delete all the arcs whose capacity is below some
threshold (i.e., 5), and then find an augmenting path from O
to T in the reduced network (OBET).
A
D (0,9)
(0,5)

(0,7)
B (0,6)
O
(0,5)

47
.
Maximum Flow Example
• Iteration 1: The augmenting path with the maximal capacity in the residual
network is: OBET, which has a capacity of min{7, 5, 6} = 5. By assigning the
flow of 5 to this path, the resulting network is shown below.
(0,3)
A
D (0,9)
(0,5)
(0,1)
(0,4) T
(0,1)
(5,7)
B (5,6)
O
(5,5)
(0,4) (0,2)
(0,4) E

48
.
Max. Flow Example: Residual Network
• Iteration 1’: Construct the residual network after iteration 1 and find the
augmenting path with the max capacity (4) is O-C-E-B-D-T (shown in next slide)!
Only the residual arc EB is plotted.
(0,3)
A
D (0,9)
(0,5)
(0,1)
(0,4) T
(0,1)
(0,2)
B (0,1)
O
(0,5) (0,5)
(0,4) (0,2) (0,0)
(0,4) E

49
.
Augmenting Path in Residual Network
• Iteration 1’’: Find the augmenting path with maximal capacity in the residual
network. First we remove all the arcs whose capacity is below 4, and the
augmenting path with max. capacity is O-->C-->E-->B-->D-->T.

A
D (0,9)
(0,5)

(0,4) T

O B
(0,5) (0,5)
(0,4)
(0,4) E

50
.
Max. Flow Example
• Iteration 2: Assign a flow of 4 to the augmenting
path OCEB->D->T. The resulting network is
(0,3)
A
D (4,9)
(0,5)
(0,1)
(4,4) T
(0,1)
(5,7)
B (5,6)
O
(1,5)
(4,4) (0,2)
(4,4) E

51
.
Max. Flow Example: Residual Network
• Iteration 2’: Construct the residual network after iteration 2
and find the augmenting path OAD-->T with a capacity 3.
(0,3)
A
D (0,5)
(0,5)
(0,1)
(0,0) T
(0,4) (0,1)
(0,2)
B (0,1)
O
(0,5) (0,1)
(0,4)
(0,2)
(0,0) E
(0,4) (0,0)

C
(0,4)
52
.
Augmenting Path in Residual Network
• Iteration 2’’: Remove all the arcs whose capacity is below 3 and then
find the augmenting path with max. capacity in the reduced residual
network ( OADT).
(0,3)
A
D (0,5)
(0,5)

T
(0,4)
O B
(0,5)
(0,4)
(0,4) E
(0,4)
C

53
.
Max. Flow Example
• Iteration 3: Assign a flow of 3 to the augmenting
path OCEB->D->T. The resulting network is
(3,3)
A
D (7,9)
(3,5)
(0,1)
(4,4) T
(0,1)
(5,7)
B (5,6)
O
(1,5)
(4,4) (0,2)
(4,4) E

54
.
Max. Flow Example
• Iteration 3’: Construct the residual network after iteration 3
and find an augmenting path OBET with capacity 1.
(0,0)
A
(0,2) (0,3) D (0,2)
(0,1)
(0,2) (0,0) T

(0,2) (0,4) (0,1)


B (0,1)
O
(0,5) (0,1)
(0,4)
(0,0) (0,2)
(0,0) E
(0,4)
C
(0,4)
55
.
Max. Flow Example
• Iteration 4: Assign a flow of 1 to the augmenting
path OBET. The resulting network is
(3,3)
A
D (7,9)
(3,5)
(0,1)
(4,4) T
(0,1)
(6,7)
B (6,6)
O
(2,5)
(4,4) (0,2)
(4,4) E

56
.
Max. Flow Example: Residual Network
• Iteration 4’: Construct the residual network after iteration 4
and find an augmenting path OBEDT with capacity 1.
(0,0)
A
D (0,2)
(3,5)
(0,1)
(0,0) T
(0,1)
(0,1)
B (0,0)
O
(0,3)
(0,0) (0,2)
(0,0) E

57
.
Max. Flow Example
• Iteration 5: Assign a flow of 1 to the augmenting
path OBEDT. The resulting network is
(3,3)
A
D (8,9)
(3,5)
(0,1)
(4,4) T
(1,1)
(7,7)
B (6,6)
O
(3,5)
(4,4) (0,2)
(4,4) E

58
.
Max. Flow Example
• Iteration 5’: Construct the residual network after iteration 5.
Can we find an augmenting path from O to T?
(0,0)
A
D (0,1)
(0,2)
(0,1)
(0,0) T
(0,0)
(0,0)
B (0,0)
O
(0,2)
(0,0) (0,2)
(0,0) E

59
.
Max. Flow Example
• Iteration 6: The solution constructed in Iteration 5 is
optimal!
(3,3)
A
D (8,9)
(3,5)
(0,1)
(4,4) T
(1,1)
(7,7)
B (6,6)
O
(3,5)
(4,4) (0,2)
(4,4) E

60
.
Verifying Optimality of the Solution
Verification of the final solution: Use the residual
network or compare with the capacity of the cut.
(3,3)
A
D (8,9)
(3,5)
(0,1)
(4,4) T
(1,1)
(7,7)
B (6,6)
O
(3,5)
(4,4) (0,2)
(4,4) E

C A Cut: (D,T) (O,A,B,C,E)


The flows on the arcs across
61 the cut reach their limits
.
Alternative Optimal Maximum Flow
Another optimal solution using the cycle O->A->B->C->O
In the residual network of the final solution in iteration 5.
But the min-cut remains the same thus optimal!
(3,3)
A
D (8,9)
(4,5)
(1,1)
(4,4) T
(1,1)
(7,7)
B (6,6)
O
(3,5)
(3,4) (1,2)
(4,4) E

C A Cut: (D,T) (O,A,B,C,E)


The flows on the arcs across
62 the cut reach their limits
.
Optimality in Maximum Flow Problem
• The Max-flow/ min-cut (primal-dual) theorem:
– A cut is defined as any set of directed arcs containing at least
one arc from every directed path from the source to the sink
– For any particular cut, the cut value is the sum of the arc
capacities of the arcs of the cut
• Therefore, for any feasible flow, the total amount of flow
shipped from the source to the sink node is less than or
equal the cut value!
• Theorem: For any network with a single source and
sink, the maximum feasible flow from the source to
the sink equals the minimum cut value for all cuts of
the network.

63
.
LO for Maximum Flow Problems
Many situations can be modeled by a network in which the arcs
may be thought of as having a capacity that limits the quantity of
a product that may be shipped through the arc. In these
situations, it is often desired to transport the maximum amount
of flow from a starting point (called the source) to a terminal
point (called the sink). Such problems are called maximum flow
problems.

64
.
An example for maximum flow problem
Sunco Oil wants to ship the maximum possible amount of oil
(per hour) via pipeline from node so to node si as shown in the
figure below.
Arc Capacity
a0 (so,1) 2
(1)3 (so,2) 3
so 1 2 si (1,2) 3
(2)2 (1)3 (2)2
(1,3) 4
(1)4 3 (1)1
(3,si) 1
(2,si) 2
The various arcs represent pipelines of different diameters. The
maximum number of barrels of oil that can be pumped through
each arc is shown in the table above (also called arc capacity).
65
.
Maximum Flow Problem: Modeling

For reasons that will become clear soon, an artificial arc called a0
is added from the sink to the source. To formulate an LP about
this problem first we should determine the decision variable.
Xij = Millions of barrels of oil per day that will pass through arc(i,j)
of pipeline.
For a flow to be feasible it needs to satisfy the capacity limit:
0 <= flow through each arc <= arc capacity
And the balance constraint:
Flow into node i = Flow out from node i

66
.
Maximum Flow Problem: Modeling
Let X0 be the total amount of oil entering the sink. It should equal the
total flow leaving the source node. Sunco’s goal is to maximize X0.
Max Z= X0
S.t. Xso,1≤2, Xso,2≤3; (Arc Capacity constraints)
X12≤3 , X13≤4;
X2,si≤2, X3,si≤1;
X0=Xso,1+Xso,2 (Node so flow constraints)
Xso,1=X12+X13 (Node 1 flow constraints)
Xso,2+X12=X2,si (Node 2 flow constraints)
X13=X3,si (Node 3 flow constraints)
X3,si+X2,si=X0 (Node si flow constraints) Xij≥0.
One optimal solution is: Z=3, Xso,1=2, X13=1, X12=1, Xso,2=1, X3,si=1, X2,si=2, Xo=3.

67
.
8.6 Minimum Spanning Tree Problems
Suppose that each arc (i,j) in a network has a length associated
with it and that arc (i,j) represents a way of connecting node i to
node j. For example, if each node in a network represents a
computer in a computer network, arc(i,j) might represent an
underground cable that connects computer i to computer j. In
many applications, we want to determine the set of arcs in a
network that connect all nodes such that the sum of the length
of the arcs is minimized. Clearly, such a group of arcs contain no
loop.

68
.
Minimum Spanning Tree Problem
• An undirected and connected network is being considered,
where the weight of each link is given (distance, cost, time,
etc.).
• Both the shortest path and minimum spanning tree problems
involve choosing a set of links that have the shortest total
length among all sets of links that satisfy a certain property
– For the shortest-path problem this property is that the chosen links
must provide a path between the origin and the destination
– For the minimum spanning tree problem, the required property is that
the chosen links must provide a path between each pair of nodes

69
.
Some Applications
• Design of telecommunication networks (fiber-optic networks,
computer networks, leased-line telephone networks, cable
television networks, etc.)
• Design of lightly used transportation network to minimize the
total cost of providing the links (rail lines, roads, etc.)
• Design of a network of high-voltage electrical transmission
lines
• Design of a network of wiring on electrical equipment (e.g., a
digital computer system) to minimize the total length of the
wire
• Design of a network of pipelines to connect a number of
locations

70
.
For a network with n nodes, a spanning tree is a group
of n-1 arcs that connects all nodes of the network and
contains no loops.

12
1 2

(1,2)-(2,3)-(3,1) is a loop
4
7
(1,3)-(2,3) is the minimum spanning tree
3

71
.
Minimum Spanning Tree Problem Description

• You are given the nodes of the network but not the links.
Instead you are given the potential links and the positive
length for each if it is inserted into the network (alternative
measures for length of a link include distance, cost, and time)
• You wish to design the network by inserting enough links to
satisfy the requirement that there be a path between every
pair of nodes
• The objective is to satisfy this requirement in a way that
minimizes the total length of links inserted into the network

72
.
Minimum Spanning Tree Algorithm
• Greedy Algorithm
– 1. Select any node arbitrarily, and then connect (i.e., add a
link) to the nearest distinct node
– 2. Identify the unconnected node that is closest to a
connected node, and then connect these two nodes (i.e.,
add a link between them). Repeat the step until all nodes
have been connected
– 3. Tie breaking: Ties for the nearest distinct node (step 1)
or the closest unconnected node (step 2) may be broken
arbitrarily, and the algorithm will still yield an optimal
solution.
• Fastest way of executing algorithm manually is the
graphical approach illustrated next
73
.
Example: The State University campus has five computers. The
distances between computers are given in the figure below.
What is the minimum length of cable required to interconnect
the computers? Note that if two computers are not connected
this is because of underground rock formations.

1 1
2
2
2
6
5 4
2 3
4
4
5 3

74
.
Solution: We want to find the minimum spanning tree.
• Iteration 1: Following the MST algorithm discussed before, we
arbitrarily choose node 1 to begin. The closest node is node 2.
Now C={1,2}, Ć={3,4,5}, and arc(1,2) will be in the minimum
spanning tree.

1 1
2
2
2
6
5 4
2 3
4
4
5 3
75
.
• Iteration 2: Node 5 is closest to C. since node 5 is
two blocks from node 1 and node 2, we may include
either arc(2,5) or arc(1,5) in the minimum spanning
tree. We arbitrarily choose to include arc(2,5). Then
C={1,2,5} and Ć={3,4}.

1 1
2
2
2
6
5 4
2 3
4
4
5 3
76
.
• Iteration 3: Since node 3 is two blocks from node 5,
we may include arc(5,3) in the minimum spanning tree.
Now C={1,2,5,3} and Ć={4}.

1 1
2
2
2
6
5 4
2 3
4
4
5 3
77
.
• Iteration 4: Node 5 is the closest node to node 4.
Thus, we add arc(5,4) to the minimum spanning tree.
We now have a minimum spanning tree consisting of
arcs(1,2), (2,5), (5,3), and (5,4). The length of the
minimum spanning tree is 1+2+2+4=9 blocks.

1 1
2
2
2
6
5 4
2 3
4
4
5 3
78
.
Traveling Salesman Problem (TSP)
Joe Sate lives in Gary, Indiana. He owns insurance agencies
in Gary, Fort Wayne, Evanville, Terre Haute and South
Bend. Each December, he visits all the agencies. Find a
travel plan to minimize the total distance for Joe.
Gary Fort Evansville Terre South
Wayne Haute Bend
Gary 0 132 217 164 58
F-W 132 0 290 210 79
Evan. 217 290 0 113 303
T-H 164 201 113 0 196
S-B 58 79 303 196 0

79
.
An Integer Programming Formulation of the TSP

• cij = distance from city i to city j


• xij = 1 if tour visits i then j, and 0 otherwise (binary)
• ti = artificial variables we need to solve for
• The last set of constraints is added to eliminate the subtours.

80
.
Eliminating Subtours in a Network

• The set of constraints to eliminate the subtours.


• Example of subtours: v1v2v1; v3v4v5v3;
• A solution include some subtour may satisfy the
assignment constraints, but will violate the subtour
elimination constraints.
• Let consider a subtour with arcs v2v3… vk  v2.
• Summing up both sides of the elimination constraints for
all xij in the subtour, we get n(k-1)≤(n-1)(k-1). This is
impossible.

81
.
A Heuristics for the TSP: I
 
To apply the nearest-neighbor heuristic (NNH), we begin at any city
and then “visit” the nearest city. Then we go to the unvisited city
closest to the city we have most recently visited. We continue in this
fashion until we obtain a spanning tree

58 S
G
B
164
217 132 303 196
79 T
113 H
E
F 201
290 W

82
.
A Heuristics for the TSP: II
 
Then we can construct a tour based on the spanning tree, i.e.,
adding the tour from Evansille to Fort Wayne. Note that depending
on the obtained spanning tree, some modification is needed in the
construction of the tour.

58 S
G
B
164
217 132 303 196
79 T
113 H
E
F 201
290 W

83
.
Constructing a TSP from a Spanning Tree
 
How to construct a TSP tour based on the spanning tree?

A B

D O C

E F
In the above figure, the spanning tree consists of arcs from
O to other nodes, and the TSP tour is represented by the red
arcs. One can show that the constructed tour is a very good
approximate solution.
84
.
Shortest-Path with Time Constraint:
The idea to obtain a good solution to some hard problem via solving
another easy problem or a series of easy problems has been widely
used. Consider the shortest-path problem with time constraint:
min Ʃ dijxij
s.t. X is a path from S to T;
Ʃ tijxij ≤ t0
For fixed parameter y, the new Lagrangian problem:
F(y)= min Ʃ dijxij +y(Ʃ tijxij –t0)= Ʃ (dij+ytij)xij –yt0
s.t. X is a path from S to T;
can be solved easily.

85
.
Lagrangian Method
• Observations:
– For fixed y, F(y) can be computed by solving some
shortest path problem;
– Let X*(y) be the optimal solution for a given y, then
(-t0+Ʃ tijx*(y)ij ) is decreasing in terms of y;
We need to find y such that Ʃ tijx*(y)ij ≤t0.
• Thus we can develop a search algorithm to find a
suitable value of y* such that X(y*) is the optimal
solution to the original problem.
86 Adopted from the lecture notes by Thomson
. Learning
From the previous lecture
• Maximum flow problem
– Residual network and capacity
– Augmenting path
• Minimum spanning tree: Greedy algorithm
• Today’s topic
– Critical path
– Pert

87
.
8.4 CPM and PERT
Network models can be used as an aid in the scheduling of large
complex projects that consist of many activities.

CPM: If the duration of each activity is known with certainty, the


Critical Path Method (CPM) can be used to determine the length
of time required to complete a project.

PERT: If the duration of activities is not known with certainty,


the Program Evaluation and Review Technique (PERT) can be
used to estimate the probability that the project will be
completed by a given deadline.

88
.
CPM and PERT: Application Examples
• Scheduling construction projects such as office
buildings, highways and swimming pools
• Developing countdown and “hold” procedure for the
launching of space crafts
• Installing new computer systems
• Designing and marketing new products
• Completing corporate mergers
• Building ships

89
.
Project Planning, Scheduling and
Control
• Planning: organized approach to accomplish the goal
of minimizing elapsed time of project
– defines objectives and tasks; represents tasks interactions
on a network; estimates time and resources
• Scheduling: a time-phased commitment of resources
– identifies critical tasks which, if delayed, will delay the
project’s completion time.
• Control: means of monitoring and revising the
progress of a project

90
.
Network Representation
• Tasks (or activities) are represented by arcs (AOA)
– Each task has a duration denoted by tj
– Node 0 represents the “start” and node n denotes the “finish” of the
project
– In some special cases, activities can be represented by nodes (AON)
• Precedence relations are shown by “arcs”
– specify what other tasks must be completed before the task in
question can begin.
• A path is a sequence of linked tasks going from beginning to
end
• Critical path is the longest path

91
.
Constructing the AOA Network: I
To apply CPM/PERT, we need a list of activities from the project:
The project is considered to be completed when all
activities have been completed.
For each activity there is a set of activities (called the
predecessors of the activity) that must be completed
before the activity begins.
A project network is used to represent the precedence
relationships between activities.
We consider the AOA network where the nodes are used to
represent completion of a set of activities.
A B
1 2 3
Activity A must be completed before activity B starts
92
.
Constructing the AOA Network: II
Rules in constructing an AOA type of project diagram:
• Node 1 represents the start of the project. An arc should lead from node
1 to represent each activity that has no predecessors;
• A node (called the finish node) representing the completion
of the project should be included in the network;
• Number the nodes in the network so that the completion
node of an activity has a larger number than the beginning
node of the activity;
• An activity should not be represented by more than one arc;
• Two nodes can be connected by at most one arc.
To avoid violating rules 4 and 5, sometimes we need to introduce
a dummy activity that takes zero time.
93
.
An example for CPM
Widgetco is about to introduce a new product. A list of activities
and the precedence relationships are given in the table below.
Draw a project diagram for this project.

Activity Predecessors Duration(days)


A:train workers - 6
B:purchase raw materials - 9
C:produce product 1 A, B 8
D:produce product 2 A, B 7
E:test product 2 D 10
F:assemble products 1&2 C, E 12

94
.
Project Diagram for Widgetco

3 6
A6

B9 2

Node 1 = starting node


Node 6 = finish node

95
.
Project Diagram for Widgetco

3 6
A6

1 Dummy

B9 2

Adding a dummy arc from node 2 to node 3

96
.
Project Diagram for Widgetco
C8
3 5 6
A6
D7
1 Dummy

B9 2 4

Add two arcs for tasks C and D, and


the completion nodes for these two tasks

97
.
Project Diagram for Widgetco
C8
3 5 6
A6
D7
1 Dummy
E 10
B9 2 4

Add task E and make sure


the nodes are numbered correctly

98
.
Project Diagram for Widgetco
C8 F 12
3 5 6
A6
D7
1 Dummy
E 10
B9 2 4

Add the last task F, the network is complete now.

99
.
Formulating the CPM Problem

Input Data: An AOA network consisting of precedence


relationships and durations

Decision Variable:
ESi : Earliest starting times for each of the tasks

Objective:
Minimize the elapsed time of the project
where node n is the last node in the graph
100
.
Constraints

• If ESj is the earliest starting time of a task j, ESi is


the earliest starting time of an immediate
predecessor and ti is the duration of the
immediate predecessor, then we have
ESj  ESi + ti for every arc (i, j)

101
.
Critical Path Definitions
• Earliest Start Time (ES): the earliest time a task can feasibly
start
• Earliest Finish Time (EF): the earliest time a task can feasibly
end: EFj=ESj+tj
• The above definitions are used in the Forward Pass while the
following definitions are used in the Backward Pass.
• Latest Start Time (LS): the latest time a task can feasibly start,
without delaying the project at all.
• Latest Finish Time (LF): the latest time a task can feasibly end,
without delaying the project at all

102
.
Critical Path Method
• Forward Pass: a process to find the least completion time
of the project.
– Go through the jobs in order
– Start each job at the earliest time while satisfying the
precedence constraints
– It finds the earliest start and finish times
– EFi = ESi + ti
– Earliest start time for an activity leaving a particular node
is equal to the largest of the earliest finish times for all
activities entering the node.

103
.
CPM: The Backward Pass
• Fix the finishing time and look at tasks in reverse order to
identify the critical path and critical activities;
• Lay out tasks one at a time on the Gantt chart starting at
the finish and working backwards to the start;
• Start the task at its latest starting time
– LSi = LFi - ti
– Latest finish time for an activity entering a particular node
is equal to the smallest of the latest start times for all
activities leaving the node.

104
.
CPM and Critical Path

• Theorem: The minimum length of the schedule is the


length of the longest path in the AOA network.
The longest path is called the critical path
• Another example of the duality theorem.
Look for tasks whose earliest start time and latest start time are
the same. These tasks are critical, and are on a critical path.

105
.
CPM and Critical Path

• Critical path are found by identifying those tasks where


ES=LS (equivalently, EF=LF)
• No flexibility in scheduling tasks on the critical path
• The makespan of the critical path equals the LF of the
final task
• Slack is the difference between LS and ES, or LF and EF.
An activity with a zero slack is on the critical path

106
.
An example for CPM
Widgetco is about to introduce a new product. A list of
activities and the precedence relationships are given in the
table below. Draw a project diagram for this project.

Activity Predecessors Duration(days)


A:train workers - 6
B:purchase raw materials - 9
C:produce product 1 A, B 8
D:produce product 2 A, B 7
E:test product 2 D 10
F:assemble products 1&2 C, E 12
107
.
Project Diagram for Widgetco
C8 F 12
3 5 6
A6
D7
1 Dummy
E 10
B9 2 4

Node 1 = starting node


Node 6 = finish node

108
.
Project Diagram for Widgetco Forward Pass (ES,EF)
(9,17) (26,38)
C8 F 12
(0,6) 3 5 6
A6
D7
1 Dummy
E 10
(16,26)
B9 (9,16)
2 4
(0,9)
Node 1 = starting node
Node 6 = finish node

109
.
Project Diagram for Widgetco Backward Pass (LS,LF)
LS:(18,26) (26,38)
ES: (9,17) F 12
(3,9) 3 C8 5 6
A (0, 6)
D7
1 Dummy
E 10
(16,26)
B9 (9,16)
2 4
(0,9)
Node 1 = starting node
Node 6 = finish node

110
.
For Widgetco example ES(i)’s and LS(i)’s are as follows:

Activity ES(i) LS(i) Slack


A 0 3 3
B 0 0 0
C 9 18 9
D 9 9 0
E 16 16 0
F 26 26 0
111
.
Critical path
• An activity with a slack of zero is a critical activity
• A path from node 1 to the finish node that consists
entirely of critical activities is called a critical path.

For Widgetco example B-D-E-F is a critical path.

The Makespan is equal to 38.

112
.
Critical Path for the Widgetco Project
C8 F 12
3 5 6
A6
D7
1 Dummy
E 10
B9 2 4

Critical Path: BDEF

113
.
Using LP to find a critical path

Decision variable:
Xj: the time that the event corresponding to node j occurs
Since our goal is to minimize the time required to complete the
project, we use an objective function of:

Z=XF-X1

Note that for each activity (i,j), before j occurs , i must occur and
activity (i,j) must be completed.

114
.
Project Diagram for Widgetco
C8 F 12
x3 x5 x6
A6
D7
x1 Dummy
E 10
B9 x2 x4

Node 1 = starting node


Node 6 = finish node

115
.
Min Z =X6-X1
S.T. X3>=X1+6 (Arc (1,3) constraint)
X2>=X1+9 (Arc (1,2) constraint)
X5>=X3+8 (Arc (3,5) constraint)
X4>=X3+7 (Arc (3,4) constraint)
X5>=X4+10 (Arc (4,5) constraint)
X6>=X5+12 (Arc (5,6) constraint)
X3>=X2 (Arc (2,3) constraint)

The optimal solution: Z=38, X1=0, X2=9, X3=9, X4=16, X5=26,


X6=38

116
.
Outline
• From previous lecture
– Stages in project management: Planning,
scheduling and control;
– AOA network presentation: Rules in construction;
– Finding the critical path (CPM) and LO model
• Today’s topic:
– One more CPM example;
– Dealing with uncertain durations: PERT

117
.
CPM: Example
Tasks Intermediate Duration
Predecessors
A -- 3
B -- 3
C -- 1
D A,B 3
E A,B 3
F B,C 2
G D,E 4
H E 3
118
.
Constructing the AOA Network: I

3
(A,3)
(B,3) F
1 2

(C,1)
4
•First add the start node 1, and the finish node (F).
Then add tasks A,B,C and their corresponding
completion nodes.
119
.
Constructing the AOA Network: II

3
(A,3)
F
(B,3)
1 2

(C,1)
4
•Add two dummy arcs from node 3 to node 2, node 3
to node 4 (as required for tasks D,E,F).

120
.
Constructing the AOA Network: III
(D,3) 5
3
(G,4)
(A,3) (E,3)
(B,3) 6 7
1 2

(C,1)
4
•Add one dummy arc from node 6 to 5,
•Add task G and node 7 for the finishing node.

121
.
Constructing the AOA Network: III
(D,3) 5
3
(G,4)
(A,3) (E,3)
(B,3) 6 (H,3) 7
1 2

(C,1) (F,2)
4
•Add two more tasks F and H.
•The critical path is: ADG or BEG

122
.
On variability of tasks
• Consider 10 independent tasks
– each takes 1 unit of time on average
– the time it takes is uniformly distributed between 0
and 2.

CPM (uses expected value) Modeling Randomness


123 The random schedule takes longer
.
On Incorporating Variability

• Program Evaluation and Review Technique


(PERT)
– Attempts to incorporate variability in the durations
– Assume mean, , and variance, 2, of the durations
can be estimated
• Simulation
– Model variability using any distribution
– simulate to see how long a schedule will take

124
.
PERT
CPM assumes that the duration of each activity is known with
certainty. For many projects, this is clearly not applicable. PERT
is an attempt to correct this shortcoming of CPM by modeling
the duration of each activity as a random variable. For each
activity, PERT requires that the project manager estimate the
following three quantities:
a : estimate of the activity’s duration under the most favorable
conditions
b : estimate of the activity’s duration under the least favorable
conditions
m : most likely value for the activity’s duration

125
.
Let Tij be the duration of activity (i,j). PERT requires the
assumption that Tij follows a beta distribution.
According to this assumption, it can be shown that the
mean and variance of Tij may be approximated by

a  4m  b
E (Tij ) 
6
(b  a ) 2
var Tij 
36

126
.
PERT requires the assumption that the durations of all
activities are independent. Thus,

 E (T )
( i , j )path
ij : expected duration of activities on any path

 var T
( i , j )path
ij : variance of duration of activities on any path

127
.
Let CP be the random variable denoting the total duration of
the activities on a critical path found by CPM. PERT assumes
that the critical path found by CPM contains enough activities to
allow us to invoke the Central Limit Theorem and conclude that
the following is normally distributed:

CP  T ij
( i , j )criticalpath

128
.
a, b and m for activities in Widgetco

Activity a b m
(1,2) 5 13 9
(1,3) 2 10 6
(3,5) 3 13 8
(3,4) 1 13 7
(4,5) 8 12 10
(5,6) 9 15 12
129
.
According to the table on the previous slide:
5  13  36 (13  5) 2
E (T 12)   9, var T 12   1.78
6 36
2  10  24 (10  2) 2
E (T 13)   6, var T 13   1.78
6 36
3  13  32 (13  3) 2
E (T 35)   8, var T 35   2.78
6 36
1  13  28 (13  1) 2
E (T 34)   7, var T 34  4
6 36
8  12  40 (12  8) 2
E (T 45)   10, var T 45   0.44
6 36
9  15  48 (15  9) 2
E (T 56)   12, var T 56  1
6 36

130
.
Of course, the fact that arc (2,3) is a dummy arc yields
E(T23)=varT23=0
The critical path was B-D-E-F. Thus,
E(CP)=9+0+7+10+12=38
Var(CP)=1.78+0+4+0.44+1=7.22
Then the standard deviation for CP is (7.22)1/2=2.69

CP  38 35  38
P (CP  35)  P(  )  P ( Z  1.12)  0.13
2.69 2.69

PERT indicates that there is a 13% chance that the project will
be completed within 35 days.

131
.
Question: What is the probability that the project will
be completed within at least 42 days?

CP  38 42  38
P (CP  42)  P (  )
2.69 2.69
 P ( Z  1.487)  1  0.9312  0.0688

132
.
More on Project Management
• CPM
– Advantage of ease of use
– Lays out the Gantt chart (nicely visual)
– Identifies the critical path
– Used in practice on large projects
• e.g., used for the big dig

• Other issues
– Tasks take resources, which are limited
– Task times are really random variables
– Unpredictable things happen
133
.
Incorporating Resource Constraints
• Each task can have resources that it needs
– 3 construction workers
– 1 crane
– etc
• In scheduling, do not use more resources than
are available at any time
– Makes the problem much more difficult to solve
exactly. Heuristics are used.

134
.
Dealing with the unknown
• VERY hard to model
• How does one model totally unforeseen
events?
– In the Big Dig, there is a leak in digging a tunnel
despite assurances it would not happen
– In the Hubble telescope, a firm assures that the
mirrors are ground properly. By the time the
mistake is discovered, the telescope is in outer
space.
135
.
Project Management Software

• Explosive growth in software packages using these


techniques
• Cost and capabilities vary greatly
• Yearly survey in PM Network
• Microsoft Project is most commonly used package
today
– Free 60 day trial versions:
http://www.microsoft.com/office/98/project/
trial/info.htm
136
.
Summary
• Project management
• Simple model: we use estimates of the
time for each task, and we use the
precedence constraints

137
.
Topics in Final Exam
• Convexity/Farkas Lemma
• Transportation/assignment problem
• Shortest-path and maximum flow problem
• CPM and Pert
• Integer Linear Optimization: Modeling, and
algorithms.

138
.

You might also like