Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be...

85
Routing Problems… Design of routes for vehicles or people. These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood called edge-covering problem e.g. cleaning and sweeping of streets The Chinese Postman’s Problem Alternatively, the objective may be to visit a set of given geographical points in a city in order to provide some service there or for delivery purposes called node-covering problem e.g. the distribution of newspapers to newsstands The Travelling Salesman Problem

Transcript of Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be...

Page 1: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Routing Problems…

Design of routes for vehicles or people. These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood called edge-covering problem

e.g. cleaning and sweeping of streets

The Chinese Postman’s Problem

Alternatively, the objective may be to visit a set of given geographical points in a city in order to provide some service there or for delivery purposes called node-covering problem

e.g. the distribution of newspapers to newsstands

The Travelling Salesman Problem

Page 2: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP)

Consider the case of a mailman who is responsible for the delivery of mail in the city area. The mailman must always begin his delivery route at node A

where the post office is located; must traverse every single street in his area; and, eventually, must return to node A

The Question is: How should the mailman's route be designed to minimize the

total distance he walks, while at the same time traversing every street segment at least once

This type of edge-covering problem is known as the Chinese postman's problem We will consider undirected graphs only

Page 3: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP) Obviously, if we find a tour that covers each link exactly

once, this is the optimal (i.e. best) route The problem of finding a tour that covers each link of a network

exactly once was first studied by Euler, a Swiss Mathematician and Physicist, whose work marked the birth of Graph Theory

Euler tried to find a way in which a parade procession could cross all seven bridges shown below exactly once (i.e. visiting each bridge exactly once).

Page 4: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP)

Euler proved in 1736 that no solution to the parade routing problem exists. But he derived some general results that provide the

motivation for the solution approaches to the CPP

Definitions An Euler tour is a circuit which traverses every edge

on a graph exactly once (beginning and terminating at the same node).

An Euler path is a path which traverses every edge on a graph exactly once.

Page 5: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP) Recall that the degree of a node is the number of

edges that are incident on this node

Euler’s Theorem (1736) A connected undirected graph G(N,A) has a Euler

Tour iff it contains exactly zero nodes of odd degree

If G(N,A) contains exactly 2 nodes of odd degree, then a Euler Path exists starting from any of the 2 odd-degree nodes ending at the other

Proof To pass through a node on a Euler tour/path you have to go

in through one link and come out through another

If there is a node with odd degree (e.g. 1) you will have to traverse a link incident on that node twice

Page 6: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP)

zero odd nodes in both figures

Euler tours must exist

e.g. Euler Tour: B-C-D-A-C-A-B

Page 7: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP)

two odd-degree nodes (A and F)

Euler path must exist between the two odd-degree nodes

e.g. Euler Tour: A-B-D-E-C-A-F-C-B-E-F

Page 8: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP)

four odd-degree nodes

Euler tour/path CANnot exist for these networks

This is the parade problem (a simplified rep)

Page 9: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP) An important observation that we will use later

The number of odd-degree nodes in any graph is always even

Proof by induction

If you have a graph without odd-degree nodes, such nodes can only be created in couples (handshaking concept)

Drawing a Euler Tour It is easy to draw manually an Euler Tour on a network that has

one

One method is by trial and error

The only guideline is to avoid traversing an “isthmus”: an edge which if you traverse will divide the yet uncovered part of the network into 2 separate non-empty subnetworks

Page 10: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP) Start at node a

a->b->g

Then if you include h, this will create an isthmus, so avoid including h at this point

If we include h, then arc(h,a) will be unconnected to the rest of the network

a-->b-->g-->f-->e-->d-->c-->f-->k-->m-->l-->k-->j-->i-->n-->j-->g-->h-->a

Page 11: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP)

Drawing a Euler Tour (continued)

The following is another method suited for computer applications Start from any node J0

Create a cycle C0, and delete the traversed edges of C0

If no edges left, stop

Else, start from a node J1 in C0 and create another cycle C1 in the undeleted graph, then delete the traversed edges of C1

If no edges left, stop

Else, continue

The Euler tour is

J0 J1 J2………… J1 J0Part of

C0

Part of C1

Page 12: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP) It is clear that, in most cases, there exist many different

Euler tours for any connected G(N, A) with no nodes of odd degree However, all Euler tours of any given graph naturally have the

same total length

Back to the CPP

The solution to the Chinese postman’s problem is to find the minimum length, edge-covering Euler tour of a graph G(N, A) with no restrictions placed on G other than that it be connected and undirected

For this tour to exist, Euler Theorem states that we need to make sure that the G has zero odd-degree nodes

Page 13: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP) The CPP algorithm for undirected graphs

The basic idea is to take the given graph G(N,A) and add “dummy” edges to it, until G has no odd-degree nodes. In adding edges, try to add as little length as possible to G

STEP 1

identify all m nodes of odd degree on G(N,A) – Remember m is even

STEP 2

find the minimum-cost, pairwise matching of the m odd-degree nodes

STEP 3

modify G(N,A) by adding to it the set M of dummy edges corresponding to the minimum-cost pairwise matching found in Step 2. Call this augmented graph G’(N,AM)

STEP 4

find a Euler tour on G’. This tour is a solution to the CPP

Page 14: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP) An Example

4 odd-degree nodes (a,b,d,e)

Three pairwise matching- a-b, d-e- a-d, b-e- a-e, b-d

1812 20

Page 15: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP) An Example

An Euler Tour/CCP Solution isa-->d-->a -->c -->d -->e --> c --> b -->e --> b --> a

Total travelled distance of An Euler Tour/CCP Solution is 60 (48 from original graph and 12 from artificial added links)-- this means that links (a,d) and (e,d) will be traversed twice

Page 16: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP) For graphs with small m, we can evaluate each possible

pairwise matching and select the best As m increases, the number of possible pairwise matchings

explodes

Given m odd degree nodes, the number of possible pairwise matching is given by the following relationship

For example, for m = 4 , # of pairwise matching is 3

m = 10, # of pairwise matching is 945

m = 20, # of pairwise matching is 655 million

2 i 1 i 1

m / 2

Page 17: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP) Luckily, it is possible to find manually the optimal (or

near optimal) pairwise matching for large CPPs Key point

in a minimum cost, pairwise matching of the odd-degree nodes, no two shortest paths in the matching can have any edges in common

Implication

Search only in the “neighbourhood” of each odd-degree node

This will eliminate a very large number of potential matches

Pairing a with c and bwith d is a bad match cause they share a common segment of p-q

Page 18: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP) Exercise

8 odd-degree nodesC, D, F, G, I, J, K, L

about 105 possible pairwise matching

The only optimal one is pairing I-J, K-L, C-D and F-G. with total extra cost of 490 units

Page 19: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP) Exercise

It is now possible to find an Euler Tour --start at any node and you should end at the same node

Total travel cost is 3,340 (original length) plus 490 extra units

Page 20: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Chinese Postman Problem (CPP) Applications of the CPP

Snow plowing, street sweeping, mail delivery, etc.

CPP on directed graphs can also be solved efficiently

CPP on mixed graphs is a “hard” problem

Page 21: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP) Consider the case of a salesman who is responsible for

the delivery of products to a number of specific points/cities/nodes This is commonly referred to as “node-covering” problems

The Question is: Find the minimum distance route that begins at a given

node of a network, visits all the members of a specified set of nodes on the network at least once, and returns eventually to the initial node

If we can visit each node exactly once, that would be the optimal solution

node B needs to be visited twice

Page 22: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Let’s consider TSP in the following context - TSP1 Completely Connected Networks

That is it is possible to go directly from any point to any other point without passing through any of the other points in the set

Triangular Inequality for Distances

The shortest distances between all pairs of points are equal to the length of the direct links between the two points.

i.e. between nodes i and j, l(i,j) < {l(i,k) + l(k,j)}, for any k

The shortest distance matrix is assumed to be symmetric --mainly undirected networks

l(i,j) = l(j,i)

This ensures that the shortest length traveling salesman tour and each node is visited exactly once

Page 23: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Example

A

B

D

C

A,D,B,C,A

A,C,B,D,A

A,B,D,C,A A,B,C,D,A

A,C,D,B,A A,D,C,B,A

Page 24: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

The TSP may be a very difficult problem to solve

In our (simplified) version of the TSP there are (n - 1)! different orderings of the points to be visited,

that is, (n - 1)!/2 different solutions of the TSP (since each tour can be run in either of two directions).

N # of possible solutions

4 3

10 1,814,400

20 1.2 * 1018

Page 25: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Because of the combinatorial characteristic of the TSP/TSP1 problems, efficient algorithms to find optimal solutions are hard to devise

Emphasis is on good heuristic algorithms

Heuristic algorithms can be classified as

tour construction heuristics

tour improvement heuristics

Page 26: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Heuristic Algorithms for TSP1(completely connected, symmetric distances, triangular inequalities)

Nearest Neighbour Heuristic (aka Euclidean TSP)

Insertion Heuristics Random Insertion

Nearest Insertion

Farthest Insertion

Cheapest Insertion

Minimum Spanning Tree Heuristics

Christofides Heuristics

Page 27: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Refuse-Collection Example

Locations

Page 28: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Refuse-Collection Example

Distance Matrix

Page 29: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Nearest Neighbour Heuristics

Begin at a pre-specified node

Build a tour by always moving to the nearest neighbour of the latest node to join the tour

When all nodes have been connected to the tour, join the last node to the origin to complete the TSP tour

Page 30: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Nearest Neighbour Heuristics for Refuse-Collection Example

1-->2-->3-->4-->5-->6-->7-->8-->9-->10-->11-->2-->3-->4-->5-->6-->7-->9-->8-->10-->1

Page 31: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Nearest Neighbour Heuristics The question is, how good this solution is relative to

the optimal solution to the TSP We need to do “worst-case” performance analysis

It turns out that

This means that the longest tour produced by the nearest neighbour heuristic is longer than the optimal TSP tour by up to [1/2 log2 n+ 1/2]

If n = 32, Ratio = 1/2 * 5 + 1/2 = 3 --> worst possible tour could be 3 times longer or less than the optimal tour

In practice, L(nearest neighbour) is about 20% longer than the optimal TSP tour and complexity of O(n2)

L Nearest Neighbour L Optimal TSP

1

2log2 n

1

2

Page 32: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Minimum Spanning Tree (MST) Heuristics

Find the MST of the n nodes to be visited

Double all the edges of the MST to obtain an Eulerian Graph

Find the Euler tour of that graph -- this is the solution to the TSP

Improve the tour obtained by not visiting any node that has been already visited

Page 33: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Minimum Spanning Tree (MST) Heuristics

Stop when you include all nodes in the MST

Links added to the MST in the following order (1,2),(2,3),(2,4), (1,7), (7,9), (9,8), (7,5), (5,6), (9,10)

Double all edges to create an Eulerian Graph

Create an Euler Tour1,2,3,2,4,2,1,7,5,6,5,7,9,8,9,10,9,7,1

Improve by not revisiting any node more than once1,2,3,2,4,2,1,7,5,6,5,7,9,8,9,10,9,7,1==>1,2,3,4,7,5,6,9,8,10,1

Page 34: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Minimum Spanning Tree (MST) Heuristics

Page 35: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Minimum Spanning Tree (MST) Heuristics

Further improvements-- Good tours are “rounded” not “star shaped”-- in good tours, lines don’t cross

Page 36: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Minimum Spanning Tree (MST) Heuristics

Worst-case performance Computational complexity of O(n2),

Proof Assume that the length of the optimal TSP tour is L(TSP)

If we remove from the optimal TSP tour its shortest edge, the tour becomes a tree -- call this tree T

The length of tree T, L(T) = L(TSP) - shortest edge of TSP tour

L(T) > L(MST) -- solution for MST

L(T) < L(TSP) -- optimal solution for TSP

Then, L(MST) < L(TSP)

L(MST-Tour) = 2 * L(MST) -- we doubled all edges!

==> L(MST-Tour)/L(TSP) ≤2

L MST Tour L TSP

2

Page 37: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Christofides Heuristics

Find the MST of the n nodes to be visited

Find the odd-degree nodes

Find the minimum length pairwise matching for odd-degree nodes to obtain an Eulerian Graph

Find the Euler tour of that graph -- this is the solution to the TSP

Improve the tour obtained by not visiting any node that has been already visited

Page 38: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Christofides Heuristics

Find MST --length of 258L(TSP) > 258

Find minimum pairwise matching (cost of 143)to create an Eulerian Graph (total length of 401)

Create an Euler Tour1,2,3,2,4,6,5,7,10,9,8,7,1

Improve by not revisiting any node more than once1,2,3,2,4,6,5,7,10,9,8,7,1==>1,3,2,4,6,5,7,10,9,8,1(total length 371 units)

odd-degree nodes2,3,4,6,7,10

Page 39: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Travelling Salesman Problem (TSP)

Christofides Heuristics

Further improvements-- Good tours are “rounded” not “star shaped”-- in good tours, lines don’t cross

Improved tour1,3,2,4,5,6,10,9,8,7,1 Total length of 331 -- true optimal length

Page 40: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Facility Location

Problems concerned with determining good locations for the stationing of service vehicles or the construction of major facilities

These problems arise in the context of both routine and emergency services but the objectives are usually different in the two cases

What is considered a good location? Depends on the service to be located

e.g. city center is a good location choice for a post-office, but a poor location choice for a power-plant!

We will define different objectives (or measures of goodness) for various facility categories

Page 41: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Facility Location - three categories

Median problems

Find the optimal locations of a pre-specified number of facilities so as to minimize the average travel cost (distance, time, etc) to and from the facilities for the population in the area

Sometimes called “Minsum” problems

Usually used for non-emergency facilities, e.g. library, community center, …

Page 42: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Facility Location - three categories

Center problems Find the optimal locations of a pre-specified number

of facilities so as to minimize the maximum travel cost to and from the facilities that any user has to travel

Sometimes called “Minmax” problems

This category is typical for locating emergency facilities, e.g. hospitals, fire station

The opposite of this problem is the “Maxmin” problem, where the objective is to maximize the minimum distance from/to the facility (e.g. garbage dump)

Page 43: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Facility Location - three categories

Requirements problems These are problems in which certain standards of

performance have already been prespecified for a service system (e.g. a school within 2 km from every home)

We are interested in finding the number of facilities required to meet these standards as well as the locations of these facilities.

This type of problem is a more general one than the median or center problems

It it applicable to both emergency and nonemergency services

Page 44: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems Let’s consider Undirected graphs G(N,A)

Let’s assume that we need to locate k-facilities

Each node has a weight (hj), representing the fraction of customers located at node j Assume that customers are located only at nodes

Assume that demands originating at any given node j will be served exclusively by the facility that is closest to j

∑ hj = 1

Objective is to locate k-facilities (pre-specified) on G such that the mean travel distance to a closest facility is minimized

Page 45: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems

We will use Hakimi’s theorem “At least one set of k-medians exist solely on the

nodes of G”

Meaning that nodes provide the optimal locations for facilities so as to minimize the average travel cost for all customers

The practical significance of this theorem is great It states in effect that the search for the set of the k

optimal locations for the k facilities can be limited to the node set of G (i.e., to a total of n points only) instead of the infinite number of points that lie on the links of G.

Page 46: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems - Hakimi’s theorem

The validity of the theorem is obvious for the trivial case when the required number of facilities k is greater than or equal to the number of nodes n.

Then we only have to locate one facility on each node to reduce average travel distance to zero

Let’s proof the theorem for k=1

Assume that one of the vendors along St. George street is trying to locate his stand between Bahen Centre and SS building so as to attract most students (i.e. minimize their travel distance)

Where is the optimal location?

Page 47: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems - Hakimi’s theorem

We need to find x so as to minimize the mean travel distance from BA & SS to the stand location

Let’s consider the case where hp > hq

BA SS

Where to locate?

% of students at BA is hp % of students at SS is hq = (1- hp)

BA SS|x

x 1-x

Page 48: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems - Hakimi’s theorem

Let’s call the mean travel distance to/from the facility, if is located at x, J(x)

We need to find x that minimizes J(x)

J(x) = hp * (x) + hq * (1-x)

= hp * (x) + (1- hp)* (1-x) = 2 hp * (x) + (1- x - hp)

= x (2 hp -1) + (1- hp)

x

J(x)

1- hp

0BA

1SS

hp

hp > hq

hp > (1-hp)2hp > 1(2hp-1)> 0

From the figure, the location that minimizes the average travel distance is at x = 0 (at BA), when hp > hq

Page 49: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems - Hakimi’s theorem

When hq > hp

The location that minimizes the average travel distance is at SS (x = 1)

When hq = hp

The location that minimizes the average travel distance is at SS or BA or anywhere in-between

x

J(x)

hp

0BA

1SS

1-hp

x

J(x)

1/2

0BA

1SS

Page 50: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems

1-Median Algorithm

STEP 1 Obtain the minimum distance matrix for the nodes of G

STEP 2 Multiply the jth column of the minimum distance matrix by

the demand weight hj (j = 1, 2, . . ., n) to obtain the matrix hj · d(i j)]

STEP 3 For each row i of the [hj · d(i j)] matrix, compute the sum of

all the terms in the row.

The node that corresponds to the row with the minimum sum of terms is the optimal location for the l-median.

Page 51: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems

1-Median Algorithm - Example

1 2 3 4 5

1 0 2 3 2 4

2 2 0 2 3 3

3 3 2 0 1 1

4 2 3 1 0 2

5 4 3 1 2 0

h1=0.1 1

2h2=0.1

h4=0.4 4

5h5=0.4

h3=0 3(2)

(2)

(2)

(1)

(1)(2)

STEP 1D = d(i,j)

Page 52: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems

1-Median Algorithm - Example

0.1 0.1 0 0.4 0.4

1 2 3 4 5

1 0 0.2 0 0.8 1.6

2 0.2 0 0 1.2 1.2

3 0.3 0.2 0 0.4 0.4

4 0.2 0.3 0 0 0.8

5 0.4 0.3 0 0.8 0

h1=0.1 1

2h2=0.1

h4=0.4 4

5h5=0.4

h3=0 3(2)

(2)

(2)

(1)

(1)(2)

STEP 2hj. d(i,j)

Page 53: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems

1-Median Algorithm - Example

0.1 0.1 0 0.4 0.4

1 2 3 4 5

1 0 0.2 0 0.8 1.6 2.6

2 0.2 0 0 1.2 1.2 2.6

3 0.3 0.2 0 0.4 0.4 1.3

4 0.2 0.3 0 0 0.8 1.3

5 0.4 0.3 0 0.8 0 1.5

h1=0.1 1

2h2=0.1

h4=0.4 4

5h5=0.4

h3=0 3(2)

(2)

(2)

(1)

(1)(2)

STEP 3sum of row i

minimum value at rows 3 and 4

Page 54: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems

1-Median Algorithm - Example

h1=0.1 1

2h2=0.1

h4=0.4 4

5h5=0.4

h3=0 3(2)

(2)

(2)

(1)

(1)(2)

Optimal location for 1-facility is anywhere between nodes 3 and 4, including locations at nodes 3 and 4

Page 55: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems

2-Median Algorithm - Exampleh1=0.1 1

2h2=0.1

h4=0.4 4

5h5=0.4

h3=0 3(2)

(2)

(2)

(1)

(1)(2)

We only consider facility locations at nodes -- so with 5 nodes and 2 facilities, we have 10 possible combinationsX21={1,2}, X22={1,3}, X23={1,4}, X24={1,5}X25={2,3}, X26={2,4}, X27={2,5}X28={3,4} X29={3,5}X210={4,5}

Page 56: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems

2-Median Algorithm - Exampleh1=0.1 1

2h2=0.1

h4=0.4 4

5h5=0.4

h3=0 3(2)

(2)

(2)

(1)

(1)(2)

1 2 3 4 5

X21 0 0 2 2 3

X22 0 2 0 1 1

… … … … … …

X29 3 2 0 1 0

X210 2 3 1 0 0

STEP 1D = d(X2c,j)

Customers at node 5 will use facility at node 2

Page 57: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems

2-Median Algorithm - Exampleh1=0.1 1

2h2=0.1

h4=0.4 4

5h5=0.4

h3=0 3(2)

(2)

(2)

(1)

(1)(2)

0.1 0.1 0 0.4 0.4

1 2 3 4 5

X21 0 0 0 0.8 1.2

X22 0 0.2 0 0.4 0.4

… … … … … …

X29 0.3 0.2 0 0.4 0

X210 0.2 0.3 0 0 0

STEP 2hj . d(X2c,j)

Page 58: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems

2-Median Algorithm - Exampleh1=0.1 1

2h2=0.1

h4=0.4 4

5h5=0.4

h3=0 3(2)

(2)

(2)

(1)

(1)(2)

0.1 0.1 0 0.4 0.4

1 2 3 4 5

X21 0 0 0 0.8 1.2 2

X22 0 0.2 0 0.4 0.4 1

… … … … … … …

X29 0.3 0.2 0 0.4 0 0.9

X210 0.2 0.3 0 0 0 0.5

STEP 3sum of row i

Page 59: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems

2-Median Algorithm - Example

h1=0.1 1

2h2=0.1

h4=0.4 4

5h5=0.4

h3=0 3(2)

(2)

(2)

(1)

(1)(2)

Optimal location for 2-facilities is at nodes 4 and 5

Page 60: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Median Problems K-median problems suffer from the “combinatorial

explosion” or “curse of dimensionality” as n and k grow For n = 100 and k = 5, there are 75*106 combinations

Therefore, “brute-force” approach is not practical for large applications We typically use “mathematical integer programming” for large

applications

There is also a “heuristic” approach outlined in the book (Algorithm 6.11, section 6.5.2)

Other considerations for directed graphs It makes a difference whether the average distance to be

minimized is the distance to the facilities (inward medians), fromthe facilities (outward medians), or the round-trip distance (medians)

Page 61: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Center Problems

Consider an Undirected Graph, G(N,A)

Find the optimal location for a facility so as to minimize the maximum travel distance to or from the facility

Two types of Center Problems Vertex Center Problem

Facility is required to be at a node

Absolute Center Problem Facility may be located anywhere on the graph

Page 62: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Center Problems

Vertex Center Problem - Example

1 2 3 4 5 Max

1 0 2 3 2 4 4

2 2 0 2 3 3 3

3 3 2 0 1 1 3

4 2 3 1 0 2 3

5 4 3 1 2 0 4

h1=0.1 1

2h2=0.1

h4=0.4 4

5h5=0.4

h3=0 3(2)

(2)

(2)

(1)

(1)(2)

STEP 1 Find D = d(i,j), shortest distance between i and jSTEP 2 Find the maximum of each rowSTEP 3 Find the minimum of the maximum of each row --> nodes 2,3 or 4 are vertex Centers

Page 63: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Center Problems

Absolute Center Problem For an undirected graph, let’s define the “maximum

distance function”

m(x) = max [d(x,j)] for all j N

where x G be any point on the network

Algorithm Find “local centers”, one for each link in G

Choose the local center with the smallest m(x), report the location x as the absolute center (x*) of G

Page 64: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Center Problems

Absolute Center Problem - Example

Vertex center is at C

Page 65: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Center Problems

Absolute Center Problem -Example To find local centers for link

(A,B)

Assume that the center location is at x on link A,B -- find d(x, j) for all nodes, j={A,B,C,D,E}

d(x,A) = 0, if x = 0

= 4, if x = 4

d(x,B) = 4, if x = 0

= 0, if x = 4

A B

1

2

3

4

5

m(x), d(x,j)

x

Page 66: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Center Problems

Absolute Center Problem -Example d(x,C)

= 3, if x = 0

= 2, if x = 4

= 3+x , if 0 <x< 1.5

= 2+ (4-x) , if 1.5<x<4

d(x,D) = 1, if x = 0

= 4, if x = 4

=1+x, if 0<x<3.5

=4+(4-x), if 3.5<x<4

d(x,E) Same as d(x,D), but shifted up by 1

A B

1

2

3

4

5

m(x), d(x,j)

x

Page 67: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Center Problems

Absolute Center Problem - Example If we locate the facility on

link (A,B), the maximum minimum distance from all nodes (or for all customers) is achieved when x = 0.5

If the facility is located 0.5 unit length from node A, the maximum travel distance will be 3.5 unit length

A B

1

2

3

4

5

m(x), d(x,j)

x

X= 0.5

3.5

Page 68: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Center Problems

Absolute Center Problem - Example Repeat the same analysis for all other links

Link (A,D): min-max is 4 @ x = 0 OR 1 - at node A or D

Link (B, C): min-max is 3 @ x = 1 - at node C

Link (D,E): min-max is 4 @ x = 0 - at node D

Link (D,C): min-max is 2.5 @ x = 1.5 - at 1.5 from node D

Page 69: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Center Problems

Absolute Center Problem - Example Minimum of all min-max is 2.5, on link (D,C) @ 1.5

unit length away from node D

Vertex center

Absolute center

Page 70: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Center Problems

Note the following The absolute and vertex centers do not have to

coincide

The absolute center does NOT have to be on the same link originating from the vertex center

The maximum distance associated with the vertex center must be greater than or equal to the corresponding distance for the absolute center

For any link (a,b),

ifm(a) m(b) l(a,b)

2 m(vertex center ) absolute center might be on l(a,b)

ifm(a) m(b) l(a,b)

2 m(vertex center ) absolute center is not on l(a,b)

Page 71: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Center Problems

Back to the Example

L(A,B) m(A) m(B) L(A,B)

2

4 5 4

2 2.5( 3)

L(A,D) m(A) m(D) L(A,D)

2

4 4 1

2 3.5( 3)

L(B,C) m(B) m(C) L(B,C)

2

5 3 2

2 3( 3)

L(D,E ) m(D) m(E ) L(D,E )

2

4 5 1

2 4( 3)

L(C,D) m(C) m(D) L(C,D)

2

3 4 2

2 2.5( 3)

Based on the above analysis, local centers need to be found on Links (A,B) & (C,D) only, then compared to find the absolute center

Page 72: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Center Problems

Absolute Center Example

L(1,2) m(1) m(2) L(1,2)

2

4 3 2

2 2.5( 3)

Based on the above analysis, local centers need to be found on pretty much all links, then compared to find the absolute center

-- try to find local centers as an exercise

h1=0.1 1

2h2=0.1

h4=0.4 4

5h5=0.4

h3=0 3(2)

(2)

(2)

(1)

(1)(2)

L(1,4) m(1) m(4) L(1,4)

2

4 3 2

2 2.5( 3)

L(2,3) m(2) m(3) L(2,3)

2

3 3 2

2 2( 3)

L(3,4) m(3) m(4) L(3,4)

2

3 31

2 2.5( 3)

L(3,5) m(3) m(5) L(3,5)

2

3 4 1

2 3( 3)

L(4,5) m(4) m(5) L(4,5)

2

3 4 2

2 2.5( 3)

Page 73: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Center Problems Single Tree Centre Problems

Let G be a tree network and let ei (i = 1, 2, . . ., m) represent the end vertices (i.e., the nodes of degree 1) of the tree. Then:

STEP 1 Choose arbitrarily any point x G and find the (end)

vertex, say en, farthest away from x.

STEP 2 Find the (end) vertex, say es, which is farthest away

from en.

STEP 3 The absolute center of G is at the midpoint of the path

from es to en.The vertex center of G is at the node that is closest to the absolute center.

This algorithm does not even require computing the minimum distance matrix for the tree network G

en

es

Absolute center

Vertex center

x

Page 74: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Requirements Problem

So far, we have addressed urban facility location problems of the type "Where should I locate k facilities to maximize (or

minimize) some (given) objective function ?”

Another type of questions: “for certain standards of performance, what is the

smallest (or least costly) number of facilities needed and where to locate these facilities? “

Read section 6.5.6 for a brief discussion on Requirements Problem case studies Guidelines that 95 percent of rural calls for emergency medical service

should be reached within 30 minutes from the call and 95 percent of urban calls within 10 minutes

Page 75: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Requirements Problem

Set-Covering Problem Consider G(N,A)

Let Yn= {y1, y2,…, yn}be the set of n nodes on G that are demand-generating nodes

Let Xm= {x1, x2,…, xm}be the set of m nodes on G which are candidate facility locations

The objective is to find the minimum number of facility locations (nodes from Xm) such that all demand-generating point (nodes from Yn) are “covered”

A point yn is “covered” by xi for a user specified threshold (e.g. max distance is satisfied)

If d(xj, yi)≤ , yi is covered by xj

If d(xj, yi)> , yi is NOT covered by xj

Page 76: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Requirements Problem

Set-Covering Problem - Example Consider the demand locations A through G & the

candidate facility locations V through Z, which all lie on a road network

Find the smallest number of facilities to cover demand-generating nodes such that the maximum travel distance is 20 minutes

Assume that this the travel-distance matrix

Page 77: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Requirements Problem

Set-Covering Problem - Example Develop the coverage matrix c(i,j) from the travel-

distance matrix and the pre-specified threshold (or standards)

The coverage matrix contains 0 and 1 values A zero-cell (i,j) means that facility (i) does NOT cover node (j)

A 1-cell (i,j) means that facility (i) does cover node (j)

A B C D E F G

V 1 1 1 0 1 0 0

W 0 0 1 1 0 0 1

X 1 0 0 1 0 1 0

Y 1 1 1 1 0 0 1

Z 0 0 0 0 1 0 0

Coverage matrix

Page 78: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Requirements Problem

Set-Covering Problem - Example The set-covering problem (SCP) can now be stated as

to reduce the coverage matrix [c(i, j)] to the minimum number of rows required so that each column in the reduced matrix has at least a single element equal to 1.

The problem in this form can be readily formulated as an integer programming 0-1 problem

For now, a simple matrix-reduction algorithm will be introduced which may be used to reduce the computational size of SCP’s

Page 79: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Requirements Problem Matrix Reduction for Set Covering

STEP 1 (Feasibility Check): If there is at least one column in the coverage

matrix that consists entirely of zeroes, stop.

No feasible solution exists (i.e., the performance standards for coverage must be relaxed or more points must be added to the facilities set).

STEP 2 If any columns have only one nonzero element, say in row i*, then

the point corresponding to row i* must receive a facility.

Include that point in the list of those that must receive a facility and eliminate row i* and all columns having a 1 in row i* from the matrix.

STEP 3 If any row(s) i" is such that all its entries are less than or equal to the

corresponding entries of another row i' [i.e., if c(i", j) c(i',j) for all j], then eliminate row i” (dominance rule)

Page 80: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Requirements Problem Matrix Reduction for Set Covering

STEP 4 If any column(s) j" is such that all its entries are greater than or

equal to the corresponding entries of another column j' [i.e., if c(i,j") c(i,j') for all i], then eliminate column j".

STEP 5 Repeat Steps 2-4 until either

The coverage matrix becomes completely empty. In this case, a complete solution (minimum number of facilities and their locations) has been obtained on termination.

No columns or rows are eliminated during a complete pass through Steps 2-4. In this case, a solution may be obtainable by inspection on termination, or application of a more sophisticated SCP algorithm to the reduced matrix may be necessary

Page 81: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Requirements Problem

Set-Covering Problem - Example STEP 1 --> there exists a feasible solution

STEP 2 --> column F has only one nonzero element at row x This means that a facility has to be located at node X

We eliminate column F, row X, and columns A and D as they are covered by a facility at node X

A B C D E F G

V 1 1 1 0 1 0 0

W 0 0 1 1 0 0 1

X 1 0 0 1 0 1 0

Y 1 1 1 1 0 0 1

Z 0 0 0 0 1 0 0

Coverage matrix

Page 82: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Requirements Problem Set-Covering Problem - Example

STEP 3 --> eliminate rows W and Z as they are dominated by row Y and V, respectively e.g. A facility at node Y will cover nodes B,C and G -- a

facility at W will cover equal or less nodes than a facility at node Y

STEP 4 --> eliminate columns B and C as they are dominated by column E e.g. A facility that covers node E will also cover nodes B and

C

B C E G

V 1 1 1 0

W 0 1 0 1

Y 1 1 0 1

Z 0 0 1 0

B C E G

V 1 1 1 0

Y 1 1 0 1

E G

V 1 0

Y 0 1

Page 83: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Requirements Problem Set-Covering Problem - Example

BACK TO STEP 2 --> columns E and G has only one nonzero element at row V and Y, respectively This means that a facility has to be located at node V and

node Y

The matrix is empty -- STOP

The optimal number of facilities is 3 and are located at nodes X, V and Y From the distance-matrix, we can tell that

demand at nodes A and E are assigned to the facility at node V.

Demand from nodes D and F are assigned to the facility at node X.

Demand at nodes B,C and G are assigned to the facility at node Y

Page 84: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

Real-world Network Problems…

Page 85: Routing Problems… Routing Problems… Design of routes for vehicles or people.These routes must be designed so that they traverse in an exhaustive way the streets in a neighborhood

PBW 654Applied Statistics - I

Urban Operations Research

End of Unit 3