Ask05 Network-Model
Ask05 Network-Model
Network Models
A.A.B. Dinariyana
Application of network models
2
Models of network optimization problem
3
Basic definitions
o A graph or network consists of a set of nodes linked by arcs or branches. Associated with arc is a
flow of some type.
Example: in transportation network, cities represent nodes, highways represent arcs, with traffic
representing the arc flow
o Standard notation of network G is G=(N,A), where N is the set of nodes and A is the set of arcs.
A path is a sequence of distinct arcs that join the two nodes regardless of
the orientation of the individual arcs.
4
Basic definitions
A path will form a loop or a cycle if it connects a node to itself
For example in the figure below:
o (2,3)-(3,4)-(4,2) form a loop from node 2 to 4.
o (1,3)-(3,2)-(2-4) represent a path from node 1 to 4.
1 3 5
2 4
N = {1, 2, 3, 4, 5}
A = {(1,3), (1,2), (2,3), (2,4), (2,5), (3,4), (3,5), (4,5)}
5
Minimum
spanning
tree
6
Minimum spanning tree problems
o 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.
o In many applications it must be determined that the set of arcs in a network
that connects all nodes such that the sum of the length of the arcs is
minimized. Clearly, such a group of arcs contain no loop.
o 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.
7
Minimum spanning tree problems
o A spanning tree of minimum length in a network is a minimum spanning tree
(MST).
o The MST Algorithm may be used to find a minimum spanning tree.
Begin at any node i, and join node i to the node in the network (call it node j) that is
closest to node i.
• The two nodes i and j now form a connected set of nodes C={i,j}, and arc (i,j) will be in the
minimum spanning tree. The remaining nodes in the network (call them C’) are referred to as the
unconnected set of nodes.
8
Minimum spanning tree problems
• Now choose a member of C’ (call it n) that is closest to set C. Let m represent the node in
C that is closest to n. Then the arc(m,n) will be in the minimum spanning tree. Now
update C and C’. Since n is now connected to {i,j}, C now equals {i,j,n} and we must
eliminate node n from C’.
• Repeat this process until a minimum spanning tree is found. Ties for closest node and arc
to be included in the minimum spanning tree may be broken arbitrarily.
9
Example: MST algorithm
o The university campus has five
computers. The distances between
each pair of computers are given. 1 1
2
o What is the minimum length of
2 2
cable required to interconnect the 6
computers? 5 4
4 2 3
Note that if two computers are not 4
connected this is because of underground 3
rock formations. 5
10
Example: MST algorithm - solution
We want to find the
minimum spanning tree. 1
1
Iteration 1: Following the MST
algorithm discussed before, 2
2
arbitrarily choose node 1 to 2
begin. The closest node is node 2. 6
Now C={1,2}, C’={3,4,5}, and 5 4
arc(1,2) will be in the minimum 2 3
4
spanning tree.
4
5 3
11
Example: MST algorithm - solution
Iteration 2: Node 5 is closest
to C. since node 5 is two 1
blocks from node 1 and 1
2
node 2, we may include 2
either arc(2,5) or arc(1,5) in 2
6
the minimum spanning tree.
5 4
We arbitrarily choose to 2 3
include arc(2,5). Then 4
C={1,2,5} and Ć={3,4}. 4
5 3
12
Example: MST algorithm - solution
Iteration 3: Since node 3 is
two blocks from node 5, we 1
may include arc(5,3) in the 1
2
minimum spanning tree. 2
Now C={1,2,5,3} and C’={4}. 2
6
5 4
2 3
4
4
5 3
13
Example: MST algorithm - solution
Iteration 4: Node 5 is the
closest node to node 4. 1
Thus, we add arc(5,4) to the 1
2
minimum spanning tree. 2
2
6
The minimum spanning tree 5 4
2 3
consists of arcs(1,2), (2,5), 4
(5,3), and (5,4). The length 4
of the minimum spanning 5 3
tree is 1+2+2+4=9 blocks.
14
Exercise
15
Shortest path/route problems
o Assume that each arc in the network has a length associated with it.
o The problem of finding the shortest path from node 1 to any other node in
the network is called a shortest path/route problem.
o Determining the connected arcs in a transportation network that collectively
comprise the shortest distance between a source and destination.
16
Example - Dijkstra algorithm
The figure gives the route and their length in miles between city 1 and four other
cities.
Determine the shortest route between node 1 and node 2 and shortest route
between node 1 to node 5.
15
2
100 4 50
20
10
1 60
3 5
30
17
15
Example(cont’d) 100
2
20 10
4 50
1 60
3 5
30
o Iteration 0: assign permanent label [0,--] to node 1
o Iteration 1: node 2 and 3 can be reached from (the last permanent
labeled) node 1 thus the list labeled node (temporary and permanent)
becomes
Node label status
1 [0,--] permanent
2 [0+100, 1] temporary
3 [0+30,1] temporary
o For both two temporary label [100,1] and [30,1] node 3 is smallest
distance so, status of node 3 is changed to permanent
18
15
Example(cont’d) 100
2
20 10
4 50
1 60
3 5
30
o Iteration2: node 4, and 5 can be reached from node 3 and the list labeled node
becomes:
Node label status
1 [0,--] permanent
2 [100, 1] temporary
3 [30,1] Permanent
4 [30+10,3]=[40,3] temporary
5 [30+60,3]=[90,3] temporary
o node 4 is smallest distance so from the temporaries list. so, status of node 4 is
changed to permanent
19
15
Example(cont’d) 100
2
20 10
4 50
1 60
3 5
30
o Iteration 3: node 2 and 5 can be reached from node 4. the list of labeled is
updated as
Node label status
1 [0,--] permanent
2 [40+15,4]=[55,4] temporary
3 [30,1] Permanent
4 [40,3] Permanent
5 [30+60,3] or [40+50,4] temporary
o Node 2 is permanent
20
15
Example(cont’d) 100
2
20 10
4 50
1 60
3 5
30
o Iteration 4: only node 3 can be reached from node 2, the node 3 is
permanent , so the new list remain the same
21
15
Example(cont’d) 100
2
20 10
4 50
1 60
3 5
o The process ends
30
22
Maximum flow problems
o 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.
o 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).
o These types of problems are called maximum flow problems.
23
Maximal flow algorithm
o In a maximal flow problem, we seek to find the maximum volume of flow
from a source node to terminal sink node in a capacitated network.
o Maximum flow algorithm is straightforward.
o In maximum flow algorithm, we determine if there is any path from source
to sink that can carry flow.
o If there is , the flow is augmented as much as possible along this path; and
residual capacities of the arc used on the path are reduced accordingly.
24
Steps of maximum flow algorithm
o Step1: find path from the source to the sink that has positive residual
capacities. If no path have positive, STOP; the maximum flow have been
found
o Step2: Find the minimum residual capacity of the arc on the path ( call it K)
and augment the flow on each involved arc by K
o Step3: Adjust the residual capacities of arcs on the path by decreasing the
residual capacities in direction of flow by K; and increasing the residual
capacities in the direction opposite the flow by K;
GO TO STEP 1
25
Example
Determine the maximum flow in the network
20
0 4
5
10 0
30 0
1 5
0
20 30 10
0
0 20
2 3
40 0
26
Example (cont.)
Iteration1:
Select Path: 1à4à5
0 4 20 10 4 10 10
5 10 5
10 0 0 10
1 30 0 5 1 30 0 5
20 0 20 0
30 10 30 10
0 0
0 2 40 0
3 20 0 2 40 0
3 20
27
Example (cont.)
Iteration 2:
o No additional possible flow along arc(1,4); thus find new path;
Select path 1à3à4à5
Residual capacities
1-3 30 Augment flow by 10
Reduce forward capacities by 10
3-4 10 Increase backward capacities by 10
4-5 10
10
10 4 10 10 10 4 0 10
10 5 10 15
0 10 0 20
10
30 1 10 5
1 0 5 20 0
0 20 0 0
20 30 10 30 10
0
0 2 3 20 0 2 40 0
3 20
40 0
28
Example (cont.)
Iteration 3:
o No additional possible flow along arc(3,4) and (4,5); thus find
new path; Select path 1à3à5
Residual capacities
Augment flow by 20
1-3 20 Reduce forward capacities by 20
3-5 20 Increase backward capacities by 20
10 4 0 20 10 4 0 20
10 15 10 15
20
0 20 0 20
10
10
1 20 10 0 5 1 0 10 0 5
0 20
20 30 0 20 30 0
10 30
0 2 3 20 0 2 3 0 20
40 0 40 0
29
Example (cont.)
Iteration 4:
o No additional possible flow along arc(1,3) and (3,5); thus find
new path; Select path 1à2à5
Residual capacities
Augment flow by 20
1-2 20 Reduce forward capacities by 20
2-5 30 Increase backward capacities by 20
10 4 0 20
10 4 0 20
10 15 10
15
10
0 20 0 20
30
10
0
1 0 30 0 5 1 20 5
20 20 20
20 0 0 10 0
30 30 30
20 20
0 2 3 0 20 20 2 40 0
3 0
40 0
30
Example (cont.)
Iteration 4:
o No more flow is possible flow because there is no residual capacity left on the cut consisting
(1,2),(1,3), and (1,4); so maximum flow is 20+30+10=60.
From To Flow
10 4 0 20
1 2 20 10 15
10
0
1 3 30 0 30
20
1 20 5
1 4 10 20 20
0 10 0
30
20
2 5 20 20 2 3 0 20
40 0
3 4 10
3 5 20
4 5 20
31
References
o Operations Research:
Applications and Algorithms,
Wayne L. Winston
o Introduction to Operations
Research, Hillier &
Lieberman, McGraw-Hill Int.
o Operations Research – An
Introduction, Hamdy A.
Taha, Maxwell Macmillan
Int. Edition.
32
33