Praise for Stochastic Local Search: Foundations and Applications
‘Hoos and Stützle, two major players in the field, provide us with an excellent overview of stochastic local search. If you are looking for a book that covers all the major meta-heuristics, gives you insight into their working and guides you in their application to a wide set of combinatorial optimization problems, this is the book.’
Marco Dorigo, Université Libre de Bruxelles
‘Stochastic Local Search: Foundations and Applications provides an original and synthetic presentation of a large class of algorithms more commonly known as meta-heuristics. Over the last 20 years, these methods have become extremely popular, often representing the only practical approach for tackling so many of the hard combinatorial problems that are encountered in real-life applications. Hoos and Stützle’s treatment of the topic is comprehensive and covers a variety of techniques, including simulated an-nealing, tabu search, genetic algorithms and ant colony optimization, but a main feature of the book is its proposal of a most welcome unifying framework for describing and analyzing the various methods.’
Michel Gendreau, Université de Montréal
‘Local search algorithms are often the most practical approach to solving constraint satisfaction and optimization problems that admit no fast deterministic solution. This book is full of information and insights that would be invaluable for both researchers and practitioners.’
Henry Kautz, University of Washington
‘This extensive book provides an authoritative and detailed exposition for novices and experts alike who need to tackle difficult decision or combinatorial optimization prob-lems. The chapters span fundamental theoretical questions such as, “When and why do heuristics work well?” but also more applied aspects involving, for instance, the com-parison of very different algorithms. The authors are university faculty members and leading players in their research fields; our communities will enjoy in particular their book’s valuable teaching material and a “complete” bibliography of the state of the art for the field.’
Olivier Martin, Université Paris-Sud, Orsay
‘The authors provide a lucid and comprehensive introduction to the large body of work on stochastic local search methods for solving combinatorial problems. The text also covers a series of carefully executed empirical studies that provide significant further insights into the performance of such methods and show the value of an empirical sci-entific methodology in the study of algorithms. An excellent overview of the wide range of applications of stochastic local search methods is included.’
natorial problems. If you only want to read one book on this important topic, you should read Hoos and Stützle’s. It is a comprehensive and informative survey of the field that will equip you with the tools and understanding to use stochastic local search to solve the problems you come across.’
Toby Walsh, Cork Constraint Computation Centre University College Cork
‘This book provides remarkable coverage and synthesis of the recent explosion of work on randomized local search algorithms. It will serve as a good textbook for classes on heuristic search and metaheuristics as well as a central reference for researchers. The book provides a unification of a broad spectrum of methods that enables concise, highly readable descriptions of theoretical and experimental results.’
S
t o c h a s t i c
L
o c a l
S
e a r c h
S
t o c h a s t i c
L
o c a l
S
e a r c h
F
o u n d a t i o n s a n d
A
p p l i c a t i o n s
Holger H. Hoos
Department of Computer Science
University of British Columbia
Canada
Thomas Stützle
Department of Computer Science
Darmstadt University of Technology
Germany
AMSTERDAM • BOSTON • HEIDELBERG • LONDON NEW YORK • OXFORD • PARIS • SAN DIEGO SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO
Editorial Coordinator Emilia Thiuri Editorial Assistant Valerie Witte
Cover Design Gary Ragaglia and Holger H. Hoos
Cover Image “Antelope Canyon” c Thomas Morse/Chuck Place Photo Text Design Rebecca Evans and Associates
Composition Kolam USA
Technical Illustration Dartmouth Publishing, Inc.
Copyeditor Lori Newhouse
Proofreader Calum Ross
Indexer Robert Swanson
Interior printer The Maple-Vail Book Manufacturing Group
Cover printer Phoenix Color
Morgan Kaufmann Publishers is an imprint of Elsevier. 500 Sansome Street, Suite 400, San Francisco, CA 94111 This book is printed on acid-free paper.
© 2005 by Elsevier Inc. All rights reserved.
Designations used by companies to distinguish their products are often claimed as trademarks or registered trademarks. In all instances in which Morgan Kaufmann Publishers is aware of a claim, the product names appear in initial capital or all capital letters. Readers, however, should contact the appropriate companies for more complete information regarding trademarks and registration.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means—electronic, mechanical, photocopying, scanning, or
otherwise—without prior written permission of the publisher.
Permissions may be sought directly from Elsevier’s Science & Technology Rights Department in Oxford, UK: phone: (+44) 1865 843830, fax: (+44) 1865 853333,
e-mail: [email protected]. You may also complete your request
on-line via the Elsevier homepage (http://elsevier.com) by selecting “Customer Support” and then “Obtaining Permissions.”
Library of Congress Cataloging-in-Publication Data
Application submitted ISBN: 1-55860-872-9
For information on all Morgan Kaufmann publications, visit our Web site at www.mkp.com.
Printed in the United States of America 04 05 06 07 08 5 4 3 2 1
[Science] ... is not a steady march from ignorance to knowledge. It’s more like mountaineering expedition.
On the way up an unscaled peak, climbers will gain some altitude on one route,
then find it’s a dead end.
They’ll spot a better one, backtrack a little and move on. The fact that they sometimes have to take a step backward for every two steps forward
doesn’t mean they are wasting their time.
It means that inching up an uncharted mountain is tough work. When you step back, though, and take a look at the overall picture
— a long view from the upper slopes of the mountain — it turns out in hindsight that the path was clear.
This book is dedicated to our parents
Dieses Buch ist unseren Eltern gewidmet
Eva-Marie Hoos & Hans-Helmut Hoos
Berta Stützle & Günther Stützle
About the Authors
Holger H. Hoos is an Assistant Professor at the Computer Science Department of the University of British Columbia (Canada). His Ph.D. thesis on stochastic local search algorithms for computationally hard problems in artificial intelligence, completed in 1998 at Darmstadt University of Technology (Germany), received the ‘Best Dissertation Award 1999’ of the German Informatics Society. He has been working on the design and empirical analysis of stochastic local search algorithms since 1994, and his research in this area has been published in book chapters, journal articles and at major conferences in AI and OR.
Holger’s research interests are currently focused on topics in artificial intelli-gence, bioinformatics, empirical algorithmics and computer music. At the University of British Columbia, he is a founding member of the Bioinformatics, Empirical & Theoretical Algorithmics Laboratory (BETA-Lab), a member of the Laboratory for Computational Intelligence (LCI), and a faculty associate of the Peter Wall Institute for Advanced Studies.
Thomas Stützle is an Assistant Professor at the Computer Science Department of Darmstadt University of Technology (Germany). He received an M.Sc. degree in In-dustrial Engineering and Management Science at the University of Karlsruhe and a Ph.D. from the Computer Science Department of Darmstadt University of Technology. He was a postgraduate fellow at the Department of Statistics and Operations Research, Universidad Complutense de Madrid and a Marie Curie Fellow at IRIDIA, Université Libre de Bruxelles. Thomas has been involved in several EU funded projects on the study of stochastic local search techniques and his research is published in various jour-nals, book chapters and conferences in OR and AI. His current research focuses on the further development of SLS methods, search space analysis, the automatisation of the design and the tuning of SLS algorithms, and new hybridisation schemes for the effective solution of hard combinatorial problems.
Contents
Prologue
1
Part I: Foundations
11
1 Introduction
13
1.1 Combinatorial Problems. . . 13
1.2 Two Prototypical Combinatorial Problems. . . 16
1.3 Computational Complexity . . . 23
In Depth: Some Advanced Concepts in Computational Complexity . . . 29
1.4 Search Paradigms . . . 31
1.5 Stochastic Local Search . . . 37
In Depth: Randomness and Probabilistic Computation . . . 52
1.6 Further Readings and Related Work . . . 54
1.7 Summary . . . 55
Exercises . . . 56
2 SLS Methods
61
2.1 Iterative Improvement (Revisited). . . 612.2 ‘Simple’ SLS Methods . . . 71
2.3 Hybrid SLS Methods . . . 85
2.4 Population-Based SLS Methods. . . 95
2.5 Further Readings and Related Work . . . 105
2.6 Summary . . . 108
Exercises . . . 111
3 Generalised Local Search Machines
113
3.1 The Basic GLSM Model. . . 113In Depth: Formal Definition of GLSM Semantics . . . 119
3.2 State, Transition and Machine Types. . . 122
3.3 Modelling SLS Methods Using GLSMs. . . 131
3.4 Extensions of the Basic GLSM Model. . . 138
3.5 Further Readings and Related Work . . . 142
3.6 Summary . . . 144
Exercises . . . 145
4 Empirical Analysis of SLS Algorithms
149
4.1 Las Vegas Algorithms . . . 149
In Depth: Probabilistic Approximate Completeness and ‘Convergence’ . . . 155
4.2 Run-Time Distributions . . . 158
4.3 RTD-Based Analysis of LVA Behaviour . . . 171
In Depth: Benchmark Sets . . . 176
4.4 Characterising and Improving LVA Behaviour . . . 184
4.5 Further Readings and Related Work . . . 198
4.6 Summary . . . 200
Exercises . . . 201
5 Search Space Structure and SLS Performance
203
5.1 Fundamental Search Space Properties . . . 2035.2 Search Landscapes and Local Minima. . . 209
5.3 Fitness-Distance Correlation . . . 220
5.4 Ruggedness . . . 226
In Depth:NK-Landscapes . . . 231
5.5 Plateaus. . . 235
5.6 Barriers and Basins . . . 243
5.7 Further Readings and Related Work . . . 249
5.8 Summary . . . 250
Exercises . . . 252
Part II: Applications
255
6 Propositional Satisfiability and Constraint Satisfaction
257
6.1 The Satisfiability Problem . . . 2576.2 The GSAT Architecture . . . 267
In Depth: Efficiently Implementing GSAT . . . 271
6.3 The WalkSAT Architecture. . . 273
6.4 Dynamic Local Search Algorithms for SAT . . . 284
6.5 Constraint Satisfaction Problems . . . 292
6.6 SLS Algorithms for CSPs . . . 299
6.7 Further Readings and Related Work . . . 306
6.8 Summary . . . 308
Exercises . . . 310
7 MAX-SAT and MAX-CSP
313
7.1 The MAX-SAT Problem . . . 3137.2 SLS Algorithms for MAX-SAT . . . 321
In Depth: Efficient Evaluation ofk-Flip Neighbourhoods for MAX-SAT . . . 336
Contents xiii
7.4 Further Readings and Related Work . . . 350
7.5 Summary . . . 352
Exercises . . . 354
8 Travelling Salesman Problems
357
8.1 TSP Applications and Benchmark Instances . . . 3578.2 ‘Simple’ SLS Algorithms for the TSP . . . 367
In Depth: Efficiently Implementing SLS Algorithms for the TSP . . . 382
8.3 Iterated Local Search Algorithms for the TSP . . . 384
8.4 Population-Based SLS Algorithms for the TSP. . . 399
8.5 Further Readings and Related Work . . . 410
8.6 Summary . . . 413
Exercises . . . 414
9 Scheduling Problems
417
9.1 Models and General Considerations. . . 4179.2 Single Machine Scheduling . . . 426
In Depth: Details of Dynasearch for the SMTWTP . . . 437
9.3 Flow Shop Scheduling . . . 438
In Depth: Neighbourhood Restrictions in TS-NS-PFSP . . . 448
9.4 Group Shop Problems . . . 449
9.5 Further Readings and Related Work . . . 460
9.6 Summary . . . 463
Exercises . . . 464
10 Other Combinatorial Problems
467
10.1 Graph Colouring. . . 46810.2 The Quadratic Assignment Problem. . . 477
10.3 Set Covering. . . 488
10.4 Combinatorial Auctions . . . 498
10.5 DNA Code Design . . . 507
10.6 Further Readings and Related Work . . . 517
10.7 Summary . . . 520 Exercises . . . 523
Epilogue
527
Glossary
537
Bibliography
575
Index
633
Iterative Improvement (II):
determine initial candidate solutions While⎢ sis not a local optimum:
⎢ ⎢ ⎢ ⎣
choose a neighboursofssuch that g(s)< g(s)
s:=s
Randomised Iterative Improvement (RII):
determine initial candidate solutions While termination condition not satisfied:⎢
⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ With probabilitywp:
choose a neighboursofsuniformly at random
Otherwise:
choose a neighboursofssuch that g(s)< g(s)
or, if no suchsexists, chooses such thatg(s) is minimal s:=s
Variable Neighbourhood Descent (VND):
determine initial candidate solutions i:= 1 Repeat:
choose a most improving neighboursofsinNi Ifg(s)< g(s): s:=s i:= 1 Else: i:=i+ 1 Untili > imax
Note:N1, . . . ,Nimaxis a set of neighbourhood relations,
typically ordered according to increasing size of the re-spective local neighbourhoods.
Variable Depth Search (VDS):
determine initial candidate solutions ˆ
t:=s
While⎢ sis not locally optimal: ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ Repeat:
select best feasible neighbourt Ifg(t)< g(ˆt): ˆt:=t
Until construction of complex step completed
s:= ˆt
Simulated Annealing (SA):
determine initial candidate solutions set initial temperatureTaccording to
annealing schedule
While termination condition not satisfied:⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣
probabilistically choose a neighbour sofs
Ifssatisfies probabilistic acceptance criterion (depending onT): s:=s
updateTaccording to annealing schedule
Note: The annealing schedule may keepTconstant for a number of search steps.
Tabu Search (TS):
determine initial candidate solution s While termination criterion is not satisfied:⎢
⎢ ⎢ ⎢ ⎢ ⎢ ⎣
determine setNof non-tabu neighbours ofs choose a best improving solutionsinN update tabu attributes based ons s:=s
Note: Tabu attributes are associated with solution
determine initial candidate solutions initialise penalties
While termination criterion is not satisfied:⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣
compute modified evaluation functiong fromgbased on penalties
perform subsidiary local search ons using evaluation functiong update penalties based ons
Note: Penalties are associated with solution
compo-nents; the subsidiary local search ends in a local minimum ofg.
Iterated Local Search (ILS):
determine initial candidate solutions perform subsidiary local search ons While termination criterion is not satisfied:⎢
⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ r:=s perform perturbation ons
perform subsidiary local search ons based on acceptance criterion, keeps
or revert tos:=r
Note: The search history may additionally influence the
perturbation phase and the acceptance criterion.
Greedy Randomised ‘Adaptive’ Search Procedure (GRASP):
While termination criterion is not satisfied:⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣
generate candidate solutionsusing subsidiary greedy randomised constructive search
perform subsidiary local search ons
initialise weights
While termination criterion is not satisfied:⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣
generate candidate solutionsusing subsi-diary randomised constructive search perform subsidiary local search ons adapt weights based ons
Note: The subsidiary constructive search is based
on weights and heuristic information.
Ant Colony Optimisation (ACO):
initialise weights
While termination criterion is not satisfied:⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣
generate populationspof candidate solutions using subsidiary randomised constructive search perform subsidiary local search onsp adapt weights based onsp
Note: The subsidiary constructive search uses weights
(pheromone trails) and heuristic information.
Memetic Algorithm (MA):
determine initial populationsp perform subsidiary local search onsp While termination criterion is not satisfied:⎢
⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣
generate setsprof new candidate solutions by recombination
perform subsidiary local search onspr generate setspmof new candidate
solutions fromspandsprby mutation perform subsidiary local search onspm select new populationspfrom candidate
rologue
We can only see a short distance ahead, but we can see plenty there that needs to be done. —Alan Turing, Mathematician
Imagine you visit a friend in the beautiful city of Augsburg in southern Germany. It is summer and you set yourselves the challenge to visit all 127 ‘Biergärten’ (beer gardens) on a single day. (If you don’t like beer, or if you don’t have friends in Augsburg, consider visiting all coffee shops in Vancouver, Canada.) Can this be done? If so, which route should you take? Clearly, your chances of reaching your goal may depend on finding a short round trip that takes you to all 127 places.
As you arrive at Biergarten No. 42, your friend gives you the following puzzle, offering to pay for all your drinks if you can solve it before the night is over: ‘Last week my friends Anne, Carl, Eva, Gustaf and I went out for dinner every night, Monday to Friday. I missed the meal on Friday because I was visiting my sister and her family. But otherwise, every one of us had selected a restaurant for a particular night and served as a host for that dinner. Overall, the following restaurants were selected: a French bistro, a sushi bar, a pizzeria, a Greek restau-rant, and the Brauhaus. Eva took us out on Wednesday. The Friday dinner was at the Brauhaus. Carl, who doesn’t eat sushi, was the first host. Gustaf had selected the bistro for the night before one of the friends took everyone to the pizzeria. Tell me, who selected which restaurant for which night?’
There are various approaches for solving these problems. Given the huge number of possible round trips through the Biergärten, or assignments of week-days, hosts, and restaurants, systematic enumeration (i.e., trying out all pos-sibilities) is probably not a realistic option. Some people would take a more sophisticated approach and eliminate certain assignments or partial tours through careful reasoning, while systematically searching over the remaining alternatives.
But most of us would probably take a rather different approach in practice: starting with a rough and somewhat arbitrary first guess, small changes are re-peatedly performed on a given tour or assignment, with the goal of improving its quality or of getting closer to a feasible solution. This latter type of approach is known as stochastic local search (SLS) and plays a very important role in solving combinatorial problems like the ones illustrated above. (It may be noted that the logical puzzle and the shortest round trip problem can be seen as instances of the Propositional Satisfiability and Travelling Salesman Problems, which will be more formally introduced in Chapter 1 and used throughout this book.)
Why Stochastic Local Search?
There are many reasons for studying stochastic local search (SLS) methods. As illustrated above, SLS is closely related to a very natural approach in human problem solving. Many SLS methods are surprisingly simple, and the respec-tive algorithms are rather easy to understand, communicate and implement. Yet, these algorithms can often solve computationally hard problems very effectively and robustly. SLS methods are also typically quite general and flexible. The same SLS methods have been found to work well for a broad range of different combi-natorial problems, and existing algorithms can often be modified quite naturally and easily to solve variants of a given problem. This makes SLS methods partic-ularly attractive for solving real-world problems, which are often not completely or correctly specified at the beginning of a project and may consequently undergo numerous revisions or modifications before all relevant aspects of the given ap-plication situation are captured.
Another reason for the popularity of SLS lies in the fact that this computa-tional approach to problem solving facilitates an explorative approach to algo-rithm design. Furthermore, as we will discuss in more detail in Chapter 2, many prominent and successful SLS methods are inspired by natural phenomena, which gives them an additional intellectual appeal.
For these (and many other) reasons, SLS methods are among the most promi-nent and successful techniques for solving computationally hard problems in many areas of computer science (specifically artificial intelligence) and opera-tions research; they are also widely used for solving combinatorial problems in other disciplines, including engineering, physics, management science and bioin-formatics.
The academic interest in SLS methods can be traced back to the begin-nings of modern computing. In operations research, local search algorithms were developed and described in the 1950s, and in artificial intelligence, SLS methods have been studied since the early days of the field, in the 1960s. To date, the study
Prologue 3
of SLS algorithms falls into the intersection of algorithmics, statistics, artificial intelligence, operations research, and numerous application areas. At the same time, SLS methods play a prominent role in these fields and are rapidly becoming part of the respective mainstream academic curricula.
About this Book
‘Stochastic Local Search: Foundations and Applications’ was primarily written for researchers, students and practitioners with an interest in efficient heuris-tic methods for solving hard combinatorial problems. In parheuris-ticular, it is geared towards academic and industry researchers in computer science, artificial intelli-gence, operations research, and engineering, as an introduction to and overview of the field or as a reference text; towards graduate students in computer sci-ence, operations research, mathematics, or engineering, as well as towards senior undergraduate students with some background in computer science and math-ematics, as primary or supplementary text for a course, or for self-study; and towards practitioners, who need to solve combinatorial problems for practical applications, as a reference text or as an introduction to and overview of the field.
The main goal of this book is to provide its readers with important compo-nents of a scientific approach to the design and application of SLS methods, and to present them with a broad, yet detailed view on the general concepts and spe-cific instances of SLS methods, including aspects of their development, analysis, and application. More specifically, we aim to give our readers access to detailed knowledge on the most prominent and successful SLS techniques; to facilitate an understanding of the relationships, the characteristic similarities and differences between existing methods; to introduce and discuss basic and advanced aspects of the empirical analysis of SLS algorithms; and to give hands-on knowledge on the application of some of the most widely used SLS methods to a variety of combinatorial problems.
Stochastic search algorithms are being studied by a large number of re-searchers from different communities, many of which have quite different views on the topic or specific aspects of it. While striving for a balanced and objective presentation, this book provides a view on stochastic local search that is based on our background and experience. This is reflected, for instance, in the spe-cific choice of our formal definition of stochastic local search (Chapter 1), in the GLSM model for hybrid SLS methods (Chapter 3), the extensive and in-depth coverage of empirical analysis and search space structure (Chapters 4 and 5), as well as in the selection of algorithms and problems we cover in varying degree of detail (particularly in Chapters 9 and 10). There are rational reasons for most
– if not all – of these choices; nevertheless, in many cases, equally defensible alternative decisions could have been made.
Clearly, some topics would benefit from broader and deeper coverage. How-ever, even relatively large book projects are subject to certain resource limitations in both time and space, and it is our hope that our choices of the material and its presentation will make this book useful for the previously stated purposes.
Structure and Supplementary Materials
The main body of this book consists of two parts. Part 1, which comprises Chap-ters 1 to 5, covers the foundations of the study of stochastic local search algo-rithms, including:
• fundamental concepts, definitions, and terminology (Chapter 1),
• an introduction to a broad range of important SLS methods and their most relevant variants (Chapter 2),
• a conceptual and formal model that facilitates the development and un-derstanding of hybrid SLS methods (Chapter 3),
• a methodical approach for the empirical analysis of SLS methods and other randomised algorithms (Chapter 4), and
• features and properties of the spaces searched by SLS algorithms and their impact on SLS behaviour (Chapter 5).
The material from the first two chapters provides the basis for all other aspects of SLS algorithms covered in this book; Chapters 1 and 2 should therefore be read before any other chapters and in their natural sequence. Chapters 3, 4, and 5 are quite independent from each other and expand the foundations of SLS in differ-ent directions. Chapter 3 complemdiffer-ents Chapter 2; since it discusses some of the more complex SLS methods in a different light, it can be very useful for review-ing and deepenreview-ing the understandreview-ing of these practically very relevant methods. The scope of Chapter 4 extends substantially beyond the empirical analysis of SLS algorithms; although most of the material covered in the subsequent chap-ters does not directly depend on the concepts and methods from Chapter 4, we strongly believe that anyone involved in the design and application of SLS algo-rithms should be familiar at least with the basic issues and approaches discussed there. Chapter 5 in some sense covers the most advanced material presented in this book; it should be useful to readers interested in a deeper knowledge of the
Prologue 5
factors and reasons underlying SLS behaviour and performance, but reading it is not a prerequisite to understanding any of the material covered in the other chapters.
Part 2 comprises Chapters 6 to 10, which present, in varying degree of scope and detail, SLS algorithms for a number of well-known and widely studied com-binatorial problems. Except for Chapter 7, which should be read after Chapter 6 since it builds on much of the material covered there, all chapters of this second part are basically independent of each other and can be studied in any combi-nation and order. Chapters 6 to 8 provide a reasonable coverage of the most prominent and successful SLS methods for the respective problems and discuss the respective algorithms in a relatively detailed way. Chapters 9 and 10 are of a more introductory nature; their focus lies on a small number of SLS algorithms for the respective combinatorial problems that have been selected primarily based on their performance and general interest. In particular, the five main sections of Chapter 10 are independent of each other and can be studied in any combination and order.
‘In Depth’ Sections. Additional, clearly marked ‘In Depth’ sections are inclu-ded in various chapters. These provide additional material that expands or com-plements the main body of the respective chapter, often at a more technical or detailed level. These sections are generally not required for understanding the main text, but in many cases they should be helpful for obtaining a deeper understanding of important concepts and issues.
Further Readings. Towards the end of each chapter, a ‘Further Readings and Related Work’ section provides additional references and pointers to literature on related topics. In the case of subjects for which there is a large body of lit-erature, these represent only a small selection of references deemed especially relevant and/or accessible by the authors. These references should provide good starting points for the reader interested in a broader and deeper knowledge of the respective topic.
Chapter Summaries. Each chapter closes with a summary section that briefly reviews the most relevant concepts and ideas covered in the respective chapter. The purpose of this summary is to provide the reader with a high-level overview of the material presented in the chapter, and to point out connections (and dif-ferences) between the respective concepts and approaches. Together with the chapter introductions and exercises, these summaries facilitate rapid reviewing of previously studied or known material.
Exercises. Each chapter is accompanied by a collection of exercises, classified according to their degree of difficulty as ‘easy’, ‘medium’ and ‘hard’. This clas-sification is only approximate and does not necessarily reflect the anticipated amount of time needed for producing a solution; although an exercise marked as ‘easy’ may be relatively straightforward to solve, it may still require a substantial amount of time until the details of the solution are worked out and written down. The exercises cover the material presented in the respective chapter and are in-tended to facilitate a deeper understanding of the subject matter. They include theoretical questions as well as hands-on implementation and experimentation exercises.
References and Bibliography. References to the technical and research litera-ture are provided throughout the book, particularly in the previously mentioned ‘Further Readings and Related Work’ sections. These give rise to an extensive bibliography that covers much of the most relevant literature on SLS algorithms and related topics, with a particular emphasis on recent publications.
Glossary and Index. The glossary contains brief explanations of important technical terms useful throughout the book. In conjunction with the extensive and thoroughly compiled index, the glossary particularly facilitates using this book as a reference book or for self-study.
Webpage and Supplementary Materials. Supplementary materials are pro-vided from the book webpage at
www.sls-book.net
. These include slide sets that may be useful in the context of courses that use the book as a primary or supplementary text (see also Section ‘Suggested Uses’ below), as well as ref-erence implementations of some of the SLS algorithms discussed in this book (needed for some of the hands-on exercises and useful for further practical expe-rience) and some educational tools, for example, for the empirical analysis of SLS behaviour.Suggested Uses
This book was designed for various types of uses. As a whole, it is intended to be used as a reference book for researchers and practitioners or as the primary text for a specialised graduate or upper-level undergraduate course on stochastic search algorithms; furthermore, parts of it can be used as primary reading or sup-plementary material for modules of more general courses in artificial intelligence, algorithms, operations research, combinatorial problem solving, empirical meth-ods in computer science, etc. The following specific suggestions reflect our own experience, including the use of parts of this book by students, researchers, and
Prologue 7
course instructors at the University of British Columbia (Vancouver, Canada) and Darmstadt University of Technology (Darmstadt, Germany).
General introduction to SLS methods, particularly for self-study. Chapters 1 and 2; Sections 3.1 to 3.3 and 3.6; Sections 4.1 to 4.3 and 4.6; Section 5.8; any one or two sections from Chapter 10. For more advanced self-study, the remaining materials can be added as desired; particularly the remaining sections of Chapters 4 as well as Chapters 6 and 8 are highly recommended.
Graduate Course on SLS methods/stochastic search. Chapters 1 and 2; Sec-tions 3.1 to 3.3 and 3.6; Chapter 4; SecSec-tions 5.1 to 5.3 and 5.8; Chapters 6 and 7 without the sections on CSP and MAX-CSP; Chapter 8; and any two sections from Chapter 10. Depending on the precise format, focus and level of the course, this selection may be expanded in various ways, for example, by additionally cov-ering Section 9.1 and any one other section from Chapter 9. For a general course on stochastic search methods, an additional module on randomised systematic search algorithms should be included (a sample set of slides for such a module is available from
www.sls-book.net
).SLS Module(s) in a general AI course. Parts of Chapters 1 and 2; Sections 3.1 to 3.3 and 3.6; Sections 4.1 to 4.3 and 4.6; parts of Chapter 6; and possibly parts of Chapters 8, 9, or 10. The selections from Chapters 1, 2, 6 and 8 to 10 will naturally be based on the prerequisite knowledge of the students as well as the format, level and other modules of the course. A minimal subset for a module of about two lectures in an undergraduate course would mainly take parts of Chapters 1 and 2 and illustrate the working principles of SLS methods using example applications described in Part 2.
SLS Module(s) in a general algorithms course. Parts of Chapters 1 and 2; Sections 3.1 to 3.3 and 3.6; Sections 4.1 to 4.3 and 4.6; Sections 5.1 to 5.3 and 5.8; parts of Chapters 6 and 8; and possibly one or more sections from Chapter 10. The precise balance between these components will naturally depend on the exact nature of the course, particularly on its focus on theoretical or practical aspects of problem solving. In the context of strongly practically oriented algo-rithms courses, the in-depth sections in Chapters 4, 6 and 8 may be of particular interest.
SLS Module(s) in a discrete optimisation course. Parts of Chapters 1 and 2; Sections 3.1 to 3.3 and 3.6; Chapter 4; parts of Chapter 8 and 9; and any one or two sections from Chapter 10. Additional material, particularly from Chapters 6 and 7, can be used to further expand and complement this selection.
Parts of this book can also be used as primary or supplementary material for specialised graduate courses on SAT, CSP, TSP, scheduling and empirical methods in computing.
The Making of SLS:FA
The process of creating this book is in many ways related to the subject ma-terial discussed therein. Not unlike the fundamental approach of local search, it involved navigating a huge space of possibilities in an iterative manner. This process was initiated in 1998, when both, H. H. and T. S. were finishing their Ph.D. theses at the Computer Science Department of Darmstadt University of Technology, and the idea of combining materials from both theses into a com-prehensive book on Stochastic Local Search first arose. Five years and about 650 pages later, we reached the end of this search trajectory. The result of a myriad of construction, perturbation and evaluation steps is this book. Interestingly and perhaps not too surprisingly, both, the writing process and its end result turned out to be very different from what we had originally imagined.
Although it would be hard to precisely define the objective(s) being opti-mised through the writing process, it took us through many situations that closely resemble those of a stochastic local search algorithm trying to solve a challenging instance of a hard combinatorial problem. There were phases of rapid progress and stagnation; we encountered (and overcame) numerous local minima; and along the way, we had to make many decisions based on very limited local infor-mation, various forms of heuristic guidance, and some degree of experience.
Random, or at least completely unforeseen and unpredictable, factors played a large role in this local search process. Rather trivial sources of randomness, such as hardware and software glitches, were complemented by more fundamental stochastic influences, such as the random thoughts and ideas that on warm sum-mer nights seem to preferably lurk around the Biergärten, always looking for a receptive mind, or the random person sticking their head into the office door, causing the more organised ideas to fly apart in a hurry. Without these random influences, and the circumstances conducive to them, this book could not have been created in its present form.
At the same time, this book has been shaped by many other factors and influences. These include the places and circumstances under which part of the work was done. (Some of the more interesting places where parts of the book have been written include a log cabin on Sechelt Inlet, the beautiful and tranquil Nitobe Garden, a grassy spot near the top of Whyte Islet in Howe Sound, and the wild and remote inlets of the Pacific Northwest, onboard the Nautilus Explorer.) More importantly, they include a huge and diverse amount of interaction with
Prologue 9
friends and family, mentors, colleagues, students and our publishers, who pro-vided crucial guidance, diversification, evaluation and general support. Finally, especially during the final phase of the process, our work on this book was largely driven by Hofstadter’s Law: ‘It always takes longer than you expect, even when you take into account Hofstadter’s Law.’ [Hofstadter, 1979], the significance and effects of which can hardly be overestimated.
As a consequence, it would be foolish to believe that our stochastic local search process has led us into a global optimum. However, we feel that, largely thanks to the previously mentioned factors and influences, in the process of cre-ating this book we managed to avoid and escape from many low-quality local optima, and achieved an end result that we hope will be useful to those who study it. In this context, we are deeply grateful towards those who contributed directly and indirectly to this work, and who provided us with guidance and sup-port in our local — and global — search.
High-level guidance is of central importance in any effective search process; in our case, there are several people who played a key role in shaping our ap-proach to scientific research and who provided crucial support during various stages of our academic careers. First and foremost, we thank Wolfgang Bibel, our former advisor and ‘Doktorvater’, for providing a highly supportive and stimu-lating academic environment in which we could freely pursue our research in-terests, and whose encouragement and substantial support was highly significant in getting this project underway. Furthermore, H. H. gratefully acknowledges the ongoing and invaluable support from his academic mentors and colleagues, Alan Mackworth and Anne Condon, who also played an important role during the early stages of writing this book. T. S. would especially like to thank Marco Dorigo for the pleasure of joint research and for his support in many senses.
On the other side, we have received more specific guidance on the contents of this book from a number of colleagues, students and fellow SLS researchers. Their detailed comments led to improvements in various parts of this book and helped to significantly reduce the number of errors. (Obviously, the responsibility for those errors that we managed to hide well enough to escape their vigilance rests solely with us.) In this context, we especially thank (in alphabetical order) Markus Aderhold, Christian Blum, Marco Chiarandini, Anne Condon, Irina Du-mitrescu, Frank Hutter, David Johnson, Olivier Martin, Luis Paquete, Marco Pranzo, Tommaso Schiavinotto, Kevin Smyth, Dan Tulpan and Maxwell Young. We also acknowledge helpful comments by Craig Boutilier, Rina Dechter, Jin-Kao Hao, Keld Helsgaun, Kalev Kask, Henry Kautz, Janek Klawe, Lucas Lessing, Elena Marchiori, David Poole, Rubén Ruiz García, Alena Shmygelska and Dave Tompkins. Special thanks go to David Woodruff, Toby Walsh, Celso Ribeiro and Peter Merz, whose detailed comments provided valuable guidance in improving the presentation of our work.
In addition, we gratefully acknowledge the interesting and stimulating dis-cussions on the topics of this book that we shared with many of our co-authors, colleagues, students and fellow researchers at TUD and UBC, as well as at confer-ences, workshops, tutorials and seminars. It is their encouragement, enthusiasm and continuing interest that provided much of the background and motivation for this work.
The staff at Morgan Kaufmann, Elsevier, Kolam and Dartmouth Publishing have been instrumental in the realisation of this book in many ways; we deeply appreciate their expertise and friendly support throughout the various stages of this project. We are particularly grateful to Denise Penrose, Senior Editor at Morgan Kaufmann, whose enthusiasm for this project and patience in dealing with the adverse effects of Hofstadter’s Law (as well as with her authors’ more peculiar wishes and ideas) played a key role in creating this book. Simon Crump, Publishing Services Manager at Elsevier, and Jamey Stegmaier, Project Manager at Kolam USA, have been similarly instrumental during the production stages, and we gratefully acknowledge their help and support. We also thank Jessica Meehan and her team at Dartmouth Publishing, who produced many of the fig-ures, as well as Lori Newhouse and Calum Ross for copyediting and proofread-ing the book, and Robert Swanson for creatproofread-ing the index. Many thanks also to Emilia Thiuri and Valerie Witte, for their help during the draft stages, throughout the reviewing process and during production, and to Brian Grimm, marketing manager at Morgan Kaufmann, for substantially increasing the visibility of our work. H. H. also wishes to thank Valerie McRae for her help with proofread-ing the manuscript in various draft stages, and for much appreciated moral and administrative support.
Finally, we thank our families who provided the stable and stimulating environment that formed the starting point of our personal and intellectual de-velopment, and who shape and accompany the trajectories of our lives in a unique and special way. H. H. expresses his deepest gratitude to Sonia and Jehannine for being his partners in adventure, joy, and sorrow, and his parents, siblings and extended family for their affection and diversifying influence. T. S. especially thanks his wife Maria José for sharing her life with him, Alexander for all his curiosity and love, and his parents for their continuous care and support.
This book has been shaped by many factors and influences, but first and foremost it is the product of our joint research interests and activities, which co-evolved over the past seven years into an immensely fruitful and satisfying collaboration and, more importantly, into a close friendship.
part
I
1
Introduction
The machine does not isolate us from the great problems of life but plunges us more deeply into them. —Antoine de Saint-Exupéry, Pilot & Writer
This introductory chapter provides the background and motivation for studying stochastic local search algorithms for combinatorial problems. We start with an introduction to combinatorial problems and present SAT, the sat-isfiability problem in propositional logic, as well as TSP, the travelling salesman problem, as the central problems used for illustrative purposes throughout the first part of this book. This is followed by a short introduction to computational complexity. Next, we discuss and compare various fundamental search paradigms, including the concepts of systematic and local search, after which we formally de-fine and discuss the notion of stochastic local search, one of the practically most important and successful approaches for solving hard combinatorial problems.
1.1
Combinatorial Problems
Combinatorial problems arise in many areas of computer science and other disci-plines in which computational methods are applied, such as artificial intelligence, operations research, bioinformatics and electronic commerce. Prominent exam-ples are tasks such as finding shortest or cheapest round trips in graphs, find-ing models of propositional formulae or determinfind-ing the 3D-structure of pro-teins. Other well-known combinatorial problems are encountered in planning, scheduling, time-tabling, resource allocation, code design, hardware design and genome sequencing. These problems typically involve finding groupings, order-ings or assignments of a discrete, finite set of objects that satisfy certain conditions or constraints. Combinations of these solution components form the potential solutions of a combinatorial problem. A scheduling problem, for instance, can be
seen as an assignment problem in which the solution components are the events to be scheduled, and the values assigned to events correspond to the time at which these occur. This way, typically a huge number of candidate solutions can be obtained; for most combinatorial optimisation problems, the space of poten-tial solutions for a given problem instance is at least exponenpoten-tial in the size of that instance.
Problems and Solutions
At this point, it is useful to clarify the distinction between problems and problem instances. In this book, by ‘problem’, we mean abstract problems (sometimes also called problem classes), such as ‘for any given set of points in the Euclidian plane, find the shortest round trip connecting these points’. In this example, an instance of the problem would be to find the shortest round trip for a specific set of points in the plane. The solution of such a problem instance would be a specific shortest round trip connecting the given set of points. The solution of the abstract problem, however, is an algorithm that, given a problem instance, determines a solution for that instance. Generally, problems can be defined as sets of problem instances, where each instance is a pair of input data and solution data. This is an elegant mathematical formalisation; however, in this book we will define problems using a slightly less formal, but more intuitive (yet precise), representation.
For instances of combinatorial problems, we draw an important distinction between candidate solutions and solutions. Candidate solutions are potential so-lutions that may possibly be encountered during an attempt to solve the given problem instance; but unlike solutions, they may not satisfy all the conditions from the problem definition. For our shortest round trip example, typically any valid round trip connecting the given set of points, regardless of length, would be a candidate solution, while only those candidate round trips with minimal length would qualify as solutions. It should be noted that while the definition of any combinatorial problem states clearly what is considered a solution for an instance of this problem, the notion of candidate solution is not always uniquely deter-mined by the problem definition, but can already reflect a particular approach for solving the problem. As an example, consider the variant of the shortest round trip problem in which we are only interested in trips that visit each given point exactly once. In this case, candidate solutions could be either arbitrary round trips which do not necessarily respect this additional condition, or the notion of candidate solution could be restricted to round trips that visit no point more than once.
1.1 Combinatorial Problems 15
Decision Problems
Many combinatorial problems can be naturally characterised as decision prob-lems: for these, the solutions of a given instance are specified by a set of logical conditions. As an example of a combinatorial decision problem, consider the Graph Colouring Problem: given a graph
G
and a number of colours, find an as-signment of colours to the vertices ofG
such that two vertices that are connected by an edge are never assigned the same colour. Other prominent combinatorial decision problems include finding satisfying truth assignments for a given propo-sitional formula (the Propopropo-sitional Satisfiability Problem, SAT, which we revisit in more detail in Section 1.2) or scheduling a series of events such that a given set of precedence constraints is satisfied. For any decision problem, we distinguish two variants:the search variant, where, given a problem instance, the objective is to find a solution (or to determine that no solution exists);
the decision variant, in which for a given problem instance, one wants to answer the question whether or not a solution exists.
These variants are closely related because algorithms solving the search variant can always be used to solve the decision variant. Interestingly, for many combi-natorial decision problems, the converse also holds: algorithms for the decision variant of a problem can be used for finding actual solutions.
Optimisation Problems
Many practically relevant combinatorial problems are optimisation problems rather than decision problems. Optimisation problems can be seen as generalisa-tions of decision problems, where the solugeneralisa-tions are additionally evaluated by an objective function and the goal is to find solutions with optimal objective func-tion values. The objective funcfunc-tion is often defined on candidate solufunc-tions as well as on solutions; the objective function value of a given candidate solution (or solution) is also called its solution quality. For the Graph Colouring Prob-lem mentioned previously, a natural optimisation variant exists, where a variable number of colours is used and the goal is, given a graph, to find a colouring of its vertices, using only a minimal (rather than a fixed) number of colours.
Any combinatorial optimisation problem can be stated as a minimisation problem or as a maximisation problem, depending on whether the given objective function is to be minimised or maximised. Often, one of the two formulations is
more natural, but algorithmically, minimisation and maximisation problems are treated equivalently. In this book, for uniformity and formal convenience, we generally formulate optimisation problems as minimisation problems. For each combinatorial optimisation problem, we distinguish two variants:
the search variant: given a problem instance, find a solution with minimal (or maximal, respectively) objective function value;
the evaluation variant: given a problem instance, find the optimal objec-tive function value (i.e., the solution quality of an optimal solution).
Clearly, the search variant is the more general of these, since with the knowledge of an optimal solution, the evaluation variant can be solved trivially. Additionally, for each optimisation problem, we can define:
associated decision problems: given a problem instance and a fixed so-lution quality bound
b
, find a solution with an objective function value smaller than or equal tob
(for minimisation problems; greater than or equal tob
for maximisation problems) or determine that no such solution exists.Many combinatorial optimisation problems are defined based on an objective function as well as on logical conditions. In this case, candidate solutions satisfying the logical conditions are called feasible or valid, and among those, optimal solu-tions can be distinguished based on their objective function value. While the use of logical conditions in addition to an objective function often leads to more natural formulations of a combinatorial optimisation problem, it should be noted that the logical conditions can always be integrated into the objective function in such a way that the feasible candidate solutions correspond to the solutions of an associ-ated decision problem (i.e., to candidate solutions with bounded solution quality). As we will see throughout this book, many algorithms for decision problems can be extended to related optimisation problems in a rather natural way. How-ever, such simple extensions of algorithms that work well on certain decision problems are not always effective for finding optimal or near-optimal solutions of the corresponding optimisation problems, and consequently, different algo-rithmic methods need to be considered for this task.
1.2
Two Prototypical Combinatorial Problems
In the following, we introduce two well-known combinatorial problems which will be used throughout the first part of this book for illustrating algorithmic
1.2 Two Prototypical Combinatorial Problems 17
techniques and approaches. These are the Propositional Satisfiability Problem (SAT), a prominent combinatorial decision problem which plays a central role in several areas of computer science, and the Travelling Salesman Problem (TSP), one of the most extensively studied combinatorial optimisation problems. Be-sides their prominence and well established role in algorithm development, both problems have the advantage of being conceptually simple, which facilitates the development, analysis and presentation of algorithms and algorithmic ideas. Both will be discussed in more detail in Part 2 of this book (see Chapters 6 and 8).
The Propositional Satisfiability Problem (SAT)
Roughly speaking, the Propositional Satisfiability Problem is, given a formula in propositional logic, to decide whether there is an assignment of truth values to the propositional variables appearing in this formula under which the for-mula evaluates to ‘true’. In the following, we present a formal definition of SAT. While the details of this definition may not be crucial for comprehending the restricted forms of the problem used in the remainder of this book, they are im-portant for a deeper understanding of the nature and properties of the general SAT problem.
Propositional logic is based on a formal language over an alphabet com-prising propositional variables, truth values and logical operators. Using logical operators, propositional variables and truth values are combined into proposi-tional formulae which represent proposiproposi-tional statements. Formally, the syntax of propositional logic can be defined in the following way:
Definition 1.1 Syntax of Propositional Logic
S
:=V
∪C
∪O
∪ {(,
)} is the alphabet of propositional logic, withV
:={
x
i |i
∈ N} denoting the countable infinite set of propositional variables,C
:= {,
⊥} the set of truth values (or propositional constants) true andfalse, and
O
:= {¬,
∧,
∨} the set of propositional operators negation (‘not’), conjunction (‘and’) and disjunction (‘or’).The set of propositional formulae is characterised by the following induc-tive definition:
• the truth values and ⊥ are propositional formulae;
• each propositional variable
x
i∈V
is a propositional formula;• if
F
is a propositional formula, then ¬F
is also a propositional formula;• if
F
1andF
2are propositional formulae, then (F
1∧F
2) and (F
1∨F
2)are also propositional formulae.
Only strings obtained by a finite number of applications of these rules are propositional formulae.
Remark: Often, additional binary operators, such as ‘←’ (implication) and ‘↔’ (equivalence), are used in propositional formulae. These can be defined based on the operators from Definition 1.1; hence, including them into our propositional language does not increase its expressiveness.
Assignments are mappings from propositional variables to truth values. Us-ing the standard interpretations of the logical operators on truth values, assign-ments can be used to evaluate propositional formulae. Hence, the semantics of propositional logic can be defined as follows:
Definition 1.2 Semantics of Propositional Logic
The variable set Var (
F
) of formulaF
is defined as the set of all variables appearing inF
.A variable assignment of formula
F
is a mappinga
: Var(F
) → {,
⊥} of the variable set ofF
to the truth values. The set of all possible variable assignments ofF
is denoted byAssign
(F
).The value
Val
(F, a
) of formulaF
under assignmenta
is defined inductively based on the syntactic structure ofF
:•
Val
(, a
) :=•
Val
(⊥, a
) := ⊥ •Val
(x
i, a
) :=a
(x
i)•
Val
(¬F
1, a
) := ¬Val
(F
1, a
)•
Val
(F
1∧F
2, a
) :=Val
(F
1, a
) ∧Val
(F
2, a
) •Val
(F
1∨F
2, a
) :=Val
(F
1, a
) ∨Val
(F
2, a
)The truth values ‘’ and ‘⊥’ represent logical truth and falsehood, respec-tively; the operators ‘¬’ (negation), ‘∧’ (conjunction) and ‘∨’ (disjunction) are defined by the following truth tables:
1.2 Two Prototypical Combinatorial Problems 19 ¬ ⊥ ⊥ ∧ ⊥ ⊥ ⊥ ⊥ ⊥ ∨ ⊥ ⊥ ⊥
Remark: There are many different notations for the truth values ‘’ and ‘⊥’, including ‘0’ and ‘1’, ‘−1’ and ‘+1’, ‘T’ and ‘F’, as well as ‘TRUE’ and ‘FALSE’. Likewise, the propositional operators ‘¬’, ‘∧’ and ‘∨’ are often denoted ‘–’, ‘∗’ and ‘+’, or ‘NOT’, ‘AND’ and ’OR’.
Because the variable set of a propositional formula is always finite, the complete set of assignments for a given formula is also finite. More precisely, for a formula containing
n
variables there are exactly 2ndifferent variable assignments.Considering the values of a formula under all possible assignments, the fun-damental notion of satisfiability can be defined in the following way:
Definition 1.3 Satisfiability
A variable assignment
a
is a model of formulaF
if, and only if,Val
(F, a
) = ; in this case we say thata
satisfiesF
.A formula
F
is called satisfiable if, and only if, there exists at least one model ofF
.Based on the notion of satisfiability, we can now formally define the SAT problem.
Definition 1.4 The Propositional Satisfiability Problem
Given a propositional formula
F
, the Propositional Satisfiability Problem (SAT) is to decide whether or notF
is satisfiable.Obviously, SAT can be seen as a combinatorial decision problem, where vari-able assignments represent candidate solutions and models represent solutions. As for any combinatorial decision problem, we can distinguish a decision variant and a search variant: in the former, only a yes/no decision regarding the satisfia-bility of the given formula is required; in the latter, also called the model-finding variant, in case the given formula is satisfiable, a model has to be found.
Often, logical problems like SAT are studied for syntactically restricted classes of formulae. Imposing syntactic restrictions usually facilitates theoreti-cal studies and can also be very useful for simplifying the design and analysis of
algorithms. Normal forms are types of syntactically restricted formulae such that for an arbitrary formula
F
there is always at least one semantically equivalent formulaF
in normal form. Thus, each normal form induces a subclass of propo-sitional formulae which is as expressively powerful as full propopropo-sitional logic. The two most commonly used normal forms, CNF and DNF, are introduced in the following definition.Definition 1.5 Normal Forms
A literal is a propositional variable (called a positive literal) or its negation (called a negative literal). Formulae of the syntactic form
c
1∧c
2∧. . .
∧c
mare called conjunctions, while formulae of the form
d
1∨d
2∨. . .
∨d
marecalled disjunctions.
A propositional formula
F
is in conjunctive normal form (CNF), if, and only if, it is a conjunction over disjunctions of literals. In this context, the disjunctions are called clauses. A CNF formulaF
is ink
-CNF, if, and only if, all clauses ofF
contain exactlyk
literals.A propositional formula
F
is in disjunctive normal form (DNF), if, and only if, it is a disjunction over conjunctions of literals. In this case, the con-junctions are called clauses. A DNF formulaF
is ink
-DNF, if, and only if, all clauses ofF
contain exactlyk
literals.Example 1.1 A Simple SAT Instance
Let us consider the following propositional formula in CNF:
F
:= (¬x
1∨x
2) ∧ (¬x
2∨x
1) ∧ (¬x
1∨ ¬x
2∨ ¬x
3) ∧ (x
1∨x
2) ∧ (¬x
4∨x
3) ∧ (¬x
5∨x
3)For this formula, we obtain the variable set Var(
F
) = {x
1, x
2, x
3, x
4, x
5}; consequently, there are 25= 32 different variable assignments. Exactly one of these,x
1=x
2=, x
3=x
4=x
5= ⊥, is a model, renderingF
satisfiable.
The Travelling Salesman Problem (TSP)
The motivation behind the Travelling Salesman Problem (also known as Travel-ling Salesperson Problem) is the problem faced by a salesperson who needs to
1.2 Two Prototypical Combinatorial Problems 21
visit a number of customers located in different cities and tries to find the shortest round trip accomplishing this task. In a more general and abstract formulation, the TSP is, given a directed, edge-weighted graph, to find a shortest cyclic path that visits every node in this graph exactly once. In order to define this problem formally, we first introduce the notion of a Hamiltonian cycle:
Definition 1.6 Path, Hamiltonian Cycle
Let
G
:= (V, E, w
) be an edge-weighted, directed graph whereV
:= {v
1, v
2,
. . . , v
n} is the set ofn
= #V
vertices,E
⊆V
×V
the set of (directed) edges,and
w
:E
→ R+a function assigning each edgee
∈E
a weightw
(e
).A path in
G
is a list (u
1, u
2, . . . , u
k) of verticesu
i∈V
(i
= 1, . . . , k
), suchthat any pair (
u
i, u
i+1),i
= 1, . . . , k
− 1, is an edge inG
. A cyclic path inG
is a path for which the first and the last vertex coincide, i.e.,
u
1 =u
k in theabove notation.
A Hamiltonian cycle in
G
is a cyclic pathp
inG
that visits every ver-tex ofG
(except for its starting point) exactly once, i.e.,p
= (u
1, u
2, . . . ,
u
n, u
1) is a Hamiltonian cycle inG
if, and only if,n
= #V
, and{u
1, u
2,
. . . , u
n} =V
.The weight of a path
p
can be calculated by adding up the weights of the edges inp
:Definition 1.7 Path Weight
For a given edge-weighted, directed graph and a path
p
:= (u
1, . . . , u
k) inG
,the path weight
w
(p
) is defined asw
(p
) :=k−1i=1
w
((u
i, u
i+1)).Now, the TSP can be formally defined in the following way:
Definition 1.8 The Travelling Salesman Problem
Given an edge-weighted, directed graph
G
, the Travelling Salesman Problem (TSP) is to find a Hamiltonian cycle with minimal path weight inG
.Often, the TSP is defined in such a way that the underlying graphs are always complete graphs, that is, any pair of vertices is connected by an edge, because for any TSP instance with an underlying graph