Heuristic Search Theory and Applications
Total Page:16
File Type:pdf, Size:1020Kb
Heuristic Search Theory and Applications Stefan Edelkamp Stefan Schrodl AMSTERDAM • BOSTON • HEIDELBERG • LONDON NEW YORK • OXFORD • PARIS • SAN DIEGO SAN FRANCISCO • SINGAPORE • SYDNEY » TOKYO ELSEVIER Morgan Kaufmann is an imprint of Elsevier Contents List of Algorithms Preface xxul PART I HEURISTIC SEARCH PRIMER CHAPTER 1 Introduction 3 1.1 Notational and Mathematical Background 3 1.1.1 Pseudocode 3 1.1.2 Computability Theory 4 1.1.3 Complexity Theory 5 1.1.4 Asymptotic Resource Consumption 7 1.1.5 Symbolic Logic 8 1.2 Search 9 1.3 Success Stories 9 1.4 State Space Problems 12 1.5 Problem Graph Representations 14 1.6 Heuristics 15 1.7 Examples of Search Problems 19 1.7.1 Sliding-Tile Puzzles 19 1.7.2 Rubik's Cube 22 1.7.3 Sokoban 22 1.7.4 Route Planning 24 1.7.5 TSP 25 1.7.6 Multiple Sequence Alignment 26 1.8 General State Space Descriptions 29 1.8.1 Action Planning 29 1.8.2 *Production Systems 32 1.8.3 Markov Decision Processes 35 1.8.4 Generic Search Model 36 1.9 Summary 37 1.10 Exercises 39 1.11 Bibliographic Notes 45 CHAPTER 2 Basic Search Algorithms 47 2.1 Uninformed Graph Search Algorithms 48 2.1.1 Depth-First Search 50 2.1.2 Breadth-First Search 51 2.1.3 Dijkstra's Algorithm 53 V vi Contents 2.1.4 Negatively Weighted Graphs 57 2.1.5 Relaxed Node Selection 58 2.1.6 * Algorithm of Bellman-Ford 60 2.1.7 Dynamic Programming 62 2.2 Informed Optimal Search 68 2.2.1 A* 69 2.2.2 On the Optimal Efficiency of A* 74 2.3 *General Weights 75 2.3.1 Cost Algebras 76 2.3.2 Multiobjective Search 79 2.4 Summary 80 2.5 Exercises 82 2.6 Bibliographic Notes 86 CHAPTER 3 *Dictionary Data Structures 89 3.1 Priority Queues 89 3.1.1 Bucket Data Structures 90 3.1.2 Heap Data Structures 97 3.2 Hash Tables 110 3.2.1 Hash Dictionaries Ill 3.2.2 Hash Functions 112 3.2.3 Hashing Algorithms 121 3.2.4 Memory-Saving Dictionaries 130 3.2.5 Approximate Dictionaries 134 3.3 Subset Dictionaries 138 3.3.1 Arrays and Lists 139 3.3.2 Tries 139 3.3.3 Hashing 139 3.3.4 Unlimited Branching Trees 141 3.4 String Dictionaries 142 3.4.1 Suffix Trees 143 3.4.2 Generalized Suffix Trees 146 3.5 Summary 151 3.6 Exercises 154 3.7 Bibliographic Notes 157 CHAPTER 4 Automatically Created Heuristics 161 4.1 Abstraction Transformations 162 4.2 Valtorta's Theorem 164 4.3 hierarchical A* 165 4.4 Pattern Databases 167 4.4.1 Fifteen-Puzzle 168 4.4.2 Rubik's Cube 169 4.4.3 Directed Search Graphs 170 4.4.4 Korf's Conjecture 170 4.4.5 Multiple Pattern Databases 172 4.4.6 Disjoint Pattern Databases 173 4.5 *Customized Pattern Databases 177 4.5.1 Pattern Selection 178 4.5.2 Symmetry and Dual Pattern Databases 179 4.5.3 Bounded Pattern Databases 180 4.5.4 On-Demand Pattern Databases 183 4.5.5 Compressed Pattern Databases 183 4.5.6 Compact Pattern Databases 185 4.6 Summary 185 4.7 Exercises 187 4.8 Bibliographic Notes 190 PART II HEURISTIC SEARCH UNDER MEMORY CONSTRAINTS CHAPTER 5 Linear-Space Search 195 5.1 ^Logarithmic Space Algorithms 195 5.1.1 Divide-and-Conquer BFS 196 5.1.2 Divide-and-Conquer Shortest Paths Search 196 5.2 Exploring the Search Tree 197 5.3 Branch-and-Bound 198 5.4 Iterative-Deepening Search 201 5.5 Iterative-Deepening A* 204 5.6 Prediction of IDA* Search 206 5.6.1 Asymptotic Branching Factors 206 5.6.2 IDA* Search Tree Prediction 212 5.6.3 *Convergence Criteria 217 5.7 * Refined Threshold Determination 218 5.8 *Recursive Best-First Search 219 5.9 Summary 220 5.10 Exercises 222 5.11 Bibliographic Notes 223 CHAPTER 6 Memory-Restricted Search 227 6.1 Linear Variants Using Additional Memory 228 6.1.1 Transposition Tables 228 6.1.2 Fringe Search 231 viii Contents 6.1.3 iterative Threshold Search 233 6.1.4 MA*, SMA, and SMAG 235 6.2 Nonadmissible Search 240 6.2.1 Enforced Hill-Climbing 240 6.2.2 Weighted A* 243 6.2.3 Overconsistent A* 244 6.2.4 Anytime Repahing A* 246 6.2.5 Jt-Best-First Search 250 6.2.6 Beam Search 251 6.2.7 Partial A* and Partial IDA* 251 6.3 Reduction of the Closed List 254 6.3.1 Dynamic Programming in Implicit Graphs 255 6.3.2 Divide-and-Conquer Solution Reconstruction 255 6.3.3 Frontier Search 257 6.3.4 *Sparse Memory Graph Search 259 6.3.5 Breadth-First Heuristic Search 261 6.3.6 Locality 264 6.4 Reduction of the Open List 266 6.4.1 Beam-Stack Search 266 6.4.2 Partial Expansion A* 270 6.4.3 Two-Bit Breadth-First Search 271 6.5 Summary 273 6.6 Exercises 275 6.7 Bibliographic Notes 279 CHAPTER 7 Symbolic Search 283 7.1 Boolean Encodings for Set of States 284 7.2 Binary Decision Diagrams 286 7.3 Computing the Image for a State Set 290 7.4 Symbolic Blind Search 291 7.4.1 Symbolic Breadth-First Tree Search 291 7.4.2 Symbolic Breadth-First Search 293 7.4.3 Symbolic Pattern Databases 294 7.4.4 Cost-Optimal Symbolic Breadth-First Search 296 7.4.5 Symbolic Shortest Path Search 298 7.5 Limits and Possibilities of BDDs 299 7.5.1 Exponential Lower Bound 299 7.5.2 Polynomial Upper Bound 300 7.6 Symbolic Heuristic Search 302 7.6.1 Symbolic A* 302 7.6.2 Bucket Implementation 305 Contents ix 7.6.3 Symbolic Best-First Search 307 7.6.4 Symbolic Breadth-First Branch-and-Bound 308 7.7 *Refinements 309 7.7.1 Improving the BDD Size 309 7.7.2 Partitioning 310 7.8 Symbolic Algorithms for Explicit Graphs 311 7.9 Summary 311 7.10 Exercises 313 7.11 Bibliographic Notes 317 CHAPTER 8 External Search 319 8.1 Virtual Memory Management 320 8.2 Fault Tolerance 321 8.3 Model of Computation 321 8.4 Basic Primitives 323 8.5 External Explicit Graph Search 324 8.5.1 * External Priority Queues 324 8.5.2 External Explicit Graph Depth-First Search 325 8.5.3 External Explicit Graph Breadth-First Search 326 8.6 External Implicit Graph Search 328 8.6.1 Delayed Duplicate Detection for BFS 328 8.6.2 *External Breadth-First Branch-and-Bound 330 8.6.3 *External Enforced Hill-Climbing 332 8.6.4 External A* 334 8.6.5 *Lower Bound for Delayed Duplicate Detection 340 8.7 *Refinements 342 8.7.1 Hash-Based Duplicate Detection 342 8.7.2 Structured Duplicate Detection 343 8.7.3 Pipelining 344 8.7.4 External Iterative-Deepening A* Search 345 8.7.5 External Explicit-State Pattern Databases 346 8.7.6 External Symbolic Pattern Databases 348 8.7.7 External Relay Search 348 8.8 *External Value Iteration 349 8.8.1 Forward Phase: State Space Generation 349 8.8.2 Backward Phase: Update of Values 349 8.9 *Flash Memory 353 8.9.1 Hashing 354 8.9.2 Mapping 354 8.9.3 Compressing 356 8.9.4 Flushing 358 x Contents 8.10 Summary 358 8.11 Exercises 361 8.12 Bibliographic Notes 364 PART III HEURISTIC SEARCH UNDER TIME CONSTRAINTS CHAPTER 9 Distributed Search 369 9.1 Parallel Processing 370 9.1.1 Motivation for Practical Parallel Search 374 9.1.2 Space Partitioning 374 9.1.3 Depth Slicing 375 9.1.4 Lock-Free Hashing 378 9.2 Parallel Depth-First Search 379 9.2.1 *Parallel Branch-and-Bound 379 9.2.2 Stack Splitting 380 9.2.3 Parallel IDA* 382 9.2.4 Asynchronous IDA* 382 9.3 Parallel Best-First Search Algorithms 385 9.3.1 Parallel Global A* 385 9.3.2 Parallel Local A* 387 9.4 Parallel External Search 388 9.4.1 Parallel External Breadth-First Search 388 9.4.2 Parallel Structured Duplicate Detection 391 9.4.3 Parallel External A* 392 9.4.4 Parallel Pattern Database Search 398 9.5 Parallel Search on the GPU 400 9.5.1 GPU Basics 401 9.5.2 GPU-Based Breadth-First Search 401 9.5.3 Bitvector GPU Search 407 9.6 Bidirectional Search 408 9.6.1 Bidirectional Front-to-End Search 409 9.6.2 *Biclirectional Front-to-Front Search 410 9.6.3 Perimeter Search 412 9.6.4 Bidirectional Symbolic Breadth-First Search 416 9.6.5 *Island Search 416 9.6.6 *Multiple-Goal Heuristic Search 418 9.7 Summary 419 9.8 Exercises 422 9.9 Bibliographic Notes 425 Contents xi CHAPTER 10 State Space Pruning 429 10.1 Admissible State Space Pruning 430 10.1.1 Substring Pruning 430 10.1.2 Pruning Dead-Ends 440 10.1.3 Penalty Tables 445 10.1.4 Symmetry Reduction 447 10.2 Nonadmissible State Space Pruning 449 10.2.1 Macro Problem Solving 449 10.2.2 Relevance Cuts 452 10.2.3 Partial Order Reduction 453 10.3 Summary 458 10.4 Exercises 460 10.5 Bibliographic Notes 463 CHAPTER 11 Real-Time Search 465 11.1 LRTA* 466 11.2 LRTA* with Lookahead One 473 11.3 Analysis of the Execution Cost of LRTA* 474 11.3.1 Upper Bound on the Execution Cost of LRTA* 476 11.3.2 Lower Bound on the Execution Cost of LRTA* 477 11.4 Features of LRTA* 479 11.4.1 Heuristic Knowledge 479 11.4.2 Fine-Grained Control 479 11.4.3 Improvement of Execution Cost 480 11.5 Variants of LRTA* 482 11.5.1 Variants with Local Search Spaces of Varying Sizes 482 11.5.2 Variants with Minimal Lookahead 482 11.5.3 Variants with Faster Value Updates 484 11.5.4 Variants That Detect Convergence 488 11.5.5 Variants That Speed Up Convergence 488 11.5.6 Nonconverging Variants 491 11.5.7 Variants for Nondeterministic and Probabilistic State Spaces 494 11.6 How to Use Real-Time Search 496 11.6.1 Case Study.