0% found this document useful (0 votes)
353 views

Network Flow Problems

Uploaded by

Udit Jethva
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)
353 views

Network Flow Problems

Uploaded by

Udit Jethva
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/ 183

ISyE/Math/CS/Stat 525

Linear Optimization

7. Network flow problems

Prof. Alberto Del Pia


University of Wisconsin-Madison

Based on the book Introduction to Linear Optimization by D. Bertsimas and J.N. Tsitsiklis
Outline

▶ Network flow problems are the most frequently solved LP


problems. They include as special cases:
▶ The assignment problem,
▶ The transportation problem,
▶ The maximum flow problem,
▶ The shortest path problem.
▶ They arise naturally in the analysis and design of
communication, transportation, and logistics networks, as well
as in many other contexts.
Outline

▶ The network flow problem is a special case of LP, and any


algorithm for LP can be directly applied.
▶ On the other hand, network flow problems have a special
structure which results in:
▶ Substantial simplification of general methods
(e.g., of the simplex method),
▶ New, special purpose, methods.
▶ We will study a primal method for network flow problems.
▶ These methods maintain and keep improving a primal feasible
solution.
Outline

Sec. 7.1 Brief introduction to graphs.


Sec. 7.2 We provide a formulation of the network flow problem.
Sec. 7.3 We develop the network simplex algorithm.
7.1 Graphs
Undirected graphs
Undirected graphs

▶ An undirected graph G = (N , E) consists of:


▶ a set N of nodes and
▶ a set E of edges.
▶ An edge is an unordered pair of distinct nodes, that is, a
two-element subset {i, j} of N .
▶ We often denote n = |N | and m = |E|.
Undirected graphs

Example: An undirected graph G = (N , E) with

N = {1, 2, 3, 4, 5},
E = {{1, 2}, {1, 3}, {2, 3}, {1, 4}, {3, 4}, {3, 5}}.
Undirected graphs

▶ {i, j} = {j, i}.


▶ “Self-edges” like {i, i} are not allowed.
▶ We say that the edge {i, j} is incident to nodes i and j, and
these nodes are called the endnodes of the edge.
Undirected graphs

▶ The degree of a node is the number of edges incident to


that node.
▶ The degree of an undirected graph is defined as the
maximum of the degrees of its nodes.
Undirected graphs

▶ A walk from node i1 to node it in an undirected graph is a


finite sequence of nodes

i1 , i2 , . . . , it

such that {ik , ik+1 } ∈ E, for k = 1, 2, . . . , t − 1.


▶ A walk is called a path if it has no repeated nodes.
▶ An undirected graph is connected if for every two distinct
nodes i, j ∈ N , there exists a path from i to j.
Undirected graphs

▶ A cycle is a walk i1 , i2 , . . . , it such that


▶ the nodes i1 , . . . , it−1 are distinct,
▶ it = i1 , and
▶ the number t − 1 of distinct nodes is at least 3.
▶ This is in order to exclude a walk of the form i, j, i, where
the same edge {i, j} is traversed back and forth.
Directed graphs
Directed graphs

▶ A directed graph G = (N , A) consists of


▶ a set N of nodes and
▶ a set A of arcs.
▶ An arc is an ordered pair (i, j) of distinct nodes.
▶ Both (i, j) and (j, i) can be elements of A.
▶ Self-arcs like (i, i) are not allowed.
▶ We denote n = |N | and m = |A|.
Directed graphs

Example: A directed graph G = (N , A) with

N = {1, 2, 3, 4, 5},
A = {(1, 2), (2, 1), (1, 3), (3, 2), (1, 4), (4, 3), (3, 5)}.
Directed graphs

▶ For any arc (i, j), we say that i is the tail and j is the head.
▶ The arc (i, j) is said to be leaving from node i, entering to
node j, and incident to both i and j.
Directed graphs

▶ We define δ in (i) as the set of tails of arcs that are entering


to node i:
δ in (i) = {j ∈ N | (j, i) ∈ A}.
▶ We define δ out (i) as the set of heads of arcs that are leaving
from node i:

δ out (i) = {j ∈ N | (i, j) ∈ A}.


Directed graphs

▶ Starting from a directed graph, we can construct a


corresponding undirected graph by ignoring the direction of
the arcs and by deleting repeated edges.
Directed graphs

▶ One possible interpretation:


▶ In an arc, flow or movement is permitted only from the tail
to the head.
▶ In an edge, flow or movement is permitted in both
directions.
▶ We say that a directed graph is connected if the resulting
undirected graph is connected.
Directed graphs

A walk is defined as a sequence of nodes

i1 , i2 , . . . , it ,

together with an associated sequence a1 , . . . , at−1 of arcs such


that for k = 1, . . . , t − 1, we have either
▶ ak = (ik , ik+1 ), in which case ak is a forward arc, or
▶ ak = (ik+1 , ik ), in which case ak is a backward arc.
Directed graphs

▶ Note that if ik and ik+1 are consecutive nodes in a walk and


if (ik , ik+1 ) and (ik+1 , ik ) are both arcs of the underlying
directed graph, then either arc can be used in the walk.
▶ The reason for including the arcs ak in the definition of a
walk is precisely to avoid such ambiguities.
Directed graphs

▶ A path is a walk with all nodes i1 , . . . , it distinct.


▶ A cycle is a walk with all nodes i1 , . . . , it−1 distinct and
it = i1 .
▶ Note that we allow a cycle to consist of only two distinct
nodes (in contrast to our definition for the case of
undirected graphs).
▶ A walk, path, or cycle is said to be directed if it only
contains forward arcs.
Trees
Trees

▶ An undirected graph G = (N , E) is called a tree if it is


connected and has no cycles.
▶ If a node of a tree has degree equal to 1, it is called a leaf.
Trees
Theorem 7.1
(a) Every tree with more than one node has at least one
leaf.
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.
(c) For any two distinct nodes i and j in a tree, there exists
a unique path from i to j.
(d) If we start with a tree and add a new edge, the
resulting graph contains exactly one cycle (as long as
we do not distinguish between cycles involving the
same set of nodes).

Let’s see how to prove it!


Trees

Theorem 7.1
(a) Every tree with more than one node has at least one
leaf.

Proof idea:
▶ Assume by contradiction that there is no leaf. Then every
node has degree at least 2.

1bc
Trees

Theorem 7.1
(a) Every tree with more than one node has at least one
leaf.

Proof idea:
▶ Assume by contradiction that there is no leaf. Then every
node has degree at least 2.

1bc 2bc
Trees

Theorem 7.1
(a) Every tree with more than one node has at least one
leaf.

Proof idea:
▶ Assume by contradiction that there is no leaf. Then every
node has degree at least 2.

1bc 2bc 3bc


Trees

Theorem 7.1
(a) Every tree with more than one node has at least one
leaf.

Proof idea:
▶ Assume by contradiction that there is no leaf. Then every
node has degree at least 2.

1bc 2bc 3bc nbc


Trees

Theorem 7.1
(a) Every tree with more than one node has at least one
leaf.

Proof idea:
▶ Assume by contradiction that there is no leaf. Then every
node has degree at least 2.

1bc 2bc 3bc nbc


Trees

Theorem 7.1
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.

Proof idea: “⇒”


▶ By induction on the number of nodes, and using part (a).

rest of the graph jbc ibc


Trees

Theorem 7.1
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.

Proof idea: “⇒”


▶ By induction on the number of nodes, and using part (a).

rest of the graph jbc


Trees

Theorem 7.1
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.

Proof idea: “⇒”


▶ By induction on the number of nodes, and using part (a).

tree jbc
Trees

Theorem 7.1
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.

Proof idea: “⇒”


▶ By induction on the number of nodes, and using part (a).

|N | − 2 edges jbc
Trees

Theorem 7.1
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.

Proof idea: “⇒”


▶ By induction on the number of nodes, and using part (a).

|N | − 2 edges jbc ibc


Trees

Theorem 7.1
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.

Proof idea: “⇐”


▶ Select a cycle of G and remove from it an edge. Repeat.
Then use “⇒”.
1bc 4bc
6bc
3bc

5bc
2bc
8bc

7bc
Trees

Theorem 7.1
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.

Proof idea: “⇐”


▶ Select a cycle of G and remove from it an edge. Repeat.
Then use “⇒”.
1bc 4bc
6bc
3bc

5bc
2bc
8bc

7bc
Trees

Theorem 7.1
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.

Proof idea: “⇐”


▶ Select a cycle of G and remove from it an edge. Repeat.
Then use “⇒”.
1bc 4bc
6bc
3bc

5bc
2bc
8bc

7bc
Trees

Theorem 7.1
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.

Proof idea: “⇐”


▶ Select a cycle of G and remove from it an edge. Repeat.
Then use “⇒”.
1bc 4bc
6bc
3bc

5bc
2bc
8bc

7bc
Trees

Theorem 7.1
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.

Proof idea: “⇐”


▶ Select a cycle of G and remove from it an edge. Repeat.
Then use “⇒”.
1bc 4bc
6bc
3bc

5bc
2bc
8bc

7bc
Trees

Theorem 7.1
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.

Proof idea: “⇐”


▶ Select a cycle of G and remove from it an edge. Repeat.
Then use “⇒”.
1bc 4bc
6bc
3bc

5bc
2bc
8bc

7bc
Trees

Theorem 7.1
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.

Proof idea: “⇐”


▶ Select a cycle of G and remove from it an edge. Repeat.
Then use “⇒”.
1bc 4bc
6bc
3bc

5bc
2bc
8bc

7bc
Trees

Theorem 7.1
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.

Proof idea: “⇐”


▶ Select a cycle of G and remove from it an edge. Repeat.
Then use “⇒”.
1bc 4bc
6bc
3bc

5bc
2bc
8bc

7bc
Trees

Theorem 7.1
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.

Proof idea: “⇐”


▶ Select a cycle of G and remove from it an edge. Repeat.
Then use “⇒”.
1bc 4bc
6bc
3bc

5bc
2bc
8bc

7bc
Trees

Theorem 7.1
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.

Proof idea: “⇐”


▶ Select a cycle of G and remove from it an edge. Repeat.
Then use “⇒”.
1bc 4bc
6bc
3bc

5bc
2bc
8bc

7bc
Trees

Theorem 7.1
(b) An undirected graph is a tree if and only if it is
connected and has |N | − 1 edges.

Proof idea: “⇐”


▶ Select a cycle of G and remove from it an edge. Repeat.
Then use “⇒”.
1bc 4bc
6bc
3bc

5bc
2bc
8bc

7bc
Trees

Theorem 7.1
(c) For any two distinct nodes i and j in a tree, there exists
a unique path from i to j.

Proof idea:
▶ By contradiction.

bc bc

ibc bc jbc
Trees

Theorem 7.1
(c) For any two distinct nodes i and j in a tree, there exists
a unique path from i to j.

Proof idea:
▶ By contradiction.

bc bc

ibc bc jbc

bc bc
Trees

Theorem 7.1
(c) For any two distinct nodes i and j in a tree, there exists
a unique path from i to j.

Proof idea:
▶ By contradiction.

bc bc

bc jbc

bc bc
Trees

Theorem 7.1
(d) If we start with a tree and add a new edge, the
resulting graph contains exactly one cycle.

Proof idea:
▶ Add an edge to a tree and use part (c).

1bc 4bc
6bc
3bc

5bc
2bc
8bc

7bc
Trees

Theorem 7.1
(d) If we start with a tree and add a new edge, the
resulting graph contains exactly one cycle.

Proof idea:
▶ Add an edge to a tree and use part (c).

1bc 4bc
6bc
3bc

5bc
2bc
8bc

7bc
7.2 Formulation of the network flow problem
Formulation of the network flow problem

A network is a directed graph G = (N , A) together with some


additional numerical information:
▶ Supply:
bi ∈ R ∀i ∈ N .
▶ Capacity:

uij ∈ R≥0 ∪ {∞} ∀(i, j) ∈ A.

▶ Cost per unit of flow:

cij ∈ R ∀(i, j) ∈ A.
Formulation of the network flow problem

▶ We visualize a network by thinking of some material that


flows on each arc.
▶ We use fij to denote the amount of flow through arc (i, j).
Formulation of the network flow problem

▶ We visualize a network by thinking of some material that


flows on each arc.
▶ We use fij to denote the amount of flow through arc (i, j).
▶ The supply bi is interpreted as the amount of flow that
enters the network from the outside, at node i.
▶ If bi < 0, then the quantity |bi | is called the demand at
node i.
▶ Node i is called a source if bi > 0, and a sink if bi < 0.
Formulation of the network flow problem
▶ We impose the following conditions on the flow variables fij ,
(i, j) ∈ A:
∑ ∑
bi + fji = fij ∀i ∈ N (i)
j∈δ in (i) j∈δ out (i)

0 ≤ fij ≤ uij ∀(i, j) ∈ A. (ii)

▶ Equation (i) is a flow conservation law: it states that the


amount of flow into a node i must be equal to the total
flow out of that node.
▶ Equation (ii) requires that the flow through an arc must be
nonnegative and cannot exceed the capacity of the arc.
Formulation of the network flow problem
▶ We impose the following conditions on the flow variables fij ,
(i, j) ∈ A:
∑ ∑
bi + fji = fij ∀i ∈ N (i)
j∈δ in (i) j∈δ out (i)

0 ≤ fij ≤ uij ∀(i, j) ∈ A. (ii)

▶ Any vector with components fij , (i, j) ∈ A, will be called a


flow.
▶ If it also satisfies the constraints (i)–(ii), it will be called a
feasible flow.
Formulation of the network flow problem
▶ We impose the following conditions on the flow variables fij ,
(i, j) ∈ A:
∑ ∑
bi + fji = fij ∀i ∈ N (i)
j∈δ in (i) j∈δ out (i)

0 ≤ fij ≤ uij ∀(i, j) ∈ A. (ii)

▶ By summing both sides of Eq. (i) over all i ∈ N , we obtain



bi = 0.
i∈N

▶ This means that the total flow from the outside into the
network (at the sources) must be equal to the total flow
from the network to the outside (at the sinks).
Formulation of the network flow problem
▶ We impose the following conditions on the flow variables fij ,
(i, j) ∈ A:
∑ ∑
bi + fji = fij ∀i ∈ N (i)
j∈δ in (i) j∈δ out (i)

0 ≤ fij ≤ uij ∀(i, j) ∈ A. (ii)

▶ From now on, we will always assume that



bi = 0.
i∈N

▶ Otherwise no flow vector could satisfy the flow conservation


constraints, and we would have an infeasible problem.
Formulation of the network flow problem
▶ We impose the following conditions on the flow variables fij ,
(i, j) ∈ A:
∑ ∑
bi + fji = fij ∀i ∈ N (i)
j∈δ in (i) j∈δ out (i)

0 ≤ fij ≤ uij ∀(i, j) ∈ A. (ii)

▶ The general minimum cost network flow problem deals with


the minimization of a linear cost function of the form

cij fij ,
(i,j)∈A

over all feasible flows.


▶ We observe that this is a LP problem.
Formulation of the network flow problem
▶ We impose the following conditions on the flow variables fij ,
(i, j) ∈ A:
∑ ∑
bi + fji = fij ∀i ∈ N (i)
j∈δ in (i) j∈δ out (i)

0 ≤ fij ≤ uij ∀(i, j) ∈ A. (ii)

▶ If uij = ∞ for all (i, j) ∈ A, we say that the problem is


uncapacitated; otherwise, we say that it is capacitated.
▶ Note that in the uncapacitated case, we only have equality
and nonnegativity constraints, and the problem is in
standard form.
A concise formulation
A concise formulation

▶ We now discuss how to rewrite the network flow problem


using a concise matrix-vector notation.
▶ We assume that N = {1, . . . , n} and we let m be the number
of arcs.
▶ Let us fix a particular ordering of the arcs, and let f be the
vector of flows that results when the components fij are
ordered accordingly.
A concise formulation

We define the node-arc incidence matrix A as follows:


▶ Its dimensions are n × m. Each row corresponds to a node
and each column to an arc.
▶ Its entry aik is associated with the ith node and the kth arc:


1, if i is the tail of the kth arc,
aik = −1, if i is the head of the kth arc,


0, otherwise.

▶ Thus, every column of A has exactly two nonzero entries, one


equal to +1, and one equal to −1, indicating the tail and the
head of the corresponding arc.
Example 7.1

▶ Ordering of arcs: (1, 2), (2, 1), (3, 2), (4, 3), (1, 4), (1, 3), (3, 5).
▶ The corresponding node-arc incidence matrix is

(1,2) (2,1) (3,2) (4,3) (1,4) (1,3) (3,5)


 
1 1 −1 0 0 1 1 0
2  −1 1 −1 0 0 0 0 
 
A=  0 0 1 −1 0 −1 1 .
3  
4  0 0 0 1 −1 0 0 
5 0 0 0 0 0 0 −1
A concise formulation
▶ We now focus on the ith row of A, denoted by a′i . This is the
row associated with node i.
▶ Nonzero entries indicate the arcs that are incident to node i:
▶ +1 if the arc is leaving node i,
▶ −1 if the arc is entering node i.
A concise formulation
▶ We now focus on the ith row of A, denoted by a′i . This is the
row associated with node i.
▶ Nonzero entries indicate the arcs that are incident to node i:
▶ +1 if the arc is leaving node i,
▶ −1 if the arc is entering node i.
▶ Thus, ∑ ∑
a′i f = fij − fji .
j∈δ out (i) j∈δ in (i)
▶ The flow conservation constraint at node i can be written as
∑ ∑
bi + fji = fij ⇔ a′i f = bi .
j∈δ in (i) j∈δ out (i)
A concise formulation
▶ We now focus on the ith row of A, denoted by a′i . This is the
row associated with node i.
▶ Nonzero entries indicate the arcs that are incident to node i:
▶ +1 if the arc is leaving node i,
▶ −1 if the arc is entering node i.
▶ Thus, ∑ ∑
a′i f = fij − fji .
j∈δ out (i) j∈δ in (i)
▶ The flow conservation constraint at node i can be written as
∑ ∑
bi + fji = fij ⇔ a′i f = bi .
j∈δ in (i) j∈δ out (i)

▶ The system of all flow conservation constraints can then be


written in matrix notation:
Af = b,
where b is the vector (b1 , . . . , bn ).
A concise formulation

▶ We observe that the sum of the rows of A is equal to the zero


vector. Why?
▶ In particular, the rows of A are linearly dependent.
▶ Thus, the matrix A violates one of the basic assumptions
underlying our development of the simplex method.
▶ As discussed in Chapter 2 (cf. Theorem 2.5 in Section 2.3),
either the problem is infeasible or we can remove some of the
equality constraints, without affecting the feasible set, so that
the remaining constraints are linearly independent.
Circulations
Circulations

▶ We introduce some elementary concepts that are central to


many network flow algorithms.
▶ Any flow vector f (feasible or infeasible) that satisfies

Af = 0,

is called a circulation.
▶ Intuitively, we have flow conservation within the network and
zero external supply or demand, which means that the flow
“circulates” inside the network.
Circulations

▶ Let us now consider a cycle C.


▶ We let F and B be the set of forward and backward arcs of
the cycle, respectively.
▶ In the example, we have

F = {(1, 2), (2, 3), (4, 5)},


B = {(4, 3), (1, 5)}.
Circulations

▶ The flow vector hC with components




1 if (i, j) ∈ F
C
hij = −1 if (i, j) ∈ B


0 otherwise.

is called the simple circulation associated with the cycle C.


Circulations

▶ It is easily seen that hC satisfies AhC = 0, and is indeed a


circulation.
▶ The reason is that any two consecutive arcs on the cycle
are:
▶ either similarly oriented and carry the same amount of flow,
▶ or they have the opposite orientation and the sum of the
flows that they carry is equal to 0.
▶ In either case, we have a′i hC = 0 for every node i.
Circulations

▶ If f is a flow vector, C is a cycle, and θ is a scalar, we say


that the flow vector f + θhC is obtained from f by pushing θ
units of flow around the cycle C.
▶ Note that, if f satisfies the flow conservation constraints,
then so does f + θhC :

A(f + θhC ) = Af + θ · AhC = b + 0 = b.


Circulations

▶ We finally define the cost of a cycle C to be equal to


∑ ∑
c′ hC = cij − cij .
(i,j)∈F (i,j)∈B

▶ The resulting cost change from flow f to f + θhC is:

c′ (f + θhC ) − c′ f = c′ f + c′ (θhC ) − c′ f = θ · c′ hC .
7.3 The network simplex algorithm
The network simplex algorithm
▶ In this section, we develop the details of the simplex method,
as applied to the uncapacitated network flow problem

minimize c′ f
subject to Af = b
f ≥ 0,

where A is the node-arc incidence matrix of a directed graph


G = (N , A).
▶ The network simplex algorithm is widely used in practice, and
is included in many commercial optimization codes, due to its
simplicity and efficiency.
▶ In particular, it tends to run an order of magnitude faster than
a general purpose simplex code applied to a network flow
problem.
The network simplex algorithm

minimize c′ f
subject to Af = b
f≥0

▶ Due to our restriction to uncapacitated problems, we are


dealing with a LP problem in standard form.
▶ We let n and m be the number of nodes and arcs of G,
respectively.
▶ We therefore have
▶ n equality constraints and
▶ m flow variables.
▶ Unfortunately, this is the exact opposite of the notational
conventions used in earlier chapters.
The network simplex algorithm

▶ Throughout this section, the following assumption will be in


effect.

Assumption 7.1

(a) We have i∈N bi = 0.
(b) The graph G is connected.

▶ Part (a) of this assumption is natural, because otherwise the


problem is infeasible.
▶ Part (b) is also natural, because if the graph is not connected,
then the problem can be decomposed into subproblems that
can be treated independently.
The network simplex algorithm

▶ As noted in Section 7.2, the rows of the matrix A sum to the


zero vector and are therefore linearly dependent.
▶ From Assumption 7.1, also the entries of the vector b sum to
zero.
▶ Thus, the flow conservation constraint at any node coincides
with the sum of the flow conservation constraints at all the
other nodes.
▶ Therefore, one flow conservation constraint can be omitted
without affecting the feasible set.
▶ We omit the last one: the flow conservation at node n.
The network simplex algorithm

Let us define the truncated node-arc incidence matrix à to be the


matrix of dimensions (n − 1) × m, which consists of the first n − 1
rows of the matrix A.
▶ Any column of à that corresponds to an arc of the form (i, n)
has a single nonzero entry, equal to 1, at the ith row.
▶ Any column of à that corresponds to an arc of the form (n, i)
has a single nonzero entry, equal to −1, at the ith row.
▶ All other columns of à have two nonzero entries.
The network simplex algorithm

▶ Similarly, let b̃ = (b1 , . . . , bn−1 ).


▶ We replace the original equality constraint

Af = b

by the constraint
Ãf = b̃.
▶ We will see shortly that under Assumption 7.1, the matrix Ã
has linearly independent rows.
Example 7.2
▶ Consider the node-arc incidence matrix A in Example 7.1.

(1,2) (2,1) (3,2) (4,3) (1,4) (1,3) (3,5)


 
1 1 −1 0 0 1 1 0
2  −1 1 −1 0 0 0 0 
 
A=  0 0 1 −1 0 −1 1 .
3  
4  0 0 0 1 −1 0 0 
5 0 0 0 0 0 0 −1

▶ The associated matrix à is given by

(1,2) (2,1) (3,2) (4,3) (1,4) (1,3) (3,5)


 
1 1 −1 0 0 1 1 0
2  −1 1 −1 0 0 0 0 
à =  .
3  0 0 1 −1 0 −1 1 
4 0 0 0 1 −1 0 0

▶ It can be verified that the matrix à has full rank.


Trees and basic feasible solutions
Trees and basic feasible solutions

We now introduce an important definition.

Definition 7.1
A flow vector f is called a tree solution if it can be constructed
by the following procedure.
(a) Pick a set T ⊂ A of n − 1 arcs that form a tree when
their direction is ignored.
(b) Let fij = 0 for every (i, j) ∈
/ T.
(c) Use the flow conservation equation Ãf = b̃ to determine
the flow variables fij , for (i, j) ∈ T.
A tree solution that also satisfies f ≥ 0, is called a feasible tree
solution.
Trees and basic feasible solutions

Step (c) in the above definition can be carried out using the
following systematic procedure.
(a) Call node n the root of the tree.
(b) Use the flow conservation equations to determine the flows on
the arcs incident to the leaves, and continue by proceeding
from the leaves towards the root.
Note that the existence of leaves follows from Theorem 7.1 (a).
Trees and basic feasible solutions

▶ This network has n = 8.


▶ The n − 1 arcs indicated by
hatched lines form a tree.
▶ The double arrows represent the
supply.
Trees and basic feasible solutions

▶ We set the arc flows outside the


tree to zero.
▶ We construct a tree solution using
our systematic procedure.
Trees and basic feasible solutions

▶ We set the arc flows outside the


tree to zero.
▶ We construct a tree solution using
our systematic procedure.
Trees and basic feasible solutions

▶ We set the arc flows outside the


tree to zero.
▶ We construct a tree solution using
our systematic procedure.
Trees and basic feasible solutions

▶ We set the arc flows outside the


tree to zero.
▶ We construct a tree solution using
our systematic procedure.
Trees and basic feasible solutions

▶ We set the arc flows outside the


tree to zero.
▶ We construct a tree solution using
our systematic procedure.
Trees and basic feasible solutions

▶ We set the arc flows outside the


tree to zero.
▶ We construct a tree solution using
our systematic procedure.
Trees and basic feasible solutions

▶ We set the arc flows outside the


tree to zero.
▶ We construct a tree solution using
our systematic procedure.
Trees and basic feasible solutions

▶ We set the arc flows outside the


tree to zero.
▶ We construct a tree solution using
our systematic procedure.
▶ We have obtained a feasible tree
solution.
Trees and basic feasible solutions
Once a tree is fixed, a corresponding tree solution is uniquely
determined.
Theorem 7.3
Let T ⊂ A be a set of n − 1 arcs that form a tree when their
direction is ignored. Then, the system of linear equations
Ãf = b̃, and fij = 0 for all (i, j) ∈
/ T, has a unique solution.

Proof idea: Form the submatrix B of à consisting of the columns that


correspond to the arcs of T. Reorder the nodes (rows) and the arcs
(columns) according to the order used in our systematic procedure.
(1, 2) (4, 3) (5, 6) (6, 7) (2, 3) (3, 8) (8, 6)
1
4
5
7
2
3
6
Trees and basic feasible solutions
Once a tree is fixed, a corresponding tree solution is uniquely
determined.
Theorem 7.3
Let T ⊂ A be a set of n − 1 arcs that form a tree when their
direction is ignored. Then, the system of linear equations
Ãf = b̃, and fij = 0 for all (i, j) ∈
/ T, has a unique solution.

Proof idea: Form the submatrix B of à consisting of the columns that


correspond to the arcs of T. Reorder the nodes (rows) and the arcs
(columns) according to the order used in our systematic procedure.
(1, 2) (4, 3) (5, 6) (6, 7) (2, 3) (3, 8) (8, 6)
1 1
4 0
5 0
7 0
2 −1
3 0
6 0
Trees and basic feasible solutions
Once a tree is fixed, a corresponding tree solution is uniquely
determined.
Theorem 7.3
Let T ⊂ A be a set of n − 1 arcs that form a tree when their
direction is ignored. Then, the system of linear equations
Ãf = b̃, and fij = 0 for all (i, j) ∈
/ T, has a unique solution.

Proof idea: Form the submatrix B of à consisting of the columns that


correspond to the arcs of T. Reorder the nodes (rows) and the arcs
(columns) according to the order used in our systematic procedure.
(1, 2) (4, 3) (5, 6) (6, 7) (2, 3) (3, 8) (8, 6)
1 1 0
4 0 1
5 0 0
7 0 0
2 −1 0
3 0 −1
6 0 0
Trees and basic feasible solutions
Once a tree is fixed, a corresponding tree solution is uniquely
determined.
Theorem 7.3
Let T ⊂ A be a set of n − 1 arcs that form a tree when their
direction is ignored. Then, the system of linear equations
Ãf = b̃, and fij = 0 for all (i, j) ∈
/ T, has a unique solution.

Proof idea: Form the submatrix B of à consisting of the columns that


correspond to the arcs of T. Reorder the nodes (rows) and the arcs
(columns) according to the order used in our systematic procedure.
(1, 2) (4, 3) (5, 6) (6, 7) (2, 3) (3, 8) (8, 6)
1 1 0 0
4 0 1 0
5 0 0 1
7 0 0 0
2 −1 0 0
3 0 −1 0
6 0 0 −1
Trees and basic feasible solutions
Once a tree is fixed, a corresponding tree solution is uniquely
determined.
Theorem 7.3
Let T ⊂ A be a set of n − 1 arcs that form a tree when their
direction is ignored. Then, the system of linear equations
Ãf = b̃, and fij = 0 for all (i, j) ∈
/ T, has a unique solution.

Proof idea: Form the submatrix B of à consisting of the columns that


correspond to the arcs of T. Reorder the nodes (rows) and the arcs
(columns) according to the order used in our systematic procedure.
(1, 2) (4, 3) (5, 6) (6, 7) (2, 3) (3, 8) (8, 6)
1 1 0 0 0
4 0 1 0 0
5 0 0 1 0
7 0 0 0 −1
2 −1 0 0 0
3 0 −1 0 0
6 0 0 −1 1
Trees and basic feasible solutions
Once a tree is fixed, a corresponding tree solution is uniquely
determined.
Theorem 7.3
Let T ⊂ A be a set of n − 1 arcs that form a tree when their
direction is ignored. Then, the system of linear equations
Ãf = b̃, and fij = 0 for all (i, j) ∈
/ T, has a unique solution.

Proof idea: Form the submatrix B of à consisting of the columns that


correspond to the arcs of T. Reorder the nodes (rows) and the arcs
(columns) according to the order used in our systematic procedure.
(1, 2) (4, 3) (5, 6) (6, 7) (2, 3) (3, 8) (8, 6)
1 1 0 0 0 0
4 0 1 0 0 0
5 0 0 1 0 0
7 0 0 0 −1 0
2 −1 0 0 0 1
3 0 −1 0 0 −1
6 0 0 −1 1 0
Trees and basic feasible solutions
Once a tree is fixed, a corresponding tree solution is uniquely
determined.
Theorem 7.3
Let T ⊂ A be a set of n − 1 arcs that form a tree when their
direction is ignored. Then, the system of linear equations
Ãf = b̃, and fij = 0 for all (i, j) ∈
/ T, has a unique solution.

Proof idea: Form the submatrix B of à consisting of the columns that


correspond to the arcs of T. Reorder the nodes (rows) and the arcs
(columns) according to the order used in our systematic procedure.
(1, 2) (4, 3) (5, 6) (6, 7) (2, 3) (3, 8) (8, 6)
1 1 0 0 0 0 0
4 0 1 0 0 0 0
5 0 0 1 0 0 0
7 0 0 0 −1 0 0
2 −1 0 0 0 1 0
3 0 −1 0 0 −1 1
6 0 0 −1 1 0 0
Trees and basic feasible solutions
Once a tree is fixed, a corresponding tree solution is uniquely
determined.
Theorem 7.3
Let T ⊂ A be a set of n − 1 arcs that form a tree when their
direction is ignored. Then, the system of linear equations
Ãf = b̃, and fij = 0 for all (i, j) ∈
/ T, has a unique solution.

Proof idea: Form the submatrix B of à consisting of the columns that


correspond to the arcs of T. Reorder the nodes (rows) and the arcs
(columns) according to the order used in our systematic procedure.
(1, 2) (4, 3) (5, 6) (6, 7) (2, 3) (3, 8) (8, 6)
1 1 0 0 0 0 0 0
4 0 1 0 0 0 0 0
5 0 0 1 0 0 0 0
7 0 0 0 −1 0 0 0
2 −1 0 0 0 1 0 0
3 0 −1 0 0 −1 1 0
6 0 0 −1 1 0 0 −1
Trees and basic feasible solutions
Once a tree is fixed, a corresponding tree solution is uniquely
determined.
Theorem 7.3
Let T ⊂ A be a set of n − 1 arcs that form a tree when their
direction is ignored. Then, the system of linear equations
Ãf = b̃, and fij = 0 for all (i, j) ∈
/ T, has a unique solution.

Corollary 7.1
If the graph G is connected, then the matrix à has linearly
independent rows.
Trees and basic feasible solutions
▶ With our construction of a tree solution, the columns of B are
the columns of à corresponding to the variables fij , for
(i, j) ∈ T, and are linearly independent.
▶ In general LP terminology, B is a basis matrix.
▶ Since the remaining variables fij , (i, j) ∈
/ T, are set to zero, the
resulting flow vector f is the basic solution corresponding to
this basis.
▶ Thus, a tree solution is a basic solution.
▶ And a feasible tree solution is a basic feasible solution.
Trees and basic feasible solutions
▶ With our construction of a tree solution, the columns of B are
the columns of à corresponding to the variables fij , for
(i, j) ∈ T, and are linearly independent.
▶ In general LP terminology, B is a basis matrix.
▶ Since the remaining variables fij , (i, j) ∈
/ T, are set to zero, the
resulting flow vector f is the basic solution corresponding to
this basis.
▶ Thus, a tree solution is a basic solution.
▶ And a feasible tree solution is a basic feasible solution.
▶ In fact, the converse is also true.

Theorem 7.4
A flow vector is a basic solution if and only if it is a tree
solution.

To prove Theorem 7.4 we need spanning trees.


Spanning trees

▶ Given a connected undirected graph G = (N , E), let E 1 be a


subset of E such that T = (N , E 1 ) is a tree.
▶ Such a tree is called a spanning tree.
Spanning trees
Theorem 7.2
Let G = (N , E) be a connected undirected graph and let E 0
be some subset of the set E of edges. Suppose that the
edges in E 0 do not form any cycles. Then, the set E 0 can
be augmented to a set E1 ⊇ E 0 so that (N , E1 ) is a
spanning tree.

Proof idea:
▶ Select a cycle of G and 1bc
remove from it an edge not
in E 0 .
▶ Repeat. 5bc 2bc
6bc

4bc 3bc
Spanning trees
Theorem 7.2
Let G = (N , E) be a connected undirected graph and let E 0
be some subset of the set E of edges. Suppose that the
edges in E 0 do not form any cycles. Then, the set E 0 can
be augmented to a set E1 ⊇ E 0 so that (N , E1 ) is a
spanning tree.

Proof idea:
▶ Select a cycle of G and 1bc
remove from it an edge not
in E 0 .
▶ Repeat. 5bc 2bc
6bc

4bc 3bc
Spanning trees
Theorem 7.2
Let G = (N , E) be a connected undirected graph and let E 0
be some subset of the set E of edges. Suppose that the
edges in E 0 do not form any cycles. Then, the set E 0 can
be augmented to a set E1 ⊇ E 0 so that (N , E1 ) is a
spanning tree.

Proof idea:
▶ Select a cycle of G and 1bc
remove from it an edge not
in E 0 .
▶ Repeat. 5bc 2bc
6bc

4bc 3bc
Spanning trees
Theorem 7.2
Let G = (N , E) be a connected undirected graph and let E 0
be some subset of the set E of edges. Suppose that the
edges in E 0 do not form any cycles. Then, the set E 0 can
be augmented to a set E1 ⊇ E 0 so that (N , E1 ) is a
spanning tree.

Proof idea:
▶ Select a cycle of G and 1bc
remove from it an edge not
in E 0 .
▶ Repeat. 5bc 2bc
6bc

4bc 3bc
Spanning trees
Theorem 7.2
Let G = (N , E) be a connected undirected graph and let E 0
be some subset of the set E of edges. Suppose that the
edges in E 0 do not form any cycles. Then, the set E 0 can
be augmented to a set E1 ⊇ E 0 so that (N , E1 ) is a
spanning tree.

Proof idea:
▶ Select a cycle of G and 1bc
remove from it an edge not
in E 0 .
▶ Repeat. 5bc 2bc
6bc

4bc 3bc
Spanning trees
Theorem 7.2
Let G = (N , E) be a connected undirected graph and let E 0
be some subset of the set E of edges. Suppose that the
edges in E 0 do not form any cycles. Then, the set E 0 can
be augmented to a set E1 ⊇ E 0 so that (N , E1 ) is a
spanning tree.

Proof idea:
▶ Select a cycle of G and 1bc
remove from it an edge not
in E 0 .
▶ Repeat. 5bc 2bc
6bc

4bc 3bc
Spanning trees
Theorem 7.2
Let G = (N , E) be a connected undirected graph and let E 0
be some subset of the set E of edges. Suppose that the
edges in E 0 do not form any cycles. Then, the set E 0 can
be augmented to a set E1 ⊇ E 0 so that (N , E1 ) is a
spanning tree.

Proof idea:
▶ Select a cycle of G and 1bc
remove from it an edge not
in E 0 .
▶ Repeat. 5bc 2bc
6bc

4bc 3bc
Spanning trees
Theorem 7.2
Let G = (N , E) be a connected undirected graph and let E 0
be some subset of the set E of edges. Suppose that the
edges in E 0 do not form any cycles. Then, the set E 0 can
be augmented to a set E1 ⊇ E 0 so that (N , E1 ) is a
spanning tree.

Proof idea:
▶ Select a cycle of G and 1bc
remove from it an edge not
in E 0 .
▶ Repeat. 5bc 2bc
6bc

4bc 3bc
Spanning trees
Theorem 7.2
Let G = (N , E) be a connected undirected graph and let E 0
be some subset of the set E of edges. Suppose that the
edges in E 0 do not form any cycles. Then, the set E 0 can
be augmented to a set E1 ⊇ E 0 so that (N , E1 ) is a
spanning tree.

Proof idea:
▶ Select a cycle of G and 1bc
remove from it an edge not
in E 0 .
▶ Repeat. 5bc 2bc
6bc

4bc 3bc
Spanning trees
Theorem 7.2
Let G = (N , E) be a connected undirected graph and let E 0
be some subset of the set E of edges. Suppose that the
edges in E 0 do not form any cycles. Then, the set E 0 can
be augmented to a set E1 ⊇ E 0 so that (N , E1 ) is a
spanning tree.

Proof idea:
▶ Select a cycle of G and 1bc
remove from it an edge not
in E 0 .
▶ Repeat. 5bc 2bc
6bc

4bc 3bc
Spanning trees
Theorem 7.2
Let G = (N , E) be a connected undirected graph and let E 0
be some subset of the set E of edges. Suppose that the
edges in E 0 do not form any cycles. Then, the set E 0 can
be augmented to a set E1 ⊇ E 0 so that (N , E1 ) is a
spanning tree.

Proof idea:
▶ Select a cycle of G and 1bc
remove from it an edge not
in E 0 .
▶ Repeat. 5bc 2bc
6bc

4bc 3bc
Spanning trees
Theorem 7.2
Let G = (N , E) be a connected undirected graph and let E 0
be some subset of the set E of edges. Suppose that the
edges in E 0 do not form any cycles. Then, the set E 0 can
be augmented to a set E1 ⊇ E 0 so that (N , E1 ) is a
spanning tree.

Proof idea:
▶ Select a cycle of G and 1bc
remove from it an edge not
in E 0 .
▶ Repeat. 5bc 2bc
6bc

4bc 3bc
Now let’s prove Theorem 7.4!
Trees and basic feasible solutions

To summarize our conclusions so far, we have established the


following:
(a) Basic (feasible) solutions are (feasible) tree solutions and vice
versa.
(b) Every basis matrix is triangular when its rows and columns are
suitably reordered.
(c) Given a basis matrix B, the vector of basic variables B−1 b̃,
can be easily computed, without the need to maintain B−1 in
a tableau.
Trees and basic feasible solutions

▶ As in the case of general LP problems, a basic feasible


solution can be degenerate.
▶ This happens if the flow on some arc (i, j) ∈ T turns out to be
0.
▶ In this case, the same basic feasible solution may correspond
to several trees.
Trees and basic feasible solutions

Example:
▶ The tree in the figure leads to a
degenerate basic feasible solution,
because f67 = 0.
▶ A different tree that would yield
the same basic feasible solution is
obtained by replacing arc (6, 7) by
arc (5, 7).
Change of basis
Change of basis

▶ We will now develop the mechanics of a change of basis.


▶ Recall that in a general LP problem, we
1. Choose a nonbasic variable that enters the basis,
2. Find how to adjust the basic variables in order to maintain the
equality constraints,
3. Increase the value of the entering variable until one of the old
basic variables is about to become negative.
Change of basis

▶ Picking a nonbasic variable is


the same as choosing an arc 5 2
5
jbc kbc
(i, j) that does not belong to T.

0 3
ibc

3
Change of basis

▶ Picking a nonbasic variable is


the same as choosing an arc 5 2
5
jbc kbc
(i, j) that does not belong to T.
▶ We wish to increase the value of
the nonbasic variable fij to some θ+0 3
θ. ibc

3
Change of basis

▶ Picking a nonbasic variable is


the same as choosing an arc 5 2
5−θ
jbc kbc
(i, j) that does not belong to T.
▶ We wish to increase the value of
the nonbasic variable fij to some θ+0 3−θ
θ. ibc
▶ The old basic variables need to 3
be adjusted in order not to
violate the flow conservation
constraints.
Change of basis

▶ By Theorem 7.1 (d), the arc


(i, j) together with some of the 5 2
5−θ
arcs in T form a cycle C. jbc kbc
▶ Let us choose the orientation of
the cycle so that (i, j) is a θ+0 3−θ
forward arc. ibc
▶ This flow change can be 3
accomplished by pushing θ units
of flow around the cycle.
Change of basis

▶ The new flow is given by

f̂ = f + θhC .

▶ Let F be the sets of forward arcs in C.


▶ Let B be the sets of backward arcs in C.
▶ The new flow variables f̂kℓ are given by


fkℓ + θ if (k, ℓ) ∈ F
f̂kℓ = fkℓ − θ if (k, ℓ) ∈ B


fkℓ otherwise.
Change of basis



fkℓ + θ if (k, ℓ) ∈ F
f̂kℓ = fkℓ − θ if (k, ℓ) ∈ B


fkℓ otherwise.
▶ We set θ as large as possible, provided that all arc flows
remain nonnegative.
▶ If B is empty, we let θ∗ = ∞.
▶ Otherwise, the largest possible value of θ is equal to

θ∗ = min fkℓ .
(k,ℓ)∈B

▶ A variable fkℓ that attains the minimum is set to zero and


exits the basis.
Change of basis

5 2
5−θ
jbc kbc
▶ In this example we set θ = 3.
θ+0 3−θ
ibc

3
Change of basis

5 2
5−3
jbc kbc
▶ In this example we set θ = 3.
3+0 3−3
ibc

3
Change of basis

5 2
2
jbc kbc
▶ In this example we set θ = 3.
▶ The variable fik exits the basis. 3 0
ibc

3
Change of basis
Change of basis

If f24 enters the basis:


▶ B = {(2,3)}.
▶ f23 exits the basis and θ∗ = 2.
Change of basis

If f14 enters the basis:


▶ B = {(2,3), (1,2)}.
▶ Either f12 or f23 exits the basis
and θ∗ = 2.
Change of basis

If f45 enters the basis:


▶ B = {(8,6), (3,8), (4,3)}.
▶ f86 exits the basis and θ∗ = 1.
Change of basis

If f57 enters the basis:


▶ B = {(6,7), (5,6)}.
▶ f67 exits the basis and θ∗ = 0.
Change of basis

If f57 enters the basis:


▶ B = {(6,7), (5,6)}.
▶ f67 exits the basis and θ∗ = 0.

▶ If fkℓ = 0 for some arc (k, ℓ) ∈ B, then the change of basis


occurs without any change of the arc flows.
▶ This can only happen if we start with a degenerate basic
feasible solution.
Calculation of the cost change
Calculation of the cost change

The cost change resulting from the change of basis f̂ = f + θ∗ hC


is:
 
∑ ∑
θ∗ · c′ hC = θ∗ ·  ckℓ − ckℓ  . (*)
(k,ℓ)∈F (k,ℓ)∈B

▶ Since we are minimizing the cost of the flow, the variable fij
should enter the basis only if the value of the expression (*)
is negative.
▶ From the development of the simplex method, we know
that if the variable that enters the basis takes the value θ∗ ,
then the cost changes by

θ∗ · (reduced cost of the entering variable).


Calculation of the cost change

The cost change resulting from the change of basis f̂ = f + θ∗ hC


is:
 
∑ ∑
θ∗ · c′ hC = θ∗ ·  ckℓ − ckℓ  . (*)
(k,ℓ)∈F (k,ℓ)∈B

▶ Comparing with (*), we see that the reduced cost c̄ij of a


nonbasic variable fij is given by
∑ ∑
c̄ij = c′ hC = ckℓ − ckℓ ,
(k,ℓ)∈F (k,ℓ)∈B

which is the cost of the cycle around which flow is being


pushed.
Calculation of the cost change

We will now derive an alternative formula for the reduced costs


that allows for more efficient computation.
▶ The general formula for determining the reduced costs is:

c̄′ = c′ − c′B B−1 Ã = c′ − p′ Ã.

▶ B is the current basis matrix,


▶ cB is the vector with the costs of the basic variables,
▶ p is the dual vector given by

p′ = c′B B−1 .

▶ The dimension of p is equal to the number of rows of Ã,


which is n − 1, and we have one dual variable pi associated
with each node i ̸= n.
Calculation of the cost change

c̄′ = c′ − p′ Ã.

Consider the component corresponding to an arc (i, j).


▶ The entries of the vectors c̄ and c are equal to c̄ij and cij ,
respectively.
▶ The entry of the vector p′ Ã is equal to the inner product of
p with the column of à corresponding to (i, j).
▶ This column has an entry equal to 1 at the ith row (if
i < n), and an entry equal to −1 at the jth row (if j < n).
Calculation of the cost change

c̄′ = c′ − p′ Ã.

▶ We conclude that


cij − (pi − pj ) if i, j ̸= n
c̄ij = cij − pi if j = n


cij + pj if i = n.

▶ This equation can be written more concisely if we define


pn = 0, in which case we have

c̄ij = cij − (pi − pj ) ∀(i, j) ∈ A.


Calculation of the cost change

c̄ij = cij − (pi − pj ) ∀(i, j) ∈ A.

It remains to compute the dual vector p associated with the


current basis.
▶ Since the reduced cost of every basic variable must be equal
to zero, we obtain the system of equations

pi − pj = cij ∀(i, j) ∈ T
pn = 0.
Calculation of the cost change

pi − pj = cij ∀(i, j) ∈ T
pn = 0.
▶ This system of equations is easily solved using the following
procedure.

1. We view node n as the root


of the tree and set pn = 0.
2. We then go down the tree,
proceeding from the root
towards the leaves, with a
new component of p being
evaluated at each step.
Calculation of the cost change

pi − pj = cij ∀(i, j) ∈ T
pn = 0.
▶ This system of equations is easily solved using the following
procedure.

Example: once pi is evaluated,


we can compute pj and pk :
▶ pi − pj = cij ⇔ pj = pi − cij ,
▶ pk −pi = cki ⇔ pk = pi +cki .
Overview of the algorithm
Overview of the algorithm

The simplex method for uncapacitated network flow


problems
1. A typical iteration starts with a basic feasible solution f
associated with a tree T.
2. To compute the dual vector p, solve the system of
equations
pi − pj = cij ∀(i, j) ∈ T,
pn = 0,
by proceeding from the root towards the leaves.
Overview of the algorithm

The simplex method for uncapacitated network flow


problems
3. Compute the reduced costs

c̄ij = cij − (pi − pj )

of all arcs (i, j) ∈


/ T. If they are all nonnegative, the
current basic feasible solution is optimal and the
algorithm terminates; else, choose some (i, j) with c̄ij < 0
to be brought into the basis.
4. The entering arc (i, j) and the arcs in T form a unique
cycle. If all arcs in the cycle are oriented the same way as
(i, j), then the optimal cost is −∞ and the algorithm
terminates.
Overview of the algorithm

The simplex method for uncapacitated network flow


problems
5. Let B be the set of arcs in the cycle that are oriented in
the opposite direction from (i, j). Let θ∗ = min(k,ℓ)∈B fkℓ ,
and push θ∗ units of flow around the cycle. A new flow
vector is determined by

 ∗
fkℓ + θ if (k, ℓ) ∈ F
f̂kℓ = fkℓ − θ∗ if (k, ℓ) ∈ B


fkℓ otherwise.

Remove from the basis one of the old basic variables


whose new value is equal to zero.
Example 7.3

▶ Consider the uncapacitated network


flow problem shown in the figure.
▶ The numbers next to each arc are the
corresponding costs.
Example 7.3

▶ The tree in the figure below


corresponds to a feasible tree solution.
▶ Arc (4, 3) forms a cycle consisting of
nodes 4, 3, and 5.
▶ The reduced cost c̄43 of f43 is equal to
the cost of that cycle, which is

c43 + c35 − c45 = −1.

▶ We let arc (4, 3) enter the tree.


▶ Pushing flow along the cycle attempts
to reduce the flow along the arc (4, 5).
▶ Since this was zero to start with
(degeneracy), we have θ∗ = 0; the arc
(4, 5) leaves the tree.
Example 7.3

▶ We obtain the feasible tree solution


indicated in the figure below.
▶ The reduced cost associated with arc
(1, 2) is

c12 + c24 + c43 − c13 = −1.

▶ We let arc (1, 2) enter the tree.


▶ We can push up to one unit of flow
along the cycle 1, 2, 4, 3, 1, that is,
until the flow along arc (1, 3) is set to
zero.
▶ Thus, θ∗ = 1, and the arc (1, 3) leaves
the tree.
Example 7.3

▶ We obtain the feasible tree solution


indicated in the figure.
▶ It is not hard to verify that all reduced
costs are nonnegative and we have an
optimal solution.
Overview of the algorithm
▶ In the case where an initial basic feasible solution is not
available, we need to form and solve an auxiliary problem.

b1 > 0 bc
1

4bc b4 < 0

b2 > 0 bc
2

5bc b5 < 0

b3 > 0 bc
3

▶ For each pair of source and sink nodes, we introduce an


auxiliary arc from the source to the sink.
▶ Finding a basic feasible solution in the presence of these
auxiliary arcs is straightforward. Exercise!
Overview of the algorithm
▶ In the case where an initial basic feasible solution is not
available, we need to form and solve an auxiliary problem.

b1 > 0 bc
1

4bc b4 < 0

b2 > 0 bc
2

5bc b5 < 0

b3 > 0 bc
3

▶ We set the costs cij of the auxiliary arcs to 1 and the costs
of the original arcs to 0.
▶ Then, the optimal solution of the auxiliary problem yields a
basic feasible solution of the original problem.
Overview of the algorithm
▶ In the case where an initial basic feasible solution is not
available, we need to form and solve an auxiliary problem.

b1 > 0 bc
1

4bc b4 < 0

b2 > 0 bc
2

5bc b5 < 0

b3 > 0 bc
3

▶ Alternatively, if the costs cij of the auxiliary arcs are chosen


large enough, and the costs of the original arcs are the
original ones, solving the auxiliary problem is equivalent to
solving the original problem. Exercise!
Overview of the algorithm

▶ The network simplex algorithm is similar to the naive


implementation described in Section 3.3.
▶ Because of the special structure of the basis matrix B, the
system c′B = p′ B can be solved on the fly, without the need to
maintain a simplex tableau or the inverse basis matrix B−1 .
▶ At each iteration we need
▶ O(n) computations to evaluate the dual vector p, (why?)
▶ O(m) computations to evaluate the reduced costs, (why?)
▶ O(n) computations to effect the change of basis. (why?)
▶ Given that m ≥ n − 1 (why?), the total is O(m).
Overview of the algorithm

▶ The O(m) computations in the network simplex algorithm


compare favorably with the O(mn) computational
requirements of an iteration of the simplex method for general
LP problems.
▶ In practice, the running time of the network simplex algorithm
is improved further by:
▶ using a more clever way of updating the dual variables, and
▶ using suitable data structures to organize the computation.
Overview of the algorithm
▶ All of the theory in Chapters 3 and 4 applies to the network
simplex method.
▶ In particular, in the absence of degeneracy, the algorithm is
guaranteed to terminate after a finite number of steps.
▶ In the presence of degeneracy, the algorithm may cycle.
▶ Cycling can be avoided by using either a general purpose
anticycling rule or special methods.
▶ If the optimal cost is −∞, the algorithm terminates with a
negative cost directed cycle.
▶ If the optimal cost is finite, the algorithm terminates with an
optimal flow vector f and an optimal dual vector p.
▶ In practice, the number of iterations is often O(m), but there
exist examples involving an exponential number of basis
changes.
Integrality of optimal solutions
Integrality of optimal solutions

▶ An important feature of network flow problems is that when


the problem data are integer, most quantities of interest are
also integer and the simplex method can be implemented
using integer arithmetic.
▶ This allows for:
▶ Faster computation, and
▶ The issues of finite precision and truncation error disappear.
Integrality of optimal solutions
▶ The theorem that follows provides a summary of integrality
properties.

Theorem 7.5
Consider an uncapacitated network flow problem and assume
that the underlying graph is connected.
(a) For every basis matrix B, the matrix B−1 has integer
entries.
(b) If the supplies bi are integer, then every basic solution has
integer coordinates.
(c) If the cost coefficients cij are integer, then every dual
basic solution has integer coordinates.

Let’s prove it!


Integrality of optimal solutions

Theorem 7.5
Consider an uncapacitated network flow problem and
assume that the underlying graph is connected.
(a) For every basis matrix B, the matrix B−1 has integer
entries.

Proof:
▶ As shown in the proof of Theorem 7.3, we can reorder the
rows and columns of a basis matrix B so that it becomes
lower triangular and its diagonal entries are either 1 or −1.
▶ Therefore, the determinant of B is equal to 1 or −1.
▶ By Cramer’s rule, B−1 has integer entries.
Integrality of optimal solutions

Theorem 7.5
Consider an uncapacitated network flow problem and
assume that the underlying graph is connected.
(b) If the supplies bi are integer, then every basic solution
has integer coordinates.

Proof:
▶ This follows from the formula fT = B−1 b̃.
Integrality of optimal solutions

Theorem 7.5
Consider an uncapacitated network flow problem and
assume that the underlying graph is connected.
(b) If the supplies bi are integer, then every basic solution
has integer coordinates.

Proof:
▶ This follows from the formula fT = B−1 b̃.
▶ It can also be seen by inspecting the algorithm that
determines the values of the basic variables.
Integrality of optimal solutions

Theorem 7.5
Consider an uncapacitated network flow problem and
assume that the underlying graph is connected.
(c) If the cost coefficients cij are integer, then every dual
basic solution has integer coordinates.

Proof:
▶ This follows from the formula p′ = c′B B−1 .
Integrality of optimal solutions

Theorem 7.5
Consider an uncapacitated network flow problem and
assume that the underlying graph is connected.
(c) If the cost coefficients cij are integer, then every dual
basic solution has integer coordinates.

Proof:
▶ This follows from the formula p′ = c′B B−1 .
▶ It can also be seen by inspecting the algorithm that
determines the values of the dual variables.
Integrality of optimal solutions

Corollary 7.2
Consider an uncapacitated network flow problem, and assume
that the optimal cost is finite.
(a) If all supplies bi are integer, there exists an integer
optimal flow vector.
(b) If all cost coefficients cij are integer, there exists an
integer optimal solution to the dual problem.
Special cases of the network flow problem
The maximum flow problem
▶ In the maximum flow problem, we wish to determine the
largest possible amount of flow that can be sent:
▶ from a given source node s to a given sink node t,
▶ without exceeding the arc capacities uij .
The maximum flow problem
▶ In the maximum flow problem, we wish to determine the
largest possible amount of flow that can be sent:
▶ from a given source node s to a given sink node t,
▶ without exceeding the arc capacities uij .

▶ This problem can be reformulated as a network flow problem:


1. Set the supply of each node to 0.
2. Set the cost of each arc to 0.
The maximum flow problem
▶ In the maximum flow problem, we wish to determine the
largest possible amount of flow that can be sent:
▶ from a given source node s to a given sink node t,
▶ without exceeding the arc capacities uij .

▶ This problem can be reformulated as a network flow problem:


1. Set the supply of each node to 0.
2. Set the cost of each arc to 0.
3. Introduce arc (t, s) with cost cts = −1 and capacity uts = +∞.
The shortest path problem

▶ For any directed path in a network, we define its length as the


sum of the costs of all arcs on the path.
▶ We wish to find a shortest path: A directed path from a given
origin node to a given destination node whose length is
smallest.
▶ This problem can be formulated as a network flow problem,
provided that there are no directed cycles of negative length.

Idea:
▶ Supply 1 in the origin, -1 in the destination, 0 otherwise.
▶ Costs as given.
▶ Capacities are infinity.
The transportation problem

▶ There are m suppliers and n consumers.


▶ The ith supplier can provide si units of a certain good and
the jth consumer has a demand for dj units.

▶ We assume that the total supply m i=1 si is equal to the

total demand nj=1 dj .
The transportation problem

▶ Finally, we assume that the transportation of goods from


the ith supplier to the jth consumer carries a cost of cij per
unit of goods transported.
▶ The problem is to transport the goods from the suppliers to
the consumers at minimum cost.
The transportation problem

▶ This is a special case of the uncapacitated network flow


problem, where the underlying graph has a special structure.
▶ It turns out that every network flow problem can be
transformed into an equivalent transportation problem
(Exercises 7.5 and 7.6).
The transportation problem

▶ Consequently, any algorithm for the transportation problem


can be adapted to solve general network flow problems.
▶ For this reason, the initial development and testing of new
algorithms is often carried out for transportation problems.
The assignment problem

1bc bc
1 The assignment problem is a special
case of the transportation problem,
where:

2bc bc
2
▶ the number of suppliers is equal to
the number of consumers,
▶ each supplier has unit supply, and

3bc bc
3
▶ each consumer has unit demand.
The assignment problem

▶ One can always find an optimal


1bc bc
1 solution in which every fij is either
0 or 1.
▶ This means that for each i there

2bc bc
2
will be a unique and distinct j for
which fij = 1, and we can say that
the ith supplier is assigned to the
jth consumer.
3bc bc
3 ▶ This justifies the name of this
problem.

You might also like