Professional Documents
Culture Documents
NETWORK MODEL
1
Situations using Network Model
Design offshore natural-gas pipeline
1 2
• Arcs: An
arc consists of an ordered pair of vertices
and represents a possible direction of motion that
may occur between vertices. Arc
1 2
3
Basic Definitions
1 3 5
• Connected Network
• Directed Network 2
4
• Cycle / loop
• Path 1 3 5
• Simple path
4
• Simple cycle 2
• Tree
1 3
• Spanning Tree
4
Basic Definitions
For example in the figure below:
(1,2)-(2,3)-(4,3) is not a path;
(1,2)-(2,3)-(3,4) is a path, which represents a way
to travel from node 1 to node 4.
1 4
2 3
5
Minimal Spanning Tree
Step 1: Get connected &
unconnected array
7
Shortest Path Problems
Assume that each arc in the network has a
length associated with it.
8
Car (or machine) replacement example:
Let’s assume that we have just purchased a new car
(or machine) 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.
9
Car (or machine) replacement example:
In order to avoid the high maintenance cost associated
with an older car, we may trade in the car and purchase a
new car.The trade-in prices are also given in the table.
31 31
21 21
12
12
1 7
2 7
3 7
4 7
5 7
6
12 12
21
12
Shortest Path Problem
Dijkstra’s Algorithm: source node to every other nodes.
Node Label : [ Distance , from node i ]
Temporary labels (shortest) Permanent labels
[4, C]
[0, -]
[1, B]
13
Shortest Path Problem
Node Label Status Change Node Label Status Change
In Status In Status
Iteration 3 Iteration 4
B [0,–] P B [0,–] P
C [1,B] P C [1,B] P
A [4,C] P A [4,C] P
E [4+1,C] T F [4,C] P
F [1+3,C] T ← P E [5,C] T ← P
D [4+8,A] T D [12,A] T
G [11,F] T
Iteration 5 Iteration 6
B [0,–] P B [0,–] P
C [1,B] P C [1,B] P
A [4,C] P A [4,C] P
F [4,C] P F [4,C] P
E [5,C] P E [5,C] P
D [12,A] T G [7,E] P
G [7,E] T ← P
Distance, d Sequence, S
15
Floyd’s Algorithm
Step 0: Define the starting distance matrix D0 and node
sequence matrix S0. The diagonal elements are marked (-) to
indicate that they are blocked.
Step 1 … n: Set k = n
16
Floyd’s Algorithm Example
1 2 3
1 - 4 5
D0 =
2 2 -
1 5
3 -3 -
4 2 3
1 2 3
-3 1 - 2 3
2
S= 2 1 - 3
3 1 2 -
17
Floyd’s Algorithm Example
1 1 2 3
k=1 5 D0 =1 - 4 5
Vertex 1 can be 4 2 3
2 2 -
intermediate -3
2 3 -3 -
node
1 2 3
1 - 4 5 D1[2,3] = min( D0[2,3], D0[2,1]+D0[1,3] )
D1 =
2 2 - 7 = min (, 7)
3 -3 - =7
1 2 3
1 - 2 3 D1[3,2] = min( D0[3,2], D0[3,1]+D0[1,2] )
= min (-3,)
S= 2 1 - 1
= -3
3 1 2 -
No changes 18
Floyd’s Algorithm Example
1 5 1 2 3
k=2 D1 =1 - 4 5
Vertices 1, 2 can 4 2 3
2 2 - 7
be intermediate -3
2 3 -3 -
1 2 3
1 - 4 5 D2[1,3] = min( D1[1,3], D1[1,2]+D1[2,3] )
D2 = 2 2 - 7 = min (5, 4+7)
=5
3 -1 -3 -
1 2 3
1 - 2 3 D2[3,1] = min( D1[3,1], D1[3,2]+D1[2,1] )
S= = min (, -3+2)
2 1 - 1
= -1
3 2 2 -
No changes
19
Floyd’s Algorithm Example
k=3 1 1 2 3
5 D2 =
Vertices 1, 2, 3 1 - 4 5
can be 4 2 3
2 2 - 7
intermediate -3
2 3 -1 -3 -
1 2 3
1 - 2 5 D3[1,2] = min(D2[1,2], D2[1,3]+D2[3,2] )
D3 =
2 2 - 7 = min (4, 5+(-3))
3 -1 -3 - =2
1 2 3
1 - 3 3 D3[2,1] = min(D2[2,1], D2[2,3]+D2[3,1] )
S= 2 1 - 1 = min (2, 7+ (-1))
3 2 2 - =2
No changes
20
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.
21
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
(0)3
(so,1) 2
so (2)2
1 (2)3
2 (2)2
si (so,2) 3
(1,2) 3
(0)4 3 (0)1
Step 1. Let a1 = and label the source node 1 with [, - ] . Set i =1
Step 2. Determine S = unlabeled nodes j from node i (Cij > 0 ).
Step 3. Determine k Si such that Cik = max {Cij}, for j Si.
Step 4. (Backtracking). If i = 1, no further breakthroughs are possible;
go to step 6.
Step 5. (Determination of residue network). the maximum flow along
the path is computed as fp = min { a1 , ak1 , ak2 , …, an }.
The residual capacity of is decreased by fp in the direction of the flow
and increase by fp in the reverse direction.
Step 6. (Solution).
Given that m breakthrough paths have been determined, the maximal
flow in the network is F = f1 + f 2+ ……… + fm
23
Maximal Flow Model
Iteration 1
Step 1: i = 1, [ ∞, - ], a1= ∞
Step 2: S1={2, 3, 4}
Step 3: k = 3, a3= 30
C13 = max {C12, C13, C14}
= max{20, 30, 10}=30
Step 2: S3={4, 5}
Step 3: k = 5, a5= 20
C35 = max {C34, C45}
= max{10, 20}=20 Residual capacities
Breakthrough (C13, C31)=(30-20, 0+20)
Step 5: Max flow along path =(10,20)
f1 = min(a1 , a3, a5) = 20 (C35, C53)=(20-20, 0+20)
=(0,20)
24
Maximal Flow Model
F= 60 units
25