Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

IE 454 Network Flows and Project Management, Fall 2010, by I. S.

Bakal 1

1 Basics of Networks
Networks are everywhere. Example networks: Electrical and power networks, tele-
phone, highway systems, airline and rail networks, manufacturing and distribution
systems, computer networks
In each of these examples, the aim is to move some entity from one point to
another in the most efficient way possible using the underlying network.
In the first part of this course, we will model various settings as network flow
problems, and study a number of algorithms to solve the resulting models. The main
question is: if we have alternative ways to use a network, which alternative will be
the most cost-effective?

1. Minimum Spanning Tree Problem: What is the best way to connect a number
of points as cheaply as possible?

2. Shortest Path Problem:

3. Maximum Flow Problem:

4. Minimum Cost Network Flow Problems:

Many OR problems can be studied by network representation. In many cases,


there may not be a physical network.

• Production and inventory planning problems

• Scheduling problems

• Distribution and transportation problems

First paper on graph theory was published by Leonhard Euler, a Swiss mathe-
matician, in 1736:
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 2

The Seven Bridges of Konigsberg: The river Pregel runs through the town of
Konigsberg. In the river are two islands, connected to each other and the rest of the
city by seven bridges (See the figure below). Is it possible to start at some place in
the city, cross every bridge exactly once, and return to the starting point?

Land

Island Island

Land

1.1 Notation and Definitions


A graph (network) consists of a set of nodes, and a set of arcs whose elements are
pairs of distinct nodes. It is represented as G = (N, A). Let n and m denote the
number of nodes and number of arcs, respectively.
An arc is said to be directed if it allows flow in one direction. In most problems, we
will work with directed networks. Hence, we will assume that a network is directed
unless otherwise stated.

i: Initial node
i j j: Terminal Node

Let (i, j) be a directed arc. Then, i is the tail of the arc, and j is its head. Arc (i, j)
is incident to nodes i and j. It is an outgoing arc of node i, and an incoming arc of
node j. Node j is adjacent to node i.
An example network:

2 4

1
5 7

3 6

Figure 1: Example Network


IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 3

N = {1, 2, 3, 4, 5, 6, 7}
A = {(1, 2), (1, 3), (2, 3), (2, 4), (3, 6), (4, 5), (4, 7), (5, 2), (5, 3), (5, 7), (6, 7)}
Degrees: The indegree of a node is the number of incoming arcs to that node. Its
outdegree is the number of outgoing arcs. Degree = Indegree + Outdegree

Arc Adjacency List: The arc adjacency list A(i) of node i is the set of arcs ema-
nating from node i. That is, A(i) =

Node Adjacency List: The node adjacency list A(i) of node i is the set of nodes
adjacent to node i. That is, A(i) =

Subgraph: A graph G′ = (N ′ , A′ ) is a subgraph of G = (N, A) if N ′ ⊆ N and


A′ ⊆ A. G′ = (N ′ , A′ ) is a spanning subgraph if N ′ = N and A′ ⊆ A

Walk: A walk in a directed graph G = (N, A) is a subgraph of G consisting of a


sequence of nodes and arcs i1 −a1 −i2 −a2 · · · ir−1 −ar−1 −ir satisfying the property that
for all 1 ≤ k ≤ r − 1, either ak = (ik , ik+1 ) ∈ A or ak = (ik+1 , ik ) ∈ A. Alternatively,
a walk can be defined as a sequence of arcs connecting two nodes.

2 4

2
1
5
1
5 7

Directed Walk: A directed walk is a walk such that for two consecutive nodes ik
and ik+1 on the walk (ik , ik+1 ) ∈ A.

Path: A path is a walk without any repetition of nodes.

Directed Path: A directed path is a directed walk without any repetition of nodes.
A (directed) path can be stored using a predecessor index.

Cycle: A cycle is a path i1 − i2 − · · · − ir together with the arc (ir , i1 ) or (i1 , ir ).

Directed Cycle: A directed cycle is a directed path i1 − i2 − · · · − ir together with


the arc (ir , i1 ). A graph is acyclic if it contains no directed cycle.
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 4

5 7 2 4

3 6 5

Connectivity: Two nodes i and j are connected if the graph contains at least one
path from node i to node j. A graph is connected if every pair of its nodes is connected.
A connected graph is strongly connected if it contains at least one directed path from
every node to every other node.

Cut: A cut is a partition of the node set N into two parts, S and S̄ = N − S. Each
cut defines a set of arcs consisting of those arcs that have one endpoint in S and
another endpoint in S̄.

2 4

1
5 7

{(2,4),(5,2),(5,3),(3,6)}
3 6

Tree: A tree is a connected graph that contains no cycle. A tree of n nodes contains
exactly n − 1 arcs. A tree has at least two leaf nodes (nodes with degree 1). Every
two nodes of a tree are connected by a unique path.

Forest: A graph that contains no cycles is a forest (collection of trees).

Subtree: A connected subgraph of a tree is a subtree.

Rooted Tree: A rooted tree is a tree with a specially designated node, its root; we
regard a rooted tree as though it were hanging from its root.
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 5

2 4 5

3 6 7

Directed-out Tree: A tree is a directed-out tree rooted at node s if the unique path
in the tree from s to every other node is directed.

Spanning Tree: A tree T is a spanning tree of G if T is a spanning subgraph of G.

2 4

1
5 7

3 6

Fundamental Cycles: Let T be a spanning tree of graph G. The addition of


any nontree arc to the spanning tree creates exactly one cycle. Any such cycle is a
fundamental cycle of G with respect to T . The network has m − n + 1 fundamental
cycles. If we delete any arc in a fundamental cycle, we again obtain a spanning tree.

Fundamental Cuts: Let T be a spanning tree of graph G. The deletion of any tree
arc of T produces a disconnected graph containing two subtrees, T1 and T2 . Arcs
whose endpoints belong to the different subtrees constitute a fundamental cut of G
with respect to T . The network has n − 1 fundamental cuts with respect to any tree.

Bipartite Graph: A graph G = (N, A) is a bipartite graph if we can partition N


into N1 and N2 so that for each (i, j) ∈ A either (i) i ∈ N1 and j ∈ N2 , or (ii) i ∈ N2
and j ∈ N1 .
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 6

1 5

7 3

4 8

6 2

Back to the Seven Bridges of Konigsberg:

Euler concluded that for such a route (Euler’s route) to exist, the following con-
ditions should be satisfied:
(i)

(ii)
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 7

Chinese Postman Problem


Leaving from his post office, a postman needs to visit the households on each block
in his route, delivering and collecting letters, and then returning to the post office.
Find the minimum possible distance.

In network terminology, we have the following: Given a network G(N, A) and cij ≥ 0
associated with every (i, j) ∈ A, we want to find

1.2 Network Representations


The performance of an algorithm depends not only on the algorithm, but also on
how the data is represented within a computer. In representing a network, we need
to store the network’s node and arc structure (topology), and data such as cost,
capacity, supply/demand. We will consider the network in Figure 2 for this part.

(15,40)
2 4

(25,30)

(45,10)
(15,30)
1 (35,50)
(45,60)

(35,50)

3 5
(25,20)

Figure 2: Network Example


IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 8

Node-Arc Incidence Matrix

This representation stores the network as an n × m matrix that contains one row for
each node and one column for each arc. The column corresponding to arc (i, j) has
only two nonzero elements: +1 in the row corresponding to node i, and −1 in the
row corresponding to node j.

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


1 1 1 0 0 0 0 0 0
2 -1 0 1 -1 0 0 0 0
3 0 -1 0 1 -1 0 -1 0
4 0 0 -1 0 1 1 0 -1
5 0 0 0 0 0 -1 1 1

cij 25 35 15 45 15 45 25 35

uij 30 50 40 10 30 60 20 50

Properties of the incidence matrix:

1. Only out of entries are nonzero

2. All nonzero entries are +1 or −1. Each column has exactly one +1 and one −1.

3. Number of +1’s in a row equals the . Simi-


larly, number of −1’s in a row equals the .

4. Each attribute of the arcs can be represented as a row-array. Each attribute of


the nodes can be represented as a column-array.

5. Too many columns are required if the network is dense.


IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 9

Node-Node Adjacency Matrix

This representation stores the network as an n × n matrix. Its (i, j)th entry equals 1
if (i, j) ∈ A, and equals 0 otherwise.

1 2 3 4 5
1 0 1 1 0 0
2 0 0 0 1 0
3 0 1 0 0 0
4 0 0 1 0 1
5 0 0 1 1 0

Properties of the adjacency matrix:

1. Only out of entries are nonzero.

2. It is efficient if the network is sufficiently large.

3. We can obtain the outgoing arcs from node i by . Similarly,


we can obtain incoming arcs to node i by .

4. Arc characteristics should be stored in separate matrices.


IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 10

1.3 Network Flow Problems


Minimum Cost Network Flow Problem
P
Minimize cij xij
(i,j)∈A

subject to

P P
xij − xji = b(i), ∀ i ∈ N
{j:(i,j)∈A} {j:(j,i)∈A}

lij ≤ xij ≤ uij , ∀ (i, j) ∈ A

Shortest Path Problem

We wish to find a path of minimum cost from a source node s to a sink node t. Each
arc (i, j) ∈ A has an associated cost of cij .
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 11

Maximum Flow Problem

We seek a solution that sends the maximum amount of flow from node s to node t.
We can formulate this problem as an MCNFP as follows:

Transportation Problem

Special case of MCNFP with the property that the node set is partitioned into two
sets N1 and N2 so that each node in N1 is a supply node, each node in N2 is a demand
node, and for each arc (i, j) ∈ A, we have i ∈ N1 and j ∈ N2 .
An extension is the transshipment problem where we allow transshipment nodes;
nodes that can both receive and send flow.

Circulation Problem

Circulation problem is an MCNFP with only transshipment nodes; b(i) = 0, ∀i ∈ N .


The purpose is to find a feasible flow that honors the capacity constraint.

Assignment Problem

We have two equally sized sets, N1 , and N2 , a collection of pairs A ⊆ N1 × N2


representing possible assignments, and a cost cij associated with every (i, j) ∈ A. We
wish to pair each object in N1 with exactly one object in N2 , at minimum possible
cost.

Examples:
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 12

1.4 OR Applications
Production Planning Problem

Consider a single item, finite horizon, discrete production planning problem. The
objective is to determine the production quantity for each period such that the as-
sociated cost is minimized. Demand in a period can be satisfied production in that
period, in previous periods (by carrying inventory), or in later periods (by backorder-
ing). Let

T : Length of the planning horizon


dt : Demand in period t
ct : Unit cost of production in period t
ht : Unit cost of carrying inventory from period t to period t + 1
πt : Unit cost of backorder from period t + 1 to period t.
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 13

• Can we incorporate limits on production quantities, inventory, and backorders?

• Can we handle a capacity limitation for the total quantity available in a period?

• Can we handle an aggregate capacity limit for a number of consecutive periods?

• What about a constraint on the number of production periods?

• What about the constraint that there cannot be production in each of two
consecutive period?
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 14

Travelling Salesperson Problem

Starting from his/her home base a salesperson wishes to visit each of several cities
exactly once and return home at the lowest possible travel cost.
An extension: Vehicle routing problem
An example: Loading jobs on a machine that requires sequence-dependent setup
times.
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 15

Tanker Scheduling Problem

A steamship company has contracted to deliver perishable goods between several dif-
ferent origin destination pairs, a total of n pairs. Since the cargo is perishable, the
customers have specified precise dates when the shipments must reach their desti-
nations. The cargoes may not arrive early or late. The steamship company wants
to determine whether its fleet of k ships is sufficient. Formulate this problem as a
circulation problem.
First construct a network which contains a node for each shipment and arc from node
i to node j if it is possible to deliver shipment j after completing shipment i; that is
the start time of shipment j is no earlier than the delivery time of shipment i plus
the delivery time from the destination of shipment i to the origin of shipment j. A
directed path on this network corresponds to a feasible sequence of shipments. The
problem requires that we identify if the minimum number of directed paths that will
contain each node in the network on exactly one path is smaller than k or not.
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 16

To illustrate, consider an example with 4 shipments. The figure below provides the
necessary information.

Shipment Origin Dest. Delivery date


1 A C 3
2 A C 8 C D A B
3 B D 3 A 3 2 C 2 1
4 B C 6 B 2 3 D 1 2

(a) (b) (c)

Figure 3: (a) Shipment Characteristics (b) Shipment transit times (c) Return times
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 17

1.5 Complexity of An Algorithm


An algorithm is said to solve a problem P if it is guaranteed to produce a solution for
every instance of P . The efficiency of an algorithm is usually evaluated by its time
requirement. The performance of an algorithm can be measured as follows:

• Empirical Analysis: Write a computer program and test the performance on


some classes of problem instances.

• Average-case Analysis: Choose a probability distribution for the problem in-


stances and derive asymptotic expected performance.

• Worst-case Analysis: Find an upper bound on the number of steps that the
algorithm can take on any problem instance as a function of the problem pa-
rameters

We will mainly consider worst-case analysis. The problem parameters are related to
size (number of nodes, number of arcs), and data (capacity,cost).
If an algorithm has an upper bound on the number of steps as a polynomial
function of the problem size, then it is called a polynomial-time algorithm. If a
polynomial-time algorithm exists to solve a problem, then it is a ‘polynomially solv-
able’ problem.
An algorithm is said to be pseudo-polynomial if its complexity function is a poly-
nomial function of the problem data.
If there cannot exist an algorithm to solve the problem in polynomial time, then
the problem is called (i) NP-hard in the ordinary sense if a pseudo-polynomial al-
gorithm exists, and (ii) NP-hard in the strong sense if there cannot be a pseudo-
polynomial algorithm either.
An algorithm is said to run in O(f (n)) time if for some numbers c and n0 , the
time taken by the algorithm is at most cf (n) for all n ≥ n0 .
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 18

1.6 Search Algorithms


• Finding all nodes in a network that are reachable by directed paths from a
specific node

• Finding all nodes in a network that can reach a specific node along directed
paths

• Identifying all connected components of a network

• Determining whether a given network is bipartite

• Topological ordering: In an acyclic network, reorder the nodes such that for
each arc (i, j) ∈ A, i < j.

algorithm search;
begin
unmark all nodes in N ;
mark node s;
pred(s):=0;
next:=1;
order(s):=next;
LIST:={s};
while LIST 6= ∅ do
begin
select a node i in LIST;
if node i is incident to an admissible arc (i, j) then
begin
mark node j;
pred(j):=i;
next:=next+1;
order(j):=next;
add node j to LIST;
end
else delete node i from LIST;
end;
end;
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 19

Breadth-first Search
If we maintain the LIST as a queue, we always select nodes from the front, and add
them to the rear. If we define the distance of node i as the minimum number of arcs
from s to i, this search first marks nodes with distance 1, then distance 2, and so on.

In the breadth-first search tree, the tree path from node s to any node i is a shortest
path (contains the fewest number of arcs).

Depth-first Search
Maintain the LIST as a stack. Select from the front, add to the front. The algorithm
creates a path as long as possible, backs up one node to continue.

Reverse Search
LIST = {t}. While examining a node, scan incoming arcs.

Determining Strong Connectivity


A network is strongly connected if and only if for any arbitrary node s, every node is
reachable from s, and node s is reachable from every node. Apply one forward and
one reverse search.
IE 454 Network Flows and Project Management, Fall 2010, by I. S. Bakal 20

Topological Ordering
Select a node with zero indegree. Give it a label 1 and delete it with all the arcs
emanating from it. Continue in this manner. If at some point there is a subgraph
with no zero indegree nodes, then the graph is cyclic. The algorithm runs in O(m)
time.

algorithm topological ordering;


begin
for all i ∈ N do indegree(i):=0;
for all (i, j) ∈ A do indegree(j):=indegree(j)+1;
LIST := ∅;
next:=0;
for all i ∈ N do S
if indegree(i)=0 then LIST:=LIST {i};
while LIST 6= ∅ do
begin
select a node i from LIST and delete it;
next:=next+1;
order(i):=next;
for all (i, j) ∈ A(i) do
begin
indegree(j):=indegree(j)-1; S
if indegree(j) = 0 then LIST:= LIST {j};
end;
end;
if next < n then the network contains a directed cycle
else the network is acyclic; the array order gives a topological order of nodes;
end;

You might also like