KNURE, Software department, Ph. 7021-446, e-mail: [email protected] N.V. Bilous Faculty of...
-
Upload
morgan-mcnulty -
Category
Documents
-
view
214 -
download
0
Transcript of KNURE, Software department, Ph. 7021-446, e-mail: [email protected] N.V. Bilous Faculty of...
KNURE, Software department,Ph. 7021-446, e-mail: [email protected]
N.V. Bilous
Faculty of computer sciencesSoftware department, KNURE
Transportation networksTransportation networks
Discrete mathematics.Discrete mathematics.
N.V.Belous 17.Transportation networks 2
The basic definitionsThe basic definitions
A network is - a connected directed graph without loops.
Denote network by G(X,U), where X – the set of vertices, U – the set of arcs.
- there is only one vertex with zero number of arcs entering it. This vertex is called a source.
- there is only one vertex z with zero number of arcs leaving it. This vertex is called a sink.
N.V.Belous 17.Transportation networks 3
The basic definitionsThe basic definitions
Each arc u U is supplied with the nonnegative real number C(u), called capacity of the arc.
The vertex xi x0; xi z is called
internal vertices.
A flow in the arc is a function . )(u
N.V.Belous 17.Transportation networks 4
Properties of the flowProperties of the flow
Properties of the flow :
1.
2. , x x0 ; x z,
where
the set of arcs, entering the vertex x,
the set of arcs, leaving the vertex x.
)()(0 uCu
xx UuUu
uu )()(
xUxU
)(u
N.V.Belous 17.Transportation networks 5
Properties of the flowProperties of the flow
A flow in the arc u can be considered as the velocity in which material is transported through the arc u, so material is not accumulated in vertices of the network.
Therefore the amount of the material, that is transported from the source is equal to the sum amount of the material, that is transported into the sink.
3. ,
where corresponds to the value of a flow in the network.
zUuUu xx
uu
)()(
z
N.V.Belous 17.Transportation networks 6
Cut of the flowCut of the flow
Let’s consider the task:
A – an arbitrary set of vertices x0 A and z A;
– complement of set A, z A, but x0
– the set of arcs, entering to the set A;
– the set of arcs, leaving to the set A.
The set is called a cut of a network.
A cut contains arcs that terminate in the set and ordinate in the set A.
AAUAU
AU
A
A
N.V.Belous 17.Transportation networks 7
Properties of the flowProperties of the flow
Example
a cut
zxA ,2
310 ,, xxxA
),(),,(),,( 2031 xxzxzxU A
N.V.Belous 17.Transportation networks 8
Properties of the flowProperties of the flow
4.
The capacity of the cut is the sum of arcs capacities, belonging to this cut.
5. ,where C(A) – capacity of the cut A.
The value of a flow in the network is not grater than the capacity of any cut.
AA UuUu
z uu )()(
)(ACz
N.V.Belous 17.Transportation networks 9
Maximal flow problemMaximal flow problem
The Ford-and-Falkerson theorem
Let’s value of network flow and capacity of cut V such equality is true: then is the maximal flow that can be passed through the network and V has the minimal capacity from all the cuts in this network.
Then V is called the minimal cut.
z)(VCz z
N.V.Belous 17.Transportation networks 10
Ford-and-Falkerson algorithmFord-and-Falkerson algorithm
An arc u is called saturated if
An arc u is called empty if
An arc u is called busy if
The algorithm consists of two stages:
Ι Find some complete flow
ΙΙ Evaluation maximal flow by given labels to the network vertices
)()( uCu 0)( u
0)( u
N.V.Belous 17.Transportation networks 11
Ford-and-Falkerson algorithmFord-and-Falkerson algorithm
Let be some flow distributed of an arcs of a network. Find the complete flow when every path from x0 to z contains at
least one saturated arc.
z
x0 x2 x4
x1
x3
x5
10/7
5/2
3/2
11/9
2/1
7/6
7/6
3/016/11
1/0
N.V.Belous 17.Transportation networks 12
Stage Stage ΙΙ Ford-and-Falkerson algorithmFord-and-Falkerson algorithm
Step 1.Let is difference between the capacity
of each arc and the flow in this arc.
=1. Arcs (x1, x4) and (x4,z) are
saturated.
Step 2.
=1. Arc (x1, x2) is saturated.
x0 x2 x4
x1
x3
x5
10/7+1
5/2
3/2
11/9
2/1
7/6
7/6+1
3/016/11
1/0+1
zxxx ,,,: 4101
zxxxx ,,,, 32102 x0 x2 x4
x1
x3
x5
10/8+1
5/2
3/2
11/9+1
2/1+1
7/6
7/7
3/016/11+1
1/1
12z
13z
N.V.Belous 17.Transportation networks 13
Stage Stage ΙΙ Ford-and-Falkerson algorithmFord-and-Falkerson algorithm
Step 2.=1. Arc (x1, x2) is saturated.
Step 3.=1.Arc (x2, x3) is saturated.
zxxxx ,,,, 32102
zxxx ,,, 3203
x0 x2 x4
x1
x3
x5
10/8+1
5/2
3/2
11/9+1
2/1+1
7/6
7/7
3/016/11+1
1/1
x0 x2 x4
x1
x3
x5
10/9
5/2+1
3/2
11/10+1
2/2
7/6
7/7
3/016/12+1
1/1
13z
14z
N.V.Belous 17.Transportation networks 14
Stage Stage ΙΙ Ford-and-Falkerson algorithmFord-and-Falkerson algorithm
Step 3. =1.Arc (x2, x3) is saturated.
Step 4.=1.Arc (x0 , x3) is saturated.
corresponds to the complete flow, because each path from x0 to z contains at least one saturated arc.
zxxx ,,, 3203
zxx ,, 304 15z
x0 x2 x4
x1
x3
x5
10/9
5/2+1
3/2
11/10+1
2/2
7/6
7/7
3/016/12+1
1/1
x0 x2 x4
x1
x3
x5
10/9
5/2+1
3/2+1
11/11
2/2
7/6
7/7
3/016/13+1
1/1
14z
N.V.Belous 17.Transportation networks 15
Stage Stage ΙΙΙΙ The process of labeling The process of labeling
Stage ΙΙ.
The process of increasing the flow φu consists in labeling the vertices of the network by indexes, that indicate the path where can be changed. If such label can reach the sink z that the flow φu can be increased. After this vertices are labeled again.
N.V.Belous 17.Transportation networks 16
Stage Stage ΙΙΙΙ Algorithm of labeling vertices Algorithm of labeling vertices
Algorithm of labeling vertices
1. x0 [0] label
2. Labeling vertex.
If xi has already a label then the label [+i] assign to all
unlabeling ajacence to x0 vertices when the flow fz pass through
the unbusy arc and the direction of the flow fz coincide with the
direction of the considered arc.
The label [-i] assign to all unlabeling vertices that are connected with xi by busy arc with head in xi
N.V.Belous 17.Transportation networks 17
Stage Stage ΙΙΙΙ Algorithm of labeling vertices Algorithm of labeling vertices
3. If the process of labeling vertices reaches the vertex z then go to the step 4 else the flow, received on to the previous step was the maximal value.
4. Exists x0 – z path with distinct vertices labeled
(accurate to the sign) with the number of previous vertices .
Path is built, starting form the vertex z.
N.V.Belous 17.Transportation networks 18
Stage Stage ΙΙΙΙ Algorithm of labeling vertices Algorithm of labeling vertices
The flow of the arc φu corresponds to:
a new flow is received
Go to the step 1.
oppositeuarcofdirectiontheandufflowtheofdirectionifu
coincideuarcofdirectiontheandufflowtheofdirectiontheifu
uifu
u
)(,1)(
)(,1)(
;,)(
)(
z1 zz
N.V.Belous 17.Transportation networks 19
Stage Stage ΙΙΙΙ Algorithm of labeling vertices Algorithm of labeling vertices
The sink z was labeled.
There is a path : x0, x2, x4, x3,z where
the flow can be increased.
Increase the flow in such arcs: (x0, x2),(x4, x3),(x3,z) by
one. Decrease the flow in the arc (x4, x2) by one.
x0 x2 x4
x1
x3
x5
10/9
5/3
3/3
11/11
2/2
7/6
7/7
3/016/14
1/10+0
+4
+0
-2 +3
N.V.Belous 17.Transportation networks 20
Stage Stage ΙΙΙΙ Algorithm of labeling vertices Algorithm of labeling vertices
There is a path = x0, x2, x4,
x3,z , where the flow can be
increased. Permits the flow φu is increased in arcs (x0, x1 ),(x1, x2),(x4,
x3),(x3,z) and is decreased in (x4, x2)
4
The vertex z is not labeled then the flow received at the previous step was the maximal.
– maximal flow.16z
x0 x2 x4
x1
x3
x5
10/9
5/3+1+1
3/3
11/11
2/2
7/6-1-1
7/7
3/0+1+1
16/14+1+1
1/10+1
+4
+0
-2 +3