You are on page 1of 65

NETWORK

OPTIMIZATION
MODELS

5/24/22 1
OUTLINE

■ Introduction
■ Terminology of Networks
■ Shortest-Path Problem
■ Minimum Spanning Tree Problem
■ Maximum Flow Problem
■ Minimum Cost Flow Problem
■ Special cases

5/24/22 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…

5/24/22 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

5/24/22 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

5/24/22 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

5/24/22 6
Basic Definitions

5/24/22 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 23

34

■ Undirected arc:If flow through an arc is allowed in


any direction, the arc is said to be an undirected arc.
1 23

34

5/24/22 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

5/24/22 9
Basic Definitions
■ Path: 5
c 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.

5/24/22 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.

5/24/22 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

5/24/22 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

5/24/22 13
Basic Definitions
■ Example:
Path OT, from node O to node T can go through arcs OB - BD - DT
(O->B->D->T)

5/24/22 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.

5/24/22 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)

5/24/22 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

5/24/22 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.

5/24/22 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 to :
ì1 if i = 1
ï
åx -åx
j
ij
k
ki = í0 if i = 2, m - 1
ï-1 if i = m
î
x ij = 0 or 1
5/24/22 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.

5/24/22 20
Shortest-path problem
Mathematical model
Let :
ì1 If
co˘Ò ˆ Ù n̄g
there is ano·
i tˆ from
route ¯nut̆ iià
Ò e·jn nut̆ j
xij = í
î0 Other
khac̆

5/24/22 21
Shortest-path problem
Mathematical model
Min Z = 2x01 + 4x02 + 5x03 + 2x13 + 7x14 + 4x25 + x32 + 4
x13 + 7x14 + 4x25 + x32 + 4x34 + 3x35 + 5x46 + x54 + 7x56
Subject to: x01 + x02 + x03 = 1
-x01 + x13 + x14 = 0
-x02 - x32 + x25 = 0
-x03 - x13 + x32 + x34 + x35 = 0
-x14 - x34 - x54 + x46 = 0
x25 - x35 + x54 + x56 = 0
-x46 - x56 = -1
x ij = 0 or 1, "i, j

5/24/22 22
Shortest-path problem
Graphical method
Solved Nodes
Directly Closest Total nth
Minimum Last
n Connected Connected Distance Nearest
Distance Connection
To Unsolved Unsolved Node Involved Node
Nodes

1 O A 2 A 2 OA
2 O C 4 C 4 OC
3 A B 2+2=4 B 4 AB
4 A D 2+7=9
B E 4+3=7 E 7 BE
C E 4+4=8
5 A D 2+7=9
B D 4+4=8 D 8 BD
E D 7+1=8 D 8 ED
6 D T 8 + 5 = 13 T 13 DT
E T 7 + 7 = 14

The shortest path from O à T is 13: OABDT or OABEDT

5/24/22 23
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

5/24/22 24
■ 1959, E. W. Dijkstra of the Netherlands proposed the
solution procedures (shown in this chapter) for both the
minimal spanning tree problem and the shortest route
problem. Earlier, in 1955, L. R. Ford, Jr., and D. R. Fulkerson
(colleagues of George Dantzig’s) of the RAND Corporation
introduced the procedure for solving the maximal flow
network problem, which evolved from the study of trans-
portation problems. The original problem analyzed was of a
rail network connecting cities in which each rail link had
capacity limitations.

5/24/22 25
■ Maximal flow problem: its objective is to transport the
maximal flow quantity from the source point to the destination
point. It is important to know the network’s capacity to find
out how much can be sent from one source node to one
destination node, although this can also be done by defining
cut-off points; in other words, the cut-off capacity equals the
sum of the capacities of the associated arcs and among all
the possible cut-offs in the network, the cut-off with the least
capacity provides the maximal flow in the network. Many situ-
ations can be modelled by a network with a maximal flow
index; e.g. flow of traffic, hydraulic systems, electric circuits,
transporting merchandise, telematic networks capacities, etc.
A variety of different assignment situations, such as maximal
flow problems, can also be modelled. These problems can be
solved by the Ford-Fulkerson algorithm (1956).
5/24/22 26
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.

5/24/22 27
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

5/24/22 28
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]*

5/24/22 29
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.

5/24/22 30
Dijkstra Algorithm
Example:
■ Find the shortest path from node 1:

15
2
4

100
20 10 50

30 60
1 5
3

5/24/22 31
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

5/24/22 32
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
2 4
2 2

d(1) = 0 1 1 2 3 6 d(6) = ¥
\ 6
pred(1) = 0 4 2
pred(6) = 5
3
33 55
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.
5/24/22 33
FLOYD ALGORITHM

Student find literature about Floyd algorithm then presentation in


the class.

5/24/22 34
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.

5/24/22 35
Algorithm for the Minimum
Spanning Tree Problem
■ Select any node arbitrarily, and then connect it (i.e., add a link)
to the nearest distinct node.
■ Identify the unconnected node that is closest to a connected
node, and then connect these two nodes (i.e., add a link
between them). Repeat this step until all nodes have been
connected.

5/24/22 36
Algorithm for the Minimum
Spanning Tree Problem
■ 3. Tie breaking: Ties for the nearest distinct node (step
1) or the closest unconnected node (step 2) may be broken
arbitrarily, and the algorithm must still yield an optimal
solution. However, such ties are a signal that there may be
(but need not be) multiple optimal solutions. All such optimal
solutions can be identified by pursuing breaking ties to their
conclusion.

5/24/22 37
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

5/24/22 38
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

5/24/22 39
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

5/24/22 40
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.

5/24/22 41
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.

5/24/22 42
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

5/24/22 43
The Maximum Flow Problem
Maximal flow model:
Consider the park problem again:
node O: entrance
node T: destination
others: intermediate nodes

5/24/22 44
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.

5/24/22 45
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 ; x02 £ 4 ; x03 £ 7
-x01 + x13 + x14 = 0
-x02 – x32 + x25 = 0 x13 £ 1 ; x14 £ 3 ; x25 £ 4
-x13 – x03 + x32 + x35 + x34 = 0 x32 £ 2 ; x34 £ 4 ; x35 £ 5
-x14 - x34 – x54 + x46 = 0
x46 £ 9 ; x54 £ 1 ; x56 £ 6
-x25 – x35 + x54 + x56 = 0
-x46 – x56 = -f x ij ³ 0 "ij

5/24/22 46
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.

5/24/22 47
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.

5/24/22 48
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

5/24/22 49
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.

5/24/22 50
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.

5/24/22 51
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.

5/24/22 52
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

5/24/22 53
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.

5/24/22 54
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.

5/24/22 55
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)

56
5/24/22 56
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.

57
5/24/22 57
Example
Min Z = 2x AB + 4x AC + 9x AD + 3x BC + xCE + 3x DE + 2x ED
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

5/24/22 58
Special Cases
■ The transportation problem.
■ The assignment problem.
■ The traveling salesman problem.

5/24/22 59
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.

5/24/22 60
TRAVELING SALESMAN PROBLEM (TSP)

Example 1:
TSP with n = 15,112

5/24/22 61
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.

5/24/22 62
TRAVELING SALESMAN PROBLEM (TSP)

ì1 ñi töø from
travel i ñ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

5/24/22 63
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

5/24/22 64
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

5/24/22 65

You might also like