Hybrid Meta-Heuristic Frameworks : a Functional Approach
Total Page:16
File Type:pdf, Size:1020Kb
Hybrid Meta-heuristic Frameworks : A Functional Approach by Richard James Senington Submitted in accordance with the requirements for the degree of Doctor of Philosophy. The University of Leeds School of Computing February 2013 The candidate confirms that the work submitted is his/her own, except where work which has formed part of jointly-authored publications has been included. The contribution of the candidate and the other authors to this work has been explicitly indicated below. The candidate confirms that appropriate credit has been given within the thesis where reference has been made to the work of oth- ers. Further details of the jointly-authored publications and the contributions of the candidate and the other authors to the work are included in the Declarations below. This copy has been supplied on the understanding that it is copyright material and that no quotation from the thesis may be published without proper acknowl- edgement. Assertion of moral rights: The right of Richard James Senington to be identified as Author of this work has been asserted by him in accordance with the Copyright, Designs and Patents Act 1988. c 2013 The University of Leeds and Richard James Senington i Acknowledgements I would like to thank my supervisor David Duke for his guidance, advice and tolerance over the three years of this project. For their many discussions with me regarding optimisation research in general and metaheuristics in particular I would like to thank Sarah Fores, Ray Kwan and Natasha Shakhlevich. For providing a wonderful example of metaheuristic optimisation on a real application written in Haskell and subsequently a useful case study I would like to thank Noah Daniels and Norman Ramsey of Tufts University. I would also like to thank Peter Wort- mann for his advice on the inner workings of the Haskell compiler and the impact this would have upon my own work. Finally I would like to thank Karolina for her forbearance as I have stared at computer screens for hours and my parents for listening to me talk when I needed to think out loud. ii Abstract Problems requiring combinatorial optimisation are routinely encountered in research and applied computing. Though polynomial-time algorithms are known for certain problems, for many practical problems, from mundane tasks in schedul- ing through to exotic tasks such as sequence alignment in bioinformatics, the only effective approach is to use heuristic methods. In contrast to complete strategies that locate globally optimal solutions through (in the worst case) the enumera- tion of all solutions to a problem, heuristics are based upon rules of thumb about specific problems, which guide the search down promising avenues. Work in the field of Operations Research has gone further, developing generic metaheuristics, abstract templates which may be adapted to tackle many different problems. Metaheuristic researchers have created a variety of algorithms, each with their own strengths and weaknesses, and development of metaheuristics now often tries to combine concepts from a number of existing strategies to balance the advantages of the originals, known as hybridisation. This interest in hybridisation has led to the creation of a number of frame- works in imperative languages to assist programmers in the rapid creation and experimentation upon the algorithms. However these existing frameworks have struggled to enable hybridisation of the two major classes of metaheuristic, point based and population based, while being large and complicated to use. This Thesis investigates a functional approach to hybridisation. Despite su- perficial analogies between hybridisation and function composition, there are sub- stantial challenges: unlike global search methods that can be explained elegantly in terms of graph traversal, prior work on local search has struggled to articulate a common model, let alone one that can accommodate more esoteric optimisation techniques such as ant colony optimisation. At the same time, these implemen- tations cannot ignore the fact that the development of these techniques is driven by large-scale problems, and computational efficiency cannot be ignored. Given this background, this Thesis makes three substantial contributions. It decomposes metaheuristic search methods into a set of finer-grained concepts and tools that can be reassembled to describe both standard search strategies and more specialised approaches. It resolves problems found in implementing these abstractions in the widely used language Haskell, developing a novel approach based on dataflow networks. The value of functional abstraction in the practice of metaheuristic development and tuning is demonstrated through case studies, including a sub- stantial problem in bioinformatics. iii Declarations Some parts of the work presented in this thesis have been published in the following articles: Senington R. and Duke, D. (2012), ”Decomposing Metaheuristic Operations”, Imple- mentation and Application of Functional Languages, (conditionally accepted) Senington R. and Duke, D. (2012), ”Combinators for Meta-heuristic Search”, Journal of Functional Programming, (Under review) All these articles are substantially the candidates own work, with guidance from his co-author and PhD supervisor David Duke. No other co-authors have contributed directly to these papers. iv Contents 1 Introduction 1 1.1 Motivation .............................. 1 1.2 Research goals and Hypotheses ................... 4 1.3 Main Contributions ......................... 5 1.4 Overview of the Thesis ....................... 6 2 Combinatorial Problems and Metaheuristics 8 2.1 Discrete Combinatorial Optimisation Problems .......... 8 2.1.1 Complexity ......................... 10 2.1.2 Exhaustive Search Methods ................ 11 2.1.3 Example Problems ..................... 11 2.1.3.1 Satisfiability ................... 12 2.1.3.2 TSP ....................... 12 2.1.3.3 Real world problems ............... 14 2.2 Metaheuristic Concepts ....................... 14 2.2.1 Why should metaheuristics be effective? .......... 16 2.2.2 Similarity and Neighbourhood ............... 16 2.2.3 Recombination ....................... 17 2.2.4 Generically definable search processes ........... 18 2.3 Metaheuristic Algorithms ...................... 19 2.3.1 Random Generation & Random Walk ........... 19 2.3.2 Iterative Improvers ..................... 20 2.3.3 TABU search ........................ 21 2.3.4 Simulated Annealing .................... 23 2.3.5 Genetic Algorithms ..................... 26 2.3.6 Ant Colony Optimisation .................. 27 2.4 Models of metaheuristic operation ................. 30 2.4.1 Navigation of a Graph ................... 30 v 2.4.1.1 Tree representation ............... 31 2.4.1.2 Limitation .................... 32 2.4.2 Expansion and Contraction of Decisions .......... 33 2.5 Tuning, Fitting, and Hybridisation ................. 34 2.5.1 Design of Low Level Operators .............. 35 2.5.2 Hybridisation ........................ 36 2.5.3 Tuning ........................... 36 2.5.4 Hyperheuristics ....................... 37 2.6 Summary .............................. 37 3 Functional Programming 38 3.1 Haskell ............................... 39 3.2 Haskell and Operational Research ................. 39 3.2.1 Accessing External Solvers ................. 40 3.2.2 Systematic Search ..................... 40 3.2.3 Constraint Programming .................. 42 3.2.4 Metaheuristics ....................... 43 3.3 Summary .............................. 44 4 Metaheuristics in a functional setting 45 4.1 Generalising Comparison of Solutions ............... 45 4.2 Naive Implementations ....................... 47 4.2.1 Random walk ........................ 47 4.2.2 Termination Functionality & Output ............ 48 4.2.3 Functional properties of metaheurstics ........... 50 4.2.4 Extensible State ....................... 52 4.2.4.1 Records & HList ................. 52 4.2.4.2 Accessor Classes ................ 53 4.2.4.3 Monads and Monad Transformers ........ 53 4.3 Functional Reactive Programming (FRP) .............. 56 4.3.1 FRP for Metaheuristics ................... 57 4.3.2 Threading Behaviour .................... 58 4.3.3 The problem of shared iterative behaviour ......... 59 4.3.4 Impure short term memoization .............. 59 4.4 Dataflow & Stream Programming ................. 60 4.4.1 Sharing and memoization ................. 60 4.4.2 Simulated Annealing .................... 61 vi 4.4.3 Supporting streams using Haskell Prelude ......... 61 4.4.4 Separation of termination conditions ............ 63 4.4.5 Abstracting Recursive Construction ............ 64 4.4.6 The use of top level terms ................. 65 4.4.7 Managing stochastic components & unsafePerformIO . 65 4.5 Summary .............................. 67 5 Metaheuristic Combinators 68 5.1 Types for stream transformations .................. 68 5.2 Common operations on Streams .................. 69 5.2.1 Stream⇐⇒stream of lists ................. 70 5.2.2 Stream⇐⇒list of streams ................. 70 5.2.3 List of streams ⇐⇒ stream of lists ............. 71 5.2.4 Composite Operations ................... 71 5.2.5 Restart Combinators .................... 72 5.2.6 Combinators for eagerness ................. 72 5.3 Hill Climbers ............................ 73 5.4 TABU ................................ 75 5.4.1 Variable TABU List Size .................. 76 5.4.2 Performance Considerations ................ 77 5.5 Simulated Annealing ........................ 77 5.5.1 Standard Cooling Strategies ...............