0% found this document useful (0 votes)
22 views31 pages

AA Session02

Uploaded by

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

AA Session02

Uploaded by

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

‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ ‪۱‬‬

‫ﺑﺴﻢ ﺍﻟ ﻪ ﺍﻟﺮﺣﻤﻦ ﺍﻟﺮﺣﯿﻢ‬

‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﺩﺍﻧﺸ ﺪﮤ ﻣﻬﻨﺪﺳ ﺑﺮﻕ ﻭ ﮐﺎﻣﭙﯿﻮﺗﺮ‬


‫)ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ ‪(۴۰۳۱‬‬

‫‪Advanced Algorithms‬‬
‫)‪(17‐34‐532‬‬

‫‪Instructor: Hossein Falsafain‬‬

‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ ‪۴۰۳۱‬‬ ‫‪IUT ‐ ECE ‐ H. Falsafain‬‬


۲ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬
Applications of linear programming

Linear programming has proved to be flexible enough to model a wide


variety of important applications, such as airline crew scheduling,
transportation and communication network planning, oil exploration
and refining, and industrial production optimization. In fact, linear
programming is considered by many as one of the most important
achievements in the history of applied mathematics. The classic algo‐
rithm for this problem is called the simplex method. It was discovered
by the U.S. mathematician George Dantzig in the 1940s. Although
the worst‐case efficiency of this algorithm is known to be exponen‐
tial, it performs very well on typical inputs. Moreover, a more recent
algorithm by Narendra Karmarkar not only has a proven polynomial
worstcase efficiency but has also performed competitively with the
simplex method in empirical tests.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۳ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬
Formulating problems as linear programs

It is important to be able to recognize when we can formulate


a problem as a linear program. Once we cast a problem as a
polynomial‐sized linear program, we can solve it in polynomial time
by the ellipsoid algorithm or interior‐point methods. Several linear‐
programming software packages can solve problems efficiently, so
that once the problem is in the form of a linear program, such a pack‐
age can solve it.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۴ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬
We express the maximum‐flow problem as a linear program

Now, we consider the important problem of maximizing the flow of a


material through a transportation network (pipeline system, commu‐
nication system, electrical distribution system, and so on). We will
assume that the transportation network in question can be repre‐
sented by a connected weighted digraph (directed graph) with n ver‐
tices numbered from 1 to n and a set of edges E , with the following
properties:

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۵ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬

k It contains exactly one vertex with no entering edges; this vertex


is called the source and assumed to be numbered 1.

k It contains exactly one vertex with no leaving edges; this vertex is


called the sink and assumed to be numbered n.

k The weight uij of each directed edge (i, j) is a positive integer,


called the edge capacity. (This number represents the upper bound
on the amount of the material that can be sent from i to j through a
link represented by this edge.)

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۶ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬

A digraph satisfying these properties is called a flow network or sim‐


ply a network.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۷ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬

It is assumed that the source and the sink are the only source and
destination of the material, respectively; all the other vertices can
serve only as points where a flow can be redirected without consum‐
ing or adding any amount of the material. In other words, the to‐
tal amount of the material entering an intermediate vertex must be
equal to the total amount of the material leaving the vertex. This
condition is called the flow‐conservation requirement.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۸ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬

If we denote the amount sent through edge (i, j) by xij , then for any in‐
termediate vertex i, the flow‐conservation requirement can be expressed
by the following equality constraint:

where the sums in the left‐ and right‐hand sides express the total inflow
and outflow entering and leaving vertex i, respectively.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۹ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬
Since no amount of the material can change by going through intermediate
vertices of the network, it stands to reason that the total amount of the
material leaving the source must end up at the sink. Thus, we have the
following equality:

This quantity, the total outflow from the source—or, equivalently, the
total inflow into the sink—is called the value of the flow. We denote it
by v . It is this quantity that we will want to maximize over all possible
flows in a network.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۱۰ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬

A (feasible) flow is an assignment of real numbers xij to edges (i, j)


of a given network that satisfy flow‐conservation constraints and the
capacity constraints 0 ≤ xij ≤ uij for every edge (i, j) ∈ E.

.‫ ﺑﻬﯿﻨﻪ ﻧﯿﺰ ﻫﺴﺖ‬،‫ ﺟﺮﯾﺎﻥ ﺷﺪﻧ ﻓﻮﻕ‬:‫ﺗﺬﮐﺮ‬

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۱۱ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬
LP ‫ﺗﺒﺪﯾﻞ ﻣﺴﺌﻠﮥ ﺟﺮﯾﺎﻥ ﺑﯿﺸﯿﻨﻪ ﺑﻪ ﻣﺴﺌﻠﮥ‬
The maximum‐flow problem can be stated formally as the following opti‐
mization problem:

We can solve the above linear programming problem by the simplex method
or by another algorithm for general linear programming problems.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۱۲ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬

maximize v = x12 + x14


subject to
x12 = x23 + x25
x23 + x43 = x36
x14 = x43
x25 = x56
0 ≤ x12 ≤ 2, 0 ≤ x14 ≤ 3, 0 ≤ x23 ≤ 5,
0 ≤ x25 ≤ 3, 0 ≤ x36 ≤ 2, 0 ≤ x43 ≤ 1,
0 ≤ x56 ≤ 4.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۱۳ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬

We can solve the above LP instance by the simplex method or by an‐


other algorithm for general LP problems. However, the special struc‐
ture of problem can be exploited to design faster algorithms. In par‐
ticular, it is quite natural to employ the iterative‐improvement idea
as follows. We can always start with the zero flow. Then, on each
iteration, we can try to find a path from source to sink along which
some additional flow can be sent. Such a path is called flow augment‐
ing. If a flow‐augmenting path is found, we adjust the flow along
the edges of this path to get a flow of an increased value and try to
find an augmenting path for the new flow. If no flow‐augmenting
path can be found, we conclude that the current flow is optimal. This
general template for solving the maximum‐flow problem is called the
augmenting‐path method, also known as the Ford‐Fulkerson method
after L. R. Ford, Jr., and D. R. Fulkerson, who discovered it.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۱۴ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬
The Maximum‐Flow Problem and the Ford‐Fulkerson Algorithm
(Kleinberg & Tardos, Section 7.1)

One often uses graphs to model transportation networks—networks


whose edges carry some sort of traffic and whose nodes act as
“switches” passing traffic between different edges. Consider, for ex‐
ample, a highway system in which the edges are highways and the
nodes are interchanges; or a computer network in which the edges
are links that can carry packets and the nodes are switches; or a fluid
network in which edges are pipes that carry liquid, and the nodes
are junctures where pipes are plugged together. Network models of
this type have several ingredients: capacities on the edges, indicating
how much they can carry; source nodes in the graph, which generate
traffic; sink (or destination) nodes in the graph, which can “absorb”
traffic as it arrives; and finally, the traffic itself, which is transmitted
across the edges.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۱۵ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬

Flow Networks: Formally, we’ll say that a flow network is a directed


graph G = (V, E) with the following features.

k Associated with each edge e is a capacity, which is a nonnegative


number that we denote ce .

k There is a single source node s ∈V.

k There is a single sink node t ∈V.

Nodes other than s and t will be called internal nodes.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۱۶ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬
We will make three assumptions about the flow networks we deal with:
first, that no edge enters the source s and no edge leaves the sink t; sec‐
ond, that there is at least one edge incident to each node; and third, that
all capacities are integers. These assumptions make things cleaner to think
about, and while they eliminate a few pathologies, they preserve essen‐
tially all the issues we want to think about.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۱۷ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬
Defining Flow: Next we define what it means for our network to carry
traffic, or flow. We say that an s‐t flow is a function f that maps each edge
e to a nonnegative real number, f : E 7→ R+ ; the value f (e) intuitively
represents the amount of flow carried by edge e. A flow f must satisfy the
following two properties.

k (i) (Capacity conditions) For each e ∈ E , we have 0 ≤ f (e) ≤ ce .

k (ii) (Conservation conditions) For each node v other than s and t, we


have ∑ ∑
f (e) = f (e).
e into v e out of v

Here e into v f (e) sums the flow value f (e) over all edges entering node

v , while e out of v f (e) is the sum of flow values over all edges leaving
node v .

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۱۸ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬
Thus the flow on an edge cannot exceed the capacity of the edge. For every
node other than the source and the sink, the amount of flow entering must
equal the amount of flow leaving. The source has no entering edges (by our
assumption), but it is allowed to have flow going out; in other words, it can
generate flow. Symmetrically, the sink is allowed to have flow coming in,
even though it has no edges leaving it. The value of a flow f , denoted v(f ),
is defined to be the amount of flow generated at the source:

v(f ) = f (e).
e out of s

To make the notation more compact, we define f out (v) = e out of v f (e)

and f in (v) = e into v f (e). In this terminology, the conservation con‐
dition for nodes v 6= s, t becomes f in (v) = f out (v); and we can write
v(f ) = f out (s).

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۱۹ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬
The Maximum‐Flow Problem: Given a flow network, a natural goal is to
arrange the traffic so as to make as efficient use as possible of the avail‐
able capacity. Thus the basic algorithmic problem we will consider is the
following: Given a flow network, find a flow of maximum possible value.

A greedy approach:

Suppose we start with zero flow: f (e) = 0 for all e. Clearly this respects
the capacity and conservation conditions; the problem is that its value is
0. We now try to increase the value of f by “pushing” flow along a path
from s to t, up to the limits imposed by the edge capacities.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۲۰ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬

{(s, u), (u, v), (v, t)}


We increase the flow on each of these edges to 20, and leave f (e) = 0
for the other two.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۲۱ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬

In this way, we still respect the capacity conditions—since we only set


the flow as high as the edge capacities would allow—and the conser‐
vation conditions— since when we increase flow on an edge enter‐
ing an internal node, we also increase it on an edge leaving the node.
Now, the value of our flow is 20, and we can ask: Is this the maximum
possible for the graph in the figure? If we think about it, we see that
the answer is no, since it is possible to construct a flow of value 30.
The problem is that we’re now stuck—there is no s‐t path on which
we can directly push flow without exceeding some capacity—and yet
we do not have a maximum flow. What we need is a more general
way of pushing flow from s to t, so that in a situation such as this, we
have a way to increase the value of the current flow.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۲۲ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬

This is a more general way of pushing flow: We can push forward on


edges with leftover capacity, and we can push backward on edges
that are already carrying flow, to divert it in a different direction. We
now define the residual graph, which provides a systematic way to
search for forward‐backward operations such as this.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۲۳ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬
The Residual Graph: Given a flow network G, and a flow f on G, we define
the residual graph Gf of G with respect to f as follows.

k The node set of Gf is the same as that of G.

k For each edge e = (u, v) of G on which f (e) < ce , there are ce − f (e)
“leftover” units of capacity on which we could try pushing flow forward.
So we include the edge e = (u, v) in Gf , with a capacity of ce − f (e).
We will call edges included this way forward edges.

k For each edge e = (u, v) of G on which f (e) > 0, there are f (e) units
of flow that we can “undo” if we want to, by pushing flow backward. So
we include the edge e′ = (v, u) in Gf , with a capacity of f (e). Note that
e′ has the same ends as e, but its direction is reversed; we will call edges
included this way backward edges.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ ‪۲۴‬‬

‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ ‪۴۰۳۱‬‬ ‫‪IUT ‐ ECE ‐ H. Falsafain‬‬


۲۵ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬

Note that each edge e in G can give rise to one or two edges in Gf : If 0 <
f (e) < ce it results in both a forward edge and a backward edge being
included in Gf . Thus Gf has at most twice as many edges as G. We will
sometimes refer to the capacity of an edge in the residual graph as a residual
capacity, to help distinguish it from the capacity of the corresponding edge
in the original flow network G.

Augmenting Paths in a Residual Graph: Now we want to make precise


the way in which we push flow from s to t in Gf . Let P be a simple s‐
t path in Gf —that is, P does not visit any node more than once. We
define bottleneck(P, f ) to be the minimum residual capacity of any
edge on P , with respect to the flow f . We now define the following
operation augment(f, P ), which yields a new flow f ′ in G.

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


۲۶ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬

We often refer to any s‐t path in the residual graph as an augmenting path.
The result of augment(f, P ) is a new flow f ′ in G, obtained by increasing
and decreasing the flow values on edges of P .
Fact: f ′ is indeed a flow in G. (The proof is omitted.)

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ ‪۲۷‬‬

‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ ‪۴۰۳۱‬‬ ‫‪IUT ‐ ECE ‐ H. Falsafain‬‬


۲۸ ‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ‬
The Ford‐Fulkerson algorithm

The Ford‐Fulkerson algorithm is really quite simple. What is not at all clear
is whether its central While loop terminates, and whether the flow re‐
turned is a maximum flow.
(Surprisingly, the final flow always turns out to be maximal, irrespective of
a sequence of augmenting paths.)

۴۰۳۱ ‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ‬ IUT ‐ ECE ‐ H. Falsafain


‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ ‪۲۹‬‬
‫)‪Example (Kleinberg & Tardos‬‬

‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ ‪۴۰۳۱‬‬ ‫‪IUT ‐ ECE ‐ H. Falsafain‬‬


‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ ‪۳۰‬‬
‫)‪Example (CLRS‬‬

‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ ‪۴۰۳۱‬‬ ‫‪IUT ‐ ECE ‐ H. Falsafain‬‬


‫ﻣﺴﺌﻠﮥ ﺷﺎﺭﮤ ﺑﯿﺸﯿﻨﻪ ⁃ ﺍﺳﻼﯾﺪ ﺷﻤﺎﺭﮤ ‪۳۱‬‬
‫‪Example (CLRS) continued‬‬

‫ﺩﺍﻧﺸ ﺎﻩ ﺻﻨﻌﺘ ﺍﺻﻔﻬﺎﻥ ⁃ ﻧﯿﻢﺳﺎﻝ ﺗﺤﺼﯿﻠ ‪۴۰۳۱‬‬ ‫‪IUT ‐ ECE ‐ H. Falsafain‬‬

You might also like