0% found this document useful (0 votes)
1K views84 pages

Network Models: Based On: "Operations Research: Applications and Algorithms" by Wayne L. Winston

The document defines basic network models including nodes, arcs, chains, paths, and shortest path problems. It provides an example of Dijkstra's algorithm to solve a shortest path problem on a sample network. The algorithm works by permanently labeling reachable nodes from the starting node with their shortest path distances until all nodes are permanently labeled. The document also provides an example equipment replacement problem that can be modeled as a shortest path problem on a network.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views84 pages

Network Models: Based On: "Operations Research: Applications and Algorithms" by Wayne L. Winston

The document defines basic network models including nodes, arcs, chains, paths, and shortest path problems. It provides an example of Dijkstra's algorithm to solve a shortest path problem on a sample network. The algorithm works by permanently labeling reachable nodes from the starting node with their shortest path distances until all nodes are permanently labeled. The document also provides an example equipment replacement problem that can be modeled as a shortest path problem on a network.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 84

Network Models

Based on: “Operations Research: Applications and Algorithms”


by Wayne L. Winston
Basic Definitions
 A graph or network is defined by two sets of
symbols: nodes and arcs.
 A set (call it V) of points, or vertices. The
vertices of a graph or network are also called
nodes.
 An arc consists of an ordered pair of vertices
and represents a possible direction of motion
that may occur between vertices.
 A sequence of arcs such that every arc has
exactly one vertex in common with the
previous are is called a chain.
2
 A path is a chain in which the terminal node of
each arc is identical to the initial node of next
arc.
 For example in the figure below:
 (1,2)-(2,3)-(4,3) is a chain but not a path;
 (1,2)-(2,3)-(3,4) is a chain and a path, which
represents a way to travel from node 1 to node 4.
1 4

2 3 3
Shortest Path Problems
 Assume that each arc in the network has a
length associated with it.
 The problem of finding the shortest path from
node 1 to any other node in the network is
called a shortest path problem.

4
 Assuming that all arc lengths are non-negative,
Dijkstra’s algorithm, can be used to find the
shortest path from a node.
 Finding the shortest path between node i and
node j in a network may be viewed as a
transshipment problem.
 The transshipment problem can then easily be
solved by using LINGO.

5
Shortest Path Problem
Consider the following flow network:
d26
2 6
d12 d36
d23
d13
1 3 d56
d35
d34
d14 d45
  4 5
The objective is to find the shortest path from node 1 to node
n. The distance from node i to j, dij does not have to equal the
distance from node j to i, dji.
6
Shortest Path Problem
Dijkstra’s labeling algorithm: 9
2 6
3 6
2
7
1 3 3
3
1
4 3
Summary: Nodes are  
4 5
permanently labeled or
temporarily labeled. All nodes that can be immediately reached from
permanently labeled nodes are temporarily labeled. The label is the minimum
of the sum of the distance from node 1 to the permanent node plus the distance
to the temporary node. Start with node 1 as the only permanently labeled
node. Find the temporarily labeled node with minimum distance. Make this
node permanent. Repeat this process until all nodes are permanently labeled.
7
Shortest Path Problem
Dijkstra’s labeling algorithm:
2 9 6
(3,1) ()
3 6
2
1 7 3
[0] (7,1)
3
1 3
4 4 3 5
 
(4,1) ()
[ ] – permanent label
(d,f) – temporary label; d – distance, f - from node

L(0) = [0, 3, 7, 4, inf., inf.] – choose node 2


8
*
Shortest Path Problem
Dijkstra’s labeling algorithm:
2 9 6
[3,1] (12,2)
3 6
2
1 7 3
[0] (5,2)
3
1 3
4 4 3 5
 
(4,1) ()

L(1) = [0, 3, 5, 4, inf., 12] – choose node 4


* *

9
Shortest Path Problem
Dijkstra’s labeling algorithm:
2 9 6
[3,1] (12,2)
3 6
2
1 7 3
[0] (5,2)
3
1 3
4 4 3 5
 
[4,1] (7,4)

L(2) = [0, 3, 5, 4, 7, 12] – choose node 3


* * *

10
Shortest Path Problem
Dijkstra’s labeling algorithm:
2 9 6
[3,1] (11,3)
3 6
2
1 7 3
[0] [5,2]
3
1 3
4 4 3 5
 
[4,1] (7,4)

L(3) = [0, 3, 5, 4, 7, 11] – choose node 5


* ** *

11
Shortest Path Problem
Dijkstra’s labeling algorithm:
2 9 6
[3,1] (10,5)
3 6
2
1 7 3
[0] [5,2]
3
1 3
4 4 3 5
 
[4,1] [7,4]

L(4) = [0, 3, 5, 4, 7, 10] – choose node 6


* ** * *

12
Shortest Path Problem
Dijkstra’s labeling algorithm:
2 9 6
[3,1] [10,5]
3 6
2
1 7 3
[0] [5,2]
3
1 3
4 4 3 5
 
[4,1] [7,4]

L(5) = [0, 3, 5, 4, 7, 10] – done


* ** * * *

Shortest Path: 1-4-5-6 13


Shortest Path Problem –
Cost Example
j i
Equipment Replacement Problem: d ij  K i  S j i   ct
t 1
d15

d14
d13
d35

d12 d23 d34 d45


1 2 3 4 5

 where Ki is purchase price in year i , Si is salvage value


after i years in service, and ct is maintenance cost after t
years of service. 14
Example 1: Equipment Replacement
 Assume that a new car (or machine) has been
purchased for $12,000 at time 0.
 The cost of maintaining the car during a year
depends on the age of the car at the beginning
of the year, as given in the table below.
Age of Car Annual Age of Car Trade-in Price
(Years) Maintenance (Years)
cost
0 $2,000 1 $7,000
1 $4,000 2 $6,000
2 $5,000 3 $2,000
3 $9,000 4 $1,000
4 $12,000 5 $0
15
Example 1 - continued
 In order to avoid the high maintenance cost
associated with an older car, we may trade in
the car and purchase a new car.
 To simplify the computations we assume that
at any time it costs $12,000 to purchase a new
car.
 The goal is to minimize the net cost incurred
during the next five years.

16
Example 1: Solution
 This problem should be formulated as a
shortest path problem.
 The network will have six nodes.
 Node i is the beginning of year i and for i<j, an arc
(i,j) corresponds to purchasing a new car at the
beginning of year i and keeping it until the beginning
of year j.
 The length of arc (i,j) (call it cij) is the total net
cost incurred from year i to j.
cij = maintenance cost incurred during years i,i+1,…,j-1
+ cost of purchasing a car at the beginning of year i
- trade-in value received at the beginning of year j

17
Ex. 1 – Solution continued
 Applying this formula to the information the
problem yields
c12=2+12-7=7 c16=2+4+5+9+12+12-0=44
c13=2+4+12-6=12 c23=2+12-7=7
c14=2+4+5+12-2=21 c24=2+4+12-6=12
c15=2+4+5+9+12-1=31
c25=2+4+5+12-2=21

c26=2+4+5+9+12-1=31 c45=2+12-7=7
c34=2+12-7=7 c46=2+4+12-6=12
c35=2+4+12-6=12 c56=2+12-7=7
c36=2+4+5+12-2=21

18
Ex. 1 – Solution continued
 From the figure below we can see that both
path 1-3-5-6 and 1-2-4-6 will give us the
shortest path with a value of 31.

44

31 31

21 21

12
12

1 7
2 7
3 7
4 7
5 7
6
12 12
21

19
Example-2
A company sells seven types of boxes, ranging in volume from
17 to 33 cubic feet. The demand and size of each box is given
below
Box type: 1 2 3 4 5 6 7
Size: 33 30 26 24 19 18 17
Demand: 400 300 500 700 200 400 200

The variable cost (in Rupees) of producing each box is equal


to the box’s volume. A fixed cost of Rs. 1000 is incurred to
produce any of a particular box. If the company desires,
demand for a box may be satisfied by a box of larger size.
Formulate and solve a shortest-path problem whose solution
will minimize the cost of meeting the demand for boxes.
20
Maximum Flow Problems
 Many situations can be modeled by a network
in which the arcs may be thought of as having
a capacity that limits the quantity of a product
that may be shipped through the arc.
 In these situations, it is often desired to
transport the maximum amount of flow from a
starting point (called the source) to a terminal
point (called the sink).
 These types of problems are called maximum
flow problems.

21
Maximal Flow Problem
 The maximal flow problem is concerned with
determining the maximal volume of flow from
one node (called the source) to another node
(called the sink).
 In the maximal flow problem, each arc has a
maximum arc flow capacity which limits the
flow through the arc.

22
Example: Maximal Flow
 Network Model
3
2 5
3
4 2 3 2
Source 3 4 Sink
4 3
1 4 7
3 1
3 5 1 5
3 6
6

23
Example: Maximal Flow
 A capacitated transshipment model can be
developed for the maximal flow problem.
 We will add an arc from node 7 back to node 1
to represent the total flow through the
network.
 There is no capacity on the newly added 7-1
arc.
 We want to maximize the flow over the 7-1
arc.

24
Example: Maximal Flow
 Modified Network Model
3
2 5
3
4 2 3 2
Source 3 4 Sink
4 3
1 4 7
3 1
3 5 1 5
3 6
6

25
Maximal Flow Problem
 LP Formulation
(as Capacitated Transshipment Problem)
 There is a variable for every arc.
 There is a constraint for every node; the flow out
must equal the flow in.
 There is a constraint for every arc (except the added
sink-to-source arc); arc capacity cannot be
exceeded.
 The objective is to maximize the flow over the added,
sink-to-source arc.

26
Maximal Flow Problem
 LP Formulation
(as Capacitated Transshipment Problem)

Max xk1 (k is sink node, 1 is source node)

s.t. xij - xji = 0 (conservation of flow)


i j

xij < cij (cij is capacity of ij arc)

xij > 0, for all i and j (non-negativity)

(xij represents the flow from node i to node j)

27
Example: Maximal Flow
 LP Formulation
 18 variables (for 17 original arcs and 1 added arc)
 24 constraints
 7 node flow-conservation constraints
 17 arc capacity constraints (for original arcs)

28
Example: Maximal Flow
 LP Formulation
 Objective Function
Max x71
 Node Flow-Conservation Constraints
x71 - x12 - x13 - x14 = 0 (flow in & out of node 1)
x12 + x42 + x52 – x24 - x25 = 0 (node 2)
x13 + x43 – x34 – x36 = 0 (etc.)
x14 + x24 + x34 + x54 + x64 – x42 - x43 - x45 - x46 - x47 = 0
x25 + x45 – x52 – x54 - x57 = 0
x36 + x46 - x64 - x67 = 0
x47 + x57 + x67 - x71 = 0
29
Example: Maximal Flow
 LP Formulation (continued)
 Arc Capacity Constraints
x12 < 4 x13 < 3 x14 < 4

x24 < 2 x25 < 3

x34 < 3 x36 < 6

x42 < 3 x43 < 5 x45 < 3 x46 < 1 x47 < 3

x52 < 5 x54 < 5 x57 < 5

x64 < 5 x67 < 5


30
Example: Maximal Flow
 Optimal Solution

2
2 5
3 1 2
Source Sink
4 3
1 4 7
1
3 1 5
10 3 6
4

31
Example 3: Maximum Flow
 Sunco Oil wants to ship the maximum possible
amount of oil (per hour) via pipeline from node
so to node si.
Arc Capacity
a0(2)
(so,1) 2
(0)3 (so,2) 3
(1,2) 3
so (2)2
1 (2)3
2 (2)2
si (1,3) 4
(3,si) 1

(0)4 3 (0)1 (2,si) 2

 The various arcs represent pipelines of different


diameters.
 The maximum number of barrels of oil that can
be pumped through each arc the arc capacity. 32
Continued
 Formulate an LP that can be used to determine
the maximum number of barrels of oil per hour
that can be send from so to si.

33
Ex. 3 – Solution continued
 Let x0 be the flow through the artificial arc, the
conservation of flow implies that x0 = total amount of oil
entering the sink.
 Sunco’s goal is to maximize x0.
Max Z= X0
S.t. Xso,1<=2 (Arc Capacity constraints)
Xso,2<=3
X12<=3
X2,si<=2
X13<=4
X3,si<=1
X0=Xso,1+Xso,2 (Node so flow constraints)
Xso,1=X12+X13 (Node 1 flow constraints)
Xso,2+X12=X2,si (Node 2 flow constraints)
X13+X3,si (Node 3 flow constraints)
X3,si+X2,si=X0 (Node si flow constraints)
Xij>=0

 One optimal solution to this LP is Z=3, xso,1=2, x13=1,


x12=1, xso,2=1, x3,si=1, x2,si=2, xo=3.
34
 The maximum flow in a network can be found
using LINDO, but LINGO greatly lessens the
effort needed to communicate the necessary
information to the computer.
 Important questions – Ford-Fulkerson Method
 Given a feasible flow, how can we tell if it an optimal
flow (that is maximizes x0)?
 If a feasible flow is nonoptimal, how can we modify
the flow to obtain a new feasible flow that has a
larger flow from the source to the sink?

35
 Choose any set of nodes V’ that contains the
sink but does not contain the source. Then the
set of arcs (i,j) with i not in V’ and j a member
of V’ is a cut for the network.
 The capacity of a cut is the sum of the
capacities of the arcs in the cut.
 The flow from source to sink for any feasible
flow is less than or equal to the capacity of any
cut.
 If the sink cannot be labeled, then
Capacity of CUT = current flow from source to sink

36
Minimum Cost Network Flow
Problems
 The transportation, assignment,
transshipment, shortest path, maximum flow,
and CPM problems are all special cases of
minimum cost network flow problems (MCNFP).
 Any MCNFP can be solved by a generalization
of the transportation simplex called the
network simplex.
 MCNFP can be written as
min c X
allarcs
ij ij

s.t. Xij   Xki  bi (for each node i in the network)


j k

Lij  Xij  Uij (for each arc in the network)

37
 Constraints stipulate that the net flow out of
node i must equal bi and are referred to as the
flow balance equation.
 Consider the following transportation problem
Supply point 1 Demand point 1

1 3 1 2 4 (Node 1)

3 4 5 (Node 2)

6 (Node 3) 3 (Node 4)
2 4
Supply point 2 Demand point 2
38
 MCNFP representation of the problem
min Z=X13+2X14+3X23+4X24

X13 X14 X23 X24 rhs Constraint

1 1 0 0 = 4 Node 1

0 0 1 1 = 5 Node 2

-1 0 -1 0 = -6 Node 3

0 -1 0 -1 = -3 Node 4

All Variables nonnegative

39
 The flow balance equations in any MCNFP have
this important property:

Each variable xij has a coefficient of +1 in the


node i flow balance equation, a coefficient of -1
in the node j flow balance equation, and a
coefficient of 0 in all other flow balance
equations.
 LINGO can easily be used to solve ay MCNFP
problem.

40
Assignment Problems

Example: Machineco has four jobs to be completed. Each


machine must be assigned to complete one job. The time
required to setup each machine for completingeach job is
shown in the table below. Machinco wants to minimize the
total setup time needed to complete the four jobs.
Setup times
(Also called the cost matrix)

Time (Hours)

Job1 Job2 Job3 Job4

Machine 1 14 5 8 7

Machine 2 2 12 6 5

Machine 3 7 8 3 9

Machine 4 2 4 6 10
The Model

min Z  14 X 11  5 X 12  8 X 13  7 X 14  2 X 21  12 X 22  6 X 23  5 X 24
 7 X 31  8 X 32  3 X 33  9 X 34  2 X 41  X 42  6 X 43  10 X 44
s.t. X 11  X 12  X 13  X 14  1
X 21  X 22  X 23  X 24  1
X 31  X 32  X 33  X 34  1
X 41  X 42  X 43  X 44  1
X 11  X 21  X 31  X 41  1
X 12  X 22  X 32  X 42  1
X 13  X 23  X 33  X 43  1
X 14  X 24  X 34  X 44  1
Xij  0orXij  1
For the model on the previous page note that:

Xij=1 if machine i is assigned to meet the demands of job j

Xij=0 if machine i is assigned to meet the demands of job j

In general an assignment problem is balanced transportation


problem in which all supplies and demands are equal to 1.
Although the transportation simplex appears to be very
efficient, there is a certain class of transportation problems,
called assignment problems, for which the transportation
simplex is often very inefficient. For that reason there is an
other method called The Hungarian Method. The steps of The
Hungarian Method are as listed below:
Step1. Find a bfs. Find the minimum element in each row of
the mxm cost matrix. Construct a new matrix by subtracting
from each cost the minimum cost in its row. For this new
matrix, find the minimum cost in each column. Construct a new
matrix (reduced cost matrix) by subtracting from each cost the
minimum cost in its column.
Step2. Draw the minimum number of lines (horizontal and/or
vertical) that are needed to cover all zeros in the reduced cost
matrix. If m lines are required , an optimal solution is available
among the covered zeros in the matrix. If fewer than m lines
are required, proceed to step 3.

Step3. Find the smallest nonzero element (call its value k) in


the reduced cost matrix that is uncovered by the lines drawn in
step 2. Now subtract k from each uncovered element of the
reduced cost matrix and add k to each element that is covered
by two lines. Return to step2.
Assignment Problems

Personnel Assignment:

Time (hours)
Job 1 Job 2 Job 3 Job 4
Person 1 14 5 8 7
Person 2 2 12 6 5
Person 3 7 8 3 9
Person 4 2 4 6 10

47
Assignment Problem Formulation
Define Variables:
Let Xij = 1 if ith person is assigned to jth job
Xij = 0 if ith person is not assigned to jth job

Objective Function:
Min z = 14*X11 + 5*X12 + … + 10*X44
Personnel Constraints: Demand Constraints:
X11 + X12 + X13 + X14 = 1 X11 + X21 + X31 + X41 = 1
X21 + X22 + X23 + X24 = 1 X12 + X22 + X32 + X42 = 1
X31 + X32 + X33 + X34 = 1 X13 + X23 + X33 + X43 = 1
X41 + X42 + X43 + X44 = 1 X14 + X24 + X34 + X44 = 1

Binary Constraints:
Xij = 0 or Xij = 1 48
Assignment Problem Algorithm
Row Minimum
14 5 8 7 5
2 12 6 5 2
7 8 3 9 3
2 4 6 10 2
Subtract Row Minimum from Each Row:
9 0 3 2
0 10 4 3
4 5 0 6
0 2 4 8

Column Minimum 0 0 0 2

49
Assignment Problem Algorithm
Subtract Column Minimum from Each Column:
9 0 3 0
0 10 4 1
4 5 0 4
0 2 4 6
Subtract Minimum uncrossed value from uncrossed values
and add to twice-crossed values:
Solution:
10 0 3 0 0
0 9 3 0 0
5 5 0 4 0
0 1 3 5 0

Draw lines to cross out zeros and read solution from zeros
50
Example - 1
Five men are available for doing five different jobs. From past
records, the time (in hours) that each man takes to do each
job is known and given in the following table:

Jobs
I II III IV V
A 4 11 4 9 3
B 8 10 9 8 3
C 6 8 7 5 3
Men D 6 4 9 5 3
E 7 5 11 7 3
Find the assignment of men to jobs that will minimize the total
time taken
51
Example - 2
Xo-Air has six flights arriving at IGI airport between 9.00 and 9.30
am. The same six airplanes depart on different flights between 9.40
am and 12.20 am. The average numbers of people transferring
between incoming and leaving flights appear below:

L01 L02 L03 L04 L05 L06


I01 20 15 16 5 4 7

I02 17 15 33 12 8 6
I03 9 12 18 16 30 13

I04 12 8 11 27 19 14

I05 0 7 10 21 10 32

I06 0 0 0 6 11 13
52
Example - 2..
Flight I05 arrives too late to connect with L01,
similarly I06 is too late for flights L01, L02 and L03.

All the planes are identical. A decision problem is


which incoming flight should be assigned to which
outgoing flight. For example if incoming flight I02 is
assigned to leaving flight L03, then 33 people (and
their baggage) will be able to remain on their plane
at the stop at IGI airport. How should incoming
flights be assigned to leaving flights, so a minimum
number of people need to change planes at the IGI?

53
Example - 3

Paltry properties has just acquired four rental homes.


Paltry wishes to have the houses painted within the
next week so that all can be available for the prime
rental season. This means that each house will have
to be painted by a different contractor. The following
table shows the bids (lakhs of rupees) received from
four contractors on the four houses:

Paltry wants to decide which bids to accept in order


to paint all houses at minimum total cost.
(a) Formulate a linear assignment problem to choose
an optimal plan.

54
Example – 3…

Painter Bid

House A B C D
1 2.5 1.3 3.6 1.8
2 2.9 1.4 5.0 2.2
3 2.2 1.6 3.2 2.4
4 3.1 1.8 4.0 2.5

55
Minimum Spanning Tree
Problems
 Suppose that each arc (i,j) in a network has a
length associated with it and that arc (i,j)
represents a way of connecting node i to node
j.
 In many applications it must be determined
that the set of arcs in a network that connects
all nodes such that the sum of the length of the
arcs is minimized. Clearly, such a group of arcs
contain no loop.
 For a network with n nodes, a spanning tree
is a group of n-1 arcs that connects all nodes of
the network and contains no loops.
56
 A spanning tree of minimum length in a
network is a minimum spanning tree (MST).
 The MST Algorithm may be used to find a
minimum spanning tree.
 Begin at any node i, and join node i to the node in
the network (call it node j) that is closest to node i.
 The two nodes i and j now form a connected set of
nodes C={i,j}, and arc (i,j) will be in the minimum
spanning tree. The remaining nodes in the network
(call them Ć) are referred to as the unconnected set
of nodes.

57
 Now choose a member of C’ (call it n) that is closest
to set C. Let m represent the node in C that is closest
to n. Then the arc(m,n) will be in the minimum
spanning tree. Now update C and C’. Since n is now
connected to {i,j}, C now equals {i,j,n} and we must
eliminate node n from C’.
 Repeat this process until a minimum spanning tree is
found. Ties for closest node and arc to be included in
the minimum spanning tree may be broken
arbitrarily.

58
Example: MST Algorithm
 The State University campus has five
computers. The distances between each pair os
computers are given.
 What is the minimum length of cable required
to interconnect the computers?
 Note that if two computers are not connected this is
because of underground rock formations.

1 1 2
2 2
6 5
2 4 3
4 4
3
5
59
Example: Solution
 We want to find the minimum spanning tree.
 Iteration 1: Following the MST algorithm discussed
before, arbitrarily choose node 1 to begin. The
closest node is node 2. Now C={1,2}, Ć={3,4,5},
and arc(1,2) will be in the minimum spanning tree.

1 1
2
2
2
6
5 4
2 3
4
4
5 3 60
Ex. – Solution continued
 Iteration 2: Node 5 is closest to C. since node 5
is two blocks from node 1 and node 2, we may
include either arc(2,5) or arc(1,5) in the
minimum spanning tree. We arbitrarily choose
to include arc(2,5). Then C={1,2,5} and
Ć={3,4}. 1 1
2
2
2
6
5 4
2 3
4
4
5 3 61
Ex.– Solution continued
 Iteration 3: Since node 3 is two blocks from
node 5, we may include arc(5,3) in the
minimum spanning tree. Now C={1,2,5,3} and
Ć={4}.

1 1
2
2
2
6
5 4
2 3
4
4
5 3
62
Ex. – Solution continued
 Iteration 4: Node 5 is the closest node to node
4. Thus, we add arc(5,4) to the minimum
spanning tree.
 The minimum spanning tree consists of
arcs(1,2), (2,5), (5,3), and (5,4). The length of
the minimum spanning tree is 1+2+2+4=9
blocks. 1 1
2
2
2
6
5 4
2 3
4
4
5 3 63
Another Example : Minimal Spanning Tree

Objective: Find the minimum distance such that all


nodes are visited once (i.e. no cycles).

9
2 6
3 6
2
7
1 3 3
3
1
4 3
  4 5

64
Minimal Spanning Tree

One possible spanning tree, Z = 26 (note, no cycles).

9
2 6
3
7
1 3

4 3
  4 5

65
Minimal Spanning Tree

Possible applications:
• Phone lines between cities.
• Rail lines between cities.
• Road networks.
• Air conditioning ducts. 9
• etc.. 2 6
3
7
1 3

4 3
  4 5
66
Minimal Spanning Tree

Algorithm:

Step 1 – Select an arbitrary node initially. Identify a node


that is closest and include the arc connecting these two nodes
in the spanning tree.

Step 2 – Out of the remaining nodes, determine the one that


is closest to a node already selected in the spanning tree.
Include the arc connecting these two nodes in the spanning
tree. Whenever there is a tie for the closest node, it is
broken arbitrarily.

67
Minimal Spanning Tree

Start with node 1. Node 2 is closest.

9
2 6
3 6
2
7
1 3 3
3
1
4 3
  4 5

68
Minimal Spanning Tree

Node 3 is closest to partial spanning tree {(1,2)}. Remove


any cycles.

9
2 6
3 6
2
1 3 3
3
1
4 3
  4 5

69
Minimal Spanning Tree

Node 4 is closest to partial spanning tree {(1,2), (2,3)}.


Remove any cycles.

9
2 6
3 6
2
1 3 3
3
1
3
  4 5

70
Minimal Spanning Tree

Node 5 is closest to partial spanning tree {(1,2), (2,3),(3,4)}.


Remove any cycles. Note, arbitrarily select (3,5) or (4,5).

9
2 6
3 6
2
1 3 3

1
3
  4 5

71
Minimal Spanning Tree

Node 6 is closest to partial spanning tree {(1,2), (2,3),(3,4),(4,5)}.


Remove any cycles. Stop, no more nodes.

2 6
3
2
1 3 3

1
3
  4 5

Minimal spanning tree is {(1,2), (2,3),(3,4),(4,5),(5,6)}. Z = 12.


72
The Constrained Shortest Path Problem

(1,1)
2 4
(1,10) (2,3) (1,7)

1 (1,2) (10,1) 6
(5,7)
(10,3) (2,2)
3 5
(12,3)

Find the shortest path from node 1 to node 6


with a transit time at most 10 73
Constrained Shortest Paths: LP
Formulation

 Given: a network G = (N,A)


 cij cost for arc (i,j)
 tij traversal time for arc (i,j)

Z* = Min  c xij
( i , j ) A ij
 1 if i = s

s. t.  j xij   j x ji   1 if i = t
 0 otherwise

 ( i , j )A tij xij  T Complicating constraint

xij  0 or 1 for all ( i , j )  A


74
Classes of routing problems

 Traveling salesman problem (TSP)


 Multiple traveling salesman problem (MTSP)
 Vehicle routing problem (VRP)
 Chinese postman problem (CPP)

75
Traveling salesman problem:
The integer programming formulation
1, if the salesman goes from node i to j during leg k
xijk  
 0, otherwise

Min cijk xijk


i j k

Subject to constraints
x
j, j1
1 j1 1

x
i, i 1
i1n 1

n 1

 x
i k 1
ijk  1, j  2,3,..., n; i  j
n

 x
j k 1
ijk  1, i  1,2,3,..., n; i  j

76
Traveling salesman problem:
The integer programming formulation

1, if the salesman goes from node i to j during leg k


xijk  
 0, otherwise

Min  cij xij


i j

Subject to constraints
N

x
i 1
ij  1 (for j  1,2,...N)
N

x
j 1
ij  1 (for i  1,2,...N)

n 1

 x
i k 1
ijk  1, j  2,3,..., n; i  j

ui  u j  Nxij  N  1 (for i  j; i  2,3,..., N , j  2,3,..., N ; u j  0)


77
Solving TSP
 Branch-and-Bound method is an effective way
of solving TSPs
 There are many heuristics to solve TSPs

78
Traveling salesman problem:
The nearest neighbor procedure
1. Start with a node at the beginning of the tour (the depot
node).
2. Find the node closest to the last node added to the tour.
3. Go back to step-2 until all nodes have been added.
4. Connect the first and the last nodes to form a complete tour.

Advantage:
1. Simple and gives a ‘near optimal’ solution
Disadvantage:
1. May not give a optimal solution

79
Traveling salesman problem:
The nearest neighbor procedure
From To node (distance in kilometers)
Node
A B C D E F

A - 5.4 2.8 10.5 8.2 4.1

B 5.4 - 5.0 9.5 5.0 8.5

C 2.8 5.0 - 7.8 6.0 3.6

D 10.5 9.5 7.8 - 5.0 9.5

E 8.2 5.0 6.0 5.0 - 9.2

F 4.1 8.5 3.6 9.5 9.2 -


80
Traveling salesman problem:
The nearest neighbour procedure
Solution:
A C F B E D A

The length of the tour 35.4 km

Best tour
A B E D C F A
The length of the tour 30.9 km
81
Traveling salesman problem:
The nearest neighbor procedure

 For smaller networks it is easy to enumerate all


possible tours and select the best.
 But with bigger networks it is not possible even
with super computers (why?). So approximate
solutions can be useful
 The nearest neighbour procedure can be
repeated assuming each node as starting point
to find still better solutions. In the example
above the best solution (31.3 km) is
F C A B E D F
82
Multiple traveling salesman problem
and
Vehicle routing problem

The MTSP is a generalization of the TSP where


there are multiple vehicles and a single depot.

In MTSP when there are restrictions on the


capacity of the multiple vehicles and demand
at each node is different the problem is
classified as Vehicle routing problem.

83
The Vehicle routing problem
Cluster first, route second approach

 Use optimization algorithm for block formation


 Include the affect of peak periods, existing
route, vehicle type etc.
 Updation

84

You might also like