A mixed Heuristic Algorithm for Solving the Travelling Tourist Problem

Page 1

The Travelling Tourist Problem: A Mixed Heuristic Approach Joshuah Touyz

Abstract The following paper uses evolutionary Markov chain Monte Carlo and simulated annealing to solve a variant of the travelling salesman problem (TSP) titularly referred to as the travelling tourist problem (TTP). The TTP is a more general case of the TSP which seeks to minimize a time-dependent cost function.

1


2

CONTENTS

Contents 1 Introduction

4

2 Methodology

4

2.1

Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4

2.2

Simulated Annealing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7

2.3

Evolutionary Markov Chain Monte Carlo . . . . . . . . . . . . . . . . . . .

8

2.3.1

Terminology

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

2.3.2

Proposal Densities and Acceptance Probabilities . . . . . . . . . . .

8

An Algorithm for a Minimum Time-Cost Circuit . . . . . . . . . . . . . . .

9

2.4

3 Results

10

4 Conclusion

11

5 Appendix

12

5.1

Distinction between Family Competitive and Population Driven EMCMC . 12

5.2

Results Finding a Local Minimum Cost Circuit for fixed {t}ni=1 Using SA . 12

List of Tables 1

Revenue in US$ of Selected Online Travel Agencies . . . . . . . . . . . . . .

4

2

Specifying the Objective Function, Proposal Density, Temperature and # Iterations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7

3

Optimal Routes for Different Number of Travel Days, Parallel Chains and Iterations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4

Expected Cost for a Given Number of Travel Days . . . . . . . . . . . . . . 11

5

Expected Cost for a Given Number of Travel Days . . . . . . . . . . . . . . 11

6

Results for Time-Dependent SA . . . . . . . . . . . . . . . . . . . . . . . . . 12

List of Figures 1

Illustration of First 3 Steps of the Algorithm with 5 Chains . . . . . . . . .

5


3

LIST OF FIGURES

2

Cost Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6

3

Graph of costs between cities 1, 2, 3 . . . . . . . . . . . . . . . . . . . . . . .

6

4

Time Dependent Cost Matrix . . . . . . . . . . . . . . . . . . . . . . . . . .

6

5

t1

t2

t3

Time Dependent Circuit for the Ordered Tour of Cities A −→ B −→ C −→ A.

6


1

4

INTRODUCTION

1

Introduction

Online travel agencies (OTA) specialize in offering travel booking and planning resources. Decreased costs and increased access have allowed many OTAs to capitalize on scale consequently transforming the online travel industry into a multibillion dollar business. Company Revenue in Billions

Expedia 2.937$

Sabre Holdings 2.9$

Priceline 1.9$

Orbitz 0.87$

Table 1: Revenue in US$ of Selected Online Travel Agencies While most OTAs offer multi-city travel options they require itinerants to specify both times and places of travel. In the case where time of travel does not impact the cost of travel, finding a cost-minimizing route reduces to a well-known NP-hard combinatorial optimization problem called the travelling salesman problem (TSP). In its modern conception the TSP seeks to minimize a salesman’s cost of travel among a circuit of cities. Costs, between cities may be symmetric or asymmetric in which case the titularly synonymous symmetric and asymmetric TSP obtain. In a symmetric TSP, when the number of cities n is small, brute force methods may be used to find optimal solutions; however, as n increases exhaustive enumeration is infeasible. Although, alternate exact algorithms present a marked decrease in run time, on the order of O(n2 2n ), they remain computationally inefficient for large n. Consequently, frameworks that exploit heuristic paradigms and realize close to optimal, if not optimal, solutions are important. The TSP can be recast in more general terms where cost changes with time. In this case it is instructive to think of a travelling tourist rather than a travelling salesman. Formally, the travelling tourist problem (TTP) requires a tourist to minimize the cost of visiting n cities (exactly once) over an ordered set of times t = {ti }m i=1 where m ≼ n in which cost may vary with time. An algorithm that expediently determines minimum time-cost circuits may well be strategically and financially attractive to OTAs. Besides better serving the needs of their customers OTAs acquire a competitive advantage over their opposition. Accordingly, the goal of this project is to design a consistent Markov chain Monte Carlo (MCMC) heuristic sampler that procures semi-optimal solutions to the TTP within a reasonable amount of time.

2 2.1

Methodology Setup

The TTP requires solving two interconnected problems, namely finding a minimum cost circuit for a given set of dates and a set of dates that achieve a minimum cost circuit. Single


2

5

METHODOLOGY

heuristic methods present salient options for problem-solutions when the state space is static; unfortunately, they fail to perform as-well in dynamic environments. While solving both problems simultaneously presents a challenge, dividing the problem into smaller subcomponents simplifies potential exploration and exploitation issues. Using a mixed approach is one alternative that provides solutions better adapted to problem requirements. By conditioning on a given set of dates, finding an optimal circuit reduces to an asymmetric TSP. At each iteration, multiple parallel chains with different sets of dates need to be run to efficiently explore the sample space. Interaction among members of a cohort further allows propagation of useful past information forwards. While interaction alone retains useful information, it is insufficient to explore the full sample space. Accordingly, point changes in chains are introduced. Algorithm outline: 1. (a) If first iteration: Initialize cohort of chains with sets of random dates; (b) Else: Select new generation of chains based on rule f (路), 2. Find a minimal cost circuits for each chain within the group, 3. Chains undergo interaction, point changes or remain the same. 4. Repeat steps 1-3 until computational budget is exhausted. Graphically steps 1-3:

* *

Random group of dates -> Circuits randomly initialized

-> Minimal cost circuits generated

-> Interaction amongst chains

Figure 1: Illustration of First 3 Steps of the Algorithm with 5 Chains *Step 1: Intialization, Step 2: Optimization, Step 3: Interaction

As the chain iterates the two problems, initially loosely connected, gradually depend more heavily on one another. Given sufficient time, the chain will converge to both the correct set of cities and dates. Subsequent knowledge of either the set of cities or dates, would be tantamount to the other.


2

6

METHODOLOGY

Carefully selecting heuristics to fulfill the aforementioned requirements will reduce the burden of computation. Developing a consistent MCMC sampler also requires reversibility, symmetry and irreducibility properties to be satisfied. Simulated annealing and evolutionary Markov chain Monte Carlo (EMCMC) are well suited to this end and are presented in the following section. However, before proceeding two definitions are essential for to subsequent analysis and discussion. Definition 2.1 (Cost Matrix). For a given time ti , a cost matrix, Λti is a matrix that represents the cost of travelling from city i to city j. If the cost between cities i and j is given by li,j , and n = 3, then an asymmetric cost matrix is defined as follows by: l32

0 l12 l13  Λ = l21 0 l23  l31 l32 0

l13

3 l31

2

l23

1

l21 l12

Figure 2: Cost Matrix

Figure 3: Graph of costs between cities 1, 2, 3 Definition 2.2 (Time-Cost Matrix). For a given set of dates a time-cost matrix represents the relations among travel cost and time of travel. For example suppose a tourist visits cities A, B, C at times t1 , t2 , t3 then the time-cost matrix and circuit are:   0 Λ1 0 Λ =  0 0 Λ2  Λ3 0 0 9×9 Figure 4: Time Dependent Cost Matrix

l1,CB

l1,AC

C

l2,CB

l1,CA

l1,BC

B

A

l2,AC

C

B

l1,AB

Λ1

A

l3,AC

C l3,BC

l2,CA

l2,BC

l1,BA

l3,CB

l3,CA

B

A l3,BA

l2,BA

l3,AB

l2,AB

Λ2

Λ3 t

t

t

1 2 3 Figure 5: Time Dependent Circuit for the Ordered Tour of Cities A −→ B −→ C −→ A.

Here costs change as time progresses.


2

7

METHODOLOGY

2.2

Simulated Annealing

Given a set of dates a minimum cost circuit can be calculated using simulated annealing (SA). SA is an adaptation of the random walk Metropolis-Hastings sampler for locating extremes (min or max) of an objective function f (x). The sampler works by evaluating f at a sequence of points {xi }; i = 1, ..., N subject to a cooling schedule T = {Ti } that tempers the speed of convergence. The acceptance probability is given by: f (xnew ) − f (x)old new old ,1 (1) αi (x , x ) = min exp Ti where the proposed move xnew is generated according to: (2)

xnew = xold + ui

In equation (2) ui is a symmetric density whose scale depends on i. In general, {Ti } and {ui } are selected so that {ui , Ti } → {0, 0} very slowly as i → ∞. This allows the sampler to explore the sample space when {ui , Ti } are large while zeroing in on local extremes (min or max depending on how f (·) is defined) as i → ∞. The algorithm is iterated i = 1, ...N times and the chain with max |f (x)| is selected. For a given set of n cities and fixed dates {t}ni=1 SA is used to find a local minimum cost route. Pair-wise costs between cities are set to be equal and the resulting problem reduces to an asymmetric TSP 1 . The objective function, proposal density, temperature and number of iterations are specified in Table 2. Objective Function g(x) Total cost of Circuit P f ((x)) = i=1 Cost(xi−1,i )

Proposal Density u Random walk implemented by randomly interchanging two cities on a given circuit

Temperature {Ti } T∗ {Ti } = ln(1+i)

Table 2: Specifying the Objective Function, Proposal Density, Temperature and # Iterations Notice the minimal cost circuit depends on the starting city of the tourist 2 . By assigning a starting position, to a tourist, the complexity of the problem reduces as (n−1)! routes are considered rather than n!. The SA algorithm was tested under different conditions and performed as expected; the results are summarized in appendix section 5.2. One point of interest relates to the density and spread of simulated costs. While SA often performed worse when data clustered, rescaling (through a function g(·)) and exacerbating small differences significantly reduced the variability in performance, achieving close to optimal solutions (results not included). 1

Dates still affect the cost of travelling between cities; the ensuing time-cost matrix is not symmetric In the TSP the salesman may start at any city since distance between cities is static whereas in TTP costs change with time 2


2

METHODOLOGY

2.3

8

Evolutionary Markov Chain Monte Carlo

Running multiple sample chains in parallel from different starting points allows an MCMC sampler to efficiently explore a sample space. However without interaction amongst chains previously useful information is lost, clarification is achieved using evolutionary Markov Chain Monte Carlo (EMCMC)3 . EMCMC is a heuristic method that allows chains within a sampled population to “evolve” according to recombination and mutation proposals 4 . Intuitively, interaction help population members explore regions of higher probability. Some terminology is introduced before discussing proposal densities and acceptance probabilities. 2.3.1

Terminology

Let Xt = (Xt [1], ..., Xt [N ]) be a population of N individuals at time t where each individual X[·] is a string of l characters {X[·][j]}lj=1 . Individuals are sampled according to P (X[·]) such that g(f (X[·])) = P (X[·]) where f is the fitness function defined over the sample space as f : Ω(X[·]) → R; g(·) is a monotonic function g(·) : R → R+ . The position of a character at locus X[·][j] is called an allele and is denoted as X[·][j]a . The ensemble of alleles (that is the characters {X[·][j]}lj=1 ) is collectively called the genetic material of an individual X[·]. Xt′ and Xt′′ denote the intermediate states of the population at time t.

2.3.2

Proposal Densities and Acceptance Probabilities

Candidate states are generated by either mutation or recombination (also called crossover ) and accepted according to two different rules.[4] In mutation, chains are uniformly mutated when a population generates a new individual Xt′ [i] by sampling a new chain from P (X[·]). Mutation probability occurs with ρ and accepted with probability: ′ ′ (3) α(X ′ [·]|X[·]) = min 1, (1 − ρ)l−∆(X [·],X[·])ρ∆(X [·],X[·])

where ∆(X s ′[·], X[·]) is the Hamming distance[1]. Similarly, recombination selects two parent chains X[i] and X[k] and mixes the parent’s genetic material to birth two children(call them X ′′ [i] and X ′′ [k]). Some care is taken when defining the crossover proposal so ensuing alleles satisfy MCMC reversibility; the genetic material of the parents is preserved through their children. Accordingly, recombination occurs with probability 1 − ρ and the Metropolis acceptance probability is: P (X ′′ [i])P (X ′′ [k]) . (4) α(X ′′ [i], X ′′ [k]|X[i], X[k]) = min 1, P (X[i])P (X[k]) 3

See appendix section 5.1 for details Although other perturbation operators exist using recombination in conjunction with mutation ensures that over a long enough period of time all states in the sample space are reached. Recombination alone would not constitute a valid sampler since there is no guarantee that the entire sample space will be explored. 4


2

9

METHODOLOGY

Upon acceptance the proposed alleles replace the parents, otherwise the population remains unchanged. The uniform mutation operator defines an irreducible, symmetric and stationary proposal distribution. When coupled with mutation, recombination satisfies necessary sampler requirements to form a consistent MCMC chain.[2]

2.4

An Algorithm for a Minimum Time-Cost Circuit

To achieve a minimum cost circuit selected dates must yield a minimum cost route relative to other possible date combinations. Previously it was shown that for a fixed set of times, SA locates close to optimal circuits. These results combine with EMCMC to develop an algorithm that preferentially selects “fit” (i.e. minimize cost circuits) dates: Algorithm: 1. For n different travel days (a) If first iteration: Initialize a population of N individuals, (b) Else: Select new generations based on the fitness criteria f (·), 2. Use SA to find a minimal cost circuit for each individual within the population, 3. Order the circuits from cheapest to most expensive and ascribe to them a corresponding temperature (decreasing from largest to smallest), 4. Apply mutation and crossover operations to travel days, 5. Repeat steps 2-4 until the budget on function evaluations is exhausted. The fitness function f (X[·]) is defined as the total cost of a given circuit whereas the monotonic function g(·) is equal to: (5)

g(X[i]) = exp(−f (X[i])/tempi ).

The resulting acceptance probability, for recombination is:

(6)

α(X ′′ [i],X ′′ [k]|X[i], X[k]) f (X[i]) − f (X ′′ [i]) f (X[k]) − f (X ′′ [k]) = min 1, exp + . temp[i] temp[k]

Similarly, the probability of mutation ρ is: Proposed Fitness − Current Fitness . (7) ρ = exp − Temp


3

10

RESULTS

In equation (7), the proposed fitness is the cost of a new circuit generated through mutation whereas the current fitness is the cost of the current circuit. Like parallel tempering, the recombination proposal uses different temperatures to improve the mixing capabilities of chains; better states in warm chains are inserted in colder chains with slow mixing.

3

Results

Algorithm functionality is tested using simulated data with n = 10 cities. An exact minimal cost circuit is embedded in the data and it’s total cost is set at 10. Both distributions mean and standard deviation were set to 500 and 173, respecticvely. Simulated costs were left-censored at 10. The table below summarizes experimental results using different numbers of chains, iterations and data: m Travel Days 15 15 15 15 15 15 40 40 40 40

Data Generated From Normal(500,173) Normal(500,173) Normal(500,173) Unif(200,800) Unif(200,800) Unif(200,800) Normal(500,173) Normal(500,173) Unif(200,800) Unif(200,800)

# Parallel Chains 10 20 10 10 20 10 10 20 10 20

Iter. EMCMC 10 20 10 10 20 10 10 20 10 20

Iter. SA 100 100 1000 100 100 1000 100 100 100 100

Mean/SE for 5 Sims. (614.6,75.57) (605.2,68.87) (574.4,84.34) (597.4,29.969) (579.2,10.73) (581.4,12.87) (772.6,65.82) (694.4,19.53) (944.4,43.43) (911.2,37.81)

Table 3: Optimal Routes for Different Number of Travel Days, Parallel Chains and Iterations Execution time is less than a minute when using an AMD Athlon II X4 635 2.9 GHz processor. The chain finds reasonable local minima with as few as a hundred SA iterations and 10 EMCMC iterations. On average better circuits are realized as the number of parallel chains, EMCMC iterations and SA iterations increase. Increasing the number of chains and EMCMC iterations allows chains to exchange information more efficiently amongst themselves, whereas increasing SA iterations improves exploration of the sample space. Since the mixed algorithm is a consistent MCMC sampler, increasing the computational budget leads to better circuits. In spite of a tight radius of convergence around the mean (small standard errors) the number of travel days impact average circuit cost for differentially distributed data. Data generated according to a uniform distribution exhibit increased variability as the number of travel days increase whereas circuits obtained from normally distributed costs are more stable. Data sparseness may play a role in determining the relative stability of the algorithm however further discussion remains the topic for another paper. In both cases, the resulting circuit averages are substantially less than randomly


4

11

CONCLUSION

picking places to visit i.e. the expected circuit means for costs generated according to uniform and normal distributions. Tables 4 and 5 summarizes the % decrease in costs for the best and worst performing samples. Expected Cost Worst Sample % Decrease

Normal 5000 574(m = 15, PC=10,I.E=10,I.SA=1000) 89%

Uniform 5000 579 (m = 15, PC=20,I.E=10,I.SA=100) 88%

Table 4: Expected Cost for a Given Number of Travel Days Expected Cost Best Sample % Decrease

Normal 5000 744 (m = 40, PC=10,I.E=10,I.SA=100) 85%

Uniform 5000 944 (m = 40, PC=10,I.E=10,I.SA=100) 81%

Table 5: Expected Cost for a Given Number of Travel Days * PC=Parallel Chains, I.E=Iterations EMCMC, I.SA=Iterations SA

Rescaling and modifying the cooling schedule are two ways in which precision can be increased; however discussion of this paradigm is beyond the scope of this paper. Also, a viable alternative to the present quad-core processing architecture is CUDA-GPU acceleration because the algorithm is well suited for parallelization.

4

Conclusion

Due to it’s complexity the TTP remains a challenging problem to study. While approximating algorithms exist they are too slow to use in real-world applications[3]. The current paper serves as an initial attempt to develop a rapid algorithm to prototype possible solutions. Future work might involve comparing the TTP to other types of heuristic and exact methods, looking at the effect of cooling schedules and rescaling on efficiency, increasing the number of cities n the tourist travels too as well as how average circuit costs are affected by the distribution of travel costs for different times and cities. Besides OTAs, the TTP can be used in micro-economic applications to maximize individual time-dependent utility functions. Under such a framework, solutions not strictly optimal may coincide better with reality because agent choices are often subject to forms of bounded rationality. A possible theoretic extension to the current model is to include multiple travelling tourists that visit different cities on different dates. Immediate applications include modelling time-dependent group behaviour and decision choices.


5

12

APPENDIX

5 5.1

Appendix Distinction between Family Competitive and Population Driven EMCMC

In section2.3 EMCMC was introduced as a general heuristic method for sampling. Two classes of EMCMC algorithms exist: family competitive and population driven. Family competitive algorithms are more closely aligned with computer science evolutionary and genetic algorithms. That is they evolve sample populations according to a proposal function. Population-driven algorithms try to model the probabilistic-distribution of the sample. Each new generation samples from the posterior population-driven distribution.

5.2

Results Finding a Local Minimum Cost Circuit for fixed {t}ni=1 Using SA

SA was tested on several sets of simulated data to assess performance. The following results were recorded Simulation Method Unif(200,800) Norm(400,60) Unif(200,800) Norm(400,60) Unif(200,800) Norm(400,60)

Number of Cities 40 40 40 40 40 40

T∗ 100 100 100 100 100 100

SA Iterations 1000 1000 10000 10000 20000 20000

Optimal Route Averaged(and SE) over 5 Runs (24522.6,1239.74) (11352,893) (20266.8,4851.44) 40 40 40

Table 6: Results for Time-Dependent SA From 6 it can be seen that the time-dependent SA works well for iterations greater than 200000 when the number of cities is n = 40. T =Temperature, SE=standard Error

References [1] Madalina M. Drugan and Dirk Thierens. Evolutionary Markov chain Monte Carlo. Technical report, University of Utrecht, 2003. [2] Madalina Mihaela Drugan. Conditional-loglikelihood MDL and Evolutionary MCMC, November. [3] Sudipto Guha and Samir Khuller. Approximation algorithms for connected dominating sets. Algorithmica, 20:374–387, 1996. [4] Malcolm J A Strens. Evolutionary MCMC Sampling and Optimization in Discrete Spaces. In Proceedings of the Twentieth International Conference on Machine Learning ICML-2003, 2003.


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.