Top Banner
Linköpings universitet SE–581 83 Linköping +46 13 28 10 00 , www.liu.se Linköping University | Department of Computer Science Bachelor thesis, 16 ECTS | Computer Science 2018 | LIU-IDA/LITH-EX-G--18/073--SE A Cycle-Trade Heuristic for the Weighted k-Chinese Postman Problem Anton Hölscher Supervisor : Kaj Holmberg Examiner : Fredrik Heintz
28

A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

Oct 14, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

Linköpings universitetSE–581 83 Linköping

+46 13 28 10 00 , www.liu.se

Linköping University | Department of Computer ScienceBachelor thesis, 16 ECTS | Computer Science

2018 | LIU-IDA/LITH-EX-G--18/073--SE

A Cycle-Trade Heuristic forthe Weighted k-ChinesePostman Problem

Anton Hölscher

Supervisor : Kaj HolmbergExaminer : Fredrik Heintz

Page 2: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

Upphovsrätt

Detta dokument hålls tillgängligt på Internet – eller dess framtida ersättare – under 25 årfrån publiceringsdatum under förutsättning att inga extraordinära omständigheter uppstår.Tillgång till dokumentet innebär tillstånd för var och en att läsa, ladda ner, skriva ut enstakakopior för enskilt bruk och att använda det oförändrat för ickekommersiell forskning och förundervisning. Överföring av upphovsrätten vid en senare tidpunkt kan inte upphäva dettatillstånd. All annan användning av dokumentet kräver upphovsmannens medgivande. Föratt garantera äktheten, säkerheten och tillgängligheten finns lösningar av teknisk och admin-istrativ art. Upphovsmannens ideella rätt innefattar rätt att bli nämnd som upphovsman iden omfattning som god sed kräver vid användning av dokumentet på ovan beskrivna sättsamt skydd mot att dokumentet ändras eller presenteras i sådan form eller i sådant sam-manhang som är kränkande för upphovsmannenslitterära eller konstnärliga anseende elleregenart. För ytterligare information om Linköping University Electronic Press se förlagetshemsida http://www.ep.liu.se/.

Copyright

The publishers will keep this document online on the Internet – or its possible replacement– for a period of 25 years starting from the date of publication barring exceptional circum-stances. The online availability of the document implies permanent permission for anyone toread, to download, or to print out single copies for his/hers own use and to use it unchangedfor non-commercial research and educational purpose. Subsequent transfers of copyrightcannot revoke this permission. All other uses of the document are conditional upon the con-sent of the copyright owner. The publisher has taken technical and administrative measuresto assure authenticity, security and accessibility. According to intellectual property law theauthor has the right to be mentioned when his/her work is accessed as described above andto be protected against infringement. For additional information about the Linköping Uni-versity Electronic Press and its procedures for publication and for assurance of documentintegrity, please refer to its www home page: http://www.ep.liu.se/.

c©Anton Hölscher

Page 3: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

Abstract

This study aims to answer whether a heuristic that trades cycles between the tours ina solution would show good results when trying to solve the Weighted k-Chinese PostmanProblem for undirected graphs, of varying size, representing neighbourhoods in Sweden.A tabu search heuristic was implemented with each iteration consisting of giving a cyclefrom the most expensive tour to the cheapest. The heuristic performed increasingly wellfor graphs of increasing size, although the solution quality decreased when increasing thenumber of tours to be used in the solution. It is suspected that the cause for this behavioris due to the heuristic only giving cycles from the most expensive tour, not consideringtrading cycles from other tours in the solution. It is believed that a heuristic consideringmore than only the most expensive tour when trading cycles would produce even bettersolutions.

Page 4: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

Contents

Abstract iii

Contents iv

List of Figures 1

1 Introduction 21.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Aim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 Research Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.4 Delimitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Theory 42.1 The Chinese Postman Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.2 The Rural Postman Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.3 The k-Chinese Postman Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.4 The Min Max k-Chinese Postman Problem . . . . . . . . . . . . . . . . . . . . . 62.5 The Weighted k-Chinese Postman Problem . . . . . . . . . . . . . . . . . . . . . 62.6 Dynamic Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.7 Lower Bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.7.1 Lower Bounds for W k-CPP . . . . . . . . . . . . . . . . . . . . . . . . . . 72.7.2 Lower Bounds for MM k-CPP . . . . . . . . . . . . . . . . . . . . . . . . . 72.7.3 Lower Bounds for k-CPP . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.8 Metaheuristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.8.1 Tabu Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3 Method 103.1 Pre-Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.2 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.3 Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4 Results 124.1 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

4.1.1 The Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124.1.2 The Cycle Trade Heuristic . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

4.2 Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134.2.1 Åtvidaberg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144.2.2 Colonia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154.2.3 Skänninge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164.2.4 Studentryd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174.2.5 Vadstena . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

5 Discussion 19

iv

Page 5: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

5.1 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195.2 Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205.3 The Work in a Wider Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

6 Conclusion 216.1 Answer to Research Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.2 Further Research . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

Bibliography 22

Page 6: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

List of Figures

4.1 Åtvidaberg – 68 nodes, 95 edges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144.2 Colonia – 24 nodes, 36 edges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154.3 Skänninge – 62 nodes, 80 edges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164.4 Studentryd – 387 nodes, 519 edges . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174.5 Vadstena – 581 nodes, 778 edges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

1

Page 7: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

1 Introduction

This chapter introduces the problem and gives a motivation as to why research in this areais important. The motivation is followed by the aim of this thesis and the specification of theresearch questions to be examined in this study. The problem is then narrowed down into aspecific type in order to keep the study of a feasible size.

1.1 Motivation

To find the most efficient way of traversing an entire graph is a widely spread problem intoday’s society. For a snow truck to plow all snow on every street in a town in the minimalconsumed time is only one of a vast amount of applications of this problem. This particularproblem, to find the least expensive path in a graph such that all edges in a given graphhas been traversed, is called the Chinese Postman Problem (CPP), which can often be solved inpolynomial time. However, rarely is it the case that a single mailman delivers all of the mailin an entire city. And if we want to find the optimal tour for each mailman such that all mailis delivered, we have found a much more complicated problem than the CPP.

When multiple vehicles can be utilized and the goal is to minimize both the combined costfor all vehicle’s routes and minimize the cost of the most expensive route, e.g. minimizingboth the total environmental inpact and the total time taken, we have encountered a problemdefined by Holmberg as the Weighted k-Chinese Postman Problem (W k-CPP)[8]. Along withthe definition of the problem, Holmberg constructed an algorithm for generating solutionsto this type of problems, albeit not optimal solutions. Finding a method that could furtherimprove these solutions would lead to both a financial and an environmental improvementto companies and cities all over the world.

1.2 Aim

According to Holmberg, solutions generated by using his heuristic could be improved sig-nificantly by manually altering the solution [8]. So a heuristic for the W k-CPP that mimicssome of the methods used to manually improve a solution might perform well. This studyaims to answer if a heuristic consisting of trading cycles between the tours would show goodresults on graphs resembling real life cities.

2

Page 8: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

1.3. Research Questions

1.3 Research Questions

It is imporant that the heuristic that is to be implemented, can generate solutions that are goodenough in a reasonable amount of time. Therefore, this study aims to answer the followingresearch questions:

Can a heuristic, consisting of trading cycles between all tours in the graph, be imple-mented, such that:

Q.1 The solution found by the heuristic is close to the optimum?

Q.2 The solution can be computed in a reasonable amount of time?

1.4 Delimitations

This thesis will only concern undirected connected graphs containing edges with postitivecosts. The number of vehicles will alter between the range of 2–10.

This study will only consider graphs resembling the streets of a city. This means that thegraphs will be sparse, i.e. each node is connected to relatively few edges.

The starting solution will always be the CPP-solution to the problem for one of the vehi-cles along with nothing for the rest of the K� 1 vehicles.

3

Page 9: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

2 Theory

In this chapter, all terms and concepts relevant to this study are explained. The first sectionsdescribe the problem which the heuristic will try to solve, starting at the founding problem(the CPP), then building upon it until the W k-CPP is obtained. This is followed by explan-ing the concepts used to implement the heuristic. Since all CPP problems only applies toconnected graphs, for the rest of this report, any mention of a graph refers to a connectedgraph.

2.1 The Chinese Postman Problem

The Chinese Postman Problem (CPP) is defined by Edmond and Johnson as finding the shortesttour in a graph such that each edge in the graph has been traversed at least once [6]. Theproblem was first discovered by Kwan Mei-Ko who described it, according to Grötschel andYuan, as walking the shortest possible distance when delivering mail through all the streetsin the neighborhood, starting and ending in the post office [7].

In a graph G, consisting of a set of vertices V = tv1, v2, . . . , vnu, a set of edges E � V2

and a function c : E Ñ R determining the cost of an edge, we want to find a mappingfunction f : E :Ñ N0 that indicates the flow in each edge, such that the total cost of that flowis minimized and the flow form an Euler tour. Given these definitions the problem can bemodelled as in formula 2.1.

minimize z =¸

ePE

( f (e) � c(e))

subject to

f (e) ¥ 1 @e P E,

w:(w,v)PE

f ((w, v)) ) + (¸

w:(v,w)PE

f ((v, w)) ) � 0 (mod 2) @v P V

(2.1)

This problem is NP-Complete meaning that it takes non-polynomial time to generatea CPP solution, but verifying the correctness of the solution can be performed in polyno-mial time. However, with proper constraints the CPP can be both solvable and verifiable inpolynomial time. If it is required that the graph is undirected, a chinese postman tour can beretrieved by adding the cheapest set of edges required to make the graph Eulerian, i.e. adding

4

Page 10: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

2.2. The Rural Postman Problem

edges until all vertices in the graph has an even degree, followed by finding a Euler cycle inthat graph [7].

Since we have restricted this study to only consider undirected graphs, the CPP will beconsidered as a polynomial problem for the rest of this report.

2.2 The Rural Postman Problem

The Rural Postman Problem (RPP) is closely related to the CPP. According to the definitionby Orloff, the only alteration to the problem is that only some of the edges in the graph arerequired to be traversed [11].

This problem can be viewed upon as a mailman delivering mail in some villages, whereeach road in each village has to be served, but the mailman has no required route to travelbetween the villages.

In order to formalize this problem another set ER � E is included, containing all edges inE that requires traversal. A requirement is added that the tour starts and ends in the startingvertex vs P V, since it might be the case that no edges connected to vs exists in ER. Theproblem can then be defined as in formula 2.2.

minimize z =¸

ePE

( f (e) � c(e))

subject to

f (e) ¥ 1 @e P ER,

w:(w,v)PE

f ((w, v)) ) + (¸

w:(v,w)PE

f ((v, w)) ) � 0 (mod 2) @v P V,

te P E : f (e) ¥ 1u composes a connected graph,

f ((vs, w)) ¥ 1 Dw P V

(2.2)

The RPP has been proved by Orloff to beNP-Hard, meaning that finding a solution to theRPP requires non-polynomial time, and verifying that solution also requires non-polynomialtime, given P � NP[11].

2.3 The k-Chinese Postman Problem

The k-Chinese Postman Problem (k-CPP) is related to both the RPP and the CPP. The problemis described by Osterhues and Mariak as finding k tours such that each edge of the graph hasbeen traversed by at least one vehicle and the combined cost of all tours is minimal [12].

This problem can be viewed upon as having multiple mailmen delivering mail to allstreets in a city. It is sufficient that only one mailman visits a street but all streets has tobe handled by at least one mailman, and the combined distance traveled should be minimal.

To formalize the k-CPP, instead of finding f , we need to find a set T = tt1, t2, . . . , tku ofsize k, where each element t P T is a function t : E Ñ N0 denoting how many times eachedge in the graph has been traversed by that specific tour, such that every edge is traversed

5

Page 11: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

2.4. The Min Max k-Chinese Postman Problem

by at least one of the tours and each tour starts and stops in the starting point of the graphvs P V. Using this set, T, the k-CPP can be formalized as in 2.3.

minimize z =¸

tPT

¸

ePE

( c(e) � t(e) )

subject to¸

tPT

t(e) ¥ 1 @e P E,

w:(w,v)PE

t((w, v)) ) + (¸

w:(v,w)PE

t((v, w)) ) � 0 (mod 2) @v P V @t P T,

te P E : t(e) ¥ 1u composes a connected graph @t P T,

t((vs, w)) ¥ 1 Dw P V @t P T

(2.3)

Finding one of the tours of a solution for the k-CPP is identical to finding a solutionto the RPP. This implies that the k-CPP cannot be easier than the RPP and is thereforeNP-Hard [12].

2.4 The Min Max k-Chinese Postman Problem

The Min Max k-Chinese Postman Problem (MM k-CPP) formulates the problem of minimizingthe most expensive tour rather than the total sum of all tours [2, 12].

This problem could be viewed upon as minimizing the total time taken for the last mail-man to return to the post office.

The formalization of this problem is a lot similar to formula 2.3 except that the objectivefunction minimizes the maximum rather than the sum. It can be formalized as in 2.4.

minimize z = maxtPT

ePE

c(e) � t(e))

subject to¸

tPT

t(e) ¥ 1 @e P E,

w:(w,v)PE

t((w, v)) ) + (¸

w:(v,w)PE

t((v, w)) ) � 0 (mod 2) @v P V @t P T,

te P E : t(e) ¥ 1u composes a connected graph @t P T,

t((vs, w)) ¥ 1 Dw P V @t P T

(2.4)

Using the same reasoning as for the k-CPP, the MM k-CPP is also NP-Hard[11].

2.5 The Weighted k-Chinese Postman Problem

The Weighted k-Chinese Postman Problem (W k-CPP) is defined by Holmberg as the weightedsum of the k-CPP and the MM k-CPP [8].

This problem can be viewed upon as delivering all mail in a city, using multiple mailmen,and taking into consideration both the total completion time and the combined environmen-tal impact of the entire team.

6

Page 12: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

2.6. Dynamic Programming

To formalize this problem a constant is required λ P [0, 1] representing to what degreeeach of the sums affect the objective function value. The problem can be formalized as informula 2.5.

minimize z = λ � ( maxtPT

ePE

c(e) � t(e)) ) + (1� λ) � (¸

tPT

¸

ePE

c(e) � t(e) )

subject to¸

tPT

t(e) ¥ 1 @e P E,

w:(w,v)PE

t((w, v)) ) + (¸

w:(v,w)PE

t((v, w)) ) � 0 (mod 2) @v P V @t P T,

te P E : t(e) ¥ 1u composes a connected graph @t P T,

t((vs, w)) ¥ 1 Dw P V @t P T

(2.5)

Inspecting formula 2.5 reveals that setting λ = 1 would turn the W k-CPP into the MMk-CPP. Setting λ = 0 would turn it into the k-CPP. This means that the W k-CPP must beNP-Hard.

2.6 Dynamic Programming

According to Bellman, Dynamic Programming is a method for solving complex problems bydividing the problem into sub-problems, solving the sub-problems individually, storing theseproblems in memory and then using the stored solutions to solve the complex problem [3].Each problem solved by a dynamic programming algorithm is stored in memory for usagein later problems. This means that dynamic programming is only advised to use when aproblem domain contains overlapping sub-problems.

Dynamic programming is not to be confused with the Divide and Conquer method sincethe Divide and Conquer method does not store any previous solutions in memory.

2.7 Lower Bounds

A lower bound to a problem is a value which is guaranteed to always be lower or equalto the value of the global optimum. Lower bounds are often used in order to evaluate theperformance of a heuristic since it is not possible to calculate the actual optimal value of anNP-Hard problem in reasonable time.

2.7.1 Lower Bounds for W k-CPP

According to Holmberg, the lower bound for the W k-CPP can be calculated using for-mula 2.6 [8].

LBWkCPP = λ(LBMMkCPP) + (1� λ)(LBkCPP) (2.6)

2.7.2 Lower Bounds for MM k-CPP

The lower bounds for the MM k-CPP can be calculated as described by Holmberg and by Ahrand Reinelt [2, 8]. It is calculated as in formula 2.7.

LBMMkCPP =cost(CPP)

k(2.7)

7

Page 13: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

2.8. Metaheuristics

2.7.3 Lower Bounds for k-CPP

The cost of the CPP solution can serve as a lower bound to the k-CPP. This is proven using aproof of contradiction.

1. Suppose that c� is the optimal solution to the CPP.

2. Suppose that there exists a solution T = tt1, t2, . . . , tku to the k-CPP such that°tPT

cost(t)   cost(c�).

3. Then there exists another tour c2 = t1t2 . . . tn.

4. The cost of c2 =°tPT

cost(t) ùñ cost(c2)   cost(c�) ùñ K

2.8 Metaheuristics

According to C. Blum and A. Roli, several attempts of defining metaheuristics has beenmade [5]. They describe metaheuristics in short as high level strategies for exploring searchspaces using different methods. Rather than finding all the neighbours of a given solution,the metaheuristics consists of algorithms for choosing which neighbouring solution to beused in the next iteration. They often depend on other heuristics to find all the neighbouringsolutions in the current search-space. They are, in a sense, heuristics of a higher abstractionlevel.

2.8.1 Tabu Search

Tabu Search is essentially an improved version of the Hill Climbing local search algorithm. TheHill Climbing algorithm works as follows:

1. Find all neighbors of the current solution.

2. Choose the best solution of all those neighbors.

3. If the objective function value of the best neighbor is worse than the current solution,return the current solution as the final answer. Otherwise, replace the current solutionwith the best neighbor and return to step 1.

This algorithm performs quite poorly in practice since it will most often get stuck in alocal optimum. According to Bianchi, Dorgio, Gambardella and Gutjahr, local optima areoften much worse than the global optimum in combinatorial problems [4]. Getting stuck inlocal optima is avoided in the Tabu Search heuristic by utilizing the following concepts: bestimprovement, tabu lists and aspiration criteria. The best improvement concept means that thebest neighbor always will be chosen, regardless if the current solution is better. This meansthat Tabu Search will never get stuck in a local optimum. While this solves local optimumproblem, it produces another problem: If the best neighbor always replaces the current solu-tion, we will enter a cycle as soon as we find a local optimum since we will alternate betweenthe local optimum and the best neighbor to that local optimum. That problem is solved byremembering the chosen solutions and forbidding them in the next iteration. They are re-membered by getting stored in tabu lists. Most often, the transition is stored in the tabu listrather than the actual solution in order to consume less memory.

The heuristic still lacks one final component. Currently, the tabu search contains no stop-ping criteria. This is why we need the aspiration criteria. These criteria contains conditions asto when the tabu search has finished its search and can consist of conditions regarding boththe objective function value as well as the transition options. The algorithm in Algorithm 2.1

8

Page 14: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

2.8. Metaheuristics

is an implementation of the Tabu Search Heuristic where f is a function calculating the ob-jective function value of a solution, x is the initial solution, and δ is a function calculating thetransition between two solutions.

Algorithm 2.1: Tabu Search Implementation

1 funct ion tabu( f , x, δ)2 T Ð [ ]3 while criteria_not_passed(x) :4 N Ð generate_neighborhood(x)5 b Ð min

nPtePN : δ(e,x)RTuf (n)

6 T.push(δ(x, b))7 x Ð b8 r e turn x

9

Page 15: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

3 Method

The study started with a planning phase where the decision was made to split the study intothree phases: a Pre-Study Phase, an Implementation Phase and an Evaluation Phase. After theplanning phase, some prior research was made in order to gain a brief understanding of theproblem at hand, the terminology, and the basic concepts required to perform this study. Themajority of this information was found in the book Optimering: metoder, modeller och teori förlinjära, olinjära och kombinatoriska problem by Holmberg [10].

3.1 Pre-Study

After the initial knowledge was aquired, several articles regarding the CPP and some of itsvariations were read. It was noted how other authors constructed the lower bounds and howthey chose to evaluate their heuristics. The graphs used to evaluate the W k-CPP heuristicin the study by Holmberg, representing different neigborhoods in Sweden, were gathered tobe used in this study (see Figure 4.1 - Figure 4.5). Studies regaring meta heuristics were readin order to make an informed decision as to which meta heuristic to be used along with theheuristic to be implemented.

3.2 Implementation

Before any heuristic could be implemented, data structures for both the graphs and the tourswere required.

Once the data structures were created, the Cycle Trade heuristic was implemented. Theidea behind the heuristic was that by swapping cycles between the most expensive and thecheapest tour in the solution, the cost of all tours would eventually "even out". If the tradesbetween the tours could be done in the cheapest possible manner it would also have a mini-mal impact on the combined cost. This would, in theory, result in a low W k-CPP cost.

After the swapping algorithm was implemented, the tabu search was constructed tochoose the most promising cycle swap. In order to decrease the execution-time of each it-eration by the heuristic, instead of creating one solution for each cycle trade, a candidate datastructure was implemented, only containing the gain of the trade and which cycle that wasto be traded between which two tours. This immensively improved the execution time of aniteration.

10

Page 16: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

3.3. Evaluation

3.3 Evaluation

The evaluation of this heuristic was performed similarly to the evaluation made by Ahr andReinelt on their tabu search heuristic for the MM k-CPP [2]. In their evaluation they madecomputational tests on the heuristic using several different graph instances. For each graph,one test was performed for each integer k P [2, 10]. For each test, the tabu search was termi-nated if either the best solution was not improved in a set amount of iterations or the searchhad been active for a set amount of time. In this evaluation a similar method of evaluationwill be used, albeit different graphs. The weight λ will be set to k

k+1 , where k represents thenumber of vehicles, so that, for all tests, the maximal traveling distance and the combinedtraveling distance will be of equal importance.

The graphs used in this study includes 5 graphs representing neighbourhoods in Swedenfetched by Holmberg from OpenStreetMaps [9, 1].

11

Page 17: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

4 Results

This chapter presents the results obtained using the method described in the Method chapter.First, the implementation of the heuristic is described, followed by a description of how theresults are formatted. Finally the data obtained by running the tests is presented.

4.1 Implementation

This section describes how the heuristic was implemented as well as how the data structureswere modelled.

4.1.1 The Data Structures

The different data structures used in the program were implemented as described below.

The Graph Abstraction

The graph was implemented as a class containing two members: the total number of ver-tices, |V|, and the edges in the graph, E. It was implemented so that |V| = 10 ùñ V =t0, 1, 2, 3, . . . , 9u. E was a implemented as a map containing a cost for each edge in thegraph. Since this study only considered undirected graphs, E was constructed such thatEx,y = Ey,x @(x, y) P V2.

The Tour Abstraction

A tour was implemented as a class containing two members: the total cost of the tour, c,and an ordered list, t, representing the tour taken, where the index of the list determined theorder in which the edges were traversed. So a tour with the member t = [1, 2, 3, 4, 2, 1] wouldrepresent the tour 1 Ñ 2 Ñ 3 Ñ 4 Ñ 2 Ñ 1. This means that the edges were traversed in thefollowing order: t1, 2u, t2, 3u, t3, 4u, t4, 2u, t2, 1u.

4.1.2 The Cycle Trade Heuristic

The Cycle Trade Heuristic generates all neighbouring solutions by, for all cycles in the mostexpensive tour, giving a cycle to the cheapest tour. The heuristic of generating new solutions

12

Page 18: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

4.2. Evaluation

can be described by the function in Algorihtm 4.1 where T is a set of tours representing asolution to the W k-CPP. Choosing which of the neighboring solutions that is to be used inthe next iteration is handled by the tabu search.

Algorithm 4.1: The Cycle Trade Heuristic.

1 funct ion cycle_trade(T) :2 Neighbours ÐH

3 t1 Ð maxtPT

tcost(t)u

4 t2 Ð mintPT

tcost(t)u

5 foreach c P get_all_cycles(t1) :6 t3 Ð with_cycle_excluded(c, t1)7 t4 Ð with_cycle_included(c, t2)8 n Ð (Tztt1, t2u)Y tt3, t4u

9 Neighbours Ð NeighboursY n10 r e turn Neighbours

In order to add a cycle, the shortest paths from all vertices in the cycle to all vertices inthe receiving tour are calculated. The shortest path of these paths is chosen as the connectingpath between the tour and the cycle and will be added immediately before traversing thecycle and the reversed path will be added immediately after traversing the cycle. The cycle isplaced in the tour where the connecting vertex is visited for the first time. The cycle is rotatedto connect with the path added.

Calculating the shortest paths from each vertex in the tour to each vertex in the cycleis an expensive operation. To enhance the computation speed, dynamic programming wasapplied. For each path found by the program in a given graph, that path, and all subpaths,are stored in memory to be used in later calculations. This means that calculating the shortestpath becomes increasingly faster as more paths have been calculated.

4.2 Evaluation

For each problem, there is a Graph illustrating the problem (Figure 4.1 - Figure 4.5), a chartand a table. The chart represents the value of the objective function during each iteration ofthe heuristic, and for each value K. For all the tests, the size of the tabu list was set to 10.

Note that even though the objective function in a specific iteration may be higher than aprevious answer, the best solution is always kept in memory.

For some tests, the heuristic was unable to complete 100 iterations due to all neighboursbeing blocked by the tabu list. Then the current best solution was returned.

13

Page 19: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

4.2. Evaluation

4.2.1 Åtvidaberg

Figure 4.1: Åtvidaberg – 68 nodes, 95 edges

0 20 40 60 80 100900

1,300

1,700

2,100

2,500

Iteration

Cur

rent

Solu

tion

Cos

t

Current solution cost at each iteration

K=2K=3K=4K=5K=6K=7K=8K=9

K=10

K Weight Obj. Func. Val LowerBound Rel. Error Execution Time (s)2 0.67 1865.01 1730.72 8% 12.703 0.75 1495.80 1298.04 15% 7.164 0.80 1338.44 1038.43 29% 5.485 0.83 1221.73 865.36 41% 4.216 0.86 1191.67 741.74 61% 3.917 0.88 1075.28 649.02 66% 2.768 0.89 1083.62 576.91 88% 2.849 0.90 1017.11 519.22 96% 2.4510 0.91 975.38 472.02 107% 1.91

14

Page 20: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

4.2. Evaluation

4.2.2 Colonia

Figure 4.2: Colonia – 24 nodes, 36 edges

0 20 40 60 80 10070

90

110

130

150

Iteration

Cur

rent

Solu

tion

Cos

t

Current solution cost at each iteration

K=2K=3K=4K=5K=6K=7K=8K=9

K=10

K Weight Obj. Func. Val LowerBound Rel. Error Execution Time (s)2 0.67 114.78 105.87 8% 1.143 0.75 96.98 79.40 22% 0.144 0.80 88.94 63.52 40% 0.335 0.83 84.73 52.94 60% 0.126 0.86 81.72 45.37 80% 0.187 0.88 79.47 39.70 100% 0.168 0.89 77.71 35.29 120% 0.189 0.90 76.31 31.76 140% 0.22

10 0.91 75.16 28.87 160% 0.24

15

Page 21: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

4.2. Evaluation

4.2.3 Skänninge

Figure 4.3: Skänninge – 62 nodes, 80 edges

0 20 40 60 80 100500

700

900

1,100

1,300

Iteration

Cur

rent

Solu

tion

Cos

t

Current solution cost at each iteration

K=2K=3K=4K=5K=6K=7K=8K=9

K=10

K Weight Obj. Func. Val LowerBound Rel. Error Execution Time (s)2 0.67 973.65 895.84 9% 11.843 0.75 781.25 671.88 16% 5.874 0.80 700.66 537.50 30% 3.315 0.83 679.96 447.92 52% 3.046 0.86 629.16 383.93 64% 2.577 0.88 610.24 335.94 82% 2.708 0.89 587.54 298.61 97% 1.759 0.90 569.37 268.75 112% 1.8110 0.91 554.51 244.32 127% 1.54

16

Page 22: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

4.2. Evaluation

4.2.4 Studentryd

Figure 4.4: Studentryd – 387 nodes, 519 edges

0 20 40 60 80 1001,000

1,750

2,500

3,250

4,000

Iteration

Cur

rent

Solu

tion

Cos

t

Current solution cost at each iteration

K=2K=3K=4K=5K=6K=7K=8K=9

K=10

K Weight Obj. Func. Val LowerBound Rel. Error Execution Time (s)2 0.67 2705.97 2612.41 4% 1720.203 0.75 2127.60 1959.30 9% 697.814 0.80 1713.86 1567.44 9% 263.615 0.83 1503.35 1306.20 15% 232.086 0.86 1369.48 1119.60 22% 203.997 0.88 1268.65 979.65 29% 142.968 0.89 1182.20 870.80 36% 109.929 0.90 1141.03 783.72 46% 125.3910 0.91 1088.77 712.47 53% 87.68

17

Page 23: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

4.2. Evaluation

4.2.5 Vadstena

Figure 4.5: Vadstena – 581 nodes, 778 edges

0 20 40 60 80 1000.25

0.44

0.64

0.81

1�104

Iteration

Cur

rent

Solu

tion

Cos

t

Current solution cost at each iteration

K=2K=3K=4K=5K=6K=7K=8K=9

K=10

K Weight Obj. Func. Val LowerBound Rel. Error Execution Time (s)2 0.67 6916.44 6913.97 0% 4281.333 0.75 5232.14 5185.48 1% 1634.074 0.80 4290.74 4148.38 3% 630.365 0.83 3684.81 3456.99 7% 644.996 0.86 3231.06 2963.13 9% 634.687 0.88 2978.81 2592.74 15% 348.478 0.89 2803.54 2304.66 22% 413.349 0.90 2630.47 2074.19 27% 310.3010 0.91 2618.16 1885.63 39% 294.08

18

Page 24: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

5 Discussion

This chapter contains the analysis of the results and method used in this study. Thoughtsregarding the ethical and societal aspects of this area are also presented.

5.1 Results

First of all, it should be noted that the results of the smaller graphs are of less importancethan the larger ones, since heuristics are mainly used on problems too large for an optimalsearch algorithm to handle. The purpose of these graphs are to show tendencies found whenincreasing the size, rather than to evaluate the performance of the heuristic.

The Cycle Trade heuristic tends to be solving the problem increasingly faster when thenumber of vehicles in the problem increase. This is probably due to the heuristic only givingcycles from the most expensive tour to the least expensive. An increasing number of vehicleswould result in all cycles being distributed on more vehicles, which, in turn, would lead to alot fewer cycles to calculate the trading cost of.

The heuristic seems to be closest to the lower bound for the problems with the fewestnumber of vehices. One of the reasons may be that the heuristic only gives cycles from themost expensive tour to the cheapest. It results in a lot of cycle-trades not being consideredsince they are not in the most expensive tour. Another reason may be that the lower boundformula does not scale well for increasing number of vehicles. The formula is calculated bydividing CPP cost by k which may not be an accurate estimation for increasing number of k.

A lot of the tests seems to have repeating patterns in the later iterations. This may be anindicator that the tabu list size was too small, allowing the search to loop between alreadydiscovered solutions.

The heuristic results in solutions relatively closer to the lower bound for graphs of greatersize. It is suspected that this is due to the larger graphs containing more tradeable cycles andcycles of more varied sizes, which results in a more even disitribution of workload for all ve-hicles. This behaviour is especially promising, since heuristics are mainly used on problemstoo large to solve using brute force methods.

A surprising trend in the results is the starting improvement speed of each iteration. Forthe majority of the tests, the best solution was found in the first 20 iterations. The cause for thismight also be due to tours being considered in the trade. The most expensive solution might

19

Page 25: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

5.2. Method

not have any profitable trades available, but trading a tour from the second most expensivetour might lower the solution cost even further.

5.2 Method

Since the W k-CPP is a relatively new problem, theory and heuristics regarding the subjectis scarse. To better evaluate the performance of this heuristic, other heuristics to be used forcomparison would have been immensely helpful.

In the tests, the attribute time was used to evaluate the effort required to perform all it-erations. Measuring the effort of a procedure using time is not an accurate method, since itdepends on the currently available processing power which may heavily fluctuate during thetest. In order to get a better estimate of the effort, either the mean time over several executionsof the same test, or the required CPU-time, could have been used.

As noted in the discussion of the results, it was suspected that the tabu search got stuckin loops in the later iterations of the heuristics. If that is the case, then the size of the tabulist was too small. And for some of the smaller problems, the test was aborted due to allneighbours being blocked by the tabu list. Using a tabu list of increasing size for increasingproblem sizes would probably remove these isues, given that the tabu size was the cause.

In this study, the lower bound for the MM k-CPP part was calculated using formula 2.7.This formula seems to be too simple for higher values of K, since it assumes that the graphcan be perfectly divided into K tours. And for an increasing number of tours this estimatongets increasingly worse. A proposal for a new lower bounds estimaton would be to simplyfind all cycles in the graph and divide them as evenly as possible, ignoring the fact that thepath for each of the vehicles has to be a tour.

5.3 The Work in a Wider Context

As with all optimizations, there are some inevitable consequences. Optimizing the plowingof a city might result in fewer snow plowers being required. This may, in term, result insome of the workers loosing their employment. And since snow plowing is not the onlyarea where this problem is applicable, the magnitude of this problem increases. That beingsaid, optimizing these types of problems results in solving them with less required resources,which leads to a lower environmental impact of the performed task. In the case of snowplowing, it also results in faster snow removal time, which means that there will be lesspeople stuck in traffic.

20

Page 26: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

6 Conclusion

6.1 Answer to Research Questions

In this study, a heuristic consisting of trading cycles between all tours in the solution hasbeen implemented. The results shows that the heuristic performs suprisingly well on largergraphs with a low number of tours. For the smaller graphs, there exists to few cycles tobe able to divide the graph into an equitable distribution between the tours. When using toomany vehicles, the heuristic considers too few alternatives in each step, since it only considerstrading cycles from the most expensive tour to the cheapest.

Regarding question Q.1, the solution found by the heuristic is close to the optimum forlarge problems having low values of k. For higher values of k, the solution quality becomesincreasingly worse, though for larger problems the heuristic handles higher values of k better.

Regarding question Q.2, the time required depends heavily on the number of vehicles,more vehicles leads to faster computation time. The size of the graph is also a significantfactor to the execution time. However, in real life applications it will most often be the casethat a larger problem is handled by several vehicles, meaning that the computation time willremain within feasible bounds.

6.2 Further Research

In order to further improve the solution, a heuristic considering more tours in the trade, isproposed. It is believed that enabling more tours to trade cycles between would, by sacrific-ing the computation time of the iterations, yield much higher quality for all problems whenthe number of vehicles in the problem increases.

Since this heuristic shows promise for the W k-CPP, it might also be a good heuristic forthe composing problems, namely the MM k-CPP and the k-CPP. Evaluating the performanceof this heuristic in these sub-problems might prove valuable.

21

Page 27: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

Bibliography

[1] c© OpenStreetMap contributors. Graph data retrieved from https://www.openstreetmap.org.https://www.openstreetmap.org. 2017.

[2] Dino Ahr and Gerhard Reinelt. “A tabu search algorithm for the min–max k-Chinesepostman problem”. In: Computers & Operations Research 33.12 (2006). Part Special Issue:Recent Algorithmic Advances for Arc Routing Problems, pp. 3403–3422. ISSN: 0305-0548. DOI: http://dx.doi.org/10.1016/j.cor.2005.02.011. URL: http://www.sciencedirect.com/science/article/pii/S0305054805000663.

[3] Richard Bellman. The theory of dynamic programming. Tech. rep. RAND CORP SANTAMONICA CA, 1954.

[4] L. ( 1 ) Bianchi, L.M. ( 1 ) Gambardella, M. ( 2 ) Dorigo, and W.J. ( 3 ) Gutjahr. “Asurvey on metaheuristics for stochastic combinatorial optimization.” In: Natural Com-puting 8.2 (2009), pp. 239–287. ISSN: 15677818. URL: https://login.e.bibl.liu.se/login?url=https://search-ebscohost-com.e.bibl.liu.se/login.aspx?direct=true&AuthType=ip,uid&db=edselc&AN=edselc.2-52.0-67349194941&lang=sv&site=eds-live&scope=site.

[5] Christian Blum and Andrea Roli. “Metaheuristics in Combinatorial Optimization:Overview and Conceptual Comparison.” In: ACM Computing Surveys 35.3 (2003),pp. 268–308. ISSN: 03600300. URL: https://login.e.bibl.liu.se/login?url=https://search-ebscohost-com.e.bibl.liu.se/login.aspx?direct=true&AuthType=ip,uid&db=buh&AN=10913758&lang=sv&site=eds-live&scope=site.

[6] Jack Edmonds and Ellis Johnson. “Matching, Euler tours and the Chinese postman.” In:Mathematical Programming 5.1 (1973), p. 88. ISSN: 00255610. URL: https://login.e.bibl.liu.se/login?url=https://search.ebscohost.com/login.aspx?direct=true&AuthType=ip,uid&db=edb&AN=71011031&lang=sv&site=eds-live&scope=site.

[7] Martin Grötschel and Ya-xiang Yuan. “Euler, mei-ko kwan, königsberg, and a chinesepostman”. In: Optimization Stories (2012), p. 43.

[8] Kaj Holmberg. “Heuristics for the weighted k-Chinese/rural postman problem with ahint of fixed costs with applications to urban snow removal.” In: (2015). URL: https://login.e.bibl.liu.se/login?url=https://search.ebscohost.com/

22

Page 28: A Cycle-Trade Heuristic for the Weighted k-Chinese Postman ...liu.diva-portal.org/smash/get/diva2:1275190/FULLTEXT01.pdf · Postman Problem Anton Hölscher Supervisor : Kaj Holmberg

Bibliography

login.aspx?direct=true&AuthType=ip,uid&db=edsbas&AN=edsbas.ftlinkoepinguniv.oai.DiVA.org.liu.122168&lang=sv&site=eds-live&scope=site.

[9] Kaj Holmberg. On Using OpenStreetMap and GPS for Optimization. Tech. rep. 2015:15.Linköping University, Faculty of Science & Engineering, 2015, p. 35.

[10] Kaj Holmberg. Optimering : metoder, modeller och teori för linjära, olinjära och kombina-toriska problem. Stockholm : Liber, 2010, 2010. ISBN: 9789147099351. URL: https://login.e.bibl.liu.se/login?url=https://search.ebscohost.com/login.aspx?direct=true&AuthType=ip,uid&db=cat00115a&AN=lkp.576466&lang=sv&site=eds-live&scope=site.

[11] C. S. Orloff. “A fundamental problem in vehicle routing”. In: Networks 4.1 (1974),pp. 35–64. ISSN: 1097-0037. DOI: 10.1002/net.3230040105. URL: http://dx.doi.org/10.1002/net.3230040105.

[12] André Osterhues and Frank Mariak. “On variants of the k-Chinese Postman Problem”.In: Operations Research and Wirtschaftsinformatik, University Dortmund 30 (2005).

23