NETWORK
OPTIMIZATION
MODELS
6/13/2023 1
OUTLINE
■ Introduction
■ Terminology of Networks
■ Shortest-Path Problem
■ Minimum Spanning Tree Problem
■ Maximum Flow Problem
■ Minimum Cost Flow Problem
■ Special cases
6/13/2023 2
INTRODUCTION
■ Many types of network:
– Transportation network, information network, and electricity
network…
– Manufacturing, distributing, planning, positioning facilities…
■ Network: a special type of linear programming problems.
■ Example: transportation problem, assignment problem…
6/13/2023 3
INTRODUCTION
Assignment
Problem
Transportation
Problem
Pure Generalized
Shortest Path Minimum Minimum Linear
Problem Cost Cost Program
Flow Flow
Problem Problem
Maximum Flow
Problem
Less general models
More general models
6/13/2023 4
Basic Definitions
■ Graph:A graph or network is defined by two sets of symbols :
nodes and arcs. Denotes G=(N,A)
■ Nodes:A set ( call N ) of points in a graph, also called
vertices.
1 3
Node set N = {1, 2, 3, 4} 2 4
6/13/2023 5
Basic Definitions
■ Arcs(edges,A):an pair of vertices and represents a possible
direction of motion that may occur between vertices. For
arc(j,k), node j is the initial node of the arc, and node k is the
terminal node of the arc.The arc is said to go from node j to
node k.
1 3
Arc Set {(1,2), (1,3), (3,2), (3,4), (2,4)}
2 4
6/13/2023 6
Basic Definitions
6/13/2023 7
Basic Definitions
■ Directed arc:If flow through an arc is allowed in only
one direction, the arc is said to be a directed arc.
1 3
2
4
3
■ Undirected arc:If flow through an arc is allowed in
any direction, the arc is said to be an undirected arc.
1 23
4
3
6/13/2023 8
Basic Definitions
■ Directed network: A network that has only directed arcs
is called a directed network.
■ Undirected network:If all its arcs are undirected, the
network is said to be an undirected network.
b b
1 2 1 2
a c a c
e e
4 3 4 d 3
d
An Undirected Graph A Directed Graph
6/13/2023 9
Basic Definitions
■ Path: c
5
d
a b 3 e
Example: 5, 2, 3, 4. 1 2 4
(or 5, c, 2, b, 3, e, 4)
– No node is repeated.
– Directions are ignored. 5
c d
■ Directed Path : 1
a
2
b 3 e 4
Example: 1, 2, 5, 3, 4
(or 1, a, 2, c, 5, d, 3, e, 4)
– No node is repeated.
– Directions are important.
6/13/2023 10
Basic Definitions
■ Undirected path:An undirected path from node i to
node j is a sequence of connecting arcs whose direction
(if any) can be either toward or away from node j. (may
includes directed arcs).
■ Connected:Two nodes are said to be connected if the
network contains at least one undirected path between
them.
6/13/2023 11
Basic Definitions
■ Cycle :A path is a finite path that begins and terminates at the
same node is called a cycle.
1, 2, 3, 1. (or 1, a, 2, b, 3, e)
▪ A path with 2 or more nodes, except that the first node is the last
node.
2
▪ Directions are ignored a b
e
1 3
d c
■ Directed Cycle: (1, 2, 3, 4, 1) or 4
1, a, 2, b, 3, c, 4, d, 1 2
a
▪ No node is repeated. b
▪ Directions are important. e
1 3
d c
6/13/2023 12
Basic Definitions
Tree:A tree is defined to be a connected subset G
containing no cycle, where G = ( N , A) is a subset
of G=(N,A)
Spanning Tree: is a connected subset of a network including
all nodes, but containing no cycles.
1 3 1 3 1 3
2 4 2 4 2 4
5 5 5
6/13/2023 13
Basic Definitions
■ Example:
Path OT, from node O to node T can go through arcs OB - BD - DT
(O->B->D->T)
6/13/2023 14
Basic Definitions
■ Arc capacity:The maximum amount of flow (possibly infinity)
that can be carried on a directed arc is called arc capacity or
weight.
■ Weight:The weight of a tree is defined as the sum of the arc
capacities of the arcs in the tree.
6/13/2023 15
Basic Definitions
■ A minimum spanning tree is a spanning tree with minimum
weight.
(a) undirected (b) spanning tree (c) a tree of (a)
network of (a)
(d) directed network (e) tree of (d)
6/13/2023 16
Basic definitions
Sources Destinations
(Supply node ) (Demand node )
Supply s1 1 Demand d1
1
Supply s2 2
2 Demand d2
…
xij …
n Demand dn
Supply sm m
Xij: flow from i to j
cij : cost/unit from i to j
Costs cij
6/13/2023 17
Shortest-path problem
Consider a network consisting of:
■ - m nodes,
■ - n directed arcs,
■ - cij : cost per unit flow through arc (i, j).
Find the shortest path (i.e. the path with the minimum total travel
cost) from node 1 to node m.
Total travel cost is the sum of the travel costs through each arc
on the path.
6/13/2023 18
Shortest-path problem
Mathematical model
0 If arc i → j is not included
Let xi j =
1 If arc i → j is included
Min c x
i j
ij ij
Subject t o :
1 if i = 1
x -x
j
ij
k
ki = 0 i f i = 2, m - 1
-1 i f i = m
x ij = 0 or 1
6/13/2023 19
Shortest-path problem
■ Example: The routes of a park is as follows:
Node O: entrance Node T: destination.
■ Find the shortest path from the entrance to the destination.
6/13/2023 20
Shortest-path problem
Mathematical model
Let :
1 Ifcoùñöôø
there n
isga noá
i t öø
route t i i→ñeá
nuù
from j n nuù
t j
xij =
0 Other
khaùc
6/13/2023 21
Shortest-path problem
Mathematical model
Min Z = 2x 01 + 4x 02 + 5x 03 + 2x13 + 7x14 + 4x 25 + x 32 + 4
x13 + 7x14 + 4x 25 + x 32 + 4x 34 + 3x 35 + 5x 46 + x 54 + 7x 56
Subject to: x 01 + x 02 + x 03 = 1
−x 01 + x13 + x14 = 0
−x 02 − x 32 + x 25 = 0
−x 03 − x13 + x 32 + x 34 + x 35 = 0
−x14 − x 34 − x 54 + x 46 = 0
x 25 − x 35 + x 54 + x 56 = 0
−x 46 − x 56 = −1
x i j = 0 or 1, i, j
6/13/2023 22
Shortest-path problem
How to solve shortest path problem?
o Dijkstra Algorithm
o Floyd Algorithm
What are applications of shortest path problem?
o Minimize the total distance traveled
o Minimize the total cost of a sequence of activities
o Minimize the total time of a sequence of activities
6/13/2023 23
Dijkstra Algorithm
■ Find the shortest path form a source node to any other nodes
in the network.
■ It can be used for cyclic network.
■ Employed a special label assignment.
6/13/2023 24
Dijkstra Algorithm
■ Let :
ui is the shortest distance from source node to node
dij ( > 0): is the distance of arc (i, j)
Label of node j is defined as:
[ui, i] = [ui + dij, i], dij > 0
6/13/2023 25
Dijkstra Algorithm
■ Temporary label: the label can be replaced by another
lable if there exist a shorter path to the node under
investigation.
Temporary label : [uj, i]
■ Permanent Label: if we can not find any other shorter
path then the temporary label will be changed to permanent
label.
Permanent label: [uj, i]*
6/13/2023 26
Dijkstra Algorithm
■ Step 1:
Assign permanent label to sources node [0, -]*.
Let i = 1
■ Step 2:
Compute temporary labels [uj + dij, i] of node j that i can reach,
knowing that j is not permanently labeled.
If node j is already labeled with a label from a node k [uj, k], and if
distance from node i: (ui + dij) < uj, replace [uj, k] with [ui +
dij, i].
■ Step 3:
If all the nodes have permanent labels, stop.
Otherwise, select the label [ur, s] having the shortest distance (=
ur) among all the temporary labels. Set i = r, repeat step i.
6/13/2023 27
Dijkstra Algorithm
Example:
■ Find the shortest path from node 1:
15
2
4
100
20 10 50
30 60
1 5
3
6/13/2023 28
Dijkstra Algorithm
[100, 1]
[55, 4]* [40, 3]*
15
2
4
100
20 10 50
[90, 3]*
[0, -]* 30 60
1 3 5 [90, 4]*
[30, 1]*
Shortest path form :
Node 1 to 2: 55, 1 → 3 → 4 → 2.
Node 1 to 3: 30, 1 → 3
Node 1 to 4: 40, 1→ 3 → 4
Node 1 to 5: 90, 1 → 3 → 5 OR 1→3→ 4→5
6/13/2023 29
Example Scan the arcs out of
i, and update
d( ), pred( ), and
d(2) =
\ 2 d(4) =
\ 6 LIST
pred(2) = 1 pred(4) = 2
4
22 44
2 2
d(1) = 0 11 1 2 3
66 d(6) =
\ 6
pred(1) = 0 4 2
pred(6) = 5
3
3 5
d(3) =
\ 4\ 3 d(5) =
\ 4
pred(3) = 1\ 2 pred(5) = 2
The
End Find
Find the
the node
the ii on
node
Initialize on
LIST
LIST with
with and
distances
\ 2,\ 3,
LIST = {1, \ 6}
\ 4,\ 5, \ minimum
minimum
LIST. distance.
distance.
6/13/2023 30
Minimum spanning tree
problem
■ You are given the nodes of a networks but not the links.
Instead, you are given the potential links and the positive
length for each if it is inserted into the network.
■ You wish to design the network by inserting enough links to
satisfy the requirement that there be a path between every
pair of nodes.
■ The objective is to satisfy this requirement in a way that
minimizes the total length of the links inserted into the
network.
6/13/2023 31
Algorithm for the Minimum
Spanning Tree Problem
The park example: select routes that connect all stations
with minimum total length.
1. 2.
A A
2 7 2 7
2 2
5 T 5 T
5 4 5 4
O B D O B D
3 1 7 3 1 7
4 1 4 1
C E C E
4 4
6/13/2023 32
Algorithm for the Minimum
Spanning Tree Problem
3. 4.
A A
2 7 2 7
2 2
5 T 5 T
5 4 5 4
O B D O B D
3 1 7 3 1 7
4 1 4 1
C E C E
4 4
6/13/2023 33
Algorithm for the Minimum
Spanning Tree Problem
5. 6.
A A
2 7 2 7
2 2
5 T 5 T
5 4 5 4
O B D O B D
3 1 7 3 1 7
4 1 4 1
C E C E
4 4
7.
A
2 7
2
5 T
5 4
O B D
3 1 7
4 1
C E
4
6/13/2023 34
OTHER APPLICATIONS
1 - Design a telecommunication network
2 - Design of a lightly used transportation network to minimize the total
cost of providing the links (rail lines, roads…)
3 - Design of a network of high-voltage electrical power transmission lines
4 – Design of a network of wiring on electrical equipment to minimize the
total length of the wire.
5 – Design of a network of pipelines to connect a number of locations.
6/13/2023 35
The Maximum Flow Problem
■ Consider a directed and connected network where just one node
is a supply node, one node is a demand node, and the rest are
transshipment nodes. Gives the arcs capacities, the objective is
to determine the feasible pattern of flows through the network
that maximize the total flow from the supply node to demand
node.
6/13/2023 36
The Maximum Flow Problem
■ After some flows have been assigned to the arcs of the
original network, the residual network show remaining
arc capacities (called residual capacities) for assigning
additional flows.
7 0 2 5
O B O B
■ An augmenting path is a directed path from the supply
node to demand node in the residual network such
that every arc on this path has strictly positive residual
capacities
6/13/2023 37
The Maximum Flow Problem
Maximal flow model:
Consider the park problem again:
node O: entrance
node T: destination
others: intermediate nodes
6/13/2023 38
The Maximum Flow Problem
Arcs represent the routes of trains through stations. Each arc has a
limited number of trains a day, shown by the number above each
arc.
In seasonal time, the number of visitors increases, the park has to
maximize the number of trains from O to T.
6/13/2023 39
The Maximum Flow Problem
Mathematical model:
Let xij: the number of train from i to j i = 0..5; j = 1..6
Max f
Subject to:
x01 + x02 + x03 = f x 01 5 ; x 02 4 ; x 03 7
-x01 + x13 + x14 = 0
-x02 – x32 + x25 = 0 x13 1 ; x 14 3 ; x 25 4
-x13 – x03 + x32 + x35 + x34 = 0 x 32 2 ; x 34 4 ; x 35 5
-x14 - x34 – x54 + x46 = 0 x 46 9 ; x 54 1 ; x 56 6
-x25 – x35 + x54 + x56 = 0
-x46 – x56 = -f x i j 0 i j
6/13/2023 40
OTHER APPLICATIONS
1 - Maximize the flow through a company’s distribution network from its
factories to its customers.
2 - Maximize the flow through a company’s supply network from its
vendors to its factories.
3 - Maximize the flow of oil through a system of pipelines.
4 - Maximize the flow of water through a system of aqueducts.
5 - Maximize the flow of vehicles through a transportation network.
6/13/2023 41
The Maximum Flow Problem
■ A cut is defined as any set of directed arcs containing at least
one arc from any directed path from the supply node to the
demand nodes.
■ The cut value is the sum of the arc capacities of the arcs of
the cut.
6/13/2023 42
Max Flow / Min Cut
Theorem
■ For any network with a single supply node and the demand
node, the maximum flow from the supply node to the demand
node equals the minimum cut value for all cuts of the network.
A 16
5 3
1
9 T
O 7 B 4 D
2 15
5 1 6
16 4
15 C E 14
4
6/13/2023 43
Minimum Cost Flow Problem
■ The network is a directed and connected network.
■ At least one of the nodes is a supply node.
■ At least one node is a demand node.
■ All the remaining nodes are transshipment nodes.
■ Flow through an arc is allowed only in one direction
indicated by the arrowhead, where the maximum
amount of flow is given by the capacity of that arc.
6/13/2023 44
Minimum Cost Flow Problem
■ The network has enough arcs with sufficient capacity
to enable all the flow generated at the supply nodes to
reach all the demand nodes.
■ The cost of the flow through each arc is proportional to
the amount of that flow, where the cost per unit flow is
known.
■ The objective is to minimize the total cost (or maximize
the total profit) of sending the available supply through
the network to satisfy the given demand.
6/13/2023 45
Formulate the Model
Consider a directed and connected network where the n nodes
include at least one supply node and at least one demand
node.
xij = flow through arc i → j.
cij = cost per unit flow through arc i → j.
uij = arc capacity for i → j.
bi = net flow generated at node i.
The value of bi depends on the nature of node i, where
bi > 0 if node i is a supply node.
bi < 0 if node i is a demand node.
bi = 0 if node i is a transshipment node.
6/13/2023 46
Mathematical Model
n n
Min Z = cij xij
i =1 j =1
n n
s. t. x − x
j =1
ij
j =1
ji = bi for each node i
0 xij uij for each arc i → j
6/13/2023 47
Feasible Solution Property
■ A necessary condition for a minimum cost flow problem to
have an feasible solutions is that
n
b = 0
i =1
i
■ That is the total flow being generated at the supply nodes
equals the total flow being absorbed at the demand nodes.
■ If a violation occurs, either a dummy demand node should be
added to absorb the excess supply or a dummy supply node
should be added to generate the flow for the excess demand.
6/13/2023 48
Integer Solution Property
■ For minimum cost flow problems where bi and uij have integer
values, all the basic variables in every BFS (basic feasible solution)
also have integer values.
6/13/2023 49
EXAMPLE OF MINIMUM COST FLOW PROBLEM
Example. A company has two factories, one distribution center, and
two warehouses as shown in the network below
Nodes 1, 2: factories
Node 3: distribution center
Node 4, 5: warehouses
Numbers in parentheses
are demand (supply) at
each node (+: supply, -:
demand)
50
6/13/2023 50
MATHEMATICAL MODEL
Numbers on arcs are transported volumes.
The maximum transported volume at arc 1 – 2 is 10, at arc 3 – 5 is
80
Determine the transported volume on arcs to minimize the
transportation cost.
51
6/13/2023 51
Example
Min Z = 2x AB + 4x AC + 9x AD + 3xBC + xCE + 3xDE + 2xED
s. t.
x AB + x AC + x AD = 50
− x AB + xBC = 40
− x AC − xBC + xCE = 0
− x AD + xDE − xED = − 30
− xCE − xDE + xED = − 60
x AB 10 xCE 80 xij 0
6/13/2023 52
Special Cases
■ The transportation problem.
■ The assignment problem.
■ The traveling salesman problem.
6/13/2023 53
TRAVELING SALESMAN PROBLEM (TSP)
n cities, the salesman:
• Start from city 1
• Go to each city once
• Return to city 1
• Traveling cost from city i to city j: cij.
Find the route so that the traveling cost is minimum.
6/13/2023 54
TRAVELING SALESMAN PROBLEM (TSP)
Example 1:
TSP with n = 15,112
6/13/2023 55
TRAVELING SALESMAN PROBLEM (TSP)
Example 2:
3
A person at node 1 wants to travel to all remaining
40 nodes, then return to node 1. The
distances between nodes are as follows:
25
59
25
40
15
1 4
15 18
10
10 59
18
2
Find the minimum travel distance.
6/13/2023 56
TRAVELING SALESMAN PROBLEM (TSP)
1 travel
ñi töøifrom
ñeáni jto j
xij = model:
Mathematical
Let 0 Khaùc
others
Let M is a large positive number.
Objective function:
Min Z = Mx11+ 40x12 + 17x13 + 15x14 + 40x21 + Mx22
+ 59x23 + 18x24 + 17x31 + 59x32 + Mx33 + 25x34
+ 15x41 + 18x42 + 25x43 + Mx44
6/13/2023 57
TRAVELING SALESMAN PROBLEM (TSP)
Constraints:
x11+ x12 + x13 + x14 = 1
x21 + x22 + x23 + x24 = 1
x31 + x32 + x33 + x34 = 1
x12 + x21 <= 1
x41 + x42 + x43 + x44 = 1 x13 + x31 <= 1
x11 + x21 + x31 + x41 = 1 x14 + x41 <= 1
x12 + x22 + x32 + x42 = 1 x23 + x32 <= 1
x13 + x23 + x33 + x43 = 1 x24 + x42 <= 1
x14 + x24 + x34 + x44 = 1 x34 + x43 <= 1
6/13/2023 58
TRAVELING SALESMAN PROBLEM (TSP)
Solving by LINGO:
x13 = x34 = x42 = x21 = 1,
Other variables equal 0.
Z = 100
Therefore the shortest route is 80.
Travel sequence: 1–3–4–2–1
6/13/2023 59