Добавил:
ivanov666
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Fundamentals of Operations Research. A textbook
.pdf
Maximum Flow Problem
•
the rst its element indicates the predecessor ofjin the path being constructed, and it is
i`, if the ow along arc
arc of the path), and
path);
•
value
εpjq
is the amount of ow that can be additionally sent fromstojwithout exceeding
arc capacities.
pi, jq
can be increased (the arc is unsaturated, and it is a forward
i´, if the ow along arc
pj, iq
can be reduced (a backward arc of the
101
Algorithm 8.1
Step 1.
Step 2.
Labeling
Label sourceswith
repeat
Choose a labeled and unscanned nodei;
for all
for all
Nodeiis labeled and scanned.
until
iftis labeled
else
STOP.
Flow Augmentation
The Labeling Algorithm For The Maximum Flow Problem
rs`, `8s
unlabeledjsuch that
labeljwith
unlabeledjsuch that
labeljwith
sinktis labeled, or no node can be labeled.
then
ri`, εpjqs
ri´, εpjqs
Goto Step 2
. The source is now labeled.
pi, jq P A
, where
pj, iq P A
, where
εpjq “ mintεpiq, bij´ xiju
εpjq “ mintεpiq, xjiu
and
xijă bijdo
and
xjią 0
do
.
;
Set
j “ t,ε “ εptq
repeat
ifjhas label
ifjhas label
until
Remove all the labels and Goto Step 1.
Example 8.1.
Arcs' capacities
the ow is 2. Increase it using the algorithm.
Step 1.
neighbors,1and2, the rst of which cannot be labeled, since arc
2,
j “ s
.
To illustrate work of the algorithm, consider the network shown in g.8.1-a.
bijand initial ow
The labeling process starts with giving the source label
.
rk`, εpjqs
rk´, εpjqs
εp2q “ mintεpsq, bs2´ xs2u “ mint8, 1u “ 1.
then
then
xijare given beside each arc in form
set
xkj“ xkj` ε
set
xjk“ xjk´ ε
and
and
j “ k
j “ k
.
rs`, `8s
ps, 1q
is saturated. For node
bij{xij. The value of
. Nodeshas two

102
s
t
1
2
1/1 3/0
1/1
2/1 2/2
s
t
1
2
1/1 3/0
1/1
2/1 2/2
[s+, +∞]
[2−, 1]
[s+, 1]
[1+, 1]
s
t
1
2
1/1 3/1
1/0
2/2 2/2
[s+, +∞]
Network Flows
(a) Initial ow
(b) Labels
(c) Increased ow
Figure 8.1: Implementation of the labeling algorithm 8.1
Therefore, node 2 is labeled with with
rs`, 1s
. Now, the sourcesis scanned.
The only labeled and unscanned node is 2. Its neighborhood includes two unlabeled nodes,
1
andt. Arc
arc,
p1, 2q
p2, tq
is saturated, so the sink cannot be labeled. For node 1, there is a backward
, which holds positive ow. Therefore,
εp1q “ mintεp2q, x12u “ mint1, 1u “ 1.
Thus, 1 gets label
The only unlabeled neighbor of node 1 is sinkt. Arc
r2´, 1s
. Node 2 is scanned.
p1, tq
is unsaturated, so
εptq “ mintεp1q, b1t´ x1tu “ mint1, 3u “ 1,
andtis labeled with
Step 2.
The sink's label is
total ow can be increased by 1, and the last arc of the path is
and go to node 1. The rst part of its label is
x21“ x21´ 1 “ 0
r1`, 1s
. The sink is labeled, now, increase the ow.
r1`, 1s
. That means, there is an augmenting path, along which the
. Node 2 is labeled with
s`, so
p1, tq
. Set
x
“ x1t` 1 “ 1
1,t
2´, so we decrease the ow along
xs2“ xs2` 1 “ 2
, and the process stops. The
p1, 2q
value of the new ow is 3 (g.8.1-c). Return to Step 1.
by 1:
Step 1.
saturated, therefore1and2cannot be labeled, and the algorithm stops. The ow is maximal.
Remark
capacities are all integral. Indeed, when the algorithm stops, a maximal ow is obtained, since
there is no augmenting path in the graph. Integrality conditions ensure the niteness of the
algorithm: each time the second step is executed, the ow increases by
and, therefore, is at least 1.
Remark
with non-maximal ow [3]. Simple modications can be made to prevent these situations. One
of them is given below.
Remark
that is, the algorithm is pseudopolynomial. There are several modications of the method,
which yield polynomial-time algorithms. One of them is to nd the shortest augmenting path
(the one with the smallest number of edges) at each step. The complexity of this algorithm is
Op|V |3q
Label the source with
rs`, `8s
. Both of the arcs incident tos,
ps, 1q
and
8.1.Algorithm 8.1 nds a maximal ow in a network, if the initial ow and the arc
ε ą 0
, which is integral
8.2.If arc capacities
bijare real numbers, the algorithm may not converge or may stop
8.3.Note that time complexity of Algorithm 8.1 depends on the value of maximal ow,
.
ps, 2q
, are

Minimum Cost Flow Problem
Modication of the Labeling Algorithm 8.1
103
Step 1.
Step 2.
Remove all saturated arcs of the network and goto Step 2.
Apply Algorithm 8.1 to nd an augmenting path.
If a path is found, then increase the ow by sending the maximal amount of ow along
the path, and goto Step 1.
If there is no augmenting path in the graph, then goto Step 3.
Step 3.
Restore the arcs removed at Step 1 and nd an augmenting path.
If a path exists, then send maximal amount of ow along it and goto Step 1.
If there is no augmenting path, the ow is optimal. The algorithm stops.
8.3. Minimum Cost Flow Problem
In this section, we discuss
The Minimum Cost Flow Problem.
t
. Non-negative arc capacities
pi, jq P A
. Find a ow of a given valuev, the cost of which is minimal.
bijand per-unit transportation costs
The problem can be stated as a linear program:
zpxq “
ÿ
xij´
i: pi,jqPA
Given a network
ÿ
cijxijÑ min
pi,jqPA
ÿ
xjk“
k: pj,kqPA
,
txu
$
´v, j “ s,
&
0, j ‰ s, t,
%
v, j “ t.
G “ pV, Aq
cijare assigned to each arc
with sourcesand sink
(8.4)
(8.5)
0 ď xijď bij, pi, jq P A.
(8.6)
Clearly, standard linear programming methods can be used to solve the problem. Moreover, as
was mentioned above concerning the Maximum Flow Problem, due to total unimodularity of
constraints matrix, an instance with integral parameters has an integral solution, which can be
found in polynomial time.
Below, we describe two specic algorithms to solve the problem in case the value of the ow
and all the arc capacities are integers.
8.3.1. BusackerGowen Algorithm
Easy to see that problem (8.4)(8.6) is a generalization of the Shortest Path Problem. Indeed,
if we intend to deliver a single unit of the ow from the source to the sink in a network with
integral arc capacities, we must choose a shortest sourcesink path. This observation provides
inspiration for an algorithm: we split an integral ow of valuevintovsuboats of unit value,
and pass each unit along the cheapest
s ´ t
path.
The correctness of the algorithm can be demonstrated by a simple inductive argument. Note
that its complexity depends linearly on the value of the ow and, therefore, is pseudopolynomial.
To illustrate the work of the algorithm, consider the following example.

104
1 2
4
3
s
t
1/1 1/2
1/1 1/2
2/2
1/1
2/2
1 2
4
3
s
t
1 1 1
1 2
4
3
s
t
1
1
1
1
1
1
Network Flows
Algorithm 8.2
Step 0.
Step 1.
pj, iq
BusackerGowen Algorithm For The Minimum Cost Flow Problem
Set
xij“ 0
for all arcs
pi, jq P A
Modify the network. For each arc
to the graph and dene costs
and goto Step 2.
Step 2.
Find a shortest
s ´ t
path and send a unit of ow along the path.
If the value of the ow isv, then the algorithm stops. Otherwise, repeat Step 1.
Example 8.2.
The network is shown in g.8.2-a. Each edge
Find a minimum-cost ow of value 2.
and goto Step 1.
pi, jq P A
such that
xiją 0
, add backward arc
$
cij, 0 ď xijă bij,
&
˚
c
ij
`8, xij“ bij,
“
%
´cji, xjią 0,
pi, jq
is labeled with pair
bij{cij.
(a) The network
(b) Iteration 1.
Figure 8.2: Example 8.2. Implementation of BusackerGowen algorithm
In the rst iteration of the algorithm, we nd a shortest
a unit of ow along it (g.8.2-b):
xs1“ x12“ x2t“ 1
.
s ´t
In the second iteration, we calculate modied costs:
Other costs
˚
c
“ 8, xs1“ bs1“ 1, c
s1
˚
c
“ 8, x12“ b12“ 1, c
12
˚
c
“ 8, x2t“ b2t“ 1, c
2t
˚
c
“ cij. The shortest path in modied network is
ij
˚
1s
˚
21
˚
t2
“ ´1;
“ ´2;
“ ´1.
second unit of the ow along it, we get the ow shown in g.8.3.
path, e.g.,
ts, 3, 2, 1, 4, tu
ts, 1, 2, tu
. Passing the
, and send
Figure 8.3: Example 8.2. Iteration 2

Minimum Cost Flow Problem
105
8.3.2. Klein's Algorithm
Another approach to solve problem (8.4)(8.6) was proposed by Morton Klein in 1967. The
idea of his method is to construct a feasible ow of required value, and then iteratively improve
it by reassigning some ow units to cheaper subpaths.
Given a feasible owxin network
above: in addition to arcs ofG, network¯G
that
xiją 0
. The costs are dened as follows
G “ pV, Aq
. Consider a modied network¯G
includes backward arcs
pj, iq
for each
described
pi, jq P A
such
$
cij, 0 ď xijă bij,
&
˚
c
“
ij
`8, xij“ bij,
%
´cji, xjią 0,
Denition 8.4.
A negative circuit
with respect to owxis a circuit in modied network¯G
such that the sum of costs of its arcs is negative.
Theorem 8.4.
Letxbe a feasible ow of some valuevin a networkG. The cost ofxis
minimal if and only if the modied network contains no negative circuits.
Proof.
Clearly, if a negative circuit exists, the cost of the ow can be reduced by increasing
circulation in the circuit. Therefore, if a ow is optimal, the graph contains no negative circuits.
Now, suppose there are no negative circuits in the modied network. Prove optimality of
the ow. Assumexis not optimal and consider an optimal ow
ows into collections of paths carrying a unit of ow each: let
O “ toi: i “ 1, . . . , vu
zpx1q ă zpxq
, there are paths
greater than that for
be the sets of paths corresponding to owsxand
piand
oi. Clearly, arcs of
oisuch that cost of ow transportation for
ppiY oiqzpoiX piq
form a collection of cycles, at least
x1. Decompose both of the
P “ tpi: i “ 1, . . . , vu
x1, respectively. Since
piis strictly
and
one of which correspond to a negative circuit in the modied network.
This theorem provides the basis for the algorithm below.
Algorithm 8.3
Klein's Algorithm For The Minimum Cost Flow Problem
Step 0.
Step 1.
Step 2.
Find a feasible ow of valuev(e.g., by using FordFulkerson algorithm).
Construct modied network¯G
with respect to current owxand goto Step 2.
Find a negative circuit. If there are no such circuits, the algorithm stops. Otherwise,
for negative circuitCcalculate
"
δ “ min
pi,jqPC
bij´ xij, pi, jq
xji, pi, jq
is a forward arc of the circuit
is a backward arc
and increase the ow along arcs of the circuit byδ. Next, repeat Step 1.
To nd negative circuits, the following procedure can be employed.
*
,
,

106
2 7
4
5
45/1 10/8
6
90/9
10/1
1
50/3 50/2
9
8
10/1
20/2
3
15/2
s
t
10/2
20/3
25/2
30/6 15/8 80/4
60/510/3
15/8
10/1 10/3
10/3
2 7
4
5
61
9
83
s
t
40
15
25 20
5 10
1530
15
15
10
10
10
65
10 10
0
20
20
20
FloydWarshall Procedure
Network Flows
Given:
for all
Conclusion:
Example 8.3.
pairs
for
graph
i P V
j P V ztiu
for
G “ pV, Aq
and arc-length matrix
do
do
k P V ztiu
do
dkj:“ mintdkj, dki` diju
nodesisuch that
diiă 0
||dij||
.
.
belong to negative circuits.
Consider the network shown in g.8.4-a. Arcs capacities and costs are given in
bij{cijplaced beside each arc. Find a minimum-cost maximal ow using Klein's algorithm.
(a) The network
(b) The initial ow
Figure 8.4: Example 8.3. Implementation of Klein's algorithm
Step 0.
First, nd a maximal ow. The initial ow of value
v “ 85
is depicted in g.8.4-b.
Note that its value is equal to capacity of the cut drawn bold (that ensures us that the ow is
maximal). Each arc of the cut is saturated and, therefore, cannot occur in any negative cycle
as a forward arc. Thus, we can split the graph into two parts and search for negative cycles in
each of these parts separately.
Step 1.
Calculate modied costs. For the subgraph over nodes
ts, 1, 2, 4, 6u
, the costs a given
in the table below.
izj s 1 2 4 6
s 8 3 8 8 8
˚
||c
|| “
ij
1 ´3 8 2 8 8
2 ´6 ´2 8 1 8
4 8 ´2 ´1 8 9
6 8 8 8 ´9 8

Exercises
2 7
4
5
61
9
83
s
t
50
25
25 20
5 10
1520
15
15
10
10
10
65
10 10
0
20
20
20
s
1
2
3
6
5
7
4
t
2
3
2
1
2
1
2
1
1
2
1
1
1
107
Costs for the subgraph over nodes
t3, 5, 7, 8, 9, tu
.
izj 3 5 7 8 9 t
3 8 8 8 8 8 8
5 ´1 8 5 8 8 8
˚
||c
ij
|| “
7 8 ´5 8 ´2 8 8
8 ´3 8 8 8 3 8
9 8 8 ´1 3 8 8
t 8 8 ´4 8 ´3 8
Step 2.
ts, 1, 2, su
By applying FloydWarshall procedure to the subgraph, we nd negative circuit
(g.8.4-b). Change the ow:
xs1“ xs1` 10 “ 50, x12“ x12` 10 “ 25, xs2“ xs2´ 10 “ 20.
The resulting ow is shown in g.8.5. Easy to see that modied graph for this ow does not
contain negative circuits. Thus, the ow is optimal. The algorithm stops.
Figure 8.5: Example 8.3. Optimal ow
8.4. Exercises
8.1.
Given the mixed network shown in g.8.6. The capacity of an arc/edge is written beside
it. Find all the minimal cuts and a maximal
8.2.
Consider the network from g.8.6. Let ow transportation cost equal 1 for each arc and
2 for each edge. Find a minimum-cost
Figure 8.6: A mixed network
s ´ t
s ´ t
ow in the network.
ow of value 3 using BusackerGowen algorithm.

108
8.3.
Apply Klein's algorithm to nd a minimum-cost
g.8.6. Costs of arcs/edges are given below.
izj s 1 2 3 4 5 6 7 t
s ´ 4 6 ´ ´ ´ ´ ´ ´
1 ´ ´ ´ 3 ´ ´ ´ ´ ´
2 ´ ´ ´ 3 ´ ´ 5 ´ ´
||cij|| “
3 ´ ´ 3 ´ 3 4 1 ´ ´
4 ´ ´ ´ ´ ´ ´ ´ ´ 8
5 ´ ´ ´ ´ ´ ´ 3 ´ 3
6 ´ ´ ´ 1 ´ 3 ´ 4 ´
7 ´ ´ ´ ´ ´ ´ ´ ´ 4
Network Flows
s ´ t
ow of value 2 in network shown in

Chapter 9.
Approximation Algorithms
Since most of the practical problems are known to be
probably cannot be solved
is paid to
approximate
exactly
by means of polynomial-time algorithms, a great attention
algorithms, which provide a decisionmaker with a good solution in
N P
hard and, therefore, they most
a reasonable time. In this chapter, we describe several approaches to construct and analyze
approximation algorithms, following [1] and [2].
9.1. Heuristic Algorithms
It is common to call
is very dicult (if not impossible) to analyze such algorithms by theoretical means, and, to
estimate performance of a heuristics,
of instances of a problem are solved using the algorithm, and then the values of constructed
solutions are compared with the optimal values (obtained by an exponential exact algorithms)
or with estimates on these values. Surprisingly, very often a heuristic works remarkably good
in practice, despite the lack of proof of its eectiveness, or even despite the presence of proof
of its ineectiveness in worst case.
Below, we describe several common heuristic frameworks.
9.1.1. Greedy Algorithm
The Greedy Algorithm
multistage process at each stage of which a locally optimal subsolution is chosen. Though
simple and straightforward, this approach is eective in many cases and, moreover, is proven
to give an exact solution for a wide class of problems. One of many possible realizations of the
greedy approach can be formalized as follows. Consider a combinatorial minimization problem
heuristic
a relatively simple intuition-based algorithm. As a rule, it
a posteriori
analysis is employed. That is, a large number
is a general heuristic paradigm, in which a solution is constructed in a
min
tcpSq : vpSq ě K u.
SĎN
For example, the inverse variant of the Boolean Knapsack Problem (BKP)
min
xPB
#
n
ÿ
n
cjxj:
j“1
n
ÿ
ajxjě A
j“1
+
can be translated into form (9.1) by setting
cpSq “
ÿ
cj, vpSq “
jPS
ÿ
aj, K “ A.
jPS
(9.1)

110
Approximation Algorithms
Further, we assume set function
Algorithm 9.1
Step 0.
Set
Step 1.
Greedy Heuristic
Initialization
t “ 0,St“ H,cpSq “ `8
Iteration
whiletdoes not exceed a given limitLdo
Set
t “ t ` 1
nd element
if
S
t´1
else
set
,
jtfor which additional cost per unit of utility is minimal:
is feasible and
St“ S
Y tjtu,t “ t ` 1
t´1
vp¨q
be monotone and non-negative, that is,
vpS Y tjuq ě vpSq ě 0, j P N.
(empty set is infeasible).
jt“ argmin
t´1
jRS
cpS
Y tju ě cpS
t´1
cpS
vpS
Y tjuq ´ cpS
t´1
Y tjuq ´ vpS
t´1
q
t´1
then
.
t´1
t´1
set
q
.
q
SG“ S
t´1
and STOP,
if
Stis feasible
else
the algorithm stops without a solution.
Example 9.1
( [2]).Solve the instance of the Facility Location Problem (example 1.3) with
n “ |I| “ 4,m “ |J| “ 6
then
SG“ Stand STOP
, and opening costs
izj
1 2 3 4 5 6
cjand transportation costs
c
ij
c
i
cijgiven below.
1 6 1 15 9 7 4 21
2 2 9 2 11 23 3 16
3 3 4 6 4 2 1 11
4 4 11 3 8 9 5 24
Apply the Greedy algorithm to nd an approximate solution. To represent the problem in form
(9.1), dene
cpSq “
We start with initial solution
Iteration 1.
Calculate
j1:
$
’
’
&
j1“ argmin
’
’
%
ÿ
min
iPS
jPJ
S0“ H
ÿ
cij`
iPS
of value
ci, vpSq “ |S|, K “ 1.
cpS0q “ `8
.
cp1q “ p6 ` 1 ` 15 ` 9 ` 7 ` 4q ` 21 “ 63,
cp2q “ p2 ` 9 ` 2 ` 11 ` 23 ` 3q ` 16 “ 66,
cp3q “ p3 ` 4 ` 6 ` 4 ` 2 ` 1q ` 11 “ 31,
cp4q “ p4 ` 11 ` 3 ` 8 ` 9 ` 5q ` 24 “ 64
,
/
/
.
/
/
-
“ 3.
Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]
