Heuristic Search
This page intentionally left blank
Heuristic Search Theory and Applications
Stefan Edelkamp ¨ Ste...
155 downloads
1476 Views
8MB Size
Report
This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
Report copyright / DMCA form
Heuristic Search
This page intentionally left blank
Heuristic Search Theory and Applications
Stefan Edelkamp ¨ Stefan Schrodl
AMSTERDAM • BOSTON • HEIDELBERG • LONDON NEW YORK • OXFORD • PARIS • SAN DIEGO SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO
Morgan Kaufmann is an imprint of Elsevier
Acquiring Editor: Rachel Roumeliotis Development Editor: David Bevans Project Manager: Sarah Binns Designer: Joanne Blank Morgan Kaufmann Publishers is an imprint of Elsevier. 225 Wyman Street, Waltham, MA 02451, USA This book is printed on acid-free paper. c 2012 Elsevier Inc. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or any information storage and retrieval system, without permission in writing from the publisher. Details on how to seek permission, further information about the Publisher’s permissions policies, and our arrangements with organizations such as the Copyright Clearance Center and the Copyright Licensing Agency can be found at our Web site: www.elsevier.com/permissions. This book and the individual contributions contained in it are protected under copyright by the Publisher (other than as may be noted herein). Notices Knowledge and best practice in this field are constantly changing. As new research and experience broaden our understanding, changes in research methods, professional practices, or medical treatment may become necessary. Practitioners and researchers must always rely on their own experience and knowledge in evaluating and using any information, methods, compounds, or experiments described herein. In using such information or methods they should be mindful of their own safety and the safety of others, including parties for whom they have a professional responsibility. To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors assume any liability for any injury and/or damage to persons or property as a matter of products liability, negligence or otherwise, or from any use or operation of any methods, products, instructions, or ideas contained in the material herein. Library of Congress Cataloging-in-Publication Data Edelkamp, Stefan. Heuristic search: theory and applications / Stefan Edelkamp, Stefan Schr¨odl. p. cm. ISBN 978-0-12-372512-7 (hardback : acid-free paper) 1. Heuristic algorithms. I. Schr¨odl, Stefan. II. Title. QA76.9.A43E34 2011 005.1’1–dc22 2011005844 British Library Cataloguing-in-Publication Data A catalogue record for this book is available from the British Library. For information on all Morgan Kaufmann publications, visit our Web site at www.mkp.com or www.elsevierdirect.com Printed in the United States of America 11 12 13 14 15 5 4 3 2 1
Contents List of Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
PART I HEURISTIC SEARCH PRIMER CHAPTER 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1 Notational and Mathematical Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.1 Pseudo Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.2 Computability Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.3 Complexity Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.4 Asymptotic Resource Consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.5 Symbolic Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Success Stories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4 State Space Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5 Problem Graph Representations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.6 Heuristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.7 Examples of Search Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.7.1 Sliding-Tile Puzzles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.7.2 Rubik’s Cube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.7.3 Sokoban . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.7.4 Route Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.7.5 TSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.7.6 Multiple Sequence Alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.8 General State Space Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.8.1 Action Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.8.2 *Production Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.8.3 Markov Decision Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.8.4 Generic Search Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.10 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.11 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3 3 3 4 5 7 8 9 9 12 14 15 19 19 22 22 24 25 26 29 29 32 35 36 37 39 45
CHAPTER 2 Basic Search Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 2.1 Uninformed Graph Search Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1 Depth-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.2 Breadth-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.3 Dijkstra’s Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
48 50 51 53
v
vi
Contents
2.2
2.3
2.4 2.5 2.6
2.1.4 Negatively Weighted Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.5 Relaxed Node Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.6 *Algorithm of Bellman-Ford . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.7 Dynamic Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Informed Optimal Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.1 A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.2 On the Optimal Efficiency of A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *General Weights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.1 Cost Algebras . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.2 Multiobjective Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
57 58 60 62 68 69 74 75 76 79 80 82 86
CHAPTER 3 *Dictionary Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 3.1 Priority Queues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.1 Bucket Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.2 Heap Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Hash Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.1 Hash Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.2 Hash Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.3 Hashing Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.4 Memory-Saving Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.5 Approximate Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Subset Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.1 Arrays and Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.2 Tries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.3 Hashing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.4 Unlimited Branching Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4 String Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.1 Suffix Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.2 Generalized Suffix Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.7 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
89 90 97 110 111 112 121 130 134 138 139 139 139 141 142 143 146 151 154 157
CHAPTER 4 Automatically Created Heuristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 4.1 4.2 4.3 4.4
Abstraction Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Valtorta’s Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *Hierarchical A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pattern Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
162 164 165 167
Contents
4.5
4.6 4.7 4.8
4.4.1 Fifteen-Puzzle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.2 Rubik’s Cube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.3 Directed Search Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.4 Korf’s Conjecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.5 Multiple Pattern Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.6 Disjoint Pattern Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *Customized Pattern Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.1 Pattern Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.2 Symmetry and Dual Pattern Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.3 Bounded Pattern Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.4 On-Demand Pattern Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.5 Compressed Pattern Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.6 Compact Pattern Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vii
168 169 170 170 172 173 177 178 179 180 183 183 185 185 187 190
PART II HEURISTIC SEARCH UNDER MEMORY CONSTRAINTS CHAPTER 5 Linear-Space Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 5.1 *Logarithmic Space Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.1 Divide-and-Conquer BFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.2 Divide-and-Conquer Shortest Paths Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Exploring the Search Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 Branch-and-Bound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4 Iterative-Deepening Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5 Iterative-Deepening A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6 Prediction of IDA* Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6.1 Asymptotic Branching Factors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6.2 IDA* Search Tree Prediction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6.3 *Convergence Criteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7 *Refined Threshold Determination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.8 *Recursive Best-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.10 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.11 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
195 196 196 197 198 201 204 206 206 212 217 218 219 220 222 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.2
6.3
6.4
6.5 6.6 6.7
6.1.3 *Iterative Threshold Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1.4 MA*, SMA, and SMAG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Nonadmissible Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.1 Enforced Hill-Climbing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.2 Weighted A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.3 Overconsistent A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.4 Anytime Repairing A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.5 k-Best-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.6 Beam Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.7 Partial A* and Partial IDA* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reduction of the Closed List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.1 Dynamic Programming in Implicit Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.2 Divide-and-Conquer Solution Reconstruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.3 Frontier Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.4 *Sparse Memory Graph Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.5 Breadth-First Heuristic Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.6 Locality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reduction of the Open List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.1 Beam-Stack Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.2 Partial Expansion A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.3 Two-Bit Breadth-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
233 235 240 240 243 244 246 250 251 251 254 255 255 257 259 261 264 266 266 270 271 273 275 279
CHAPTER 7 Symbolic Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 7.1 7.2 7.3 7.4
Boolean Encodings for Set of States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Binary Decision Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Computing the Image for a State Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Symbolic Blind Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.4.1 Symbolic Breadth-First Tree Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.4.2 Symbolic Breadth-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.4.3 Symbolic Pattern Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.4.4 Cost-Optimal Symbolic Breadth-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.4.5 Symbolic Shortest Path Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5 Limits and Possibilities of BDDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5.1 Exponential Lower Bound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5.2 Polynomial Upper Bound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.6 Symbolic Heuristic Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.6.1 Symbolic A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.6.2 Bucket Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
284 286 290 291 291 293 294 296 298 299 299 300 302 302 305
Contents
7.7
7.8 7.9 7.10 7.11
7.6.3 Symbolic Best-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.6.4 Symbolic Breadth-First Branch-and-Bound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *Refinements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.7.1 Improving the BDD Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.7.2 Partitioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Symbolic Algorithms for Explicit Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ix
307 308 309 309 310 311 311 313 317
CHAPTER 8 External Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 8.1 8.2 8.3 8.4 8.5
8.6
8.7
8.8
8.9
Virtual Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fault Tolerance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Model of Computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Basic Primitives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . External Explicit Graph Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.1 *External Priority Queues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.2 External Explicit Graph Depth-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.3 External Explicit Graph Breadth-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . External Implicit Graph Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.6.1 Delayed Duplicate Detection for BFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.6.2 *External Breadth-First Branch-and-Bound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.6.3 *External Enforced Hill-Climbing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.6.4 External A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.6.5 *Lower Bound for Delayed Duplicate Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . *Refinements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.7.1 Hash-Based Duplicate Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.7.2 Structured Duplicate Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.7.3 Pipelining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.7.4 External Iterative-Deepening A* Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.7.5 External Explicit-State Pattern Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.7.6 External Symbolic Pattern Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.7.7 External Relay Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *External Value Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.8.1 Forward Phase: State Space Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.8.2 Backward Phase: Update of Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *Flash Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.9.1 Hashing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.9.2 Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.9.3 Compressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.9.4 Flushing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
320 321 321 323 324 324 325 326 328 328 330 332 334 340 342 342 343 344 345 346 348 348 349 349 349 353 354 354 356 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.1.1 Motivation for Practical Parallel Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.1.2 Space Partitioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.1.3 Depth Slicing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.1.4 Lock-Free Hashing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2 Parallel Depth-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.1 *Parallel Branch-and-Bound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.2 Stack Splitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.3 Parallel IDA* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.4 Asynchronous IDA* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3 Parallel Best-First Search Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.1 Parallel Global A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.2 Parallel Local A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4 Parallel External Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.1 Parallel External Breadth-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.2 Parallel Structured Duplicate Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.3 Parallel External A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.4 Parallel Pattern Database Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.5 Parallel Search on the GPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.5.1 GPU Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.5.2 GPU-Based Breadth-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.5.3 Bitvector GPU Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.6 Bidirectional Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.6.1 Bidirectional Front-to-End Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.6.2 *Bidirectional Front-to-Front Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.6.3 Perimeter Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.6.4 Bidirectional Symbolic Breadth-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.6.5 *Island Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.6.6 *Multiple-Goal Heuristic Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.9 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
370 374 374 375 378 379 379 380 382 382 385 385 387 388 388 391 392 398 400 401 401 407 408 409 410 412 416 416 418 419 422 425
Contents
xi
CHAPTER 10 State Space Pruning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429 10.1 Admissible State Space Pruning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.1.1 Substring Pruning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.1.2 Pruning Dead-Ends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.1.3 Penalty Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.1.4 Symmetry Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.2 Nonadmissible State Space Pruning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.2.1 Macro Problem Solving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.2.2 Relevance Cuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.2.3 Partial Order Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.5 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
430 430 440 445 447 449 449 452 453 458 460 463
CHAPTER 11 Real-Time Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465 11.1 LRTA* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 LRTA* with Lookahead One . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3 Analysis of the Execution Cost of LRTA* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3.1 Upper Bound on the Execution Cost of LRTA* . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3.2 Lower Bound on the Execution Cost of LRTA* . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.4 Features of LRTA* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.4.1 Heuristic Knowledge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.4.2 Fine-Grained Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.4.3 Improvement of Execution Cost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.5 Variants of LRTA* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.5.1 Variants with Local Search Spaces of Varying Sizes . . . . . . . . . . . . . . . . . . . . . . . 11.5.2 Variants with Minimal Lookahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.5.3 Variants with Faster Value Updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.5.4 Variants That Detect Convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.5.5 Variants That Speed Up Convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.5.6 Nonconverging Variants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.5.7 Variants for Nondeterministic and Probabilistic State Spaces . . . . . . . . . . . . . . 11.6 How to Use Real-Time Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.6.1 Case Study: Off line Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.6.2 Case Study: Goal-Directed Navigation in Unknown Terrain . . . . . . . . . . . . . . . 11.6.3 Case Study: Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.6.4 Case Study: Localization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.9 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
466 473 474 476 477 479 479 479 480 482 482 482 484 488 488 491 494 496 496 497 500 501 507 509 514
xii
Contents
PART IV HEURISTIC SEARCH VARIANTS CHAPTER 12 Adversary Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519 12.1 Two-Player Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.1 Game Tree Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.2 αβ-Pruning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.3 Transposition Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.4 *Searching with Restricted Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.5 Accumulated Evaluations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.6 *Partition Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.7 *Other Improvement Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.8 Learning Evaluation Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.9 Retrograde Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.10 *Symbolic Retrograde Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.2 *Multiplayer Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.3 General Game Playing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.4 AND/OR Graph Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.4.1 AO* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.4.2 *IDAO* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.4.3 *LAO* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.7 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
520 524 525 530 530 534 535 537 538 543 544 547 550 552 554 554 557 559 563 567
CHAPTER 13 Constraint Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571 13.1 Constraint Satisfaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.2 Consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.2.1 Arc Consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.2.2 Bounds Consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.2.3 *Path Consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.2.4 Specialized Consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.3 Search Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.3.1 Backtracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.3.2 Backjumping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.3.3 Dynamic Backtracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.3.4 Backmarking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.3.5 Search Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.4 NP-Hard Problem Solving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.4.1 Boolean Satisfiability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.4.2 Number Partition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
572 575 575 577 578 579 580 581 583 584 585 587 591 592 596
Contents
13.4.3 *Bin Packing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.4.4 *Rectangle Packing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.4.5 *Vertex Cover, Independent Set, Clique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.4.6 *Graph Partition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.5 Temporal Constraint Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.5.1 Simple Temporal Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.5.2 *PERT Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.6 *Path Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.6.1 Formula Progression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.6.2 Automata Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.7 *Soft and Preference Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.8 *Constraint Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.10 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.11 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xiii
598 601 604 606 609 609 611 612 614 615 617 618 619 623 629
CHAPTER 14 Selective Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633 14.1 14.2 14.3 14.4 14.5
From State Space Search to Minimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Hill-Climbing Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Simulated Annealing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Tabu Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Evolutionary Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.5.1 Randomized Local Search and (1 + 1) EA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.5.2 Simple GA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.5.3 Insights to Genetic Algorithm Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.6 Approximate Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.6.1 Approximating TSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.6.2 Approximating MAX-k-SAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.7 Randomized Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.8 Ant Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.8.1 Simple Ant System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.8.2 Algorithm Flood . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.8.3 Vertex Ant Walk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.9 *Lagrange Multipliers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.9.1 Saddle-Point Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.9.2 Partitioned Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.10 *No-Free-Lunch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.11 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.12 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.13 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
634 635 637 638 639 639 641 643 645 646 646 647 652 652 654 654 657 658 661 662 662 664 668
xiv
Contents
PART V HEURISTIC SEARCH APPLICATIONS CHAPTER 15 Action Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673 15.1 Optimal Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.1.1 Graphplan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.1.2 Satplan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.1.3 Dynamic Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.1.4 Planning Pattern Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.2 Suboptimal Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.2.1 Causal Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.2.2 Metric Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.2.3 Temporal Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.2.4 Derived Predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.2.5 Timed Initial Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.2.6 State Trajectory Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.2.7 Preference Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.3 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
675 675 677 678 680 685 685 687 691 695 696 696 697 697
CHAPTER 16 Automated System Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701 16.1 Model Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.1.1 Temporal Logics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.1.2 The Role of Heuristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.2 Communication Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.2.1 Formula-Based Heuristic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.2.2 Activeness Heuristic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.2.3 Trail-Directed Heuristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.2.4 Liveness Model Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.2.5 Planning Heuristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.3 Program Model Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.4 Analyzing Petri Nets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.5 Exploring Real-Time Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.5.1 Timed Automata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.5.2 Linearly Priced Timed Automata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.5.3 Traversal Politics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.6 Analyzing Graph Transition Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.7 Anomalies in Knowledge Bases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.8 Diagnosis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.8.1 General Diagnostic Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.8.2 Symbolic Propagation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
702 702 703 705 705 707 709 710 710 713 717 721 721 722 723 723 726 727 728 729
Contents
16.9 Automated Theorem Proving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.9.1 Heuristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.9.2 Functional A* Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.10 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xv
730 732 733 734
CHAPTER 17 Vehicle Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737 17.1 Components of Route Guidance Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.1.1 Generation and Preprocessing of Digital Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.1.2 Positioning Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.1.3 Map Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.1.4 Geocoding and Reverse Geocoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.1.5 User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.2 Routing Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.2.1 Heuristics for Route Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.2.2 Time-Dependent Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.2.3 Stochastic Time-Dependent Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.3 Cutting Corners . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.3.1 Geometric Container Pruning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.3.2 Localizing A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.4 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
737 737 739 741 744 744 744 745 746 747 749 749 752 756
CHAPTER 18 Computational Biology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 759 18.1 Biological Pathway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.2 Multiple Sequence Alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.2.1 Bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.2.2 Iterative-Deepening Dynamic Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.2.3 Main Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.2.4 Sparse Representation of Solution Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.2.5 Use of Improved Heuristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.3 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
759 760 763 763 764 767 769 771
CHAPTER 19 Robotics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773 19.1 19.2 19.3 19.4 19.5
Search Spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Search under Incomplete Knowledge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fundamental Robot-Navigation Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Search Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Search Approaches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.5.1 Optimal Off line Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.5.2 Greedy On line Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
773 777 778 780 781 782 784
xvi
Contents
19.6 19.7 19.8 19.9
Greedy Localization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Greedy Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Search with the Freespace Assumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
786 787 789 791
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 793 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 825
List of Algorithms 1.1 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 3.20 3.21 3.22 3.23 3.24 3.25 3.26
Computing the approximation of the relaxed planning heuristic . . . . . . . . . . . . . . . . . . . . . . . . . . . . Skeleton of search algorithms in implicitly given graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Tracing back the solution path using predecessor links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Improve procedure with duplicate detection and predecessor links . . . . . . . . . . . . . . . . . . . . . . . . . Choosing path to v through minimum of f (v) and f (u) + w(u, v) . . . . . . . . . . . . . . . . . . . . . . . . . . . . An update routine that copes with negative edge weights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Relaxing the node expansion order in Algorithm A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Edge relaxation for implicit version of Bellman and Ford’s algorithm . . . . . . . . . . . . . . . . . . . . . . Bellman-Ford algorithm in an implicit graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Floyd-Warshall algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pairwise sequence alignment with dynamic programming in column order . . . . . . . . . . . . . . . . Policy iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Value iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Initializing a 1-Level Bucket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Inserting an element into a 1-Level Bucket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Deleting the minimum element in a 1-Level Bucket. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Updating the key in a 1-Level Bucket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Creating a Radix Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Inserting an element into a Radix Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Inserting an element into a Radix Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Delete the minimum from a Radix Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Finding the successor in a Van Emde Boas Priority Queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Inserting an element in a Van Emde Boas Priority Queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Deleting an element from a Van Emde Boas Priority Queue. . . . . . . . . . . . . . . . . . . . . . . . . . . . . Inserting an element into a Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Decreasing the key of an element in a Heap. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Extracting the minimum element from a Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Rearrange Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Rearrange Pairing Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Implementation of different subroutines for Weak Heaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Restoration of Weak Heaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Extracting the minimum element from a Weak Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Inserting an element into a Weak Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Decreasing the key of an element in a Weak Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Consolidation with bitvectors and heuristic factor in a Fibonacci Heap . . . . . . . . . . . . . . . . . . . Reducing number of markings in a Relaxed Weak Queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Algorithm of Rabin and Karp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Rank operation for permutations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Unrank operation for permutations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34 49 50 50 54 57 59 61 62 63 64 67 68 70 91 91 91 92 94 94 94 95 96 97 97 99 99 100 100 101 103 103 104 104 105 106 110 114 119 120
xvii
xviii
3.27 3.28 3.29 3.30 3.31 3.32 3.33 3.34 3.35 3.36 3.37 3.38 3.39 3.40 3.41 3.42 3.43 3.44 4.1 4.2 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 6.10 6.11 6.12 6.13 6.14 6.15 6.16
List of Algorithms
Recursion-free unranking and signature computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Recursion-free ranking operation for permutations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Searching a chained hash table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Inserting an element into a chained hash table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Deleting an element from a chained hash table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Searching an element in an open hash table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Inserting an element into an open hash table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Deleting an element from an open hash table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Inserting an element for ordered hashing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Lookup for a key in a cuckoo hash table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Inserting a key into a cuckoo hash table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Searching a Trie for a partial match . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Searching a hash table for a partial match . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Inserting a set in an Unlimited Branching Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Searching for subsets in an Unlimited Branching Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Algorithm to construct a Suffix Tree in linear time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Insertion of one suffix in a Generalized Suffix Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Deleting a string in a Generalized Suffix Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Construction of pattern database using a backward search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pattern database construction in directed and weighted problem graphs . . . . . . . . . . . . . . . . . . . . Computing the BFS level with logarithmic space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Searching the shortest paths with logarithmic space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Depth-first branch-and-bound algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Depth-first branch-and-bound subroutine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Depth-first iterative-deepening algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DFS subroutine for DFID search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Driver loop for IDA* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The IDA* algorithm (no duplicate detection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The RBFS algorithm, implemented recursively . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . IDA* driver with transposition table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . IDA* with transposition table and cost revision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fringe search algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Algorithm ITS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pruning nodes in ITS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Procedure SMAG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Update procedure in SMAG for newly generated nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Deleting unpromising nodes in SMAG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Backing up heuristic values in SMAG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Recursive deletion of unused Closed nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Enforced hill-climbing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . BFS searching for a better state v . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A* search with i-values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A* with an arbitrary overconsistent initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Subroutine for anytime repairing A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Main function of anytime repairing A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
120 122 122 122 123 124 125 125 125 128 130 140 140 142 142 145 149 150 168 171 196 197 199 200 202 202 204 205 220 230 230 232 234 235 237 238 239 239 239 241 241 245 246 248 248
List of Algorithms
6.17 6.18 6.19 6.20 6.21 6.22 6.23 6.24 6.25 6.26 6.27 6.28 6.29 6.30 6.31 6.32 6.33 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 7.10 7.11 7.12 7.13 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9.1 9.2 9.3 9.4 9.5 9.6
Algorithm k-best-first search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Algorithm k-beam search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A* search with (single) bit-state hashing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial IDA* search with (single) bit-state hashing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Dynamic programming search algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Edge relaxation step in dynamic programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Solution reconstruction in sparse-memory graph search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Improve procedure for SMGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pruning the list of expanded nodes in SMGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Breadth-first heuristic search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Update of a problem graph edge in Algorithm 6.26 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The beam-stack search algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Algorithm PEA* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Update procedure in PEA* for newly generated nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Breadth-first search with two bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Extended IDA* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Traversing the search space with one bit per state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . BDD arithmetics via fixpoint computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Symbolic breadth-first tree search implemented with BDDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Symbolic BFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Symbolic pattern database construction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Cost-optimal symbolic BFS algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Dijkstra’s algorithm implemented with BDDs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A* implemented with BDDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Symbolic A* in a bucket implementation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Greedy best-first search implemented with BDDs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Symbolic breadth-first branch-and-bound with buckets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Relational product algorithm to compute the image of a state set . . . . . . . . . . . . . . . . . . . . . . . . . . . Dijkstra’s algorithm on buckets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Shortest path A* algorithm on buckets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . External BFS by Munagala and Ranade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Delayed duplicate detection algorithm for BFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . File subtraction for external duplicate elimination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . External breadth-first branch-and-bound. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Main routine for external enforced hill-climbing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . External BFS searching for a better state v . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . External A* for consistent and integral heuristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . External value iteration algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . External value iteration—backward update. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Algorithm to compute a1 + · · · + an in parallel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Algorithm to compute all prefix sums in parallel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Transposition-driven scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The depth-slicing parallelization method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Searching and inserting an element in a lock-free hash table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Parallel branch-and-bound with global synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xix
250 252 253 254 256 256 260 261 261 263 264 269 271 272 272 276 279 290 292 293 295 297 299 303 306 307 308 314 316 316 327 329 330 331 333 333 338 350 352 372 373 376 377 379 380
xx
9.7 9.8 9.9 9.10 9.11 9.12 9.13 9.14 9.15 9.16 10.1 10.2 10.3 10.4 10.5 11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 12.1 12.2 12.3 12.4 12.5 12.6 12.7 12.8 12.9 12.10 12.11 12.12 12.13 12.14 12.15 12.16 12.17 12.18 12.19 12.20
List of Algorithms
Parallel DFS with stack splitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Parallel IDA* with global synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Distributing IDA* with respect to different search thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Parallel external breadth-first search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Parallel external A* for consistent and integral heuristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Large-scale breadth-first search on the GPU. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Expanding a layer on the GPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Detecting duplicates via sorting on the GPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bidirectional search with BHPA. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bidirectional BFS implemented with BDDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Computation of failure function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Incremental learning of duplicates in A* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bottom-up propagation in the search decomposition tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The decomposition and bottom-up propagation algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . An algorithm for checking ample sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . LRTA* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Value-update step of LRTA*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . LRTA* with lookahead one. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Min-LRTA* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . RTAA* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Variant of LRTA* (1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . FALCONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Variant of LRTA* (2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Variant of LRTA* (3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The negmax game tree labeling procedure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Minimax game tree search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . αβ negmax game tree pruning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Minimax game tree search with αβ-pruning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Negmax game tree search with αβ-pruning and transposition table . . . . . . . . . . . . . . . . . . . . . . . . . Principal-variation search in negmax formulation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . MTD algorithm framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The minimax game tree search procedure for accumulated node evaluations . . . . . . . . . . . . . . Partition search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . One iteration in the UCT algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Temporal difference learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Q-learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Calculating the set of reachable positions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The αβ-branch-and-bound algorithm for multiplayer games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The AO* search algorithm for AND/OR trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The AO* search algorithm for stochastic shortest path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The IDAO* search algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The IDAO*-DFS search subroutine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The LAO* algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
381 383 383 390 396 403 404 404 410 417 437 439 443 444 455 471 472 474 482 485 489 490 513 514 525 525 527 528 531 532 533 535 536 539 541 543 546 547 550 555 556 556 557 558
List of Algorithms
13.1 13.2 13.3 13.4 13.5 13.6 13.7 13.8 13.9 13.10 13.11 13.12 13.13 13.14 13.15 13.16 13.17 13.18 13.19 13.20 14.1 14.2 14.3 14.4 14.5 14.6 14.7 14.8 14.9 14.10 14.11 14.12 14.13 14.14 14.15 14.16 14.17 15.1 15.2 15.3 15.4 15.5 16.1 16.2
Simple consistency algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Arc consistency with AC-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Arc consistency with AC-8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Algorithm for path consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Backtracking search algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pure backtracking search algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Backjumping search algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Simple consistency for backjumping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Backmarking search algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . One iteration in limited discrepancy search. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . One iteration in improved limited discrepancy search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Depth-bounded discrepancy search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Algorithm of Davis-Putnam and Logmann-Loveland . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Computing strong and weak backdoors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Recursive computation of feasible sets for bin completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Minimal network computation in simple temporal network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Computing the critical path with PERT scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Formula progression algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . LTL path constraint solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . BDD construction algorithm for linear and bound arithmetic constraint . . . . . . . . . . . . . . . . . . . . Hill-climbing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Simulated annealing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Tabu search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Randomized tabu search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Randomized local search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Randomized (1 + 1) EA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Simple GA on solution strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Deterministic approximation algorithm for MAX-k-SAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Monien-Speckenmeyer algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Algorithm of Paturi, Pudla´ k, and Zane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Hamming sphere algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Algorithm random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The ant system algorithm for solving TSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Flood algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Vertex ant walk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Saddle-point iteration method for finding a CLM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Lagrangian method for finding a CLM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Max-atom heuristic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Approximation of a plan with causal graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Plan graph construction for numerical relaxed planning heuristic . . . . . . . . . . . . . . . . . . . . . . . . . . . Extraction of a numerical relaxed plan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fixpoint for applying a set of rules to a planning state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The unification algorithm for first-order logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Resolution refutation procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xxi
575 576 577 580 582 582 584 585 587 589 590 592 594 596 600 611 612 614 615 628 635 637 638 639 640 641 643 647 648 648 649 651 653 655 655 660 662 679 688 691 692 696 731 731
xxii
16.3 17.1 17.2 17.3 17.4 18.1 18.2 18.3 18.4 18.5 18.6
List of Algorithms
Functional implementation of the A* algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Creating shortest path containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bounding-box graph search algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Access operations on Heap of Heaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Maintenance of active heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Iterative-deepening dynamic programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Edge expansion in IDDP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Edge relaxation step for IDDP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Recursive deletion of edges that are no longer part of any solution path. . . . . . . . . . . . . . . . . . . . Divide-and-conquer solution reconstruction in reverse order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sparsification of Closed list under restricted memory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
734 750 751 753 754 765 765 766 766 767 768
Preface This book is intended to serve as a comprehensive introduction to artificial intelligence (AI) heuristic state space search. It includes many developments that are not yet covered by any textbook, including pattern databases, symbolic search, search with efficient use of external memory, and parallel processing units. Thus, the book is suitable for readers who do not yet have a background in search and are looking for a good introduction to the field, as well as for readers who do have some background in search and are interested in reading up on the latest developments in the field. It serves as a unique reference to the large body of research and provides many pointers to the literature. The book is intended to strike a balance between search algorithms and their theoretical analysis on one hand, and their efficient implementation and application to important real-world problems on the other hand. It is intended to cover the field comprehensively, from well-known basic results to recent proposals that push the state of the art. The book supplements broad textbooks on AI and, more importantly, serves as a primary textbook for more advanced AI classes on search. It discusses search applications in a variety of subfields of AI, including puzzle solving, game playing, constraint satisfaction, action planning, and robotics. However, the book is also suitable for self-study and provides a valuable source of information for graduate students, researchers, and practitioners in a variety of decision sciences (including AI and operations research), as well as application programmers who need to use search algorithms to solve their problems. The book is relatively self-contained. In particular, we do not require the readers to have any prior knowledge of AI. Instead, we assume the reader to have basic knowledge of algorithms, data structures, and calculus. It uses examples to introduce the search algorithms and motivate their properties. The text often contains proofs of the correctness and other properties of search algorithms to give it formal rigor and introduces the readers to important proof techniques. (This aspect of the book is especially important for graduate students and researchers.) The presented material also teaches how to implement search algorithms. It includes pseudo code to avoid the typical problems that practitioners (or students) have with converting ideas into running programs if textbooks describe algorithms only verbally or do not explicitly discuss implementation details. The book discusses how to implement the data structures needed to run the search algorithms, from very simple but somewhat slow implementations to highly sophisticated and extremely fast implementations. Moreover, the book includes exercises that can be used either as homework exercises in classes or as self-tests. This text gives the readers a feeling for when to use which search algorithm. For example, it discusses the time and space complexities of search algorithms and which properties make some of them well suited for a given search problem and others less suited for the same search problem. Finally, it provides case studies that show how search algorithms can be applied to a large variety of problems from different application areas. Thus, it contains cookbook solutions for a variety of important real-world problems, demonstrates the impact that search techniques already have in practice, and gives the reader a feeling for the amount of work that is needed to adapt search algorithms to specific applications. (This aspect of the book is especially important for practitioners.) The book is divided into five main parts: Heuristic Search Primer (I), Heuristic Search Under Memory Constraints (II), Heuristic Search Under Time Constraints (III), Heuristic Search Variants (IV),
xxiii
xxiv
Preface
and Heuristic Search Applications (V). Part I introduces basic problems, algorithms, and heuristics. Parts II and III address refined solutions in the context of existing resource limitations in time and space. Part II considers memory-limited, symbolic, and disk-based search, and Part III addresses parallel search, various pruning techniques, and move-committing search strategies. Part IV attacks related search methods that apply more general notions of search heuristics, including game evaluations, constraint satisfaction, as well as local search approaches. Part V is dedicated to different real-world application areas and shows how the concepts of the first four parts have been turned into rather complex search engines. We address application areas traditionally closer to AI, such as action planning and robotics, and other areas not originating in AI, such as vehicle navigation, computational biology, and automated system verification. You will notice some sections preceded by an asterisk; the asterisks in front of chapter and section headings indicate advanced material that can be skipped in a first reading of the book.
PART
Heuristic Search Primer
I
This page intentionally left blank
CHAPTER
Introduction
1
In this book, we study the theory and the applications of heuristic search algorithms. The general model is the guided exploration in a space of states. After providing some mathematical and notational background and motivating the impact of search algorithms by reflecting several success stories, we introduce different state space formalisms. Next we provide examples of single-agent puzzles such as the (n2 − 1)-Puzzle and extensions to it, the Rubik’s Cube, as well as Sokoban problems. Furthermore, the practically important application areas of Route Planning and Multiple Sequence Alignment are introduced. The former is fundamental to vehicle navigation and the latter is fundamental to computational biology. In the TSP we consider the computation of round trips. For each of the domains, we introduce heuristic evaluation functions as a means to accelerate the search. We motivate them graphically and formalize them. We define properties of heuristics, such as consistency and admissibility, and how they are related. Moreover, we define the general descriptive schemes of production systems, Markov decision process problems, and action planning. For the case of a production system, we will see that general state space problem solving is in fact undecidable. For the case of action planning, we will see how to derive some problem-independent heuristics.
1.1 NOTATIONAL AND MATHEMATICAL BACKGROUND Algorithms are specifications of action sequences, similar to recipes for cooking. The description should be concrete enough to cook a tasteful meal. On the other hand, some abstraction is necessary to keep the presentation readable; we don’t teach the cook how to dice onions. In presenting algorithms in computer science, the situation is similar. The presentation should be concrete enough to allow analysis and reimplementation, but abstract enough to be ported on different programming languages and machines.
1.1.1 Pseudo Code A program representation in a fictitious, partly abstract programming language is called pseudo code. However, its intention is to give a high-level description of an algorithm to a human, not to a machine. Therefore, irrelevant details (e.g., memory management code) are usually omitted, and sometimes natural language is used when convenient. Most programs consist of assignments (←), selection (e.g., branching based on if conditions), and iteration (e.g., while loops). Subroutine calls are important to structure the program and to implement
3
4
CHAPTER 1 Introduction
recursion, and are shown in italics. In the pseudo code implementations, we use the following constructs. if (hconditioni) hbodyi else halternativei Branching of the program based on the case selected in the Boolean predicate condition. and, or, not Logical operation on Boolean conditions. while (hconditioni) hbodyi Loop to be checked prior to the execution of its body. do hbodyi while (hconditioni) Loop to be checked after the execution of its body. for each helementi in hSeti Variable element iterates on the (often ordered) set Set. return Backtrack to calling procedure with result. Conditional and loop constructs introduce compound statements; that is, the parts of the statements constitute lists of statements (blocks) themselves. To clarify the hierarchical structure of the program, sometimes explicit begin and end statements are given. Different from this convention, in this book, in the interest of succinctness we chose to rely solely on indentation. For example, in the following fragment, note the end of the block that is executed in case the condition evaluates to false: if (hconditioni) hif-true-statement 1i hif-true-statement 2i ... else hif-false-statement 1i hif-false-statement 2i ... hafter-if-statement 1i ... For easier understanding, each line in the pseudo code is annotated with some short comments, separated from the program code by a double semicolon.
1.1.2 Computability Theory Computability theory is the branch of theoretical computer science that studies which problems are computationally solvable using different computation models. Computability theory differs from the related discipline of computational complexity theory (see next section) in asking whether a problem can be solved at all, given any finite but arbitrarily large amount of resources. A common model of computation is based on an abstract machine, the Turing machine (see Fig. 1.1). The computational model is very simple and assumes a computer M in the form of a 7-tuple M = (Q, 6, 0, δ, B, F, q0 ), with state set Q, input alphabet 6, tape alphabet 0, transition function δ : Q × 0 → Q × 0 × {L, R, N}, blank symbol B, final state set F, and head position q0 .
1.1 Notational and Mathematical Background
M = (Q, Σ, Γ, δ, B, F, q0)
1
0
1
0
Q State 0
1
0
5
δ : Q × Γ → Q × Γ × { L, R, N } Program 0
1 B
FIGURE 1.1 A Turing machine.
The machine takes some input word (w1 , . . . , wn ) over the alphabet 6 and assumes that it is already located on the tape at position 1, . . . , n. The initial head position is 1. The process of computation terminates, if some final state in F is reached. The state transition function δ sets the new state in Q, which can be interpreted as performing on step in the program that is run on the Turing machine. Then a character is written on the tape at the current head position. Depending on the value in {L, R, N} the head is moved to the left (L), to the right (R), or remains unchanged (N), respectively. The output of the computation is the content of the tape after termination. The machine solves a decision problem when for an input string, it produces a binary output signifying “yes” or “no.” A problem is decidable if a Turing machine exists that always gives an answer in finite time. Since the time of Turing, many other formalisms for describing effective computability have been proposed, including recursive functions, the lambda calculus, register machines, Post systems, combinatorial logic, and Markov algorithms. The computational equivalence of all these systems corroborates the validity of the Church-Turing thesis: Every function that would naturally be regarded as computable can be computed by a Turing machine. A recursively enumerable set S is a set such that a Turing machine exists that successively outputs all of its members. An equivalent condition is that we can specify an algorithm that always terminates and answers “yes” if the input is in S; if the input is not in S, computation might not halt at all. Therefore, recursively enumerable sets are also called semi-decidable. A function f (x) is computable if the set of all input–output pairs is recursively enumerable. Decision problems are often considered because an arbitrary problem can always be reduced to a decision problem, by enumerating possible pairs of domain and range elements and asking, “Is this the correct output?”
1.1.3 Complexity Theory Complexity theory is part of the theory of computation dealing with the resources required during computation to solve a given problem, predominantly time (how many steps it takes to solve a problem) and space (how much memory it takes). Complexity theory differs from computability theory, which deals with whether a problem can be solved at all, regardless of the resources required. The class of algorithms that need space s(n), for some function s(n), is denoted by the class DSPACE(s(n)); and those that use time t(n) is denoted by DTIME(t(n)). The problem class P consists of all problems that can be solved in polynomial time; that is, it is the union of complexity classes DTIME(t(n)), for all polynomials t(n). A nondeterministic Turing machine is a (nonrealizable) generalization of the standard deterministic Turing machine of which the transition rules can allow more than one successor configuration, and all
6
CHAPTER 1 Introduction
these alternatives can be explored in parallel (another way of thinking of this is by means of an oracle suggesting the correct branches). The corresponding complexity classes for nondeterministic Turing machines are called NSPACE(s(n)) and NTIME(s(n)). The complexity class NP (for nondeterministic polynomial) is the union of classes NTIME(t(n)), for all polynomials t(n). Note that a deterministic Turing machine might not be able to compute the solution for a problem in NP in polynomial time, however, it can verify it efficiently if it is given enough information (a.k.a. certificate) about the solution (besides the answer “yes” or “no”). Both P and NP are contained in the class PSPACE, which is the union of DSPACE(s(n)) for any polynomial function s(n); PSPACE doesn’t impose any restriction on the required time. A problem S is hard for a class C if all other problems S0 ∈ C are polynomially reducible to C; this means that there is a polynomial algorithm to transform the input x0 of S0 to an input x to S, such that the answer for S applied to x is “yes” if and only if the answer for S0 applied to x0 is “yes.” A problem S is complete for a class C if it is a member of C and it is hard for C. One of the big challenges in computer science is to prove that P 6= NP. To refute this conjecture, it would suffice to devise a deterministic polynomial algorithm for some NP-complete problem. However, most people believe that this is not possible. Figure 1.2 graphically depicts the relations between the mentioned complexity classes. Although the model of a Turing machine seems quite restrictive, other, more realistic models, such as random access machines, can be simulated with polynomial overhead. Therefore, for merely deciding if an algorithm is efficient or not (i.e., it inherits at most a polynomial time or at least an exponential time algorithm), complexity classes based on Turing machines are sufficiently expressive. Only when considering hierarchical and parallel algorithms will we encounter situations where this model is no longer adequate.
PSPACE NP
P
FIGURE 1.2 Assumed inclusion relation of some complexity classes.
NPcomplete
1.1 Notational and Mathematical Background
7
1.1.4 Asymptotic Resource Consumption In the previous section, we had a quite crude view on complexity classes, distinguishing merely between polynomial and more than polynomial complexity. While the actual degree of the polynomial can be preeminently important for practical applications (a “polynomial” algorithm might still not be practically feasible), exponential complexity cannot be deemed efficient because multiple resources are needed to increase the input size. Suppose the two functions f1 (n) = 100, 000 + n and f2 (n) = 8n2 describe the time or space used by two different algorithms for an input of size n. How do we determine which algorithm to use? Although f2 is certainly better for small n, for large inputs its complexity will increase much more quickly. The constant factors depend only on the particular machine used, the programming language, and such, whereas the order of growth will be transferable. The big-oh notation aims at capturing this asymptotic behavior. If we can find a bound c for the ratio f1 (n)/f2 (n), we write f1 (n) = O( f2 (n)). More precisely, the expression f1 (n) = O( f2 (n)) is defined that there exist two constants n0 and c such that for all n ≥ n0 we have f1 (n) ≤ c · f2 (n). With the previous example we could say that f1 ∈ O(n) and f2 = O(n2 ). The little-oh notation constitutes an even stricter condition: If the ratio approaches zero in the limit, we write f1 (n) ∈ o( f2 (n)). The formal condition is that there exists an n0 such that for all n ≥ n0 , we have f1 (n) ≤ c · f2 (n), for each c > 0. Analogously, we can define lower bounds: f1 (n) = ω( f2 (n)) and f1 (n) = ( f2 (n)), by changing the ≤ in the definition by ≥, and < by >. Finally, we have f1 (n) = 2( f2 (n)) if both f1 = O( f2 (n)) and f1 (n) = (g(n)) hold. Some common complexity classes are constant complexity (O(1)), logarithmic complexity (O(lg n)), linear complexity (O(n)), polynomial complexity (O(nk ), for some fixed value of k and exponential complexity (e.g., O(2n )). For refined analysis we briefly review the basics on amortized complexity. The main idea is to pay more for cheaper operations and use the savings to cover the more expensive ones. Amortized complexity analysis distinguishes between tl , the real cost for operation l; 8l , the potential after execution operation l; and al , the amortized costs for operation l. We have al = tl + 8l − 8l−1 and 80 = 0, m X l=1
al =
m X
tl + 8l − 8l−1 =
m X
tl − 80 + 8m
l=1
l=1
and m X l=1
tl =
m X l=1
al + 80 − 8m ≤
m X
al ,
l=1
so that the sum of the real costs can be bounded by the sum of the amortized costs. To ease the representation of the exponential algorithms, we abstract from polynomial factors. For two polynomials p and q and any constant > 0, we have that O( p(n)2q(n) ) = O((2 + )q(n) ). Therefore, we introduce the following notation: . f (n) = g(n) ⇔ f and g differ by polynomial factors only ⇔ ∃q(n) with g(n)/q(n) ≤ f (n) ≤ g(n)q(n).
8
CHAPTER 1 Introduction
1.1.5 Symbolic Logic Formal logic is a powerful and universal representation formalism in computer science, and also in this book we cannot completely get around it. Propositional logic is defined over a domain of discourse of allowed predicate symbols, P. An atom is an occurrence of a predicate. A literal is either an atom p or the negation of an atom, ¬p. A propositional formula is recursively defined as an atom or a compound formula, obtained from connecting simpler formulas using the connectives ∧ (and), ∨ (or), ¬ (not), → (if-then), ⇔ (equivalent), and ⊕ (exclusive-or). While the syntax governs the construction of well-formed formulas, the semantics determine their meaning. An interpretation maps each atom to either true or false (sometimes these values are given as 0 and 1). Atoms can be associated with propositional statements such as “the sun is shining.” In compositional logic, the truth of a compound formula is completely determined by its components and its connectors. The following truth table specifies the relations. For example, if p is true in an interpretation I, and q is false, then p ∧ q is false in I. p 0 0 1 1
q 0 1 0 1
¬p 0 0 1 1
p∧q 0 0 0 1
p∨q 0 1 1 1
p→q 1 1 0 1
p⇔q 1 0 0 1
p⊕q 0 1 1 0
A propositional formula F is satisfiable or consistent if it is true in some interpretation I; in this case, I is called a model of F. It is a tautology (or valid) if it is true in every interpretation (e.g., p ∨ ¬p). A formula G is implied by F if G is true in all models of F. Propositional formulas can always be equivalently rewritten either in disjunctive normal form (i.e., as a disjunction of conjunctions over atoms) or in conjunctive normal form (i.e., as a conjunction of disjunctions over atoms). First-order predicate logic is a generalization of propositional logic that permits the formulation of quantified statements such as “there is at least one X such that . . .” or “for any X, it is the case that. . ..” The domain of discourse now also contains variables, constants, and functions. Each predicate or function symbol is assigned an arity, the number of arguments. A term is defined inductively as a variable and a constant, or has the form f (t1 , . . . , tk ), where f is a function of arity k, and the ti are terms. An atom is a well-formed formula of the form p(t1 , . . . , tk ), where p is a predicate of arity k and the ti are terms. First-order predicate logic expressions can contain the quantifiers ∀ (read “for all”) and ∃ (read “exists”). Compound formulas can be constructed as in propositional logic from atoms and connectors; in addition, if F is a well-formed formula, then ∃xF and ∀xF are as well, if x is a variable symbol. The scope of these quantifiers is F. If a variable x occurs in the scope of a quantifier, it is bound, otherwise it is free. In first-order logic, sentences are built up from terms and atoms, where a term is a constant symbol, a variable symbol, or a function of n terms. For example, x and f (x1 , . . . , xn ) are terms, where each xi is a term. Hence, a sentence is an atom, or, if P is a sentence and x is a variable, then (∀x)P and (∃x)P are sentences. A well-formed formula is a sentence containing no free variables. For example, (∀x)P(x, y) has x bound as a universally quantified variable, but y is free. An interpretation I for predicate logic comprises the set of all possible objects in the domain, called the universe U. It evaluates constants, free variables, and terms with some of these objects. For a bound variable, the formula ∃xF is true if there is some object o ∈ U such that F is true if all occurrences of
1.3 Success Stories
9
x in F are interpreted as o. The formula ∀xF is true under I if F is for each possible substitution of an object in U for x. A deductive system consists of a set of axioms (valid formulas) and inference rules that transform valid formulas into other ones. A classic example of an inference is modus ponens: If F is true, and F → G is true, then also G is true. Other inference rules are universal elimination: If (∀x)P(x) is true, then P(c) is true, where c is constant in the domain of x; existential introduction: If P(c) is true, then (∃x)P(x) is inferred; or existential elimination: From (∃x)P(x) infer P(c), with c brand new. A deductive system is correct if all derivable formulas are valid; on the other hand, it is complete if each valid formula can be derived. Go¨ del proved that first-order predicate logic is not decidable; that is, no algorithm exists that, given a formula as input, always terminates and states whether it is valid or not. However, first-order predicate logic is recursively enumerable: algorithms can be guaranteed to terminate in case the input is valid indeed.
1.2 SEARCH We all search. The first one searches for clothes in the wardrobe, the second one for an appropriate television channel. Forgetful people have to search a little more. A soccer player searches for an opportunity to score a goal. The main restlessness of human beings is to search for the purpose of life. The term search in research relates the process of finding solutions to yet unsolved problems. In computer science research, the word search is used almost as generally as in the human context: Every algorithm searches for the completion of a given task. The process of problem solving can often be modeled as a search in a state space starting from some given initial state with rules describing how to transform one state into another. They have to be applied over and over again to eventually satisfy some goal condition. In the common case, we aim at the best one of such paths, often in terms of path length or path cost. Search has been an important part of artificial intelligence (AI) since its very beginning, as the core technique for problem solving. Many important applications of search algorithms have emerged since then, including ones in action and route planning, robotics, software and hardware verification, theorem proving, and computational biology. In many areas of computer science, heuristics are viewed as practical rules of thumb. In AI search, however, heuristics are well-defined mappings of states to numbers. There are different types of search heuristics. This book mainly focuses on one particular class, which provides an estimate of the remaining distance or cost to the goal. We start from this definition. There are other classes of search heuristics that we will touch, but with less emphasis. For example, in game tree or in local search, heuristics are estimates of the value of a particular (game) state and not giving an estimate of the distance or cost to the goal state. Instead, such search heuristics provide an evaluation for how good a state is. Other examples are variable and value ordering heuristics for constraint search that are not estimates of the distance to a goal.
1.3 SUCCESS STORIES Refined search algorithms impress with recent successes. In the area of single-player games, they have led to the first optimal solutions for challenging instances of Sokoban, the Rubik’s Cube, the
10
CHAPTER 1 Introduction
(n2 − 1)-Puzzle, and the Towers-of-Hanoi problem, all with a state space of about or more than a quintillion (a billion times a billion) of states. Even when processing a million states per second, naively looking at all states corresponds to about 300,000 years. Despite the reductions obtained, time and space remain crucial computational resources. In extreme cases, weeks of computation time, gigabytes of main memory, and terabytes of hard disk space have been invested to solve these search challenges. In Rubik’s Cube, with a state space of 43,252,003,274,489,856,000 states, first random problems have been solved optimally by a general-purpose strategy, which used 110 megabytes of main memory for guiding the search. For the hardest instance the solver generated 1,021,814,815,051 states to find an optimum of 18 moves in 17 days. The exact bound for the worst possible instance to be solved is 20 moves. The computation for the lower bound on a large number of computers took just a few weeks, but it would take a desktop PC about 35 CPU years to perform this calculation. With recent search enhancements, the average solution time for optimally solving the FifteenPuzzle with over 1013 states is only milliseconds. The state space of the Fifteen-Puzzle has been completely generated in 3 weeks using 1.4 terabytes of hard disk space. The Towers-of-Hanoi problem (with 4 pegs and 30 disks) spawns a space of 1, 152, 921, 504, 606, 846, 976 states. It was solved by integrating a number of advanced search techniques in about 400 gigabytes of disk space and 17 days. In Sokoban, more than 50 of a set of 90 benchmark instances have been solved push-optimally by looking at less than 160 million states in total. Since standard search algorithms solved none of the instances, enhancements were crucial. Search refinements have also helped to beat the best human Chess player in tournament matches, to show that Checkers is a draw, and to identify the game-theoretical values in Connect 4 variants. Chess has an expected search space of about 1044 , Checkers of about 1020 , and Connect 4 of 4,531,985,219,092 states (counted with binary decision diagrams in a few hours and validated with brute-force explicit-state search in about a month, by running 16,384 jobs). The Deep Blue system, beating the human Chess world champion in 1997, considered about 160 million states per second on a massive parallel system with 30 processors and 480 single-chip search engines, applying some search enhancements on the hardware. The Deep Fritz system won against the human world champion in 2006 on a PC, evaluating about 10 million states per second. Checkers has been shown to be a draw (assuming optimal play). Endgame databases of up to 10 pieces were built, for any combination of kings and checkers. The database size amounts to 39 trillion positions. The search algorithm has been split into a front-end proof tree manager and a back-end prover. The total number of states in the proof for a particular opening was about 1013 , searched in about 1 month on an average of seven processors, with a longest line of 67 moves (plies). The standard problem for Connect 4 is victory for the first player, however, the 9 × 6 version is won for the second player (assuming optimal play). The latter result used a database constructed in about 40,000 hours. The search itself considered about 2 · 1013 positions and took about 2,000 hours. Search algorithms also solved multiplayer games. For mere play, Bridge programs outplay worldclass human players and, together with betting, computer Bridge players match expert performance. Pruning techniques and randomized simulation have been used to evaluate about 18,000 cards per second. In an invitational field consisting of 34 of the world’s best card players, the best-playing Bridge program finished twelfth.
1.3 Success Stories
11
Search also applies to games of chance. Probabilistic versions of the (n2 − 1)-Puzzle have been solved storing 1,357,171,197 annotated edges on 45 gigabytes of disk space. The algorithm (designed for solving general MDPs) terminated after two weeks and 72 iterations using less than 1.4 gigabytes RAM. For Backgammon with about 1019 states, over 1.5 million training games were played to learn how to play well. Statistical, so-called roll-outs guide the search process. As illustrated in recent competitions, general game playing programs play many games at acceptable levels. Given the rules of a game, UCT-based search algorithms can infer a strategy for playing it, without any human intervention. Additionally, perfect players can be constructed using BDDs. Many industrial online and offline route planning systems use search to answer shortest- and quickest-route queries in fractions of the time taken by standard single-source shortest paths search algorithms. A time and memory saving exploration is especially important for smaller computational devices like smart phones and PDAs. A recent trend for such handheld devices is to process GPS data. Nowadays domain-independent state space action planning systems solve Blocksworld problems with 50 blocks and more, and produce close to step-optimal plans in Logistics with hundreds of steps. For planning with numbers, potentially infinite search spaces have to be explored. As application domains, nowadays planners control the ground traffic on airports, control the flow of oil derivatives through a pipeline network, find deadlocks in communication protocols, resupply a number of lines in a faulty electricity network, collect image data with a number of satellites, and set up applications for mobile terminals. With the appropriate selection of search techniques, optimal plans can be obtained. Search algorithms effectively guide industrial and autonomous robots in known and unknown environments. As an example, the time for path planning on Sony’s humanoid robot with 38 degrees of freedom (in a discretized environment with 80,000 configurations) was mostly below 100 milliseconds on the robot’s embedded CPUs. Parallel search algorithms also helped solve the collision-free path planning problem of industrial robot arms for assembling large work pieces. Search algorithms have assisted finding bugs in software. Different model checkers have been enhanced by directing the search toward system errors. Search heuristics also accelerate symbolic model checkers for analyzing hardware, on-the-fly verifiers for analyzing compiled software units, and industrial tools for exploring real-time domains and finding resource-optimal schedules. Given a large and dynamic changing state vector of several kilobytes, external memory and parallel exploration scale best. A sample exploration consumed 3 terabytes hard disk space, while using 3.6 gigabytes RAM. It took 8 days with four dual CPUs connected via NFS-shared hard disks to locate the error, and 20 days with a single CPU. Search is currently the best known method for solving sequence alignment problems in computational biology optimally. Alignments for benchmarks of five benchmark sequences (length 300–550) have to be computed by using parallel and disk-based search algorithms. The graphs for the most challenging problems contain about 1013 nodes. One sample run took 10 days to find an optimal alignment. Encouraging results for search in automated theorem proving with first- and higher-order logic proofs could not be obtained without search guidance. In some cases, heuristics have helped to avoid being trapped on large and infinite plateaus.
12
CHAPTER 1 Introduction
In summary, there is lot of progress in making search algorithms more efficient and in applying them to additional real-world domains. Moreover, it is not hard to predict that the success of search algorithms will likely continue in the future.
1.4 STATE SPACE PROBLEMS A multitude of algorithmic problems in a variety of application domains, many of which will be introduced in this and the following chapters, can be formalized as a state space problem. A state space problem P = (S, A, s, T) consists of a set of states S, an initial state s ∈ S, a set of goal states T ⊆ S, and a finite set of actions A = {a1 , . . . , an } where each ai : S → S transforms a state into another state. Consider a circular railway track with a siding, as in Figure 1.3. The goal is to exchange the location of the two cars, and to have the engine back on the siding. A railroad switch is used to enable the trains to be guided from the circular track to the siding. To frame this Railroad Switching problem as a state space problem, note that the exact position of the engines and the car is irrelevant, as long as their relative position to each other is the same. Therefore, it is sufficient to consider only discrete configurations where the engine or the cars are on the siding, above or below the tunnel. Actions are all switching movements of the engine that result in a change of configuration. In the literature, different notions are often used depending on the application. Thus, states are also called configurations or positions; moves, operators, or transitions are synonyms for actions. Looking at a state space problem in this way, it is immediately conducive to visualize it by drawing it. This leads to a graph-theoretical formalization, where we associate states with nodes and actions with edges between nodes. For the example problem, the state space is shown as a graph in Figure 1.4.
E
A
Tunnel
B
FIGURE 1.3 RAILROAD SWITCHING problem. An engine (E) at the siding can push or pull two cars (A and B) on the track. The railway passes through a tunnel that only the engine, but not the rail cars, can pass.
1.4 State Space Problems
EBA
13
BAE
BEA
EAB
ABE
AEB
FIGURE 1.4 Discretized state space of the RAILROAD SWITCHING problem. Possible states are labeled by the locations of the engine (E) and the cars (A and B), either in the form of a string or of a pictogram; EAB is the start state, EBA is the goal state.
Definition 1.1. (State Space Problem Graph) A problem graph G = (V, E, s, T) for the state space problem P = (S, A, s, T) is defined by V = S as the set of nodes, s ∈ S as the initial node, T as the set of goal nodes, and E ⊆ V × V as the set of edges that connect nodes to nodes with (u, v) ∈ E if and only if there exists an a ∈ A with a(u) = v. Note that each edge corresponds to a unique action, but often an action is specified in such a way that it can induce multiple edges. Each edge of the graph can be labeled by a respective action. In chess, for example, an action could be “move the king one square to the left,” and could be applied in many different positions with as many different outcomes. For the Railroad Switching problem, we could label the transitions by the sequence of executed actions of the engine; for example, (exit-right, couple-A, push-A, uncouple-A, cycle-left, couple-B, pull-B, exit-left, uncouple-B, exit-right, cycle-left) for the transition from state EAB to BAE. It is often possible to devise much smaller label sets. Actions can be strung together into a sequence by applying an action to the result of another one. The objective of solving a state space problem is finding a solution.
Definition 1.2. (Solution) A solution π = (a1 , . . . , ak ) is an ordered sequence of actions ai ∈ A, i ∈ {1, . . . , k} that transforms the initial state s into one of the goal states t ∈ T; that is, there exists a sequence of states ui ∈ S, i ∈ {0, . . . , k}, with u0 = s, uk = t, and ui is the outcome of applying ai to ui−1 , i ∈ {1, . . . , k}. A solution for our example problem would be defined by the path (EAB, BAE, AEB, ABE, EBA). Note that several different solutions are possible, such as (EAB, BAE, BEA, ABE, EBA), but also as (EAB, BAE, BEA, ABE, AEB, BAE, AEB, ABE, EBA). Typically, we are not only interested in finding any solution path, but a shortest one—one with the minimum number of edges. Frequently, we are not only interested in the solution length of a problem (i.e., the number of actions in the sequence), but more generally in its cost (again, depending on the application, authors use synonyms such as distance or weight). For the Railroad Switching example problem, costs could be given by travel time, distance, number of couplings/uncouplings, or power consumption. Each edge is
14
CHAPTER 1 Introduction
assigned a weight. Unless stated otherwise, a key assumption we will make is that weights are additive; that is, the cost of a path is the sum of the weights of its constituting edges. This is a natural concept when counting steps or computing overall costs on paths from the initial state to the goal. Generalizations to this concept are possible and discussed later. The setting motivates the following definition.
Definition 1.3. (Weighted State Space Problem) A weighted state space problem is a tuple P = (S, A, s, T, w),P where w is a cost function w : A → IR. The cost of a path consisting of actions a1 , . . . , an is defined as ni=1 w(ai ). In a weighted search space, we call a solution optimal if it has minimum cost among all feasible solutions. For a weighted state space problem, there is a corresponding weighted problem graph G = (V, E, s, T, w), where w is extended to E → IR in the straightforward way. The graph is uniform(ly weighted), if w(u, v) P is constant for all (u, v) ∈ E. The weight or cost of a path π = (v0 , . . . , vk ) is defined as w(π ) = ki=1 w(vi−1 , vi ). Unweighted (or unit cost) problem graphs, such as the Railroad Switching problem, arise as a special case with w(u, v) = 1 for all edges (u, v). Definition 1.4. (Solution Path) Let π = v0 , . . . , vk be a path in G. If v0 = s and vk ∈ T for the designated start state s and the set of goal nodes T, then π is called a solution path. In addition, it is optimal if its weight is minimal among all paths between s and vk ; in this case, its cost is denoted as δ(s, v). The optimal solution cost can be abbreviated as δ(s, T) = min{t ∈ T | δ(s, t)}. For example, the Railroad Switching problem has δ(s, T) = 4. Solution paths to uniformly weighted problem graphs with w(u, v) = k for all edges (u, v) are solved by considering the unit cost problem and multiplying the optimal solution cost with k.
1.5 PROBLEM GRAPH REPRESENTATIONS Graph search is a fundamental problem in computer science. Most algorithmic formulations refer to explicit graphs, where a complete description of the graph is specified. A graph G = (V, E) is usually represented in two possible ways (see Fig. 1.5). An adjacency matrix refers to a two-dimensional Boolean array M. The entry Mi,j , 1 ≤ i, j ≤ n, is true (or 1) if and only if an edge contains a node with index i as a source and a node with index j as the target; otherwise, it is false (or 0). The required size of this graph representation is O(|V|2 ). For sparse graphs (graphs with
1
3 1
2
2
1
3
2
1
1
2
3
1
0
0
0
2
1
0
0
3
1
1
0
FIGURE 1.5 An unweighted but directed problem graph (left) together with its adjacency list (middle), and its adjacency matrix representation (right).
1.6 Heuristics
15
relatively few edges) an adjacency list is more appropriate. It is implemented as an array L of pointers to node lists. For each node u in V, entry Lu will contain a pointer to a list of all nodes v with (u, v) ∈ E. The space requirement of this representation is O(|V| + |E|), which is optimal. Adding weight information to these explicit graph data structures is simple. In case of the adjacency matrix, the distance values are substituting the Boolean values so that entries Mi,j denote corresponding edge weights; the entries for nonexisting edges are set to ∞. In the adjacency list representation, with each node list element v in list Lu we associate the weight w(u, v). Solving state space problems, however, is sometimes better characterized as a search in an implicit graph. The difference is that not all edges have to be explicitly stored, but are generated by a set of rules (e.g., in games). This setting of an implicit generation of the search space is also called on-the-fly, incremental, or lazy state space generation in some domains.
Definition 1.5. (Implicit State Space Graph) In an implicit state space graph, we have an initial node s ∈ V, a set of goal nodes determined by a predicate Goal: V → IB = {false, true}, and a node expansion procedure Expand: V → 2V . Most graph search algorithms work by iteratively lengthening candidate paths (u0 , . . . , un = u) by one edge at a time, until a solution path is found. The basic operation is called node expansion (a.k.a. node exploration), which means generation of all neighbors of a node u. The resulting nodes are called successors (a.k.a. children) of u, and u is called a parent or predecessor (if un−1 additionally is a neighbor it might not be generated if expand is clever, but it can still be a successor). All nodes u0 , . . . , un−1 are called ancestors of u; conversely, u is a descendant of each node u0 , . . . , un−1 . In other words, the terms ancestor and descendant refer to paths of possibly more than one edge. These terms relate to the exploration order in a given search, whereas the neighbors of a node are all nodes adjacent in the search graph. To abbreviate notation and to distinguish the node expansion procedure from the successor set itself, we will write Succ for the latter. An important aspect to characterize state space problems is the branching factor.
Definition 1.6. (Branching Factor) The branching factor of a state is the number of successors it has. If Succ(u) abbreviates the successor set of a state u ∈ S then the branching factor is |Succ(u)|; that is, the cardinality of Succ(u). In a problem graph, the branching factor corresponds to the out-degree of a node; that is, its number of neighbors reachable by some edge. For the initial state EAB in the Railroad Switching example, we have only one successor, whereas for state BAE we have a branching factor of 3. For a problem graph, we can define an average, minimum, and maximum branching factor. The average branching factor b largely determines the search effort, since the number of possible paths of length l grows roughly as bl .
1.6 HEURISTICS Heuristics are meant to be estimates of the remaining distance from a node to the goal. This information can be exploited by search algorithms to assess whether one state is more promising than the rest. We will illustrate that the computational search effort can be considerably reduced if between two candidate
16
CHAPTER 1 Introduction
paths, the algorithm prefers to expand the one with the lower estimate. A detailed introduction to search algorithms is deferred to the next section. A search heuristic provides information to orient the search into the direction of the search goal. We refer to the graph G = (V, E, s, T, w) of a weighted state space problem.
Definition 1.7. (Heuristic) A heuristic h is a node evaluation function, mapping V to IR≥0 . If h(t) = 0 for all t in T and if for all other nodes u ∈ V we have h(u) 6= 0, the goal check for u simplifies to the comparison of h(u) with 0. Before plunging into the discussion of concrete examples of heuristics in different domains, let us briefly give an intuitive description of how heuristic knowledge can help to guide algorithms; the notions will be made precise in Chapter 2. Let g(u) be the path cost to a node u and h(u) be its estimate. The value g(u) varies with the path on which u is encountered. The equation f (u) = g(u) + h(u) is very important in understanding the behavior of heuristic search algorithms. In words, the f -value is the estimate of the total path cost from the start node to the target destination, which reaches u on the same path. As general state spaces are difficult to visualize, we restrict ourselves to an extremely simplified model: the states are linearly connected along the horizontal axis, like pearls on a string (see Fig. 1.6). In each step, we can look at one state connected to a previously explored state. If we have no heuristic information at all, we have to conduct a blind (uninformed) search. Since we do not know if the target lies on the left or the right side, a good strategy is to expand nodes alternatively on the left and on the right, until the target is encountered. Thus, in each step we expand a node of which the distance g from s is minimal. When a heuristic h is given, an extension of this strategy always prefers to expand the most promising node, the one of which the estimated total distance to the target, f = g + h, is minimal. Then, at least all nodes with f -value less than the optimal solution cost f ∗ will be expanded; however, since h increases the estimate, some nodes can be pruned from consideration. This is illustrated in Figure 1.7, where h amounts to half the true goal distance. In a perfect heuristic, the two are identical. In our example (see Fig. 1.8), this reduces the number of expanded nodes to one-half, which is optimal.
g
g
s
t
FIGURE 1.6 A state space without heuristic knowledge. s is the start state and t is the target state; the search depth g is illustrated with dots along the horizontal axis, and the search cost is illustrated along the vertical axis.
1.6 Heuristics
17
f
h g
f
g
s
t
FIGURE 1.7 A state space with some heuristic knowledge. The amplitudes of heuristic h and search depth g accumulate to the amplitude of f .
h
f g g
s
t
FIGURE 1.8 A state space with perfect heuristic knowledge. All states between s and t have the same f -value.
Finally, Figure 1.9 depicts the case of a heuristic that is misleading. The path going away from the goal looks better than the path to the goal. In this case, the heuristic search traversal will expand more nodes than blind exploration.
18
CHAPTER 1 Introduction
f
f
g g h
h s
t
FIGURE 1.9 A state space with misleading heuristic knowledge, indicating that by a smaller f -value the search will more likely search the part of the search space that contains no goal.
Heuristics are particularly useful if we can make sure that they sometimes may underestimate, but never overestimate, the true goal distance.
Definition 1.8. (Admissible Heuristic) An estimate h is an admissible heuristic if it is a lower bound for the optimal solution costs; that is, h(u) ≤ δ(u, T) for all u ∈ V. Other useful properties of heuristics are consistency and monotonicity.
Definition 1.9. (Consistent, Monotonic Heuristic) Let G = (V, E, s, T, w) be a weighted state space problem graph.
..
A goal estimate h is a consistent heuristic if h(u) ≤ h(v) + w(u, v) for all edges e = (u, v) ∈ E. Let (u0 , . . . , uk ) be any path, g(ui ) be the path cost of (u0 , . . . , ui ), and define f (ui ) = g(ui ) + h(ui ). A goal estimate h is a monotone heuristic if f (uj ) ≥ f (ui ) for all j > i, 0 ≤ i, j ≤ k; that is, the estimate of the total path cost is nondecreasing from a node to its successors. The next theorem shows that these properties are actually equivalent.
Theorem 1.1. (Equivalence of Consistent and Monotone Heuristics) A heuristic is consistent if and only if it is monotone. Proof. For two subsequent states ui−1 and ui on a path (u0 , . . . , uk ) we have f (ui ) = g(ui ) + h(ui ) (by the definition of f ) = g(ui−1 ) + w(ui−1 , ui ) + h(ui ) (by the definition of path cost) ≥ g(ui−1 ) + h(ui−1 ) (by the definition of consistency) = f (ui−1 ) (by the definition of f ) Moreover, we obtain the following implication.
Theorem 1.2. (Consistency and Admissibility) Consistent estimates are admissible.
1.7 Examples of Search Problems
19
Proof. If h is consistent we have h(u) − h(v) ≤ w(u, v) for all (u, v) ∈ E. Let p = (v0 , . . . , vk ) be any path from u = v0 to t = vk . Then we have w( p) =
k−1 X
w(vi , vi+1 ) ≥
i=0
k−1 X
(h(vi ) − h(vi+1 )) = h(u) − h(t) = h(u).
i=0
This is also true in the important case of p being an optimal path from u to t ∈ T. Therefore, h(u) ≤ δ(u, T).
.. .
In addition, the following conditions hold (see Exercises): The maximum of two admissible heuristics is an admissible heuristic. The maximum of two consistent heuristics is a consistent heuristic. Admissible heuristics are not necessarily consistent (although most practically used ones are).
1.7 EXAMPLES OF SEARCH PROBLEMS In this section, we introduce some standard search problems we will refer to throughout the book. Some of them are puzzles that have been used extensively in the literature for benchmarking algorithms; some are real-world applications.
1.7.1 Sliding-Tile Puzzles Our first example, illustrated in Figure 1.10, is a class of single-player sliding-tile toy games called the Eight-Puzzle, the Fifteen-Puzzle, the Twenty-Four-Puzzle, and, generally, the (n2 − 1)Puzzle. It consists of (n2 − 1) numbered tiles, squarely arranged, that can be slid into a single empty position, called the blank. The task is to rearrange the tiles such that a certain goal state is reached.
1
2
8 7
3 4
6
5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
FIGURE 1.10 Classic goal states for the EIGHT-PUZZLE (left), FIFTEEN-PUZZLE (middle), and TWENTY-FOUR-PUZZLE (right).
20
CHAPTER 1 Introduction
The state space for these problems grows exponentially in n. The total number of reachable states1 is (n2 )! /2. For modeling the puzzle as a state space problem, each state can be represented as a permutation vector, each of the components of which corresponds to one location, indicated by which of the tiles (including the blank) it occupies. For the Eight-Puzzle instance of Figure 1.10 the vector representation is (1, 2, 3, 8, 0, 4, 7, 6, 5). Alternatively, we can devise a vector of the locations of each tile (5, 1, 2, 3, 8, 5, 7, 6, 4) in the example. The last location in the vector representation can be omitted. The first vector representation naturally corresponds to a physical (n × n) board layout. The initial state is provided by the user; for the goal state we assume a vector representation with value i at index i + 1, 1 ≤ i ≤ n2 − 1. The tile movement actions modify the vector as follows. If the blank is at index j, 1 ≤ j ≤ n2 , it is swapped with the tile either in direction up (index j − n), down (index j + n), left (index j − 1), or right (index j + 1) unless the blank is already at the top-most (or, respectively, bottommost, left-most, or right-most) fringe of the board. Here we see an instance where a labeled action representation comes in handy: We let 6 be {U, D, L, R} with U, D, L, and R denoting a respective up, down, left, or right movement (of the blank). Although strictly speaking, up movements from a different blank position are different actions, in each state at most one action with a given label is applicable. The General Sliding-Tile Puzzle (a.k.a. Klotzki) is an extension of the (n2 − 1)-Puzzle where the pieces can have different shapes. It consists of a collection of possibly labeled pieces to be slid on adjacent positions on a given board in either of the four directions up, down, left, and right. Each piece is composed of a set of tiles. Pieces of the same shape and labeling are indistinguishable. Figure 1.11 visualizes typical General Sliding-Tile Puzzle instances. The goal is to move the 2 × 2 block toward the arrow head. A compact representation is the list of tiles according to fixed reference coordinates and some traversal of the board. For the Donkey Puzzle example, and a natural reference spot and traversal of the board, we obtain the list 2x1, blank, blank, 2x1, 2x2, 2x1, 2x1, 1x2, 1x1, 1x1, 1x1, and 1x1. Let s, the total number of pieces, be partitioned into sets of fi pieces of the same type for {1, . . . , k}; then the number of configurations is bounded by s!/(f1 ! · · · fk !). The exact number can be determined utilizing a turn out of which the next piece to be placed is drawn. If a piece fits into the current configuration the next one is drawn, otherwise an alternative piece is chosen. With this approach we can compute the total state count for the puzzles: Dad’s Puzzle, 18, 504; Donkey 1 The
original version of this puzzle was invented by Sam Lloyd in the 1870s, and was made with 15 wooden blocks in a tray. He offered a reward of $1,000 to anyone who could prove they’d solved it from the state where the 14 and 15 were switched. All sorts of people claimed they had solved the puzzle, but when they were asked to demonstrate how they’d done it (without actually picking the blocks off the tray and replacing them), none of them could do it. Apparently, one clergyman spent a whole freezing winter night standing under a lamp post trying to remember what he’d done to get it right. Actually, there exists no solution for this; the concept that made Sam Lloyd rich is called parity. Assume writing the tile numbers of a state in a linear order, by concatenating, consecutively, all the rows. An inversion is defined as a pair of tiles x and y in that order such that x occurs before y in that order, but x > y. Note that a horizontal move does not affect the order of the tiles. In a vertical move, the current tile always skips over the three intermediate tiles following in the order, and these are the only inversions affected by that move. If one of these intermediate tiles contributes an inversion with the moved tile, it no longer does so after the move, and vice versa. Hence, depending on the magnitudes of the intermediate tiles, in any case the number of inversions changes by either one or three. Now, for a given puzzle configuration, let N denote the sum of the total number of inversions, plus the row number of the blank. Then (N mod 2) is invariant under any legal move. In other words, after a legal move an odd N remains odd, whereas an even N remains even. Consequently, from a given configuration, only half of all possible states are reachable.
1.7 Examples of Search Problems
21
FIGURE 1.11 Instances of the GENERAL SLIDING-TILE PUZZLE: DONKEY PUZZLE (left), CENTURY PUZZLE (middle), and DAD’S PUZZLE (right).
Puzzle, 65, 880; and Century Puzzle, 109, 260. A successor can be generated in time linear to the number of tiles (see Exercises). One of the simplest heuristics for sliding-tile puzzles is to count the number of tiles that are not at their respective goal location. This misplaced-tile heuristic is consistent, since it changes by at most one between neighboring states. The (n2 − 1)-Puzzle has another lower bound estimate, called the Manhattan distance heuristic. For each two states u = ((x1 , y1 ), (x2 , y2 ), . . . , (xn2 −1 , yn2 −1 )) and v = ((x10 , y01 ), (x20 , y02 ), . . . , P2 (xn0 2 −1 , y0n2 −1 )), with coordinates xi , yi ∈ {0, . . . , n − 1} it is defined as ni=1−1 |xi − xi0 | + |yi − y0i | ; in words, it is the sum of moves required to bring each tile to its target position independently. This yields P2 the heuristic estimate h(u) = ni=1−1 (|xi − bi/nc| + |yi − (i mod n)|). The Manhattan distance and the misplaced-tile heuristic for the (n2 − 1)-Puzzle are both consistent, since the difference in heuristic values is at most 1; that is, |h(v) − h(u)| ≤ 1, for all u, v. This means h(v) − h(u) ≤ 1 and h(u) − h(v) ≤ 1. Together with w(u, v) = 1, the latter inequality implies h(v) − h(u) + w(u, v) ≥ 0. An example is given in Figure 1.12. Tiles 5, 6, 7, and 8 are not in final position. The number of misplaced tiles is 4, and the Manhattan distance is 7. An improvement for the Manhattan distance is the linear conflict heuristic. It concerns pairs of tiles that both are in the correct row (column), but in the wrong order in column (row) direction. In this case, two extra moves not accommodated in the Manhattan distance will be needed to get one tile out of the way of the other one. In the example, tiles 6 and 7 are in a linear conflict and call for an offset 2 to the Manhattan distance. Implementing the full linear conflict heuristic requires checking the permutation orders for all pairs of tiles in the same row/column. 1
6
2
3
1
5
4
8
7
8
7
FIGURE 1.12 Example for heuristic estimates in the EIGHT-PUZZLE.
2
3 4
6
5
22
CHAPTER 1 Introduction
FIGURE 1.13 A scrambled RUBIK’S CUBE; colors are in grayscale.
1.7.2 RUBIK’S CUBE Rubik’s Cube (see Fig. 1.13), invented in the late 1970s by Erno Rubik, is another known challenge for a single-agent search. Each face can be rotated by 90, 180, or 270 degrees and the goal is to rearrange the subcubes, called cubies, of a scrambled cube such that all faces are uniformly colored. The 26 visible cubies can be classified into 8 corner cubies (three colors), 12 edge cubies (two colors), and 6 middle cubies (one color). There are 8! · 38 · 12! · 212 /12 ≈ 43 · 1018 possible cube configurations. Since there are six faces—left (L), right (R), up (U), down (D), front (F), and back (B)—this gives an initial branching factor of 6 · 3 = 18. The move actions are abbreviated as L, L2 , L− , R, R2 , R− , U, U 2 , U − , D, D2 , D− , F, F 2 , F − , B, B2 , and B− . (Other notations consist of using 0 or −1 for denoting inverted operators, instead of −.) We never rotate the same face twice in a row, however, since the same result can be obtained with a single twist of that face. This reduces the branching factor to 5 · 3 = 15 after the first move. Twists of opposite faces are independent of each other and hence commute. For example, twisting the left face followed by the right face gives the same result as twisting the right face followed by the left face. Thus, if two opposite faces are rotated consecutively, we assume them to be ordered without loss of generality. For each pair of opposite faces, we arbitrarily label one a first face and the other a second face. After a first face is twisted, there are three possible twists of each of the remaining five faces, resulting in a branching factor of 15. After a second face is twisted, however, we can only twist four remaining faces, excluding the face just twisted and its corresponding first face, for a branching factor of 12. Humans solve the problem by a general strategy that generally consists of macro actions, fixed move sequences that correctly position individual or groups of cubes without violating previously positioned ones. Typically, these strategies require 50 to 100 moves, which is far from optimal. We generalize the Manhattan distance to Rubik’s Cube as follows. For all cubies, we cumulate the minimum number of moves to a correct position and orientation. However, since each move involves eight cubies, the result has to be divided by 8. A better heuristic computes the Manhattan distance for the edge and corner cubies separately, takes the maximum of the two, and divides it by 4.
1.7.3 SOKOBAN Sokoban was invented in the early 1980s by a computer games company in Japan. There exists a set of benchmark problems (see Fig. 1.14), ordered roughly easiest to hardest in difficulty for a human to solve. The start position consists of n balls (a.k.a. stones, boxes) scattered over a maze. A man,
1.7 Examples of Search Problems
23
FIGURE 1.14 First level in SOKOBAN benchmark suite. Walls define the maze to be traversed by the man; balls have to be pushed to the goal area located to the right of the maze.
controlled by the puzzle solver, traverses the board and pushes balls onto an adjacent empty square. The aim is to move the balls onto n designated goal fields. One important aspect of Sokoban is that it contains traps. Many state space problems like the Railroad Switching problem are reversible; that is, for each action a ∈ A there exists an action a−1 ∈ A, so that a(a−1 (u)) = u and a−1 (a(u)) = u. Each state that is reachable from the start state can itself reach the start state. Hence, if the goal is reachable, then it is reachable from every state. Directed state space problems, however, can include dead-ends.
Definition 1.10. (Dead-End) A state space problem has a dead-end u ∈ S if u is reachable and Pu = (S, A, u, T) is unsolvable. Examples for dead-ends in Sokoban are four balls placed next to each other in the form of a square, so that the man cannot move any of them; or balls that lie at the boundary of the maze (excluding goal squares). We see that many dead-ends can be identified in the form of local patterns. The instance in Figure 1.14, however, is solvable. For a fixed number of balls, the problem’s complexity is polynomial. In general, we distinguish three problems: Decide is just the task to solve the puzzle (if possible), Pushes additionally asks to minimize the number of ball pushes, whereas Moves request an optimal number of man movements. All these problems are provably hard (PSPACE complete). We see that complexity theory states results on a scaling set of problems, but does not give an intuitive understanding on the hardness for a single problem at hand. Hence, Figure 1.15 compares some search space properties of solitaire games. The effective branching factor is the average number of children of a state, after applying pruning methods. For Sokoban, the numbers are for typical puzzles from the humanmade test sets; common Sokoban board sizes are 20 × 20. One good lower bound estimate for Sokoban (Pushes variant) is found using a minimal matching approach. We are interested in a matching of balls to goal fields, such that the sum of all ball paths
24
CHAPTER 1 Introduction
Characteristic Branching Factor – effective – Solution Length – typical – Search Space Size Graph
TWENTY-FOUR-PUZZLE
RUBIK’S CUBE
SOKOBAN
2–4 2.13 80–112 100 1025 Undirected
12–18 13.34 14–18 16 1018 Undirected
0–50 10 97–674 260 1018 Directed
FIGURE 1.15 Search space properties of some puzzles (numbers are approximate).
FIGURE 1.16 Matching balls (top row) to goal fields (bottom row) in SOKOBAN. Bold edges illustrate a match; a matched edge connects a ball to its particular goal field.
is minimal. The one part of the bipartite graph (see Fig. 1.16) is composed of nodes for the balls, the other half consists of nodes for the goal fields, and the edge weight between every selected pair (ball, goal) of nodes is the shortest path cost for moving the ball to goal (assuming all other balls were removed from the problem). The standard algorithm to compute the best weighted matching runs in time cubic in the number of balls. More efficient algorithms reduce the problem to the maximum flow problem by inserting additional start and sink nodes connected to the ball nodes and to the goal fields, respectively. In the case of a group of goal fields that is only reachable via a single door, the minimal matching heuristic can be simplified as shortest path calculations through this articulation (an articulation of a connected graph is a node that if removed will disconnect the graph). The heuristic is consistent, since moving one ball reduces the individual shortest path to each goal by at most one, and any matching will include only one of the updated shortest path distance values.
1.7.4 ROUTE PLANNING A practically important application domain for search algorithms is Route Planning. The (explicit) search graph consists of a road network, where intersections represent nodes and edges represent
1.7 Examples of Search Problems
25
drivable connections. The graph is relatively sparse, since the degree of nodes is bounded (intersections with five or more participating roads are very rare). The task consists of finding a path between a start location s and a target location t that minimizes distance, expected travel time, or a related measure. A common approach to estimate travel time is to classify roads into a number of road classes (e.g., freeway, highway, arterial road, major road, local connecting road, residential street), and to associate an average speed with each one. The problem can become challenging in practice due to the large size of maps that have to be stored on external memory, and on tight time constraints (e.g., of navigation systems or online web search). In Route Planning, nodes have associated coordinates in some coordinate space (e.g., the Euclidean). We assume a layout function L : V → IR2 . A lower bound for the road distance between two nodes u andp v with locations L(u) = (xu , yu ) and L(v) = (xv , yv ) can be obtained as h(u) = ||L(v) − L(u)||2 = (xu − xv )2 + (yu − yv )2 , where || · ||2 denotes the Euclidean distance metric. It is admissible, since the shortest way to the goal is at least as long as the beeline. The heuristic h(u) = ||L(t) − L(u)||2 is consistent, since h(u) = ||L(t) − L(u)||2 ≤ ||L(t) − L(v)||2 + ||L(v) − L(u)||2 = ||L(t) − L(v)||2 + ||L(u) − L(v)||2 = h(v) + w(u, v) by the triangle inequality of the Euclidean plane. Due to its commercial relevance, we will cover Route Planning in Chapter 17.
1.7.5 TSP One other representative for a state space problem is the TSP (traveling salesman problem). Given a distance matrix between n cities, a tour with minimum length has to be found, such that each city is visited exactly once, and the tour returns to the first city. We may choose cities to be enumerated with {1, 2, . . . , n} and distances d(i, j) ∈ IR+ and d(i, i) = 0 for 1P ≤ i, j ≤ n. Feasible solutions are permutations τ of (1, 2, . . . , n) and the objective function is P(τ ) = ni=1 d(τ (i), τ ((i + 1) mod n + 1)) and an optimal solution is a solution τ with minimal P(τ ). The state space has (n − 1)! /2 solutions, which is about 4.7 × 10157 for n = 101. This problem has been shown to be NP complete in the general case; entire books have been dedicated to it. Figure 1.17 (left) shows an example of the TSP problem, and Figure 1.17 (right) a corresponding solution. Various algorithms have been devised that quickly yield good solutions with high probability. Modern methods can find solutions for extremely large problems (millions of cities) within a reasonable time with a high probability just 2 to 3% away from the optimal solution.
FIGURE 1.17 METRIC TSP problem instance (left) and its solution (right); edge costs are straight-line distances.
26
CHAPTER 1 Introduction
In the special case of the Metric TSP problem, the additional requirement of the triangle inequality is imposed. This inequality states that for all vertices u, v, and w, the distance function d satisfies d(u, w) ≤ d(u, v) + d(v, w). In other words, the cheapest or shortest way of going from one city to another is the direct route between two cities. In particular, if every city corresponds to a point in Euclidean space, and distance between cities corresponds to Euclidean distance, then the triangle inequality is satisfied. In contrast to the general TSP, Metric TSP can be 1.5-approximated, meaning that the approximate solution is at most 50% larger than the optimal one. When formalizing TSP as a search problem, we can identify states with incomplete tours, starting with any arbitrary node. Each expansion adds one more city to the partial path. A state denoting a completed, closed tour is a goal state. A spanning tree of a graph is a subgraph without cycles connecting all nodes of the graph. A Minimum Spanning Tree (MST) is a spanning tree such that the sum of all its edge weights is minimum among all spanning trees of the graph. For n nodes, it can be computed as follows. First, choose the edge with minimum weight and mark it. Then, repeatedly find the cheapest unmarked edge in the graph that does not close a cycle. Continue until all vertices are connected. The marked edges form the desired MST. A heuristic that estimates the total length of a TSP cycle, given a partial path, exploits that the yet unexplored cities have to be at least connected to the ends of the existing part (to both the first and the last city). So if we compute a MST for these two plus all unexplored cities, we obtain a lower bound for a connecting tree. This must be an admissible heuristic, since a connecting tree that additionally fulfills the linearity condition cannot be shorter. A partial solution and the MST used for the heuristic are shown in Figure 1.18.
1.7.6 MULTIPLE SEQUENCE ALIGNMENT The Multiple Sequence Alignment problem, in computational biology, consists of aligning several sequences (strings; e.g., related genes from different organisms) to reveal similarities and differences across the group. Either DNA can be directly compared, and the underlying alphabet 6 consists of the set {C,G,A,T} for the four standard nucleotide bases cytosine, guanine, adenine and thymine; or we can compare proteins, in which case 6 comprises the 20 amino acids.
FIGURE 1.18 TSP partial solution (solid line) and MST for heuristic (dotted line).
1.7 Examples of Search Problems
27
Roughly speaking, we try to write the sequences one above the other such that the columns with matching letters are maximized; thereby, gaps (denoted here by an additional letter ) may be inserted into either of them to shift the remaining characters into better corresponding positions. Different letters in the same column can be interpreted as being caused by point mutations during the course of evolution that substituted one amino acid by another one; gaps can be seen as insertions or deletions (since the direction of change is often not known, they are also collectively referred to as indels). Presumably, the alignment with the fewest mismatches reflects the biologically most plausible explanation. The state space consists of all possible alignments of prefixes of the input sequences m1 , . . . , mk . If the prefix lengths serve as vector components we can encode the problem as a set of vertices x = (x1 , . . . , xk ), xi ∈ {0, . . . , |mi |} with associated cost vector vx . A state x0 is a (potential) successor of x if xi0 − xi ∈ {0, 1} for all i. The underlying problem graph structure is directed and acyclic and follows a k-dimensional lattice or hypercube. There is a host of applications of sequence alignment within computational biology; for example, for determining the evolutionary relationship between species, for detecting functionally active sites that tend to be preserved best across homologous sequences, and for predicting three-dimensional protein structures. Formally, we associate a cost with an alignment and try to find the (mathematically) optimal alignment, the one with the minimum cost. When designing a cost function, computational efficiency and biological meaning have to be taken into account. The most widely used definition is the sum-of-pairs cost function. First, we are given a symmetric (|6| + 1)2 matrix containing penalties (scores) for substituting a letter with another one (or a gap). In the simplest case, this could be one for a mismatch and zero for a match, but more biologically relevant scores have been developed. A substitution matrix corresponds to a model of molecular evolution and estimates the exchange probabilities of amino acids for different amounts of evolutionary divergence. Based on such a substitution matrix, the sum-of-pairs cost of an alignment is defined as the sum of penalties between all letter pairs in corresponding column positions. An example of the calculation of the sum-of-pairs cost is depicted in Figure 1.19. The value 6 = (3 + 3) is based on entry (A/ ) in the substitution matrix, and the second value 7 is based on entry (B, ) plus 1 for a still-opened gap.
A
B B
C C
B D D
B
A B C D
A 0
B 2 1
C 4 3 2
D 2 3 2 1
3 3 3 3 0
FIGURE 1.19 Fictitious alignment problem with sum-of-pair cost: 6 + 7 + 8 + 7 + 7 = 35; alignment (left), substitution matrix (right).
28
CHAPTER 1 Introduction
A number of improvements can be integrated into the sum-of-pairs cost, like associating weights with sequences, and using different substitution matrices for sequences of varying evolutionary distance. A major issue in Multiple Sequence Alignment algorithms is their ability to handle gaps. Gap penalties can be made dependent on the neighbor letters. Moreover, it has been found that assigning a fixed score for each indel sometimes does not produce the biologically most plausible alignment. Since the insertion of a sequence of x letters is more likely than x separate insertions of a single letter, gap cost functions have been introduced that depend on the length of a gap. A useful approximation is affine gap costs, which distinguish between opening and extension of a gap and charge a + b ∗ x for a gap of length x, for appropriate a and b. Another frequently used modification is to waive the penalties for gaps at the beginning or end of a sequence. A real alignment problem is shown in Figure 1.20. The sequence alignment problem is a generalization of the problem of computing the edit distance, which aims at changing a string into another by using the three main edit operations of modifying, inserting, or deleting a letter. Each edit operation is charged, and the minimum-cost operations sequence is sought. For instance, a spell checker could determine the lexicon word of which the edit distance from a (possibly misspelled) word typed by the user is minimal. The same task arises in version control systems. Lower bounds on the cost of aligning k sequences are often based on optimal alignments of subsets of m < k sequences. In general, for a vertex v in k-space, we are looking for a lower bound for a path from v to the target corner t. Consider first the case m = 2. The cost of such a path is, by definition, the sum of its edge costs, where each edge cost in turn is the sum of all pairwise (replacement or gap) penalties. Each Multiple Sequence Alignment induces a pairwise alignment for sequences i and j, by simply copying rows i and j and ignoring columns with a “ ” in both rows. By exchanging the summation order, the sum-of-pairs cost is the sum of all pairwise alignment costs of the respective paths projected on a face, each of which cannot be smaller than the optimal pairwise path cost. Thus, we can construct an admissible heuristic hpair by computing, for each pairwise alignment and for each cell in a pairwise problem, the cheapest path cost to the goal node. The optimal solutions to all pairwise alignment problems needed for the lower-bound h values are usually computed prior to the main search in a preprocessing step. Since this time we are interested in the lowest cost of a path from v to t, it runs in a backward direction, proceeding from the bottom-right
1thx 1grx 1erv 2trcP
_aeqpvlvyfwaswcgpcqlmsplinlaantysdrlkvvkleidpnpttvkky... __mqtvi__fgrsgcpysvrakdlaeklsnerdd_fqyqyvdiraegitkedl... agdklvvvdfsatwcgpckmikpffhslsekysn_viflevdvddcqdvasec... _kvttivvniyedgvrgcdalnssleclaaeypm_vkfckira_sntgagdrf...
1thx 1grx 1erv 2trcP
...k______vegvpalrlvkgeqildstegvis__kdkllsf_ldthln_________ ...qqkagkpvetvp__qifvdqqhiggytdfaawvken_____lda____________ ...e______vksmptfqffkkgqkvgefsgan___kek_____leatine__lv____ ...s______sdvlptllvykggelisnfisvaeqfaedffaadvesflneygllper_
FIGURE 1.20 Alignment of problem 2trx of BALiBase, computed with a biologically relevant substitution matrix.
1.8 General State Space Descriptions
29
corner to the top-left corner in the alingment matrix, expanding all possible parents of a vertex in each step.
1.8 GENERAL STATE SPACE DESCRIPTIONS In this section, we introduce some general formalisms to describe state space problems: action planning, production systems, and generic search models including nondeterministic search and Markov decision processes.
1.8.1 Action Planning Action planning refers to a world description in logic. A number of atomic propositions AP describe what can be true or false in each state of the world. By applying operations in a state, we arrive at another state where different propositions might be true or false. For example, in a Blocksworld a robot might try to reach a target state by actions that stack and unstack blocks, or put them on the table. Usually, only a few atoms are affected by an action, and most of them remain the same. Therefore, a concise representation is the following Strips formalism.
Definition 1.11. (Propositional Planning Problem) A propositional planning problem (in Strips notation) is a finite-state space problem P = (S, A, s, T), where S ⊆ 2AP is the set of states, s ∈ S is the initial state, T ⊆ S is the set of goal states, and A is the set of actions that transform states into states. We often have that T is described by a simple list of propositions Goal ⊆ AP. Actions a ∈ A have propositional preconditions pre(a), and propositional effects (add(a), del(a)), where pre(a) ⊆ AP is the precondition list of a, add(a) ⊆ AP is its add list, and del(a) ⊆ AP is the delete list. Given a state u with pre(a) ⊆ u, then its successor v = a(u) is defined as v = (u \ del(a)) ∪ add(a). Effects are seen as updates to the current states. To avoid conflicts, delete effects are eliminated from the state before add effects are included. Even though we have defined Strips on sets of propositions it is not difficult to transfer the description V facts. The goal condition is shorthand for V into logic. Boolean variables for propositions are called p∈pre(a) ( p = true). The application of the p∈Goal ( p = true) and preconditions are interpreted as add and delete lists are short for setting p to false for all p ∈ del(a) followed by setting p to true for all p ∈ add(a). Strips planning assumes a closed world. Everything that is not stated true is assumed to be false. Therefore, the notation of the initial state s is shorthand for the assignment to true of the propositions included in s, and to false of the ones that are not. It is often not difficult to encode a state space problem in Strips. For modeling the (n2 − 1)-Puzzle we introduce atomic propositions at(t, p), denoting the truth of the tile t to be located at position p, and blank( p), denoting that the blank is located at position p. An action would be slide(t, p, p0 ), which has at(t, p) and blank( p0 ) as preconditions, at(t, p0 ) and blank( p) as add effects, as well as at(t, p) and blank( p0 ) as delete effects. To encode finite-domain state space problems with numbers, we observe that a variable with k possible value assignment can be encoded with O(lg k) (logarithmic encoding)—or O(k) (unary encoding)—atomic propositions. Of course, this is only feasible if k is small. In Blocksworld (see Fig. 1.21) there are labeled blocks that can be moved using a robot arm that can grasp one block at a time. Additionally, there is a table large enough to hold all blocks. The
30
CHAPTER 1 Introduction
FIGURE 1.21 BLOCKSWORLD configuration with seven blocks; grayscales label different blocks.
four operations are stack (put block onto one tower), unstack (remove block from one tower), pickup (remove block from table), and putdown (put block onto table). Let us consider a Blocksworld problem with l blocks b1 , . . . , bl placed on a table t as an example. State variables for each block are on that can take values from {⊥, t, b1 , . . . , bl }, a Boolean variable clear for each block, and an additional variable holding that can take values from {⊥, b1 , . . . , bl }. Actions are stack, unstack, putdown, pickup; for example, stack(a, b) has preconditions holding = a and clear(b) = true and the four update operations on(a) ← b, holding ← ⊥, clear(b) ← false, and clear(a) ← true. In a unary encoding, for each block a and b we devise the fluents on(a, b), clear(a), and holding(a). The corresponding Strips action for stack(a, b) has the two preconditions holding(a) and clear(b), the two add effects on(a, b) and clear(a), as well as the two delete effects holding(a) and clear(b). Planning domains can either be parametric or grounded (fully instantiated). Parametric descriptions feature predicates and actions based on a bounded number of domain objects. A (Lisp-like) formal representation for both parametric or grounded planning problems is referred to as the problem domain description language (PDDL). A PDDL example for a more complex Logistics domain illustrated in Figure 1.22 is provided in Figure 1.24. The task is to transport packages within cities using trucks, and between cities using airplanes. Locations within a city are connected and trucks can move between any two such locations. In each city there is exactly one truck, and each city has one airport. The airports are connected for airplanes to operate. One particular problem instance is shown in Figure 1.23. Strips-type planning is known to be PSPACE complete. Including types, numbers, and durations to the problem description in the developments of PDDL leads to specification formalisms that are undecidable. Nonetheless, there are enumeration algorithms and acceleration techniques that are practical for a large set of benchmarks. In recent years, the performance of state-of-theart systems has improved drastically, and with that, more realistic examples came within reach. We have devoted an entire application chapter to address these developments (See Chapter 15, “Action Planning”). Next, we present the relaxed planning heuristic h+ for planning in Strips notation with each action a, having precondition list pre(a), add list add(a), and delete list del(a). The relaxation a+ of an action a is a with the delete list omitted. The relaxation of a planning problem is the one in which all actions are substituted by their relaxed counterparts. Any solution that solves the original plan also solves the relaxed one. Value h+ is defined as the length of the shortest plan that solves the relaxed problem. This heuristic is consistent: The relaxed plan starting at v with
1.8 General State Space Descriptions
truck t1 obj p4 obj p3
31
truck t1 obj p1 city c2
city c1
obj p2 city c6 city c3
truck t6
city c5
obj p5
airplane plane1 airplane plane2
truck t3 obj p6
city c4 truck t4
truck t5
FIGURE 1.22 A map of a LOGISTICS problem with six cities of two locations each. Trucks operate within the cities, and airplanes connect the cities. Both mobiles transport objects when loaded. The planning task is to move the objects from their initial locations to their respective target locations (not shown in the figure).
cost h+ (v) can be extended to a plan from u by adding the action that leads from u to v. Therefore, we have h+ (u) ≤ h+ (v) + 1. Solving relaxed plans is still computationally hard. It can, however, efficiently be approximated by the number of actions in a parallel plan that solves the relaxed problem. The polynomial time algorithm builds a relaxed problem graph followed by a greedy plan generation process. A pseudo-code implementation is provided in Algorithm 1.1. The variables l and i denote the layer for the forward and the backward phases, respectively. An illustration for its work is given in Figure 1.25. The graph consists of five (encircled) layers for propositions, the last one containing the only goal. Layers are connected by actions. Propositions are identified with nodes and actions are identified with rectangles. Dotted lines denote the application of noop, an additional action that incurs no change. Propositions and actions in the relaxed plan are shaded. The first phase constructs the layered graph of propositional facts, performing a fixpoint computation on A+ = {a+ | a ∈ A} starting with the initial state. In layer i all facts are considered that are reachable by applying an action with satisfied precondition facts in any layer j with 1 ≤ j < i. In layer 0 we have all facts present in the initial state. Since we have a finite number of grounded propositions the process eventually reaches a fixpoint. The next loop marks the goal facts. The second phase is the greedy plan extraction phase. It performs a backward search to match facts to enabling actions. The goal facts build the first unmarked facts. As long as there are unmarked facts in layer i, select an action that makes this fact true and mark all add effects, and queue all preconditions as unmarked new goals. If there is no unmarked fact left in layer i, continue with layer i − 1 until the only unmarked facts are the initial ones in layer 0. The heuristic is constructive; that is, it not only returns the estimated distance but also a corresponding sequence of actions. The heuristic is neither admissible nor consistent, but it is effective in practice, especially for structurally simpler benchmark problems (problem graphs with no or recognized dead-end and small plateaus).
32
CHAPTER 1 Introduction
(define (problem strips-log-x-1) (:domain logistics-strips) (:objects p6 p5 p4 p3 p2 p1 c6 c5 c4 c3 c2 c1 t6 t5 t4 t3 t2 t1 plane2 plane1 c6-1 c5-1 c4-1 c3-1 c2-1 c1-1 c6-2 c5-2 c4-2 c3-2 c2-2 c1-2) (:init (obj p6) (obj p5) (obj p4) (obj p3) (obj p2) (obj p1) (city c6) (city c5) (city c4) (city c3) (city c2) (city (truck t6) (truck t5) (truck t4) (truck t3) (truck t2) (truck t1) (airplane plane2) (airplane plane1) (location c6-1) (location c5-1) (location c4-1) (location c3-1) (location c2-1) (location c1-1) (airport c6-2) (location c6-2) (airport c5-2) (location (airport c4-2) (location c4-2) (airport c3-2) (location (airport c2-2) (location c2-2) (airport c1-2) (location (in-city c6-2 c6) (in-city c6-1 c6) (in-city c5-2 c5) (in-city c5-1 c5) (in-city c4-2 c4) (in-city c4-1 c4) (in-city c3-2 c3) (in-city c3-1 c3) (in-city c2-2 c2) (in-city c2-1 c2) (in-city c1-2 c1) (in-city c1-1 c1) (at plane2 c4-2) (at plane1 c4-2) (at t6 c6-1) (at t5 c5-1) (at t4 c4-1) (at t3 c3-1) (at t2 c2-1) (at t1 c1-1) (at p6 c3-1) (at p5 c4-2) (at p4 c1-1) (at p3 c1-1) (at p2 c1-2) (at p1 c2-1)) (:goal (and (at p6 c1-2) (at p5 c6-2) (at p4 c3-2) (at p3 c6-1) (at p2 c6-2) (at p1 c2-1))))
c1)
c5-2) c3-2) c1-2)
FIGURE 1.23 An (untyped) STRIPS problem description in PDDL.
1.8.2 *Production Systems Another classic AI representation for a search problem is a production system.
Definition 1.12. (Production System) A production system is a state space problem P = (S, A, s, T), of which the states are strings over the alphabet 6, and the actions are given in form of grammar inference rules α → β, with α, β being strings over 6. The following theorem shows that any Turing machine computation can be casted as a special kind of a production system.
Theorem 1.3. (Undecidability for Production Systems) The problem to solve a general production system for arbitrary start and goal state is undecidable. Proof. The proof is done via reduction to the halting problem for Turing machines. Given a Turing machine M = (Q, 6, 0, 1, B, q0 , F) with input alphabet 6 = {a0 , . . . , an }, tape alphabet 0 = 6 ∪ {B},
1.8 General State Space Descriptions
33
(define (domain logistics-strips) (:requirements :strips) (:predicates (OBJ ?obj) (TRUCK ?t) (LOCATION ?loc) (AIRPLANE ?a) (CITY ?c) (AIRPORT ?airport) (at ?obj ?loc) (in ?obj1 ?obj2) (in-city ?obj ?c)) (:action LOAD-TRUCK :parameters (?obj ?t ?loc) :precondition (and (OBJ ?obj) (TRUCK ?t) (LOCATION ?loc) (at ?t ?loc) (at ?obj ?loc)) :effect (and (not (at ?obj ?loc)) (in ?obj ?t))) (:action LOAD-AIRPLANE :parameters (?obj ?a ?loc) :precondition (and (OBJ ?obj) (AIRPLANE ?a) (LOCATION ?loc) (at ?obj ?loc) (at ?a ?loc)) :effect (and (not (at ?obj ?loc)) (in ?obj ?a))) (:action UNLOAD-TRUCK :parameters (?obj ?t ?loc) :precondition (and (OBJ ?obj) (TRUCK ?t) (LOCATION ?loc) (at ?t ?loc) (in ?obj ?t)) :effect (and (not (in ?obj ?t)) (at ?obj ?loc))) (:action UNLOAD-AIRPLANE :parameters (?obj ?a ?loc) :precondition (and (OBJ ?obj) (AIRPLANE ?a) (LOCATION ?loc) (in ?obj ?a) (at ?a ?loc)) :effect (and (not (in ?obj ?a)) (at ?obj ?loc))) (:action DRIVE-TRUCK :parameters (?t ?from ?to ?c) :precondition (and (TRUCK ?t) (LOCATION ?from) (LOCATION ?to) (CITY ?c) (at ?t ?from) (in-city ?from ?c) (in-city ?to ?c)) :effect (and (not (at ?t ?from)) (at ?t ?to))) (:action FLY-AIRPLANE :parameters (?a ?from ?to) :precondition (and (AIRPLANE ?a) (AIRPORT ?from) (AIRPORT ?to) (at ?a ?from)) :effect (and (not (at ?a ?from)) (at ?a ?to)))) FIGURE 1.24 An (untyped) STRIPS domain description in PDDL.
Q = {q0 , . . . , qm }, initial state q0 , transition function 1 : Q × 0 → Q × 0 × {L, R, N}, and goal state set F = {qe }, we construct a state space problem as follows. States are configurations of the Turing machine M; that is, words of {B}+ × 0 ∗ × Q × 0 ∗ × {B}+ . (With “∗” we denote Kleene’s hull: For a single letter σ , the term σ ∗ refers to the set {, σ , σ 2 , σ 3 , . . .}, where ∈ 6 ∗ is the empty word. For all α, β ∈ 6 ∗ we have αβ ∈ 6 ∗ .) The initial state is state B∗ q0 B∗ and the goal state is B∗ qe B∗ . Depending on the value of d we assign each aq → bq0 d to words wcqaw0 → s, s ∈ {wcq0 bw0 , wcbq0 w0 , wq0 cbw0 } with w ∈ {B}+ × 0 ∗ and w0 ∈ 0 ∗ × {B}+ . For d = N we have wcqaw0 → wq0 bw0 ; for d = R we have wcqaw0 → wvq0 bw0 ; and for d = L we have wqcaw0 → wq0 cbw0 . Last, but not least, the rules wqe BBw0 → wqe Bw0 and wBBqe w0 → wBqe w0 shorten the empty tape. Hence, we have deduced that M halts on an empty input tape starting from q0 in finitely many steps in terminal state qe if and only if the initial state B∗ q0 B∗ can be transformed into goal state B∗ qe B∗ in finitely many steps.
34
CHAPTER 1 Introduction
Procedure Relaxed-Plan Input: Relaxed planning problem with current state u and condition Goal ⊆ 2AP Output: Value of the relaxed planning heuristic for u P0 ← u; l ← 0 ;; Set initial layer and iteration counter while (Goal 6⊆ Pl )S ;; Forward search phase Pl+1 ← Pl ∪ pre(a)⊆Pt add(a) ;; Build next layer if (Pl+1 = Pl ) return ∞ ;; Fixpoint reached l ← l+1 ;; Increase counter for each i in {0, . . . , l − 1} ;; Backward traversal Tl−i ← {t ∈ Goal | layer(t) = l − i} ;; Initialize goal queues for each i in {0, . . . , l − 1} ;; Backward search phase for each t in Tl−i ;; Consider each open goal in layer l − i if (a in A with t in add(a) and layer(a) = l − i − 1) ;; Match found RelaxedPlan ← RelaxedPlan ∪ {a} ;; Include action to relaxed plan for each p in pre(a) ;; Select preconditions Tlayer(p) ← Tlayer(p) ∪ {p} ;; Append to queues return |RelaxedPlan| ;; Size of action set is heuristic estimate Algorithm 1.1 Computing the approximation of the relaxed planning heuristic.
FIGURE 1.25 Working of the approximation of the relaxed planning heuristic. Nodes are propositions and rectangles are actions connected in the form of a layered graph constructed in the forward plan graph generation phase. The propositions in the initial state are shown on the left; the goal layer is depicted on the right. Shaded operators illustrate the relaxed plans and have been selected in the greedy backward extraction phase.
1.8 General State Space Descriptions
35
However, individual state space problems, including the ones with finite-state spaces, are decidable, so that most combinatorial problems like instances to the (n2 − 1)-Puzzle are solvable by general node expanding algorithms. A convenient though less expressive formalism than general production systems is PSVN, or vector notation for productions systems. It is defined by a triple (s, A, L), where s is a seed state, A is the set of actions, and L is the finite set of labels. States are represented by fixed-length vectors of labels from L. For example, the states of the Three-Puzzle (the (n2 − 1)-Puzzle for n = 2) can be described as a 4-tuple, of which the components are chosen out of L = {0, 1, 2, 3} to indicate which tile is located at the top-left, top-right, bottom-left, and bottom-right squares, respectively. Actions are defined by a left-hand side (LHS), representing the precondition, and a right-hand side (RHS), defining the resulting state. Each side has the same length as the state vector. The semantics are defined in a way resembling Prolog unification rules; each position can hold a constant, a named variable, or an unnamed variable, denoted “ ”. A constant in LHS represents an exact match for a state at that position. A named variable in LHS represents a binding of the label in the state to which LHS is being applied, and basically leaves a label unchanged. Every variable of RHS must be bound in LHS and every constant label must belong to the set of declared labels. The state space is the transitive closure of applying any sequence of actions to s. For example, consider the following action definition a = (A, A, 1, , B, C) → (2, , , , C, B). The action applies to states of which the first two labels are identical and the third label is 1. The fifth and sixth labels are bound to B and C, respectively. Applying a to state u = (4, 4, 1, 7, 5, 6) results in a(u) = (2, 4, 1, 7, 6, 5). In the Three-Puzzle, the action (0, A, , ) → (A, 0, , ) moves the blank from the top-left to the top-right square.
1.8.3 Markov Decision Processes Markov decision process problems (MDPs) assume a finite number of states and actions. At each time the agent observes a state and executes an action, which incurs intermediate costs to be minimized (or, in the inverse scenario, rewards to be maximized). The cost and the successor state depend only on the current state and the chosen action. Successor generation may be probabilistic, based on the uncertainty we have on the environment in which the search takes place. For example, an action might sometimes fail to result in the desired target state, instead staying in the current state with a small probability. We should point out that in this book we assume that we always have perfect knowledge of what state we are in. This assumption is dropped in the concept of a partially observable Markov decision process problem (POMDP). Here, instead, we are given some observations based on which we can estimate the probability of being in a certain state.
Definition 1.13. (MDP) A Markov decision process problem is a tuple (S, A, w, p), where S is the underlying state space, A is the set of actions, w : S × A → IR is the cost or immediate reward function, and p(v | u, a) is the probability that action a in state u will lead to state v. In some MDPs, additional costs c incur when arriving at a goal state. The goal is to minimize the (expected) accumulated costs or, equivalently, to maximize the (expected) accumulated rewards. As Markov decision processes are defined on sequences of actions they are an extension of Markov chains.
36
CHAPTER 1 Introduction
Definition 1.14. (Policy) A solution to an MDP is provided in terms of a policy π, which maps each state to an action to take in this state. In some cases the policy may be realized by means of a lookup table, whereas in others it may involve extensive computation. Applying action a in u incurs costs w(u, a). The goal is to minimize the expected costs f π (u) for a state u over the set of all possible policies π, where the value function f π (u) at u is often called expected return, starting from u. The optimal value function is denoted by f ∗ .
1.8.4 Generic Search Model A generalized model of a state space search problem consists of a discrete and finite-state space S, an initial state s, and a nonempty set of terminal states T. Furthermore, a set of actions A(u) ⊆ A applicable in each nonterminal state u, an action cost function w : (S \ T) × A → X for nonterminal states, and a terminal cost function c : T → X are assumed. In the general case, X is a real-valued cost function, but in many practical cases X is a small set of integers. In deterministic models, the successors of a node u are Succ(u) = {v ∈ S | ∃a ∈ A(u) and a(u) = v}. For the nondeterministic search model, we have Succ(u, a) = {v ∈ S | a ∈ A(u) and a(u) = v}. Successor outcomes are either added or maximized. For MDPs with probabilities p(v | u, a) we have P that v∈Succ(u,a) p(v | u, a) = 1. A simple example of an MDP is a probabilistic version of the (n2 − 1)-Puzzle with noisy actions that achieve their intended effects with probability p = 0.9 and have no effect with probability 1 − p. The solutions to the models can be expressed in terms of Bellman equations, which induce options to compute optimal policies. For the deterministic case we have ( 0 if u ∈ T . f (u) = minv∈Succ(u) {w(u, v) + f (v)} otherwise For the nondeterministic case we have either (additive model) 0 ) if u ∈ T ( P f (u) = min w(u, a) + f (v) otherwise a∈A(u) v∈Succ(u,a) or (max model)
f (u) =
0
) if u ∈ T
(
min w(u, a) + a∈A(u)
For the MDP case we have c(u) ( f (u) = min w(u, a) + a∈A(u)
max f (v) v∈Succ(u,a)
otherwise
.
if u ∈ T ) P v∈Succ(u,a)
p(v | u, a) · f (v)
otherwise
.
1.9 Summary
37
In a unified perspective, the functions f ∗ are solutions to the set of Bellman equations, and, hence, optimal value functions. Policies π : S → A for the nondeterministic and probabilistic cases are extensions of plans that map states to actions. In practice, they are used in the form of controllers to simulate the solution process. Policies are greedy if they match any given value function, and policies π ∗ that are greedy with respect to the optimal value function are called optimal. For the deterministic setting, the outcome of applying an action is unique, such that π can be reduced to a sequence of states. In this case the optimal value function f ∗ exactly estimates the total distance from each state to a goal state; that is, ( k ) X ∗ f = min w(ui−1 , a) | s = u0 , uk ∈ T , π=(u0 ,...,uk )
and the optimal plan
π∗
i=1
is the one that minimizes its total cost; that is, ( k ) X ∗ π = arg min w(ui−1 , a) | s = u0 , uk ∈ T . π=(u0 ,...,uk )
i=1
In some implementations, the update is performed on the Q-value q(a, u), an intermediate term in the preceding equations, which also depends on the model. It is defined for deterministic models as q(a, u) = w(a) + f (a(u)), for nondeterministic (additive and max) models as X
q(a, u) = w(u, a) +
f (v) ,
v∈Succ(u,a)
q(a, u) = w(u, a) +
max
v∈Succ(u,a)
f (v),
and for MDPs as q(a, u) = w(u, a) +
X
p(v | u, a) · f (v).
v∈S
1.9 SUMMARY In this chapter, we introduced the kinds of problems that we study in most chapters of this book, namely graph search problems where we are given a weighted directed graph (where edges are directed and have a cost), a start node, and a set of goal nodes, and the objective is to find a shortest path in the graph from the start node to any goal node. We introduced the terminology used in artificial intelligence for such graph search problems. The nodes, for example, are called states and the edges are called actions. We then discussed ways of categorizing graphs, for example, their branching factor (the number of outgoing edges averaged over all nodes). We also discussed two ways of representing graphs, namely explicitly (by enumerating all nodes and edges) and implicitly (by giving a procedure of which the
38
CHAPTER 1 Introduction
input is a node and the output is a list of outgoing edges together with the nodes that they point to). Implicit graph representations can be problem-specific or general, for example, using Strips or production systems. Implicit representations can be much more compact than explicit representations, which allow implicit representations to represent large graph search problems by exploiting their structure. However, a shortest path can be found in time polynomial in the size of an explicit representation, but often not in time polynomial in the size of an implicit representation. We then discussed several problems that can be formulated as graph search problems, some of which are used as typical test domains for graph search algorithms and some of which are important in practice, including for transportation systems and biology. In many of these domains, the shortest path is important since it allows one to move from the start node to a goal node. In some domains (e.g., in the TSP), however, only the goal node reached by the shortest path is important since it encodes how to move. To be efficient, graph search algorithms need to exploit some knowledge of the graphs they search. This knowledge can be provided by the domain expert in the form of encoding the heuristic function manually, or, as illustrated later in this book, obtained automatically from the problem structure. Table 1.1 gives an overview on the state space problems in this chapter and their characteristics (implicit/explicit graph, reversible/irreversible actions, range of weight function, complexity). These search problems dominate the content of the book but are not the only ones that we discuss; we also discuss different two-player games. One powerful piece of knowledge for solving state space problems is a heuristic. A heuristic assigns a heuristic value to every node, where a heuristic value is an estimate of the goal distance of the node (the length of a shortest path from the node to any goal node). Good heuristics are close to the goal distances and fast to calculate. They can be found easily for most graph search problems. Two important properties are their admissibility (does not overestimate the goal distances) and consistency (satisfies the triangle inequality), where consistency implies admissibility. In Chapter 2, we introduce a graph search algorithm that is able to exploit a given heuristic. Table 1.2 depicts the properties of the heuristics that have been introduced. Additionally, we show the order of runtime for computing the heuristic estimate for a state (measured in the size of the state vector).
Table 1.1 State spaces and their characteristics. Problem (n2 − 1)-PUZZLE RUBIK’S CUBE SOKOBAN TSP MSA ROUTE PLANNING STRIPS Production System
Implicit √ √ √ √ √ – √ √
Reversible √ √ – √ – – – –
Weight
Complexity
unit unit unit IR>0 IR≥0 unit unit unit
NP-hard fixed PSPACE-hard NP-hard NP-hard fixed PSPACE-hard undecidable
1.10 Exercises
39
Table 1.2 State spaces and their heuristics. Problem
Name
(n2 − 1)-PUZZLE
Manh. Distance Manh. Distance Min. Matching MST Sum-of-Pairs Eucl. Distance Relax
RUBIK’S CUBE SOKOBAN TSP MSA ROUTE PLANNING STRIPS
Admissible √ √ √ √ √ √
Consistent √ √ √ √ √ √
–
–
Complexity linear linear cubic superlinear quadratic constant polynomial
Some heuristics (e.g., the relaxed planning or the Euclidean distance) do not shrink the problem graph but introduce new edges. In other heuristics (e.g., the Manhattan distance or minimal matching), sets of nodes are contracted to super-nodes, and adjacent edges are merged (the principle will be reconsidered in Chapter 4). One problem in deriving well-informed heuristics based on problem projections is to devise problem simplifications, so that the individual estimates based on solving the subproblems can be added admissibly.
1.10 EXERCISES 1.1
Write a Turing machine program in pseudo code for the following problems: 1. Addition of two numbers in unary representation. 2. Increment of a number in binary representation. 3. Decrement of a number in binary representation. 4. Addition of two numbers in binary representation (use parts (b) and (c)).
1.2
1. Determine constants c and n0 , to show (n + 1)2 = O(n2 ). 2. If the limit of f (n)/g(n) for large n is bounded by a constant c we have that f (n) = O(g(n)). Use this result to show (n + 1)2 = O(n2 ). 3. The Rule of L’Hˆopital states that if the limit of f 0 (n)/g0 (n) for large n is bounded then it is equal to the limit of f (n)/g(n) for large n. Use this rule to prove (n + 1)2 = O(n2 ).
1.3
Prove the big-oh 1. addition rule: O( f ) + O(g) = O(max{ f , g}) 2. multiplication rule: O( f ) · O(g) = O( f · g), for given functions f and g. Explain the practical use of the rules.
1.4
1. Let a, b, c be real values with 1 < b, 1 ≤ a, c. Show lgb (an + c) = 2(lg2 n). 2. Let p(n) be a polynomial of constant degree k. Show O(lg p(n)) = O(lg n). √ 3. Show (lg n)3 = O( 3 n) and, more generally, (lg n)k = O(n ) for all k, > 0. . Show that according to the definition of = . 1. n2n = 2n . 2. n2 2n + (n + 1)4 3n = 3n
1.5
40
CHAPTER 1 Introduction
1.6
Show that a problem L is in NP if and only if there exist a polynomially decidable predicate P and a polynomial p such that L can be expressed as the set of all words w for which there exists a w0 with |w0 | ≤ p(|w0 |) and P(w, w0 ) is true.
1.7
Show that the bit-flipping efforts for a binary counter according to the following table are amortized constant. Step 0 1 2 3 4 5 6 7 8
Operation 0 ↓ 1 ↓ 10 ↓ 11 ↓ 100 ↓ 101 ↓ 110 ↓ 111 ↓ 1000 ↓ 1001
8i 0
ti
ai = ti + 8i+1 − 8i
1
2
2
2
1
2
3
3 + (1 − 2) = 2
1
2
2
2
1
2
4
4 + (1 − 3) = 2
1
2
1 1 2 1 2 2 3 1 2
1.8
The pseudo code we consider uses different loop and case statements. Show that 1. for (i ∈ {1, . . . , n}) hBi 2. do hBi while (hAi) 3. if (hAi) hBi else hCi are all syntactic sugar and can be expressed with a classic while loop.
1.9
The Fibonacci numbers are recursively defined as follows: F(0) = 0 F(1) = 1 F(n) = F(n − 1) + F(n − 2) , for n ≥ 2. Show by induction that 1. for n ≥ 6 we have F(n) ≥ 2n/2 2. for n ≥ 0 we have F(0) + · · · + F(n) = F(n + 2) − 1 3. for n ≥ 1 we have F 2 (n) = F(n − 1)F(n + 1) + (−1)n+1
1.10 Exercises
1.10
41
The Ackermann function is defined as follows: a(0, y) = y + 1 a(x + 1, 0) = a(x, 1) a(x + 1, y + 1) = a(x, a(x + 1, y)). Use induction to show 1. a(1, y) = y + 2 2. a(2, y) = 2y + 3
1.11
Use a truth table to show 1. ((A → (¬B → C)) ∧ (A → ¬B)) ∧ ¬(A → C) 2. (A ∧ (B ∨ C)) ⇔ ((A ∧ B) ∨ (A ∧ C))
1.12
Given four pieces of chain (initial state shown in Fig. 1.26, left), the Cheap Necklace problem is characterized as follows. It costs 20 cents to open and 30 cents to close a link. Join all links into a single necklace (goal state in Figure 1.26, right) at the lowest cost.
FIGURE 1.26 The CHEAP NECKLACE problem: initial state (left) and goal state (right).
1. What are the states? What are the actions? What is the start state? What are the goal states? What are the weights? What are the costs for an optimal solution? 2. How many states are there? What is the average branching factor? 3. Is the graph directed or undirected? Does the graph contain dead-ends? 1.13
For the General Sliding-Tile Puzzle: 1. Compute the number of reachable system states for the instances of Figure 1.27. In the Harlequin Puzzle (left) the two corner pieces have to be assembled to a 2 × 3 block. In the Man and Bottle Puzzle (right), the man at the left side has to move to the right next to the bottle. 2. Give a suitable generalization of the Manhattan distance heuristic. 3. Show that the test for successor generation can be performed in total time linear to the number of tiles (counting blanks as empty tiles).
1.14
Consider the example level in Sokoban shown in Figure 1.14. 1. Determine an optimal solution for Pushes and for Moves. 2. Show that, in general, optimal solutions for both problems differ.
42
CHAPTER 1 Introduction
FIGURE 1.27 Further instances of the GENERAL SLIDING-TILE PUZZLE.
1.15
Consider the minimal Multiple Sequence Alignment problem between ACGTACGACGT and ATGTCGTACACGT. Take as a cost function the one that assigns cost 1 to a mismatch and cost 2 to a gap. Find the minimal alignment of the two sequences.
1.16
For Blocksworld: 1. Model the problem of Figure 1.21 in Strips using the predicates on, clear, and holding. 2. Show that finding a solution that is at most twice as long as the optimal one can be computed in polynomial time.
1.17
Another scalable sliding-tile puzzle Frogs and Toads invented by Gardner additionally allows tile jumps (see Fig. 1.28). The goal is to exchange the sets of black and white tiles in the minimum number of moves. 1. Give a state space characterization of the puzzle. 2. Determine the number of reachable configurations in a formula depending on n. 3. Devise a heuristic for the puzzle.
FIGURE 1.28 An instance of Gardner’s game. A tile can either slide or jump if the target location is empty.
1.18
The goal of Atomix (see Fig. 1.29) is to assemble a given molecule from atoms. The player can select an atom at a time and push it toward one of the four directions left, right, up, and down; it will keep moving until it hits an obstacle or another atom. The game is won when the atoms form the same constellation (the molecule) as depicted beside the board. Note that the interconnection of the atoms matters.
1.10 Exercises
H
H H
O
H
H
C
H
N H
C
C
H O
H C
H H H
H H
H
H H
H C H H
C
C
H
C C H C H C C C N C N C
H H
H
H
43
C
C
H
H C C
N H
H C
H
FIGURE 1.29 Two levels of ATOMIX. The molecule to be assembled is shown to the top-right of each problem instance. The problem to the left can be solved with 13 moves. Atom 1: DL; Atom 3: LDRURDLDR; Atom 2: D; Atom 1: R. The instance to its right illustrates a more complex problem; it takes at least 66 moves to solve.
1. Formalize Atomix as a state space problem. 2. Extend Figure 1.15 with the characteristics of Atomix. 3. Obtain an easily computable heuristic that allows an atom to slide through other atoms or share a place with another atom. 4. Find a solution for Figure 1.29. 1.19
An n-Wusel (see Fig. 1.30) consists of n connected blocks. In motion, a group of blocks is simultaneously moved. The possible directions are left, right, up, down, forward, and backward. A move group is connected. An example for a sequence of moves is given in Figure 1.31. Cubes connected to the ground can only be moved upward. At least one block has to stay on the ground. All other blocks have to be arranged such that the Wusel is in balance. The Wusel tumbles if the projection of the center of mass is outside the convex hull of the blocks on the floor (the convex hull includes all points on lines between any two points).
FIGURE 1.30 A particular WUSEL of 15 blocks (3 blocks are not visible).
44
CHAPTER 1 Introduction
FIGURE 1.31 A valid move sequence for a particular 3-WUSEL with intermediate configurations to illustrate the transition.
1. 2. 3. 4. 5.
Give a (coarse) estimate for the number of n-Wusels. Choose an appropriate representation that allows fast connectivity checks. Find out how to efficiently perform stability checks for the Wusel. Devise an efficient function for a successor generation. Devise a heuristic estimate for the Wusel wrt. a target location for the center of mass.
1.20
For the Route Planning problem devise a consistent heuristic for finding: 1. The shortest-fastest route. 2. The fastest-shortest route. 3. A weighted combination of the two.
1.21
Test your structural knowledge on heuristics. 1. Prove that the maximum of several consistent heuristics is a consistent heuristic. 2. Show that the sum of two consistent estimates is not necessarily admissible. 3. Give an example of an admissible heuristic that is not consistent.
1.22
Devise a PSVN characterization of the state and state change for the Rubik’s Cube.
1.23
Prove that a PSVN action is reversible, if and only if there is no i such that the label at i of the left side is , the label at i of the right side is different to , and every variable bound on the left side is present on the right side; that is, if it is used to assign a label on the right side, or if there is a j so that the label at j on the left side is some variable A, and on the right side, it is either or A.
1.24
The cross-product state space P = (S, A, s, T) of the state space problems P1 , . . . , Pn is defined as S = S1 × · · · × Sn , s = (s1 , . . . , sn ), T = {(u1 , . . . , un )| ∀i ∈ {1, . . . , n} : ui ∈ Ti }, and A = {((u1 , . . . , un ), (v1 , . . . , vn )) | ∃i ∈ {1, . . . , n} : ∃a ∈ Ai : a(ui ) = vi and ∀i 6= j : uj = vj }. Let heuristic hi be the minimal solution length from the current local state Si to reach a goal in Ti for problem Pi . Show that hi is consistent.
1.25
Devise an MDP model for a variant of the the (n2 − 1)-Puzzle domain, where each intended move fails with a probability of 10%.
1.26
An instance of the pen-and-paper game Racetrack is defined by a racetrack divided into grid cells together with cars initially standing behind a starting line. The goal is to cross an additional finish line. The task is to find the control for driving a car from an initial state into a set of goal states, minimizing the number of time steps and without hitting the racetrack’s boarder. Each applied action achieves its intended effect with probability 0.7. Provide an MDP model for Racetrack with states consisting of coordinates (x, y) and velocity vectors (1x , 1y ).
1.11 Bibliographic Notes
45
1.11 BIBLIOGRAPHIC NOTES Milestones in single-agent games refer to publications of Korf (1985a), Korf and Schultze (2005) (Fifteen-Puzzle), Korf and Felner (2002), Korf and Taylor (1996) (Twenty-Four-Puzzle), Edelkamp et al. (2008b) (Thirty-Five-Puzzle), Korf and Felner (2007) (Towers-of-Hanoi), Junghanns (1999) (Sokoban) and Korf (1997), Kunkle and Cooperman (2008) (Rubik’s Cube). Reid has shown in 1995 that the one position (corners correct, edges placed but flipped) requires at least 20 moves; the according lower bound has been proven in 2010 by Rokicki, Kociemba, Davidson, and Dethridge.2 The presentation of multiplayer game efficiencies refers to the work of Campbell et al. (2002) (Chess), Schaeffer et al. (2005, 2007) (Checkers), Tesauro (1995) (Backgammon), Allen (2010), Allis (1998), Tromp (2008) (Connect 4), and Ginsberg (1999) and Smith et al. (1998) (Bridge). The number 4,531,985,219,092 computed by Edelkamp and Kissmann (2008b) for Connect 4 has been validated by John Tromp in 2010. Large-scale search in probabilistic environments has been studied by Edelkamp et al. (2007). The set of remarkable results in planning have been published in the context of the international planning competitions. Parallel optimal planning has been addressed by Blum and Furst (1995) and Kautz and Selman (1996), while sequential optimal planning has been considered by Helmert et al. (2007), among others. UCT for general game playing goes back to Kocsis and Szepesva´ ri (2006). Multiple sequence alignment problems have been solved with AI search methods by Edelkamp and Kissmann (2007), and Korf and Zhang (2000), Schro¨ dl (2005), and Zhou and Hansen (2002b). Recent entries to verification via AI search are given by Edelkamp et al. (2004b) (explicit-state model checking), Bloem et al. (2000) (hardware verification), Groce and Visser (2002) (program model checking), Jabbar (2008) (external model checking), Wijs (1999) (quantitative model checking), and Kupferschmid et al. (2007) (real-time model checking). Vehicle navigation results refer to work by Bast et al. (2007), Wagner and Willhalm (2003) (maps), Edelkamp et al. (2003) and Schro¨ dl et al. (2004) (GPS). From the broad range of applying search in robotics we highlighted results of Gutmann et al. (2005) and Henrich et al. (1998). The motivating example is taken from Wickelgren (1995). Ratner and Warmuth (1990) have shown that optimally solving the (n2 − 1)-Puzzle is NP-hard. First optimal solutions to the EightPuzzle have been provided by Schofield (1967), for the Fifteen-Puzzle by Korf (1985a), and for the Twenty-Four-Puzzle by Korf and Taylor (1996), with an improvement by Korf and Felner (2002). The General Sliding-Tile Puzzle problems are either commercially available or taken from Berlekamp et al. (1982). Many suboptimal solutions to Rubik’s Cube have been published but random instances have been solved optimally by Korf (1997) for the first time. TSP is a touchstone for many general heuristics devised for combinatorial optimization: genetic algorithms, simulated annealing, Tabu search, neural nets, ant system, some of which will be discussed later in this book. For Metric TSP, Christofides (1976) gives a constant-factor approximation algorithm that always finds a tour of length at most 1.5 times the shortest one. Sokoban is one of the remaining single-player games in which the human solution quality is competitive to automatic solving strategies. Culberson (1998a) has proven that Sokoban is PSPACE-hard. In his PhD thesis, Junghanns (1999) has discussed an implementation that could solve 56 of the 90 2 http://www.cube20.org.
46
CHAPTER 1 Introduction
problems push-optimally. Computing the minimal matching is reduced to network flow. An initially empty matching is iteratively enlarged by computing single-source shortest paths. Dijkstra’s original algorithm has to be modified to handle edges with negative weights. The results on branching factors, solution lengths, and search space sizes of block sliding games are contained in the work of Edelkamp and Korf (1998) and Junghanns (1999). Block sliding complexities have been studied by Demaine et al. (2000). Atomix has been studied by Hu¨ ffner et al. (2001). Holzer and Schwoon (2001) have proven that it is PSPACE complete. The Wusel problem has appeared as a challenge in a computer science competition for high school students in Germany. Gusfield (1997) and Waterman (1995) have given introductions to computational molecular biology and Multiple Sequence Alignment. Dayhoff et al. (1978) have proposed a model of molecular evolution where they estimate the exchange probabilities of amino acids for different amounts of evolutionary divergence; this gives rise to the so-called PAM matrices, where PAM250 is generally the most widely used. Jones et al. (1992) have refined the statistics based on a larger body of experimental data. The preprocessed heuristic is due to Ikeda and Imai (1994). Strips-type planning has been invented by Fikes and Nilsson (1971). Bylander (1994) has proven that propositional planning is PSPACE complete. He has also shown that finding optimal solutions for the relaxed planning problem is NP-hard. Hoffmann and Nebel (2001) have studied the polynomial time approximation based on greedily extracting a relaxed plan in a layered planning graph. The heuristic has been incorporated in many actual planning systems and has been extended to numerical planning domains (Hoffmann, 2003) and to temporal domains (Edelkamp, 2003c). Decidability and undecidability results for planning with numbers were given by Helmert (2002). PSVN has been discussed by Herna´ dvo¨ gyi and Holte (1999). MDP instances are found in Barto et al. (1995), in Hansen and Zilberstein (2001), as well as in Bonet and Geffner (2006).
CHAPTER
Basic Search Algorithms
2
Exploring state space problems often corresponds to a search for a shortest path in an underlying problem graph. Explicit graph search algorithms assume the entire graph structure to be accessible either in adjacency matrix or list representation. In case of implicit graph search, nodes are iteratively generated and expanded without access to the unexplored part of the graph. Of course, for problem spaces of acceptable size, implicit search can be implemented using an explicit graph representation, if that helps to improve the runtime behavior of the algorithm. Throughout the book, we will be concerned mostly with the Single-Source Shortest Path problem; that is, the problem of finding a solution path such that the sum of the weights of its constituent edges is minimized. However, we also mention extensions to compute the All Pairs Shortest Paths problem, in which we have to find such paths for every two vertices. Obviously, the latter case is only feasible for a finite, not too large number of nodes, and since the solution involves storing a number of distances, it is quadratic to the number of nodes in the problem graph. The most important algorithms for solving shortest path problems are:
. . . ..
Breadth-first search and depth-first search refer to different search orders; for depth-first search, instances can be found where their naive implementation does not find an optimal solution, or does not terminate. Dijkstra’s algorithm solves the Single-Source Shortest Path problem if all edge weights are greater than or equal to zero. Without worsening the runtime complexity, this algorithm can in fact compute the shortest paths from a given start point s to all other nodes. The Bellman-Ford algorithm also solves the Single-Source Shortest Paths problem, but in contrast to Dijkstra’s algorithm, edge weights may be negative. The Floyd-Warshall algorithm solves the All Pairs Shortest Paths problem. The A* algorithm solves the Single-Source Shortest Path problem for nonnegative edge costs.
The difference of A* from all preceding algorithms is that it performs a heuristic search. A heuristic can improve search efficiency by providing an estimate of the remaining, yet unexplored distance to a goal. Neither depth-first search, nor breadth-first, nor Dijkstra’s algorithm take advantage of such an estimate, and are therefore also called uninformed search algorithms. In this chapter, we prove correctness of the approaches and discuss the optimal efficiency of A* (with regard to other search algorithms). We show that the A* algorithm is a variant of the implicit variant of Dijkstra’s Single-Source Shortest Path algorithm that traverses a reweighted problem graph, transformed according to the heuristic. With nonoptimal A* variants we seek for a trade-off between solution optimality and runtime efficiency. We then propose the application of heuristic search
47
48
CHAPTER 2 Basic Search Algorithms
to problem graphs with a general or algebraic notion of costs. We solve the optimality problem within those cost structures by devising and analyzing cost-algebraic variants of Dijkstra’s algorithm and A*. Generalizing cost structures for action execution accumulates in a multiobjective search, where edge costs become vectors.
2.1 UNINFORMED GRAPH SEARCH ALGORITHMS In implicit graph search, no graph representation is available at the beginning; only while the search progresses, a partial picture of it evolves from those nodes that are actually explored. In each iteration, a node is expanded by generating all adjacent nodes that are reachable via edges of the implicit graph (the possible edges can be described for example by a set of transition rules). This means applying all allowed actions to the state. Nodes that have been generated earlier in the search can be kept track of; however, we have no access to nodes that have not been generated so far. All nodes have to be reached at least once on a path from the initial node through successor generation. Consequently, we can divide the set of reached nodes into the set of expanded nodes and the set of generated nodes that are not yet expanded. In AI literature the former set is often referred to as the Open list or the search frontier, and the latter set as the Closed list. The denotation as a list refers to the legacy of the first implementation, namely as a simple linked list. However, we will see later that realizing them using the right data structures is crucial for the search algorithm’s characteristics and performance. The set of all explicitly generated paths rooted at the start node and of which the leaves are the Open nodes constitutes the search tree of the underlying problem graph. Note that while the problem graph is defined solely by the problem domain description, the search tree characterizes the part explored by a search algorithm at some snapshot during its execution time. Figure 2.1 gives a visualization of a problem graph and a corresponding search tree. In tree-structured problem spaces, each node can only be reached on a single path. However, it is easy to see that for finite acyclic graphs, the search tree can be exponentially larger than the original c e
f
a
b
c
d
e
f
d
c
f
e
b d
g
a
g
a
c
g
a
FIGURE 2.1 The problem graph (left) and its search tree (right). As a trivial improvement (to any search algorithm) we do not generate ancestors; for example the node a from a-c-d and from a-d-c has been pruned.
2.1 Uninformed Graph Search Algorithms
49
Procedure Implicit-Graph-Search Input: Implicit problem graph with start node s, weight function w, successor generation function Expand, and predicate Goal Output: Path from s to a goal node t ∈ T, or ∅ if no such path exists Closed ← ∅ Open ← {s} while (Open 6= ∅) Remove some u from Open Insert u into Closed if (Goal(u)) return Path(u) Succ(u) ← Expand(u) for each v in Succ(u) Improve(u, v) return ∅
;; Initialize structures ;; Insert s into empty search frontier ;; As long as there are frontier nodes ;; Select node in algorithm-specific way ;; Update list of expanded nodes ;; Reconstruct solution using Alg. 2.2 ;; Generate successor set ;; For all successors v of u ;; Call Alg. 2.3, update structures ;; No solution exists
Algorithm 2.1 Skeleton of search algorithms in implicitly given graphs.
search space. This is due to the fact that a node can be reached multiple times, at different stages of the search via different paths. We call such a node a duplicate; for example, in Figure 2.1 all shown leaves at depth 3 are duplicates. Moreover, if the graph contains cycles, the search tree can be infinite, even if the graph itself is finite. In Algorithm 2.1 we sketch a framework for a general node expansion search algorithm.
Definition 2.1. (Closed/Open Lists) The set of already expanded nodes is called Closed and the set of generated but yet unexpanded nodes is called Open. The latter is also denoted as the search frontier. As long as no solution path has been established, a frontier node u in Open is selected and its successors are generated. The successors are then dealt with in the subroutine Improve, which updates Open and Closed accordingly (in the simplest case, it just inserts the child node into Open). At this point, we deliberately leave the details of how to Select and Improve a node unspecified; their subsequent refinement leads to different search algorithms. Open and Closed were introduced as data structures for sets, offering the opportunities to insert and delete nodes. Particularly, an important role of Closed is duplicate detection. Therefore, it is often implemented as a hash table with fast lookup operations. Duplicate identification is total, if in each iteration of the algorithm, each node in Open and Closed has one unique representation and generation path. In this chapter, we are concerned with algorithms with total duplicate detection. However, imperfect detection of already expanded nodes is quite frequent in state space search out of necessity, because very large state spaces are difficult to store with respect to given memory limitations. We will see many different solutions to this crucial problem in upcoming chapters. Generation paths do not have to be fully represented for each individual node in the search tree. Rather, they can be conveniently stored by equipping each node u with a predecessor link parent(u), which is a pointer to the parent in the search tree (or ∅ for the root s). More formally, parent(v) = u
50
CHAPTER 2 Basic Search Algorithms
Procedure Path Input: Node u, start node s, with start node s, weight function w, parent pointers set by search algorithm Output: Path from s to u Path ← (u) while (parent(u) 6= s) Path ← (u, Path) u ← parent(u) return (s,Path)
;; Path with single element ;; Loop through predecessors ;; Extend path by u ;; Continue with predecessor ;; Beginning of path reached
Algorithm 2.2 Tracing back the solution path using predecessor links.
Procedure Improve Input: Nodes u and v, v successor of u Side effects: Update parent of v, Open, and Closed if (v not in Closed ∪ Open) Insert v into Open parent(v) ← u
;; v not yet reached ;; Update search frontier ;; Set predecessor pointer
Algorithm 2.3 Improve procedure with duplicate detection and predecessor links.
if v ∈ Succ(u). By tracing the links back in bottom-up direction until we arrive at the root s, we can reconstruct a solution path Path(u) of length k as (s = parentk (u), . . . , parent(parent(u)), parent(u), u) (see Alg. 2.2). Algorithm 2.3 sketches an implementation of Improve with duplicate detection and predecessor link updates.1 Note that this first, very crude implementation does not attempt to find a shortest path; it merely decides if a path exists at all from the start node to a goal node. To illustrate the behavior of the search algorithms, we take a simple example of searching a goal node at (5, 1) from node (3, 3) in the Gridworld of Figure 2.2. Note that the potential set of paths of length i in a grid grows exponentially in i; for i = 0 we have at most 1 = 40 , for i = 1 we have at most 4 = 41 , and for i = k we have at most 4k paths.
2.1.1 Depth-First Search For depth-first search (DFS), the Open list is implemented as a stack (a.k.a. a LIFO, or last-in first-out queue), so that Insert is in fact a push operation and Select corresponds to a pop operation. Operation 1 In this chapter we explicitly state the calls to the underlying data structure, which are considered in detail Chapter 3. In later
chapters of the book we prefer sets for Open and Closed.
2.1 Uninformed Graph Search Algorithms
51
5 4 3 2 1 1
2
3
4
5
FIGURE 2.2 The GRIDWORLD search space.
Table 2.1 Steps in DFS (with duplicate detection) for the example in Figure 2.1. Step
Selection
1 2 3 4 5 6 7 8
{} a b e f c d g
Open
Closed
Remarks
{a} {b,c,d} {e,f,c,d} {f,c,d} {c,d} {d} {g} {}
{} {a} {a,b} {a,b,e} {a,b,e,f} {a,b,e,f,c} {a,b,e,f,c,d} {a,b,e,f,c,d,g}
f is duplicate e is duplicate d is duplicate c is duplicate Goal reached
push places an element and operation pop extracts an element at the top of this data structure. Successors are simply pushed onto the stack. Thus, each step greedily generates a successor of the last visited node, unless it has none, in which case it backtracks to the parent and explores another not yet explored sibling. It is easy to see that in finite search spaces DFS is complete (i.e., will find a solution path if there is some), since each node is expanded exactly once. It is, however, not optimal. Depending on which successor is expanded first, any path is possible. Take, for example, the solution ((3,3), (3,2), (2,2), (2,3), (2,4), (2,5), (3,5), (3,4), (4,4), (4,3), (5,3), (5,4), (5,5)) in the Gridworld example. The path length, defined as the number of state transitions, is 12 and hence larger than the minimum. Table 2.1 and Figure 2.3 show the expansion steps and the search tree explored by DFS when run on the example of Figure 2.1. Without loss of generality, we assume that children are expanded in alphabetical order. Without duplicate elimination, DFS can get trapped in cycles of the problem graph and loop forever without finding a solution at all.
2.1.2 Breadth-First Search For breadth-first search (BFS), the set Open is realized as a first-in first-out queue (FIFO). The Insert operation is called Enqueue, and adds an element to the end of the list; the Dequeue operation selects
52
CHAPTER 2 Basic Search Algorithms
a (1)
b (2)
c (3)
d (4)
e (5)
f (6)
d (9,dup)
c (10,dup)
f (7,dup)
e (8,dup)
g (11,dup)
FIGURE 2.3 DFS search tree for the example in Figure 2.1. The numbers in brackets denote the order of node generation.
Table 2.2 Steps in BFS (with duplicate detection) for the example in Figure 2.1. Step
Selection
1 2 3 4 5 6 7 8
{} a b c d e f g
Open
Closed
Remarks
{a} {b,c,d} {c,d,e,f} {d,e,f} {e,f,g} {f,g} {g} {}
{} {a} {a,b} {a,b,c} {a,b,c,d} {a,b,c,d,e} {a,b,c,d,e,f} {a,b,c,d,e,f,g}
d is duplicate c is duplicate f is duplicate e is duplicate Goal reached
and removes its first element. As a result, the neighbors of the source node are generated layer by layer (one edge apart, two edges apart, and so on). As for DFS, Closed is implemented as a hash table, avoiding nodes to be expanded more than once. Since BFS also expands one new node at a time, it is complete in finite graphs. It is optimal in uniformly weighted graphs (i.e., the first solution path found is the shortest possible one), since the nodes are generated in level order with respect to the tree expansion of the problem graph. One BFS search order in the Gridworld example is ((3,3), (3,2), (2,3), (4,3), (3,4), (2,2), (4,4), (4,2), (2,4), (3,5), (5,3), (1,3), (3,1), . . . , (5,5)). The returned solution path ((3,3), (4,3), (4,4), (4,5), (5,5)) is optimal. Table 2.2 and Figure 2.4 list steps of the BFS algorithm in the example in Figure 2.1. A possible drawback for BFS in large problem graphs is its large memory consumption. Unlike DFS, which can find goals in large search depth, it stores all nodes with depth smaller than the shortest possible solution length.
2.1 Uninformed Graph Search Algorithms
53
a (1)
e (5)
b (2)
c (3)
d (4)
f (6)
d (7/dup)
c (8/dup)
g (9)
f (10/dup) e (11/dup)
FIGURE 2.4 BFS search tree for the example in Figure 2.1. The numbers in brackets denote the order of node generation.
2.1.3 Dijkstra’s Algorithm So far we have looked at uniformly weighted graphs only; that is, each edge counts the same. Now let us consider the generalization that edges are weighted with a weight function (a.k.a. cost function) w. In weighted graphs, BFS loses its optimality. Take, for example, weights on the DFS solution path p of 1/12, and weights of 1 for edges not on p. This path is of total weight 1, and the BFS solution path is of weight 1 + 3/12 > 1. To compute the shortest (cheapest) path in graphs with nonnegative weights, Dijkstra proposed a greedy search strategy based on the principle of optimality. It states that an optimal path has the property that whatever the initial conditions and control variables (choices) over some initial period, the control (or decision variables) chosen over the remaining period must be optimal for the remaining problem, with the node resulting from the early decisions taken to be the initial condition. Applying the principle developed by Richard Bellman to shortest path search results in δ(s, v) =
min
v∈Succ(u)
{δ(s, u) + w(u, v)}.
In words, the minimum distance from s to v is equal to the minimum of the sum of the distance from s to a predecessor u of v, plus the edge weight between u and v. This equation implies that any subpath of an optimal path is itself optimal (otherwise it could be replaced to yield a shorter path). The search algorithm maintains a tentative value of the shortest distance. More precisely, an upper bound f (u) on δ(s, u) for each node u; initially set to ∞, f (u) is successively decreased until it matches δ(s, u). From this point on, it remains constant throughout the rest of the algorithm. A suitable data structure for maintaining Open is a priority queue, which associates each element with its f -value, and provides operations Insert and DeleteMin (accessing the element with the minimum f -value and simultaneously removing it from the priority queue). Additionally, the DecreaseKey operation can be thought of as deleting an arbitrary element and reinserting it with a lower associated f -value; executing these two steps together can be performed more efficiently in some implementations. Note that the signature of Insert requires now an additional parameter: the value used to store the node in the priority queue.
54
CHAPTER 2 Basic Search Algorithms
Procedure Improve Input: Nodes u and v, v successor of u Side effects: Update parent of v, f (v), Open, and Closed if (v in Open) if ( f (u) + w(u, v) < f (v)) parent(v) ← u Update f (v) ← f (u) + w(u, v) else if (v not in Closed) parent(v) ← u Initialize f (v) ← f (u) + w(u, v) Insert v into Open with f (v)
;; Node already generated but not expanded ;; New path is shorter ;; Set predecessor pointer ;; DecreaseKey, might reorganize Open ;; Node not yet reached ;; Not yet expanded ;; Set predecessor pointer ;; First estimate ;; Update search frontier
Algorithm 2.4 Choosing path to v through minimum of f (v) and f (u) + w(u, v).
u 5
2
v
u
11
5
2
v 7
FIGURE 2.5 An example for a node relaxation.
The algorithm initially inserts s into the priority queue with f (s) set to zero. Then, in each iteration an Open node u with minimum f -value is selected, and all its children v reachable by outgoing edges are generated. The subroutine Improve of Algorithm 2.1 now updates the stored estimate f (v) for v if the newly found path via u is shorter than the best previous one. Basically, if for a path you can take a detour via another path to shorten the path, then it should be taken. Improve inserts v into Open, in turn. The pseudo code is listed in Algorithm 2.4. This update step is also called a node relaxation. An example is given in Figure 2.5. For illustration, we generalize our running example by assuming edge weights, as given in Figure 2.6. The execution of the algorithm is given in Table 2.3 and Figure 2.7. The correctness argument of the algorithm is based on the fact that for a node u with minimum f -value in Open, f is exact; that is, f (u) = δ(s, u).
Lemma 2.1. (Optimal Node Selection) Let G = (V, E, w) be a positively weighted graph and f be the approximation of δ(s, u) in Dijkstra’s algorithm. At the time u is selected in the algorithm, we have f (u) = δ(s, u). Proof. Assume the contrary and let u be the first selected node from Open with f (u) 6= δ(s, u); that is, f (u) > δ(s, u). Furthermore, let (s, . . . , x, y, . . . , u) be a shortest path for u with y being the first node on the path that is not expanded (see Fig. 2.8).
2.1 Uninformed Graph Search Algorithms
e 3
f
3 4
4
b
55
c
6
2
d
10
a
5
g
FIGURE 2.6 Extended example in Figure 2.1 with edge weights.
Table 2.3 Steps in Dijkstra’s algorithm for the example in Figure 2.6. s in brackets denote the f -value. Step
Selection
1 2 3 4 5 6 7 8
{} a b e f c d g
Open
Closed
Remarks
{a(0)} {b(2),c(6),d(10)} {e(6),f(6),c(6),d(10)} {f(6),c(6),d(10)} {c(6),d(10)} {d(9)} {g(14)} {}
{} {a} {a,b} {a,b,e} {a,b,e,f} {a,b,e,f} {a,b,e,f,c,d} {a,b,e,f,c,d,g}
Ties broken arbitrarily f is duplicate e is duplicate d reopened, parent changes to c a is duplicate Goal reached
a (1/0)
b (2/2)
c (3/6)
d (4/10) Reopening
e (5/6)
f (7/dup)
f (6/6)
e (8/dup) a (10/dup)
d (9/9)
g (11/14)
FIGURE 2.7 SINGLE-SOURCE SHORTEST PATHS search tree for the example in Figure 2.6. The numbers in brackets denote the order of node generation/f -value.
56
CHAPTER 2 Basic Search Algorithms
s
Closed p
x
y u
FIGURE 2.8 Selecting u from Open in Dijkstra’s algorithm.
Then f (x) = δ(s, x), since x ∈ Closed given the minimality of u. Furthermore, the edge (x, y) has been relaxed. Hence, f ( y) ≤ f (x) + w(x, y) = δ(s, x) + w(x, y) = δ(s, y) ≤ δ(s, u) < f (u) (in the second-last step, the positivity of weights is used). This inequality is a contradiction to the selection of u from the priority queue, instead of y. It is important to observe that Lemma 2.1 suits Dijkstra’s exploration scheme to implicit enumeration, because at the first encountering of a goal node t we already have f (t) = δ(s, t).
Theorem 2.1. (Correctness Dijkstra’s Algorithm) In weighted graphs with nonnegative weight function the algorithm of Dijkstra’s algorithm is optimal; that is, at the first node t ∈ T that is selected for expansion, we have f (t) = δ(s, T). Proof. With nonnegative edge weights, for each pair (u, v) with v ∈ Succ(u) we always have f (u) ≤ f (v). Therefore, the values f for selected nodes are monotonically increasing. This proves that at the first selected node t ∈ T we have f (t) = δ(s, t) = δ(s, T). In infinite graphs we have to guarantee that a goal node will eventually be reached.
Theorem 2.2. (Dijkstra’s Algorithm on Infinite Graphs) If the weight function w of a problem graph G = (V, E, w) is strictly positive and if the weight of every infinite path is infinite, then Dijkstra’s algorithm terminates with an optimal solution. Proof. The premises induce that if the cost of a path is finite, the path itself is finite. Therefore, there are only finitely many paths of cost smaller than δ(s, T). We further observe that no path of cost ≥ δ(s, T) can be a prefix of an optimal solution path. Therefore, Dijkstra’s algorithm examines the problem graph only on a finite subset of all infinite paths. A goal node t ∈ T with δ(s, t) = δ(s, T) will eventually be reached, so that Dijkstra’s algorithm terminates. The solution will be optimal by the correctness argument of Theorem 2.1.
2.1 Uninformed Graph Search Algorithms
57
Note that for all nodes u in Closed, an optimal path from s to u has been found. Thus, a slight modification of Dijkstra’s algorithm that only stops when Open runs empty can not only find the shortest path between a single source s and a single target t, but also to all other nodes (provided, of course, that the number of nodes is finite).
2.1.4 Negatively Weighted Graphs Unfortunately, the correctness and optimality argument in Lemma 2.1 is no longer true for graphs with negative edge weights. As a simple example, consider the graph consisting of three nodes s, u, v having edges (s, u) with w(s, u) = 5, (s, v) with w(s, v) = 4, and edge (v, u) with w(v, u) = −2, for which the algorithm of Dijkstra computes δ(s, u) = 5 instead of the correct value, δ(s, u) = 3. An even worse observation is that negatively weighted graphs may contain negatively weighted cycles, so that the shortest path may be infinitely long and of value −∞. This has led to the BellmanFord algorithm to be described later. However, we can still handle graphs with negative weights using a modified Dijkstra algorithm if we impose a slightly less restrictive condition on the graph, namely that δ(u, T) = min{δ(u, t)| t ∈ T} ≥ 0 for all u. That is, the distance from each node to the goal is nonnegative. Figuratively speaking, we can have negative edges when far from the goal, but they get “eaten up” when coming closer. The condition implies that no negatively weighted cycles exist. In the sequel, we will denote the extended version of Dijkstra’s algorithm as algorithm A. As can be gleaned from the comparison between Algorithm 2.5 and Algorithm 2.4, with negative edges it can be necessary to reopen not only Open nodes, but also Closed ones.
Procedure Improve Input: Nodes u and v, v successor of u Side effects: Update parent of v, f (v), Open, and Closed if (v in Open) if ( f (u) + w(u, v) < f (v)) parent(v) ← u Update f (v) ← f (u) + w(u, v) else if (v in Closed) if ( f (u) + w(u, v) < f (v)) parent(v) ← u Update f (v) ← f (u) + w(u, v) Remove v from Closed Insert v into Open with f (v) else parent(v) ← u Initialize f (v) ← f (u) + w(u, v) Insert v into Open with f (v)
;; Node already generated but not expanded ;; New path is shorter ;; Set predecessor pointer ;; DecreaseKey operation ;; Node v already expanded ;; New path cheaper ;; Set predecessor pointer ;; Update estimate ;; Reopening of v ;; Changing lists ;; Node not visited before ;; Set predecessor pointer
Algorithm 2.5 An update routine that copes with negative edge weights.
;; Update search frontier
58
CHAPTER 2 Basic Search Algorithms
Lemma 2.2. (Invariance for Algorithm A) Let G = (V, E, w) be a weighted graph, p = (s = v0 , . . . , vn = t) be a least-cost path from the start node s to a goal node t ∈ T, and f be the approximation in the algorithm A. At each selection of a node u from Open, we have the following invariance: (I) Unless vn is in Closed with f (vn ) = δ(s, vn ), there is a node vi in Open such that f (vi ) = δ(s, vi ), and no j > i exists such that vj is in Closed with f (vj ) = δ(s, vj ). Proof. Without loss of generality let i be maximal among the nodes satisfying (I). We distinguish the following cases: 1. Node u is not on p or f (u) > δ(s, u). Then node vi 6= u remains in Open. Since no v in Open ∩ p ∩ Succ(u) with f (v) = δ(s, v) ≤ f (u) + w(u, v) is changed and no other node is added to Closed, (I) is preserved. 2. Node u is on p and f (u) = δ(s, u). If u = vn , there is nothing to show. First assume u = vi . Then Improve will be called for v = vi+1 ∈ Succ(u); for all other nodes in Succ(u) \ {vi+1 }, the argument of case 1 holds. According to (I), if v is in Closed, then f (v) > δ(s, v), and it will be reinserted into Open with f (v) = δ(s, u) + w(u, v) = δ(s, v). If v is neither in Open nor Closed, it is inserted into Open with this merit. Otherwise, the DecreaseKey operation will set it to δ(s, v). In either case, v guarantees the invariance (I). Now suppose u 6= vi . By the maximality assumption of i we have u = vk with k < i. If v = vi , no DecreaseKey operation can change it because vi already has optimal merit f (v) = δ(s, u) + w(u, v) = δ(s, v). Otherwise, vi remains in Open with an unchanged f -value and no other node besides u is inserted into Closed; thus, vi still preserves (I).
Theorem 2.3. (Correctness of Algorithm A) Let G = (V, E, w) be a weighted graph so that for all u in V we have δ(u, T) ≥ 0. Algorithm A is optimal; that is, at the first extraction of a node t in T we have f (t) = δ(s, T). Proof. Assume that the algorithm does terminate at node t0 ∈ T with f (t0 ) > δ(s, T). According to (I) there is a node u with f (u) = δ(s, u) in Open, which lies on an optimal solution path pt to t. We have f (t0 ) > δ(s, T) = δ(s, u) + δ(u, T) ≥ δ(s, u) = f (u), in contradiction to the fact that t0 is selected from Open.
In infinite graphs we can essentially apply the proof of Theorem 2.2.
Theorem 2.4. (A in Infinite Graphs) If the weight of every infinite path is infinite, then algorithm A terminates with an optimal solution. Proof. Since δ(u, T) ≥ 0 for all u, no path of cost ≥ δ(s, T) can be a prefix of an optimal solution path.
2.1.5 Relaxed Node Selection Dijkstra’s algorithm is bound to always expand an Open node with minimum f -value. However, as we will see in later chapters, sometimes it can be more efficient to choose nodes based on other criteria. For example, in route finding in large maps we might want to explore neighboring streets in subregions together to optimize disk access.
2.1 Uninformed Graph Search Algorithms
59
Procedure Node-Selection A Input: Implicit problem graph with start node s, weight function w, heuristic h, successor generation function Expand, and predicate Goal Output: Cost-optimal path to a goal node t ∈ T, or ∅ if no such path exists Closed ← ∅;Open ← {s} f (s) ← h(s) U ← ∞; bestPath ← ∅ while (Open 6= ∅) Remove some u from Open Insert u into Closed if (f (u) > U) continue if (Goal(u) and f (u) < U) U ← f (u); bestPath ← Path(u) else Succ(u) ← Expand(u) for each v in Succ(u) Improve(u, v) return bestPath
;; Initialize structures ;; Initialize estimate ;; Initialize solution path values ;; As long as there are frontier nodes ;; Select arbitrary node from search frontier ;; Update list of expanded nodes ;; Prune expansions if costs are too high ;; Improved solution established ;; Update solution path ;; Generate successor set ;; For all successor nodes ;; Update data structures ;; Return optimal solution
Algorithm 2.6 Relaxing the node expansion order in Algorithm A.
In Algorithm 2.6 we give a pseudo-code implementation for a relaxed node selection scheme that gives us precisely this freedom. In contrast to Algorithm A and Dijkstra’s algorithm, reaching the first goal node will no longer guarantee optimality of the established solution path. Hence, the algorithm has to continue until the Open list runs empty. A global current best solution path length U is maintained and updated; the algorithm improves the solution quality over time. If we want the algorithm to be optimal we have to impose the same restriction on negatively weighted graphs as in the case of Algorithm A.
Theorem 2.5. (Optimality Node-Selection A, Conditioned) If we have δ(u, T) ≥ 0 for all nodes u ∈ V, then node selection A terminates with an optimal solution. Proof. Upon termination, each node inserted into Open must have been selected at least once. Suppose that invariance (I) is preserved in each loop; that is, that there is always a node v in the Open list on an optimal path with f (v) = δ(s, v). Thus, the algorithm cannot terminate without eventually selecting the goal node on this path, and since by definition it is not more expensive than any found solution path and best maintains the currently shortest path, an optimal solution will be returned. It remains to show that the invariance (I) holds in each iteration. If the extracted node u is not equal to v there is nothing to show. Otherwise, f (u) = δ(s, u). The bound U denotes the currently best solution length. If f (u) ≤ U, no pruning takes place. On the other hand, f (u) > U leads to a contradiction since U ≥ δ(s, u) + δ(u, T) ≥ δ(s, u) = f (u) (the latter inequality is justified by δ(u, T) ≥ 0). If we do allow δ(u, T) to become negative, we can at least achieve the following optimality result.
60
CHAPTER 2 Basic Search Algorithms
Theorem 2.6. (Optimality Node-Selection A, Unconditioned) For f (u) + δ(u, T) > U-as the pruning condition in the node selection A algorithm, it is optimal. Proof. By analogy to the previous theorem, it remains to show that (I) holds in each iteration. If the extracted node u is not equal to v there is nothing to show. Otherwise, f (u) = δ(s, u). The bound U denotes the currently best solution length. If f (u) + δ(u, T) ≤ U, no pruning takes place. On the other hand, f (u) + δ(u, T) > U leads to a contradiction since δ(s, T) = δ(s, u) + δ(u, T) = f (u) + δ(u, T) > U, which is impossible given that U denotes the cost of some solution path; that is, U ≥ δ(s, T). Unfortunately, we do not know the value of δ(s, T), so the only thing that we can do is to approximate it; in other words, to devise a bound for it.
2.1.6 *Algorithm of Bellman-Ford Bellman and Ford’s algorithm is the standard alternative to Dijkstra’s algorithm when searching graphs with negative edge weights. It can handle any such finite graphs (not just those with nonnegative goal distances), and will detect if negative cycles exist. The basic idea of the algorithm is simple: relax all edges in each of n − 1 passes (n is the number of nodes in the problem graph), where node relaxation of edge (u, v) is one update of the form f (v) ← min{f (v), f (u) + w(u, v)}. It satisfies the invariant that in pass i, all cheapest paths have been found that use at most i − 1 edges. In a final pass, each edge is checked once again. If any edge can be further relaxed at this point, a negative cycle must exist; the algorithm reports this and terminates. The price we pay for the possibility of negative edges is a time complexity of O(|E||V|), worse than Dijkstra’s algorithm by a factor of |V|. Most of the time, the Bellman-Ford algorithm is described in terms of explicit graphs, and is used to compute shortest paths from a source to all other nodes. In the following, however, we develop an implicit version of the algorithm of Bellman and Ford that makes it comparable to the previously introduced algorithms. One advantage is that we can exploit the fact it is necessary to perform this relaxation in iteration i only if the f -value of u has changed in iteration (i − 1). Note that the Bellman-Ford algorithm can be made to look almost identical to Dijkstra’s algorithm by utilizing a queue instead of a priority queue: For all nodes u extracted from one end of the queue, relax every successor v of u, and insert v into the tail of the queue. The reasoning is as follows. For graphs with negative edge weights it is not possible to have perfect choice on the extracted element that is known to be contained in the Open list by invariance (I) (see page 58). As we have seen, considering already expanded nodes is necessary. Suppose that u is the extracted node. Before u is selected for next time the optimal node vi with f (vi ) = δ(s, vi ) has to be selected at least once, such that the solution path p = (v1 , . . . , vn ) that is associated with vi is extended by at least one edge. To implement this objective for convenience we redisplay the Improve procedure that has been devised so far for the situation where the Open list is a queue. Algorithm 2.7 shows the pseudo code. The implicit version of Bellman and Ford is listed in Algorithm 2.8. In the original algorithm, detection of negative cycles is accomplished by checking for optimal paths longer than the total number of nodes, after all edges have been relaxed n − 1 times. In our implicit algorithm, this can be done more efficiently. We can maintain the length of the path, and as soon as any one gets longer than n, we can exit with a failure notice. Also, more stringent checking for duplicates in a path can be implemented. We omitted the termination condition at a goal node, but it can be implemented analogously as in the node selection A algorithm. That is, it is equivalent whether we keep track of the current best
2.1 Uninformed Graph Search Algorithms
61
Procedure Improve Input: Nodes u and v, v successor of u, number of problem graph nodes n Side effects: Update parent of v, f (v), Open, and Closed if (v in Open) if (f (u) + w(u, v) < f (v)) if (length(Path(v)) ≥ n − 1) exit parent(v) ← u Update f (v) ← f (u) + w(u, v) else if (v in Closed) if (f (u) + w(u, v) < f (v)) if (length(Path(v)) ≥ n − 1) exit parent(v) ← u Remove v from Closed Update f (v) ← f (u) + w(u, v) Enqueue v into Open else parent(v) ← u Initialize f (v) ← f (u) + w(u, v) Enqueue v into Open
;; Node already generated but not expanded ;; New path is cheaper ;; Path contains some node twice ;; Negative cycle detected ;; Set predecessor pointer ;; Improved estimate ;; Node v already expanded ;; New path cheaper ;; Path contains some node twice ;; Negative cycle detected ;; Set predecessor pointer ;; Reopening of v ;; Changing lists ;; Node not seen before ;; Set predecessor pointer ;; First estimate ;; Add to search frontier
Algorithm 2.7 Edge relaxation for implicit version of Bellman and Ford’s algorithm.
solution during the search or (as in the original formulation) scan all solutions after completion of the algorithm.
Theorem 2.7. (Optimality of Implicit Bellman-Ford) Implicit Bellman-Ford is correct and computes optimal cost solution paths. Proof. Since the algorithm only changes the ordering of nodes that are selected, the arguments for the correctness and optimality of the implicit version of Bellman and Ford’s and the node selection A algorithm are the same.
Theorem 2.8. (Complexity of Implicit Bellman-Ford) Implicit Bellman-Ford applies no more than O(ne) node generations. Proof. Let Openi be the set Open (i.e., the content of the queue) when u is removed for the ith time from Open. Then, by applying the Invariant (I) (Lemma 2.2) we have that Openi contains at least one element, say ui , with optimal cost. Since Open is organized as a queue, ui is deleted from Open before u is deleted for the (i + 1)-th time. Since ui is on the optimal path and will never be added again, we have the number of iterations i is smaller than the number of nodes in the expanded problem graph. This proves that each edge is selected at most n times, so that at most ne nodes are generated.
62
CHAPTER 2 Basic Search Algorithms
Procedure Implicit Bellman-Ford Input: Problem graph with start node s, weight function w, successor generation function Expand, and predicate Goal Output: Cheapest path cost from s to t ∈ T stored in f (s) Open ← {s} f (s) ← h(s) while (Open 6= ∅) Dequeue u from Open Insert u into Closed Succ(u) ← Expand(u) for each v in Succ(u) Improve(u, v)
;; Initialize search frontier ;; Initialize estimate ;; As long as there are frontier nodes ;; Select node in breadth-first manner ;; Update list of expanded nodes ;; Generate successor set ;; Consider all successors ;; Node relaxation according to Alg. 2.7
Algorithm 2.8 Bellman-Ford algorithm in an implicit graph.
2.1.7 Dynamic Programming The divide-and-conquer strategy in algorithm design suggests to solve a problem recursively by splitting it into smaller subproblems, solving each of them separately, and then combining the partial results into an overall solution. Dynamic programming was invented as a similarly general paradigm. It addresses the problem that a recursive evaluation can give rise to solving overlapping subproblems repeatedly, invoked for different main goals. It suggests to store subresults in a table so that they can be reused. Such a tabulation is most efficient if an additional node order is given that defines the possible subgoal relationships.
All Pair Shortest Paths For example, consider the problem of finding the shortest distance for each pair of nodes in 1, . . . , n. We could run either Single-Source Shortest Paths algorithms discussed so far—BFS or Dijkstra’s algorithm—repeatedly, starting from each node i in turn, but this would traverse the whole graph several times. A better solution is to apply the All Pairs Shortest Paths Floyd-Warshall algorithm. Here, all distances are recorded in an n-by-n matrix D, where element Di,j indicates the shortest path costs from i to j. A sequence of matrices D0 , D1 , . . . , Dk is computed, where D0 contains only the edge weights (it is the adjacency matrix), and Dk contains the shortest distances between nodes with the constraint that intermediate nodes have no index larger than k. According to the principle of optimality it holds that n o (k−1) (k−1) (k−1) Dki, j = min Di, j , Di, k + Dk, j . (k−1)
In particular, if no path between i and j passes through k, then Dki, j = Di, j All Pairs Shortest Paths problem in O(n3 ) time and O(n2 ) space.
. Algorithm 2.9 solves the
Multiple Sequence Alignment Dynamic programming is a very effective means in many domains. Here, we will give a Multiple Sequence Alignment example (see Sec. 1.7.6). Let w define the cost of substituting one character
2.1 Uninformed Graph Search Algorithms
63
Procedure Floyd-Warshall Input: n-by-n adjacency matrix A Output: Matrix D containing shortest path distances between all pairs of nodes D←M for each k in {1, . . . , n} for each i in {1, . . . , n} for each j in {1, . . . , n} (k) (k−1) (k−1) (k−1) Di, j ← min{Di, j , Di, k + Dk,j } return D
;; Initialize distance matrix ;; Loop over intermediate node ;; Loop over start node ;; Loop over end node
Algorithm 2.9 Floyd-Warshall algorithm.
with another, and denote the distance between two strings m1 = m01 x1 and m2 = m02 y2 as δ. Then, according to the principle of optimality, the following recurrence relation holds: δ(m1 , m02 ) + w(0 0 , x2 ) if |m1 | = 0 0 , m ) + w(x ,0 0 ) δ(m if |m2 | = 0 2 1 1 δ(m1 , m2 ) = min{δ(m1 , m02 ) + w(0 0 , x2 ), (insertion of x2 ) δ(m01 , m2 ) + w(x1 ,0 0 ), (insertion of x1 ) otherwise δ(m01 , m02 ) + w(x1 , x2 )} (match of x1 and x2 ) A pairwise alignment can be conveniently depicted as a path between two opposite corners in a two-dimensional grid: one sequence is placed on the horizontal axis from left to right, the other one on the vertical axis from top to bottom. If there is no gap in either string, the path moves diagonally down and right; a gap in the vertical (horizontal) string is represented as a horizontal (vertical) move right (down), since a letter is consumed in only one of the strings. The alignment graph is directed and acyclic, where a (nonborder) vertex has incoming edges from the left, top, and top-left adjacent vertices, and outgoing edges to the right, bottom, and bottom-right vertices. The algorithm progressively builds up alignments of prefixes of m and m0 in a bottom-up fashion. The costs of partial alignments are stored in a matrix D, where Di,j contains the distance between m[1..i] and m0 [1..j]. The exact order of the scan can vary (e.g., rowwise or columnwise), as long as it is compatible with a topological order of the graph; a topological order of a directed, acyclic graph is a sorting of the nodes u0 , u1 , . . . , such that if ui is reachable from uj , then it must hold that j ≥ i. In particular, u0 has no incoming edges, and if the number of nodes is some finite n, then un has no outgoing edges. In general, many different topological orderings can be constructed for a given graph. For instance, in the alignment of two sequences, a cell value depends on the values of the cells to the left, top, and diagonally top-left, and these have to be explored before it. Algorithm 2.10 shows the case of columnwise traversal. Another particular such ordering is that of antidiagonals, which are diagonals running from top-right to bottom-left. The antidiagonal number of a node is simply the sum of its coordinates. As an example, the completed matrix for the edit distance between the strings sport and sort is shown in Figure 2.9. After all matrix entries have been computed, the solution path has to be
64
CHAPTER 2 Basic Search Algorithms
Procedure Align-Pairs Input: Substitution costs w, Strings m, and m0 Output: Matrix D containing shortest distances between all pairs of string prefixes for each i in {0, . . . , |m|} Di,0 ← w(0 0 , mi ) for each i ← {1, . . . , |m0 |} D0,i = w(0 0 , m0i ) for each i in {1, . . . , |m|} for each j in {1, . . . , |m0 |} Di,j ← min{Di,j−1 + w(0 0 , m0j ), Di−1,j + w(mi ,0 0 ), Di−1,j−1 + w(mi , m0j )} return D
;; Initialize first column ;; Initialize first row ;; For all columns ;; For all rows ;; Insertion into m0 ;; Insertion into m ;; Letter match
Algorithm 2.10 Pairwise sequence alignment with dynamic programming in column order.
S O R T
S O R
0
1
2
3
4
S 1 P 2
0
1
2
3
1
1
2
3
S P
O 3
2
1
2
3
O
R 4
3
2
1
3
R
T 5
4
3
2
1
T
T S_ORT SPORT
FIGURE 2.9 Edit distance matrix for strings “sport” and “sort” (left); solution path (right).
reconstructed to obtain the actual alignment. This can be done iteratively in a backward direction starting from the bottom-right corner up to the top-left corner, and selecting in every step a parent node that allows a transition with the given cost. Alternatively, we could store in each cell an additional pointer to the relevant predecessor. It is straightforward to generalize pairwise sequence alignment to the case of aligning k sequences simultaneously, by considering higher-dimensional lattices. For example, an alignment of three sequences can be visualized as a path in a cube. Figure 2.10 illustrates an example for the alignment A B C _ B _ B C D _ _ _ _ D B
If the sequence length is at most n, the generalization of Algorithm 2.10 requires O(nk ) time and space to store the dynamic programming table. In Section 6.3.2, we will present a refined algorithm
2.1 Uninformed Graph Search Algorithms
65
end D
C
B
B D
B
A
start
C
B
FIGURE 2.10 Alignment of the three sequences ABCB, BCD, and DB.
that reduces the space complexity by one order of magnitude.2 An example of how successor costs are calculated, with the cost matrix of Figure 2.10 and a gap opening penalty of 4, is shown in Figure 2.11.
Markov Decision Process Problems A common way of calculating an optimal policy is by means of dynamic programming using either policy iteration or value iteration. Both policy iteration and value iteration are based on the Bellman optimality equation, ) ( X p(v | u, a) · f ∗ (v) . f ∗ (u) = min w(u, a) + a∈A
v∈S
In some cases, we apply a discount δ to handle infinite paths. Roughly speaking, we can define the value of a state as the total reward/cost an agent can expect to accumulate when traversing the graph according to its policy, starting from that state. The discount factor defines how much more we should value immediate costs/rewards, compared to costs/rewards that are only attainable after two or more 2 As
a technical side note, we remark that to deal with the biologically more realistic affine gap costs, we can no longer identify nodes in the search graph with lattice vertices; this is because the cost associated with an edge depends on the preceding edge in the path. Similarly, as in route planning with turn restrictions, in this case, it is more suitable to store lattice edges in the priority queue, and let the transition costs for u → v, v → w be the sum-of-pairs substitution costs for using one character from each sequence or a gap, plus the incurred gap penalties for v → w followed by u → v. Note that the state space in this representation grows by a factor of 2k .
66
CHAPTER 2 Basic Search Algorithms
A
A
B
C
D
g = 53 cost(_,C) = 3 gap penalty = 4 g = 60
B
A
cost(A,_) = 3 gap penalty = 4 g = 60
cost(A,C) = 4 gap penalty = 0 g = 57
D
FIGURE 2.11 Example of computing path costs with affine gap function; the substitution matrix of Figure 2.10 and a gap opening penalty of 4 is used.
steps. Formally, the corresponding equation according to the principle of optimality is ) ( X ∗ ∗ p(v | u, a) · f (v) . f (u) = min w(u, a) + δ · a∈A
v∈S
Policy iteration successively improves a policy π by setting ) ( X π p(v | u, a) · f (v) π(u) ← arg min w(u, a) + a∈A
v∈S
for each state u, where the evaluation of π, f π (u), can be computed as a system of |S| linear equations: X p(v | u, π(u)) · f π(v). f π(u) ← w(u, π(u)) + v∈S
A pseudo-code implementation for policy iteration is shown in Algorithm 2.11. Value iteration improves the estimated cost-to-go function f by successively performing the following operation for each state u: ) ( X p(v | u, a) · f (v) . f (u) ← min w(u, a) + a∈A
v∈S
2.1 Uninformed Graph Search Algorithms
67
Procedure Policy-Iteration Input: Markov decision process problem, some initial policy π Output: Optimal policy do
f π = Evaluate(π ) changed ← false for each u ∈ S bestVal ← ∞ A ← −1 for each a ∈ A V ← w(u, a) for each v ∈ S V ← V + δ · p(v | u, a) · f π (v) if (V < bestVal) bestVal ← V; bestAct ← a if (π(u) 6= bestAct) changed ← true; π(u) ← bestAct while (changed)
;; Loop until convergence ;; Evaluate policy ;; Loop control ;; For all expanded states ;; Dynamically updated bound ;; For updating operator ;; For all operators ;; Cost/reward ;; For all successor states ;; Compute cost ;; Improvement achieved ;; Backup best results ;; Policy changed ;; Protocol change ;; Loop until flag unset
Algorithm 2.11 Policy iteration.
The algorithm exits if an error bound on the policy evaluation falls below a user-supplied threshold , or a maximum number of iterations have been executed. If the optimal cost f ∗ is known for each state, the optimal policy can be easily extracted by choosing an operation according to a single application of the Bellman equation. Value iteration is shown in pseudo code in Algorithm 2.12. The procedure takes a heuristic h for initializing the value function as an additional parameter. The error bound on the value function is also called the residual, and can, for example, be computed in form maxu∈S | ft (u) − ft−1 (u)|. A residual of zero denotes that the process has converged. An advantage of policy iteration is that it converges to the exact optimum, whereas value iteration usually only reaches an approximation. On the other hand, the latter technique is usually more efficient on large state spaces. For implicit search graphs the algorithms proceed in two phases. In the first phase, the whole state space is generated from the initial state s. In this process, an entry in a hash table (or vector) is allocated to store the f -value for each state u; this value is initialized to the cost of u if u ∈ T, or to a given (not necessarily admissible) heuristic estimate (or zero if no estimate is available) if u is nonterminal. In the second phase, iterative scans of the state space are performed updating the values of nonterminal states u as f (u) = min q(u, a), a∈A(u)
where q(u, a), which depends on the search model (see Sec. 1.8.4).
(2.1)
68
CHAPTER 2 Basic Search Algorithms
Procedure Value-Iteration Input: Markov decision process problem, tolerance > 0, heuristic h, and maximum iteration number tmax Output: -Optimal policy π t←0 for each u ∈ S f0 (u) ← h(u) while (Residual on ft > and t < tmax ) t ← t+1 for each u ∈ S bestVal ← ∞ for each a ∈ A V ← w(u, a) for each v ∈ S V ← V + δ · p(v | u, a) · ft−1 (v) if (V < bestVal) π(u) ← a; bestVal ← V ft (u) ← M return Policy( ft )
;; Iteration count ;; For all states ;; Set default value function ;; Convergence criterion ;; Next iteration number ;; For all expanded states ;; For monitoring updates ;; For all actions ;; Compute cost/reward ;; For all successor states ;; Compute value ;; Update values ;; Set value ;; Using arg-min
Algorithm 2.12 Value iteration.
Value iteration converges to the solution optimal value function provided that its values are finite for all u ∈ S. In the case of MDPs, which may have cyclic solutions, the number of iterations is not bounded and value iteration typically only converges in the limit. For this reason, for MDPs, value iteration is often terminated after a predefined bound of tmax iterations are performed, or when the residual falls below a given > 0. Monte Carlo policy evaluation estimates f π , the value of a state under a given policy. Given a set of iterations, value f π is approximated by following π. To estimate f π , we count the visits to a fixed state u. Value f π is computed by averaging the returns in a set of iterations. Monte Carlo policy evaluation converges to f π as the number of visits goes to infinity. The main argument is that by the law of large numbers the sequence of averages will converge to their expectation. For convenience of terminology, in the sequel we will continue referring to nodes when dealing with the search algorithm.
2.2 INFORMED OPTIMAL SEARCH We now introduce heuristic search algorithms; that is, algorithms that take advantage of an estimate of the remaining goal distance to prioritize node expansion. Domain-dependent knowledge captured in this way can greatly prune the search tree that has to be explored to find an optimal solution. Therefore, these algorithms are also subsumed under the category informed search.
2.2 Informed Optimal Search
g(u)
69
h(u)
s
u
t ∈T
FIGURE 2.12 Approximating the cost of a solution path.
2.2.1 A* The most prominent heuristic search algorithm is A*. It updates estimates f (u) (a.k.a. merits) defined as f (u) = g(u) + h(u), where g(u) is the weight of the (current optimal) path from s to u, and h(u) is an estimate (lower bound) of the remaining costs from u to a goal, called the heuristic function. Hence, the combined value f (u) is an approximation for the cost of the entire solution path (see Fig. 2.12). For the sake of completeness, the entire algorithm is shown in Algorithm 2.13. For illustration, we again generalize our previous example by assuming that we can obtain heuristic estimates from an unknown source, as shown in Figure 2.13. The execution of the A* algorithm is given in Table 2.4 and Figure 2.14, respectively. We see that compared to Dijkstra’s algorithm, nodes b, e, and f can be pruned from expansion since their f -value is larger than the cheapest solution path. The attentive reader might have noticed our slightly sloppy notation in Algorithm 2.13: We use the term g(u) in the Improve procedure, however, we don’t initialize these values. This is because in light of an efficient implementation, it is necessary to store either the g-value or the f -value of a node, but not both. If only the f -value is stored, we can derive the f -value of node v with parent u as f (v) ← f (u) + w(u, v) − h(u) + h(v). By following this reasoning, it turns out that algorithm A* can be elegantly cast as Dijkstra’s algorithm in a reweighted graph, where we incorporate the heuristic into the weight function as w(u, ˆ v) = w(u, v) − h(u) + h(v). An example of this reweighting transformation of the implicit search graph is shown in Figure 2.15. One motivation for this transformation is to inherit correctness proofs, especially for graphs. Furthermore, it bridges the world of traditional graphs with an AI search. As a by-product, the influence heuristics have is clarified. Let us formalize this idea.
Lemma 2.3. Let G be a weighted problem graph and h : V → IR. Define the modified weight w(u, ˆ v) as w(u, v) − h(u) + h(v). Let δ(s, t) be the length of the shortest path from s to t in the original graph ˆ t) be the corresponding value in the reweighted graph. and δ(s, ˆ t). 1. For a path p, we have w( p) = δ(s, t), if and only if w( ˆ p) = δ(s, 2. Moreover, G has no negatively weighted cycles with respect to w if and only if it has none with respect to w. ˆ Proof. For proving the first assertion, let p = (v0 , . . . , vk ) be any path from start node s = v0 to a goal node t = vk . We have k X w( ˆ p) = (w(vi−1 , vi ) − h(vi−1 ) + h(vi )) i=1
= w( p) − h(v0 ).
70
CHAPTER 2 Basic Search Algorithms
Procedure A* Input: Implicit problem graph with start node s, weight function w, heuristic h, successor generation function Expand, and predicate Goal Output: Cost-optimal path from s to t ∈ T, or ∅ if no such path exists Closed ← ∅ Open ← {s} f (s) ← h(s) while (Open 6= ∅) Remove u from Open with minimum f (u) Insert u into Closed if (Goal(u)) return Path(u) else Succ(u) ← Expand(u) for each v in Succ(u) Improve(u, v) return ∅
;; Initialize structures ;; Insert s into search frontier ;; Initialize estimate ;; As long as there are frontier nodes ;; Select node for expansion ;; Update list of expanded nodes ;; Goal found, return solution ;; Expansion yields successor set ;; For all successors v of u ;; Call relaxation subroutine ;; No solution exists
Procedure Improve Input: Nodes u and v, v successor of u Side effects: Update parent of v, f (v), Open, and Closed if v in Open if (g(u) + w(u, v) < g(v)) parent(v) ← u f (v) ← g(u) + w(u, v) + h(v) else if v in Closed if (g(u) + w(u, v) < g(v)) parent(v) ← u f (v) ← g(u) + w(u, v) + h(v) Remove v from Closed Insert v into Open with f (v) else parent(v) ← u Initialize f (v) ← g(u) + w(u, v) + h(v) Insert v into Open with f (v)
;; Node already generated but not expanded ;; New path is cheaper ;; Set predecessor pointer ;; DecreaseKey operation ;; Node v already expanded ;; New path cheaper ;; Set predecessor pointer ;; Update estimate ;; Reopening of v ;; Reopening of node ;; Node not seen before ;; Set predecessor pointer ;; First estimate ;; Add v to search frontier
Algorithm 2.13 A*.
Assume that there is a path p0 with w(p ˆ 0 ) < w(p) ˆ and w(p0 ) ≥ w(p). Then, w(p0 ) − h(v0 ) < w(p) − h(v0 ) 0 and thus w(p ) < w(p), a contradiction. The other direction is dealt with analogously. For the second assertion let c = (v0 , . . . , vl = v0 ) be any cycle in G. Then we have w(c) ˆ = w(c) + h(vl ) − h(v0 ) = w(c).
2.2 Informed Optimal Search
c(8) e (17)
3
f (17)
3
4
4
6
b (13) 2 d (5)
10
a (11)
5
g (0)
FIGURE 2.13 Extended example of Figure 2.6 with heuristic estimates (in parentheses).
Table 2.4 Steps in A* for the example of Figure 2.13. The numbers in brackets denote the g-value and f -value. Step
Selection
Open
Closed
Remarks
1 2 3 4 5
{} a c d g
{a(0,11)} {c(6,14),b(2,15),d(10,15)} {d(9,14),b(2,15)} {g(14,14),b(2,15)} {b(2,15)}
{} {a} {a,c} {a,c,d} {a,c,d,g}
update d, change parent to c a is duplicate goal reached
a (1/0,11)
b (2/2,15)
c (3/6,14)
d (4/10,15)
d (5/9,14)
a (6/dup)
g (7/14,14)
FIGURE 2.14 A* search tree for the example of Figure 2.13. The numbers in parentheses denote the order of node generation / h-value, f -value.
71
72
CHAPTER 2 Basic Search Algorithms
w(u, v)
u
v
u
w(u, v) w(u, v) + h(v) − h(u)
v
FIGURE 2.15 The process of reweighting edges.
10
s
h = 6, h* = 13 5
5
2
h=1 h* = 5
a
3
5
h=0 h* = 0
9
7
4
c
h=4 h* = 4
f =6 6 f = 12
8 f = 11
a
b
−3
4
5
6 t
h=7 h* = 8
b
s
2
9
2
8 t
2
c
FIGURE 2.16 A problem graph before (left) and after (right) reweighting.
As an example, consider the two graphs in Figure 2.16. To the left the original problem graph with heuristic estimates attached to each node is shown. Each node u is additionally labeled by the value h∗ (u) = δ(u, t). In the reweighted graph to the right the computed f -values after expanding node s are shown. The inconsistency on the original graph on edge (b, a) generates a negative weight in the reweighted graph. The usual approach to deal with inconsistent but admissible heuristics in the context of A* is called pathmax. It takes the maximum of the accumulated weights on the path to a node to enforce a monotone growth in the cost function. More formally for a node u with child v the pathmax equation sets f (v) to max{f (v), f (u)} or, equivalently, h(v) to max{h(v), h(u) − w(u, v)}, such that h does not overestimate the distance from the parent to the goal. The approach is wrong if we apply its reasoning to a graph search as A*. In the example in Figure 2.16, after expanding nodes s and a we have Open = {(b, 12), (t, 15)} and Closed = {(s, 6), (a, 11)}. Now a is reached once more via b by means (b, 12), it is moved to Closed, and (a, 12) is compared to the closed list. We have that 12 is the pathmax on path (s, b, a). Wrongly we keep (a, 11) and all information contained in (a, 12) is lost forever. The equation h(u) ≤ h(v) + w(u, v) is equivalent to w(u, ˆ v) = h(v) − h(u) + w(u, v) ≥ 0. A consistent heuristic yields a first A* variant of Dijkstra’s algorithm.
Theorem 2.9. (A* for Consistent Heuristics) Let h be consistent. If we set f (s) = h(s) for the initial node s and update f (v) with f (u) + w(u, ˆ v) instead of f (u) + w(u, v), at each time a node t ∈ T is selected, we have f (t) = δ(s, t).
2.2 Informed Optimal Search
73
Proof. Since h is consistent, we have w(u, ˆ v) = w(u, v) − h(u) + h(v) ≥ 0. Therefore, the preconditions ˆ u) + h(s), if u is selected from of Theorem 2.1 are fulfilled for weight function w, ˆ so that f (u) = δ(s, Open. According to Lemma 2.3, shortest paths remain invariant through reweighting. Hence, if t ∈ T is selected from Open we have ˆ t) + h(s) = w( f (t) = δ(s, ˆ pt ) + h(s) = w( pt ) = δ(s, t). Since wˆ ≥ 0, we have f (v) ≥ f (u) for all successors v of u. The f -values increase monotonically so that at the first extraction of t ∈ T we have δ(s, t) = δ(s, T). In case of negative values for w(u, v) − h(u) + h(v), shorter paths to already expanded nodes may be found later in the search process. These nodes are reopened. In the special case of unit edge cost and trivial heuristic (i.e., h(u) = 0 for all u), A* proceeds similarly to the breadth-first search algorithm. However, the two algorithms can have different stopping conditions. BFS stops as soon as it generates the goal. A* will not stop–it will insert the goal in the priority queue and it will finish level d − 1 before it terminates (assuming the goal is at distance d from the start node). Therefore, the difference between the two algorithms can be as large as the number of nodes at level d − 1, which is usually a significant fraction (e.g., half) of the total number of nodes expanded. The reason BFS can do this and A* cannot is because the stopping condition for BFS is correct only when all the edge weights in the problem graph are the same. A* is general-purpose–it has to finish level d − 1 because there might be an edge leading to the goal of which the edge has value 0, leading to a better solution. There is an easy solution to this. If node u is adjacent to a goal node then define h(u) = min{w(u, t) | t ∈ T}. The new weight of an optimal edge is 0 so that it is searched first.
Lemma 2.4. Let G be a weighted problem graph, h be a heuristic, and w(u, ˆ v) = w(u, v) − h(u) + h(v). ˆ T) ≥ 0. If h is admissible, then δ(u, Proof. Since h(t) = 0 and since the shortest path costs remain invariant under reweighting of G by Lemma 2.3, we have ˆ T) = min{δ(u, ˆ t) | t ∈ T} δ(u, = min{δ(u, t) − h(u) + h(t) | t ∈ T} = min{δ(u, t) − h(u) | t ∈ T} = min{δ(u, t) | t ∈ T} − h(u) = δ(u, T) − h(u) ≥ 0.
Theorem 2.10. (A* for Admissible Heuristics) For weighted graphs G = (V, E, w) and admissible heuristics h, algorithm A* is complete and optimal. Proof. Immediate consequence of Lemma 2.4 together with applying Theorem 2.3.
A first remark concerning notation: According to the original formulation of the algorithm, the ∗ in h∗ , and so on was used to denote optimality. As we will see, many algorithms developed later were named conforming to this standard. Do not be surprised if you see many stars! With respect to the search objective f = g + h, Figure 2.17 illustrates the effect of applying DFS, BFS, A*, and greedy best-first search, the A* derivate with f = h.
A∗ , f ∗ ,
74
CHAPTER 2 Basic Search Algorithms
Closed
Closed g
g
Open
Open
Expansion Criterion: u ∈Open with max. g(u)
Expansion Criterion: u ∈Open with min. g(u)
(a) Closed Open
g
h
Expansion Criterion: u ∈Open with min. g(u) + h(u) (c)
(b) Closed Open
h
Expansion Criterion: u ∈Open with min. h(u) (d)
FIGURE 2.17 Different search strategies: (a) DFS, (b) BFS, (c) A*, and (d) greedy best-first search.
2.2.2 On the Optimal Efficiency of A* It is often said that A* does not only yield an optimal solution, but that it expands the minimal number of nodes (up to tie breaking). In other words, A* has optimal efficiency for any given heuristic function, or no other algorithm can be shown to expand fewer nodes than A*. The result, however, is only partially true. It does hold for consistent heuristics, but not necessarily for admissible heuristics. We first give a proof for the first case and a counterexample for the second one.
Consistent Heuristics We remember that we can view a search with a consistent heuristic as a search in a reweighted problem graph with nonnegative costs.
Theorem 2.11. (Efficiency Lower Bound) Let G be a problem graph with nonnegative weight function, with initial node s and final node set T, and let f ∗ = δ(s, T) be the optimal solution cost. Any optimal algorithm has to visit all nodes u ∈ V with δ(s, u) < f ∗ . Proof. We assume the contrary; that is, that an algorithm A finds an optimal solution pt with w( pt ) = f ∗ and leaves some u with δ(s, u) < f ∗ unvisited. We will show that there might be another solution path q with w(q) < f ∗ that is not found. Let qu be the path with w(qu ) = δ(s, u), let t be a supplementary
2.3 *General Weights
−2^k
2^k/2
−16
8
−8
4
−4
2
75
−2
1
2^k 0
0
0
0
0
FIGURE 2.18 A problem graph with an exponential number of reopenings.
special node in T and V, and let (u, t) be a new edge with w(u, t) = 0. Since u is not expanded, for A we do not know if (u, t) exists. Let q = (qu , t). Then w(q) = w(qu ) + w(u, t) = w(qu ) = δ(s, u) < f ∗ . If the values δ(s, u) are pairwise different, then there is no tie, and the number of nodes that A expands will have to be larger than or equal to the number of nodes that A* expands.
Nonconsistent Heuristics If we have admissibility but not consistency, A* will reopen nodes. Even worse, as we will indicate later, A* might reopen nodes exponentially many times, even if the heuristic is admissible. This leads to an exponential time consumption in the size of the graph. Fortunately, this strange behavior does not appear frequently in practice, as in most cases we deal with unit costs, limiting the number of possible improvements for a particular node to the depth of the search. Based on the process of reweighting edges, we can better reflect what happens when we reopen nodes. If we consider nonconsistent heuristics, the reweighted problem graph may contain negative edges. If we consider w(u, v) + h(v) − h(u) as the new edge costs, Figure 2.18 gives an example for a problem graph that leads to exponentially many reopenings. The second last node is reopened for every path with weight {1, 2, . . . , 2k − 1}. It is not difficult to restore a heuristic function with nonnegative edge costs. For the top-level nodes in the triangles we have 2k + 2k/2 , . . . , 24, 12, 6, and 3, and for the bottom level node we have 2k , 2k/2 , . . . , 16, 8 , 4, 2, 1, and 0. The weights for the in- and outgoing edges at the top-level nodes are zero, and the bottom-level edges are weighted 2k/2 , . . . , 8, 4, 2, 1, and 2k . Recourse to basic graph theory shows that there are algorithms that can do better. First of all, we notice that the problem graph structure is directed and acyclic so that a linear-time algorithm relaxes the nodes in topological order. General problem graphs with negative weights are dealt with by the algorithm of Bellman and Ford (see Alg. 2.8), which has a polynomial complexity. But even if we call the entire algorithm of Bellman and Ford for every expanded node, we have an accumulated complexity of O(n2 · e), which is large but not exponential as with A* and reopening. As a consequence, the efficiency of A* is not optimal. Nonetheless, in the domains that are used in problem solving practice, reopenings are rare, so that A*’s strategy is still a good choice. One reason is that for bounded weights, the worst-case number of reopenings is polynomial.
2.3 *GENERAL WEIGHTS Next we consider generalizing the state space search by considering an abstract notion of costs. We will consider optimality with respect to a certain cost or weight associated to edges. We abstract costs
76
CHAPTER 2 Basic Search Algorithms
by an algebraic formalism and adapt the heuristic search algorithms accordingly. We first define the cost algebra we are working on. Then we turn to a cost-algebraic search in graphs, in particular for solving the optimality problem. Cost-algebraic versions of Dijkstra’s algorithm and A* with consistent and admissible estimates are discussed. Lastly we discuss extensions to a multiobjective search.
2.3.1 Cost Algebras Cost-algebraic search methods generalize edge weights in a rather straightforward way to more general cost structures. Our formalism for cost is called cost algebra. We recall some required definitions of algebraic concepts. Let A be a set and × : A × A → A be a binary action. A monoid is a tuple hA, ×, 1i if 1 ∈ A and for all a, b, c ∈ A, − a×b ∈ A (closeness) − a × (b × c) = (a × b) × c (associativity) − a×1 = 1×a = a (identity) Intuitively, set A will represent the domain of the costs and × is the operation representing the cumulation of costs. Let A be a set. A relation ∈ A × A is a total order whenever for all a, b, c ∈ A, − − − −
aa (reflexivity) a b ∧ b a ⇒ a = b (antisymmetry) a b ∧ b c ⇒ a c (transitivity) a b∨b a (total)
We write a ≺ b if a b and a 6= b. We say that a set A is isotone if a b implies both a × c b × c and c × a c × b for all a, b, c ∈ A.
Definition 2.2. (Cost Algebra) A cost algebra is a 5-tuple hA, ×, , 0, 1i, such that hA, ×, 1i is a monoid, is a total order, 0 = uA and 1 = tA, and A is isotone. The least and greatest operations are defined as follows: tA = c such that c a for all a ∈ A, and uA = c such that a c for all a ∈ A. Intuitively, A is the domain set of cost values, × is the operation used to cummulate values and t is the operation used to select the best (the least) among values. Consider, for example, the following cost algebras:
..
hIR+ ∪ {+∞}, +, ≤, +∞, 0i (optimization) hIR+ ∪ {+∞}, min, ≥, 0, +∞i (max/min) The only nontrivial property to be checked is isotonicity. hIR+ ∪ {+∞}, +, ≤, +∞, 0i: Here we have to show that a ≤ b implies both a + c ≤ b + c and c + a ≤ c + b for all a, b, c ∈ IR+ ∪ {∞}, which is certainly true. hIR+ ∪ {+∞}, min, ≥, 0, +∞i: a ≥ b implies min{a, c} ≥ min{b, c} and min{c, a} ≥ min{c, b}, a, b, c ∈ IR+ ∪ {∞}.
2.3 *General Weights
77
Not all algebras are isotone; for example, take A ⊆ IR × IR with (a, c) × (b, d) = (min{a, b}, c + d) and (a, c) (b, d) if a > b or c < d if a = b. We have (4, 2) × (3, 1) = (3, 3) (3, 2) = (3, 1) × (3, 1) but (4, 2) ≺ (3, 1). However, we may easily verify that the related cost structure implied by (a, c) × (b, d) = (a + b, min{c, d}) is isotone. More specific cost structures no longer cover all the example domains. For example, the slightly more restricted property of strict isotonicity, where we have that a ≺ b implies both a × c ≺ b × c and c × a ≺ c × b for all a, b, c ∈ A, c 6= 0, is not sufficient. For the max/min cost structure we have min{3, 3} = min{3, 5}, but 3 < 5.
Definition 2.3. (Multiple-Edge Graph) A multiple-edge graph G is a tuple (V, E, in, out, w), where V is a set of nodes, E is a set of edges, in, out : E → V are a source and target functions, and w : E → A is a weight function. The definition generalizes ordinary graphs as it includes a function that produces the source of an edge, and a target function that produces the destination of an edge, so that different edges can have the same source and target. An example is provided in Figure 2.19. Why haven’t we insisted on multiple-edge graphs right away? This is because with the simple cost notion we used in Chapter 1 we can remove multiple edges by keeping only the cheapest ones between the edges for each pair of nodes. The removed edges are superfluous because we are interested in shortest paths. In contrast, we need multiple edges to evidence the need of isotonicity in algebraic costs. Therefore, the definition of in and out includes graphs with multiple edges on node pairs. Multipleedge problem graphs have a distinguished start node s, which we denote with uG 0 , or just s = u0 if G is clear from the context. For an alternating sequence of nodes and edges u0 , a0 , u1 , . . . , such that for each ai i ≥ 0 we have ui ∈ V, ai ∈ E, in(ai ) = ui , and out(ai ) = ui+1 , or, shortly ui → ui+1 . An initial path is a path starting at s. Finite paths are required to end at nodes. The length of a finite path p is denoted by |p|. The concatenation of two paths p, q is denoted by pq, where we require p to be finite and end at the initial node of q. The cost of a path is given by the cumulative cost of its edges.
v2 4 3
3 4
v1
2
4 4 v3
3
3
4
2
4
v4
FIGURE 2.19 A multiple-edge graph.
2
78
CHAPTER 2 Basic Search Algorithms
v2 4
v1
4
2
v3
2
v4
FIGURE 2.20 The problem of prefix-optimality.
On general cost structures, not all subpaths of an optimal path are necessarily optimal. A path ak−1 ai−1 a0 a0 p = (s = u0 → . . . → uk ) is prefix-optimal if all prefixes of this path p = (s = u0 → . . . → ui ) with i < k form an optimal path. As an example consider the (max/min) cost structure of the problem graph in Fig. 2.20. Path (v1 , v3 , v4 ) and path (v1 , v2 , v3 , v4 ) are optimal with cost 2, but only (v1 , v2 , v3 , v4 ) is prefix-optimal. Reachability and optimality problems can be solved with traditional search algorithms. For the reachability problem, for instance, we can use, among others, depth-first search. For the optimality problem, on the other hand, only Dijkstra’s algorithm or A* are appropriate. They are traditionally defined over a simple instance of our cost algebra, namely the optimization cost algebra hIR+ ∪ {+∞}, +, ≤, +∞, 0i. Thus, we need to generalize the results that ensure the optimality of the search algorithms; that is, the fact that they correctly solve the optimality problem. The design of cost-algebraic algorithms depends on a different notion for the principle of optimality, which intuitively means that the optimality problem can be decomposed.
Definition 2.4. (Principle of Optimality) The principle of optimality requires δ(s, v) = t{δ(s, u) × a w(a) | u → v}, where s is the start node in a given problem graph G. Lemma 2.5. Any cost algebra hA, ×, , 0, 1i satisfies the principle of optimality. Proof. We have a
a
t {δ(s, u) × w(a) | u → v} = t {t {w( p) | p = (s, . . . , u)} × w(a)|u → v} a
= t {w( p) × w(a) | p = s → · · · → u → v} = t {w( p0 ) | p0 = s → · · · → v} = δ(s, v). The first step is by definition and the second step by the distributivity of ×. The third step is by isotonicity, since c × b a × b for all a implies t{b | b ∈ B} × c = t{b × c | b ∈ B}, and the last step is by definition. Next we adapt the notions of admissibility and consistency of heuristic functions.
2.3 *General Weights
79
Definition 2.5. (Cost-Algebraic Heuristics) A heuristic function h with h(t) = 1 for each goal node t ∈ T is
..
admissible, if for all u ∈ V we have h(u) δ(u, T); a consistent, if for each u, v ∈ V, a ∈ E with u → v we have h(u) w(a) × h(v).
We can generalize the fact that consistency implies admissibility.
Lemma 2.6. (Consistency Implies Admissibility) If h is consistent, then it is admissible. a0
a1
ak−1
Proof. We have δ(u, T) = w( p) for some solution path p = (u = u0 → u1 → . . . uk−1 → uk = t), t ∈ T, and h(u) w(a0 ) × h(v) w(a0 ) × w(a1 ) × . . . × w(ak−1 ) × h(uk ) = δ(u, T). We can extend the approach to more than one optimization criterion; for example, for the prioritized Cartesian product of two cost algebras C1 = hA1 , t1 , ×1 , 1 , 01 , 11 i and C2 = hA2 , t2 , ×2 , 2 , 02 , 12 i, which is defined by C1 × C2 is a tuple hA1 × A2 , t, ×, , (01 , 02 ), (11 , 12 )i, where (a1 , a2 ) × (b1 , b2 ) = (a1 × b1 , a2 × b2 ), (a1 , a2 ) (b1 , b2 ) if and only if a1 ≺ b1 ∨ (a1 = b1 ∧ a2 b2 ), and a t b = a if and only if a b. Cartesian products that prioritize one criteria among the others have the problem to deliver nonisotone algebras in general (see Exercises).
Lemma 2.7. (Cartesian Product Cost Algebra) If C1 , C2 are cost algebras and C1 is strictly isotone then C1 × C2 is a cost algebra. Proof. The only nontrivial part is isotonicity. If we have (a1 , a2 ) (b1 , b2 ) then there are two cases. First, a1 ≺ a2 , in which case (by strict isotonicity) we have a1 × c1 ≺ b1 × c1 and c1 × a1 ≺ c1 × b1 , which clearly implies (a1 , a2 ) × (c1 , c2 ) (b1 , b2 ) × (c1 , c2 ) and (c1 , c2 ) × (a1 , a2 ) (c1 , c2 ) × (b1 , b2 ). The second case is a1 = b1 and a1 b2 . This trivially implies a1 × c1 = b1 × c1 and a1 × c1 = b1 × c1 and, by isotonicity, a2 × c2 b2 × c2 and c2 × a2 c2 × b2 . Clearly, we have (a1 , a2 ) × (c1 , c2 ) (b1 , b2 ) × (c1 , c2 ) and (c1 , c2 ) × (a1 , a2 ) (c1 , c2 ) × (b1 , b2 ). Similarly, we can show that if C1 and C2 are strictly isotone then C1 × C2 is strictly isotone (see Exercises).
2.3.2 Multiobjective Search Many realistic optimization problems, particularly those in design, require the simultaneous optimization of more than one objective function. As an example for bridge construction, a good design is characterized by low total mass and high stiffness. A good aircraft design requires simultaneous optimization of fuel efficiency, payload, and weight. A good sunroof design in a car minimizes the noise the driver hears and maximizes the ventilation. With cost algebras we could preserve the work on certain cross-products of criteria. In the multiobjective case we have now arrived at vectors and partial orders. A multiobjective search is an extension to traditional search algorithms, where edge costs are vectors. It generalizes a cost-algebraic search and is applicable in various domains where one has several conflicting objectives with solutions that are optimal for the one but not the others. More formally, multiobjective search can be stated as follows. We are given a weighted problem graph G with n nodes, e edges, and cost function w : E → IRk . We additionally have a start node s and a set of goal nodes T. The goal is to find the set of nondominated solution paths in G from s to T, where dominance is
80
CHAPTER 2 Basic Search Algorithms
2 2
v2
v6 2 2
2 1
v4 7 1 8 4
v1
1 7
6 4
1 1
v3
v5
FIGURE 2.21 Example graph for multiobjective search.
given in the form of the following partial order relation : For all v ∈ IRk we have v v0 if vi ≤ v0i for all i ∈ {1, . . . , k}. A vector v ∈ A is dominated in set A ⊆ IRk if there is a v0 6= v in A with v0 v. The aim is to find solutions that are nondominated such that there exists no other feasible solution that will yield an improvement in one objective without causing a degradation in at least one other objective. Figure 2.21 provides a graph with six nodes and cost vector pairs associated with each edge. In difference to the cost-algebraic search, relation is not a total order. it is not always pos Hence, sible to rank two elements in IR with respect to . For example, take 34 and 43 . Heuristics h : V → IRk estimate the accumulated cost vectors of paths to set T. Heuristic h is admissible if for all nondominated solution paths, p = (s = u0 , u1 , . . . , uk = t), t ∈ T, and for all prefix paths pi = (s = u0 , u1 , . . . , ui ) we have w(pi ) + h(ui ) w(p) = w(pt ). Since most approaches illustrated earlier do not easily translate into a multiobjective search, solving them remains being a challenge.
2.4 SUMMARY In this chapter, we discussed several search algorithms and their properties. Some search algorithms find a path from the given start state to any of the given goal states; others find paths from the given start state to all other states; and even others find paths from all states to all other states. Desirable
2.4 Summary
81
properties of search algorithms include their correctness (they find a path if and only if one exists), optimality (they find a shortest path), a small runtime, and small memory consumption. In some cases, the correctness or optimality of a search algorithm is only guaranteed on special kinds of graphs, such as unit or nonnegative cost graphs, or where the goal distances of all states are nonnegative. We are often forced to make trade-offs between the different properties, for example, find suboptimal paths because the runtime or memory consumption would otherwise be too large. We discussed that most search algorithms perform dynamic programming as an underlying technique. Dynamic programming is a general problem-solving technique that assembles the solutions of complex problems from solutions to simpler problems, which are calculated once and reused several times. Dynamic programming works over the entire state space as a whole, in contrast to heuristic search algorithms, which focus on finding only the optimal path for a single current state and prune everything else for efficiency. On the other hand, most heuristic search algorithms apply dynamic programming updates and traverse the state space in the same way. They build a tree from the given start state to the goal state, maintaining an estimate of the start distances of all states in the search tree. The interior nodes are in the Closed list and the leaf nodes are in the Open list. They repeatedly pick a leaf of the search tree and expand it; that is, generate its successors in the state space and then add them as its children in the search tree. (They differ in which leaves they pick.) They can find a path from the start state to any of the given goal states if they stop when they are about to expand a goal state and return the only path from the root of the search tree to this goal state. They can find paths from the start state to all other states if they stop only when they have expanded all leaf nodes of the search tree. We distinguished uninformed and informed search algorithms. Uninformed search algorithms exploit no knowledge in addition to the graphs they search. We discussed depth-first search, breadth-first search, Dijkstra’s algorithm, the Bellman-Ford algorithm, and the Floyd-Warshall algorithm in this context. Informed (or synonymously, heuristic) search algorithms exploit estimates of the goal distances of the nodes (heuristic values) to be more efficient than uninformed search algorithms. We discussed A* in this context. We discussed the properties of A* in detail since we discuss many variants of it in later chapters. A* with consistent heuristics has many desirable properties:
. .
.
A* can find a shortest path even though it expands every state at most once. It does not need to reexpand states that it has expanded already. A* is at least as efficient as every other search algorithm in the sense that every search algorithm (that has the same heuristic values available as A*) needs to expand at least the states that A* expands (modulo tie-breaking; that is, possibly except for some states of which the f -values are equal to the length of the shortest path). A* with any given heuristic values cannot expand more states than A* with heuristic values that are dominated by the given heuristic values (again modulo tie-breaking).
Many of these properties followed from the properties of Dijkstra’s algorithm, since A* for a given search problem and heuristic values behave identically to Dijkstra’s algorithm on a search problem that can be derived from the given search problem by changing the edge costs to incorporate the heuristic values. Table 2.5 summarizes the uninformed and informed search algorithms, namely how to implement their Open and Closed lists, whether they can exploit heuristic values, which values their edge costs can take on, whether they find shortest paths, and whether or not they can reexpand states that they
82
CHAPTER 2 Basic Search Algorithms
Table 2.5 Overview of implicit graph search algorithms. Algorithm
Open
Closed
Heur
Weight
Optimal
Reopen
DFS (2.1/2.3) BFS (2.1/2.3) Dijkstra (2.1/2.4) Bellm.-Ford (2.7/2.8) A (2.1/2.5) Node-Sel. A (2.1/2.6) Floyd-Warshall (2.9)
stack queue pq queue pq set row
set set set set set set matrix
– – – – – – –
unit unit IR≥0 IR IR IR IR
– √ √ √ √ √ √
– – – √ √ √
A*, cons. (2.1/2.4) A*, admis. (2.1/2.5)
pq pq
set set
Policy-Iteration (2.11) Value-Iteration (2.12)
set set
set set
√ √ – √
IR≥0 IR≥0 prob. prob.
√ √ √
– – √ √ √
have expanded already. (The figures that describe their pseudo code are given in parentheses.) Most search algorithms build either on depth-first search or on breadth-first search, where depth-first search trades off runtime and optimality for a small memory consumption and breadth-first search does the opposite. Many discussed algorithms relate to breadth-first search: Dijkstra’s algorithm is a specialized version of A* in case no heuristic values are available. It is also a specialized and optimized version of the Bellman-Ford algorithm in case all edge costs are nonnegative. Breadth-first search, in turn, is a specialized and optimized version of Dijkstra’s algorithm in case all edge costs are uniform. Finally, we discussed algebraic extension to the operator costs and generalizations for search problems of which the edge costs are vectors of numbers (e.g., the cost and time required for executing an action), explaining why dynamic programming often cannot solve them as efficiently as graphs of which the edge costs are numbers because they often need to maintain many paths from the start state to states in the search tree.
2.5 EXERCISES 2.1
The Missionary and Cannibals (or Hobbits and Orcs) problem is defined as follows (see Fig. 2.22). At one side of a river there are three missionaries and three cannibals. They have a boat that can transport at most two persons. The goal for all persons is to cross the river. At no time should the number of cannibals exceed the number of missionaries for obvious reasons. 1. Draw the problem graph and provide its adjacency list representation. 2. Solve the problem via DFS and BFS by annotating the graph with numbers. 3. Consider a heuristic function that counts the number of people on the other side of the river. Do you observe an inconsistency? 4. Consider a compressed problem graph with actions that correspond to two successive river crossings. Use the same heuristic function as before. Is it consistent?
2.5 Exercises
83
Missionaries
Cannibals
FIGURE 2.22 The MISSIONARY AND CANNIBALS problem.
2.2
Solve the following two additional famous River Crossing problems optimally. 1. A man, a fox, a goose, and some corn are together on one side of the river. The boat can carry the man and one other subject. The goal is to move them on the other side. Neither the goose and the corn, nor the fox and the goose can be left alone. 2. Four couples have to cross a river that has one island. The boat carries only two persons and because partners are jealous, no person can be left alone with another single of a different sex.
2.3
The Knight’s Tour problem asks for a square disjoint on a (n × n)-size chess board; that is, for a path that covers the entire board and visits each square only once. 1. Show that there is no Knight’s Tour on a 4 × 4 board. 2. A Knight’s Tour on the 5 × 5 board is as follows: 1 12 17 24 3
18 23 2 11 16
13 8 21 4 25
22 19 6 15 10
7 14 9 20 5
Compute a Knight’s Tour starting top-left and ending two squares right of the bottom-left corner for boards sized 6 × 6, 7 × 7, 8 × 8, and 9 × 9.
84
CHAPTER 2 Basic Search Algorithms
3. A Knight’s Tour on a square board of size 6 × 6 with a square of size 1 × 1 omitted in the bottom-right corner, which starts top-right, and ends two squares right of the bottom-left corner looks as follows: 32 13 4 23 30 19
3 24 31 20 5 22
14 33 12 29 18 35
9 2 25 34 21 6
26 15 8 11 28 17
1 10 27 16 7
Construct similar tours for the boards 7 × 7 with a subsquare of size 2 × 2 omitted, 8 × 8 with a subsquare of size 3 × 3 omitted, and 9 × 9 with a subsquare of size 4 × 4 omitted. 4. Use the previous results to devise a Knight’s Tour strategy for covering any n × n board, n > 6, starting top-right. You will have to reflect some of the subtour patterns along the axes and diagonals. 2.4
Consider the Multiple Sequence Alignment problem between ACGTACGACGT and ATGTCGTACACGT. Take the same cost function as in Exercise 1.16. 1. Fill the dynamic programming table. How best to traverse it? 2. Display the extracted solution path, after the table has been filled.
2.5
Consider the graph in Figure 2.23. Denote the order of expanded nodes (and their f -values) as generated by DFS and BFS, as well as by A* and a greedy best-first search with the Euclidean distance estimate. To resolve ties, nodes should be inserted into the according data structures with respect to their alphabetic order.
2.6
Let graph G = (V, E, w) be a weighted graph, and T be a set of goal nodes. Suppose that for each node u ∈ V reachable from the source we have δ(u, T) = min{δ(u, t)| t ∈ T} ≥ 0. Show that the graph contains no negative cycle that is reachable from the source.
2.7
Consider the algorithm of Bellman and Ford (on a connected graph). 1. Show that the number of reopenings of a node can be bounded by the length (number of edges) L of an optimal solution path, so that the complexity of the algorithm is O(L · |E|). 2. Assign an order v1 , . . . , vn to the nodes of the input graph and partition E in Ef and Eb , where Ef = {(vi , vj ) ∈ E : i < j} and Eb = {(vi , vj ) ∈ E : i > j}. Gf = (V, Ef ) is acyclic with topological order v1 , . . . , vn and Gb = (V, Eb ) is acyclic with topological order vn , . . . , v1 . Now relax all edges in Ef leaving vi for all vi in {v1 , . . . , vn } and all edges in Eb leaving vi for all vi in {vn , . . . , v1 }. Show that n/2 passes suffice. 3. Another refinement is that if (Vj , Ej ), j ∈ {1, . . . , l} are the strongly connected components of G. (Recall that a and b are in the same strongly connected components P if a can reach b and b can reach a.) Show that the algorithm now runs in time O(|E| + j |Vj ||Ej |).
2.8
Knapsack has the following inputs: weights w1 , . . . , wn , utilities u1 , . . . , un , and weight limit W. Putting an item i into the knapsack increases the weight of the knapsack by wi and gives an additional utility of ui . The optimization problem is to maximize the utility in the set of all possible
2.5 Exercises
85
224 km b 60 km
48 km 168 km
c
f 40 km
236 km
d g
68 km
248 km 120 km
44 km e 240 km
a = 5 km
FIGURE 2.23 A map.
packings, while respecting the weight limit. The corresponding decision problem additionally takes a bound U for the utility as the input. 1. Show that Knapsack can be solved in time O(nW) by dynamic programming. 2. Extend the algorithm to compute the optimal packing. 2.9
The product C of two matrices A and B having respective sizes n × m and m × l is defined by P cij = m a i=1 ik · bkj , for 1 ≤ i ≤ n and 1 ≤ j ≤ l. Devise a dynamic programming algorithm to compute the matrix product of A1 , . . . , A6 (of sizes 6 × 2, 2 × 6, 6 × 3, 3 × 2, 2 × 7, and 7 × 8) with a minimal number of multiplications. 1. Determine the number of multiplications needed to compute (((A1 A2 )A3 )A4 )A5 )A6 ) and (((A1 A2 )A3 )(A4 (A5 A6 ))). 2. Find an arrangement of brackets with the least number of multiplications. 3. How many options are there to place brackets?
2.10
Prove the correctness of cost-algebraic search variants. 1. Show that the cost-algebraic version of Dijkstra’s algorithm solves the optimality problem on multiple-edge graphs. 2. Show that cost-algebraic A* for consistent estimates solves the optimality problem on multiple-edge graphs.
86
CHAPTER 2 Basic Search Algorithms
3. Prove the invariance condition for a cost-algebraic heuristic search. 4. Infer that cost-algebraic A* with reopening solves the optimality problem for admissible estimates on multiple-edge graphs. 2.11
Prove that if C1 and C2 are both strictly isotone, then C1 × C2 is strictly isotone.
2.12
Find and discuss differences and similarities of the algorithms value iteration (2.8) and BellmanFord (2.12).
2.13
Solve the following Wumpus World problem via value iteration and policy iteration: a 4 × 3 Gridworld with a hole at (2, 2), and two goals at (4, 3) and (4, 2). The agent starts at (1, 1); the rewards are: 1, for arriving at (4, 3), and −1, for arriving at (4, 2). Transition probabilities for the four possible move directions are as follows. With probability 0.8 the move is successful; with probability of 0.1 (each) the move direction misplaced at right angles. If a wall is encountered, the agent stays at its position. As discount value δ take 24/25. For both cases restrict the number of iterations to 50. 1. Display the stochastic transition system, with states and transition probabilities. 2. Provide the reward cost table.
2.14
Show that the -greedy policies with respect to πq are an improvement over every policy with π(u, a) > 0.
2.6 BIBLIOGRAPHIC NOTES Shortest path search is a classic topic in the field of combinatorial optimization. The algorithm of Dijkstra (1959) to find shortest paths in graphs with nonnegative edge weights is one of the most important algorithms in computer science. Sound introductions to shortest path search are given by Tarjan (1983) and Mehlhorn (1984). The linear-time shortest path algorithm for acyclic graphs can be found in Lawler (1976). Using lower bound to prune search goes back to the late 1950s, where branch-and-bound search was proposed. The first use of distance goal estimates to guide state space search is probably due to Doran and Michie (1966) in a program called GraphTraverser. Original A* search as proposed by Hart, Nilsson, and Raphael (1968) refers to Dijkstra’s algorithm, but in most AI textbooks the link to standard graph theory has vanished. The reweighting transformation is found in Cormen, Leiserson, and Rivest (1990) in the context of the All Pairs Shortest Paths problem of Johnson (1977). It makes it abundantly clear that heuristics do not change the branching factor of a space, but affect the relative depth of the goal, an issue stressed while predicting the search efforts of IDA*. The general problem of finding the shortest path in a graph containing cycles of negative length is NP-hard (Garey and Johnson, 1979). Bellman (1958) and Ford and Fulkerson (1962) discovered the algorithm for shortest path search in negative graphs independently. A nondeterministic version is discussed by Ahuja, Magnanti, and Orlin (1989). Gabow and Tarjan (1989) showed√that if C is the weight of the largest edge the algorithm of Bellman and Ford can been improved to O( ne lg(nC)). To alleviate the problem of exponentially many node expansions in A*, Martelli (1977) suggested a variation of the Bellman-Ford algorithm,
2.6 Bibliographic Notes
87
where the relaxation is performed for the entire set of expanded nodes each time a new node is considered. His algorithm has been slightly improved by Bagchi and Mahanti (1983). The heuristic search version of the Bellman-Ford algorithm were entitled C, ProbA, and ProbC (Bagchi and Mahanti, 1985). Mero (1984) has analyzed heuristic search with a modifiable estimate in an algorithm B0 that extends the B algorithm of Martelli (1977). A taxonomy of shortest path search has been given by Deo and Pang (1984) and a general framework that includes heuristic search has been presented by Pijls and Kolen (1992). Sturtevant, Zhang, Holte, and Schaeffer (2008) have analyzed inconsistent heuristics for A* search, and propose a new algorithm that introduces a delay list for a better trade-off. The technique of dynamic programming has been introduced by Bellman (1958). One of the most important applications of this principle in computer science is probably the parsing of context-free languages (Hopcroft and Ullman, 1979; Younger, 1967). Computing edit-distances with dynamic programming is a result that goes back to mathematicians like Ulam and Knuth. In computational biology, the work of Needleman and Wunsch (1981) is considered as the first publication that applies dynamic programming to compute the similarity of two strings. A neat application also used for compiling this textbook is the optimal line break algorithm of Knuth and Plass (1981). A good introduction to the subject of dynamic programming is found in the textbook of Cormen et al. (1990). The lattice edge representation for multiple sequence alignment has been adopted in the program MSA by Gupta, Kececioglu, and Schaffer (1996). The term best-first search appears in AI literature in two different meanings. Pearl (1985) uses this term to define a general search algorithm that includes A* as a special case. Others use it to describe an algorithm that always expands the node estimated closest to the goal. Russell and Norvig (2003) coined the term greedy best-first search to avoid confusion. In our notation an algorithm is optimal if it computes a shortest solution path. We chose an optimal instead of an admissible algorithm as done by Pearl (1985). Optimality in our notation does not mean optimal efficiency. The optimality efficiency argument on the number of node expansions in A* with consistent heuristics has been given by Dechter and Pearl (1983). Common misconceptions of heuristic search have been highlighted by Holte (2009). The cost formalism extends the one of Sobrinho (2002) with an additional set, to where the heuristic function is mapped. The problem of Cartesian products and power constructions as defined for semirings by Bistarelli, Montanari, and Rossi (1997) is that they provide partial orders. Observations on multiobjective A* have been provided by Mandow and de-la Cruz (2010a,b). Multiobjective IDA* has been considered by Coego, Mandow, and de-la Cruz (2009). Speed-up techniques for a Dijkstra-like search have been studied by Berger, Grimmer, and Mu¨ ller-Hannemann (2010). Advances in multiobjective search also include work on minimum spanning trees by Galand, Perny, and Spanjaard (2010) as well as Knapsack problems by Delort and Spanjaard (2010).
This page intentionally left blank
CHAPTER
*Dictionary Data Structures
3
The exploration efficiency of algorithms like A* is often measured with respect to the number of expanded/generated problem graph nodes, but the actual runtimes depend crucially on how the Open and Closed lists are implemented. In this chapter we look closer at efficient data structures to represent these sets. For the Open list, different options for implementing a priority queue data structure are considered. We distinguish between integer and general edge costs, and introduce bucket and advanced heap implementations. For efficient duplicate detection and removal we also look at hash dictionaries. We devise a variety of hash functions that can be computed efficiently and that minimize the number of collisions by approximating uniformly distributed addresses, even if the set of chosen keys is not (which is almost always the case). Next we explore memory-saving dictionaries, the space requirements of which come close to the information-theoretic lower bound and provide a treatment of approximate dictionaries. Subset dictionaries address the problem of finding partial state vectors in a set. Searching the set is referred to as the Subset Query or the Containment Query problem. The two problems are equivalent to the Partial Match retrieval problem for retrieving a partially specified input query word from a file of k-letter words with k being fixed. A simple example is the search for a word in a crossword puzzle. In a state space search, subset dictionaries are important to store partial state vectors like dead-end patterns in Sokoban that generalize pruning rules (see Ch. 10). In state space search, string dictionaries are helpful to exclude a set of forbidden action sequences, like UD or RL in the (n2 − 1)-Puzzle, from being generated. Such sets of excluded words are formed by concatenating move labels on paths that can be learned and generalized (see Ch. 10). Therefore, string dictionaries provide an option to detect and eliminate duplicates without hashing and can help to reduce the efforts for storing all visited states. Besides the efficient insertion (and deletion) of strings, the task to determine if a query string is the substring of a stored string is most important and has to be executed very efficiently. The main application for string dictionaries are web search engines. The most flexible data structure for efficiently solving this Dynamic Dictionary Matching problem is the Generalized Suffix Tree.
3.1 PRIORITY QUEUES When applying the A* algorithm to explore a problem graph, we rank all generated but not expanded nodes u in list Open by their priority f (u) = g(u) + h(u). As basic operations we need to find the
89
90
CHAPTER 3 *Dictionary Data Structures
element of the minimal f -value: to insert a node together with its f -value and to update the structure if a node becomes a better f -value due to a shorter path. An abstract data structure for the three operations Insert, DeleteMin, and DecreaseKey is a priority queue. In Dijkstra’s original implementation, the Open list is a plain array of nodes together with a bitvector indicating if elements are currently open or not. The minimum is found through a complete scan, yielding quadratic execution time in the number of nodes. More refined data structures have been developed since, which are suitable for different classes of weight functions. We will discuss integer and general weights; for integer cost we look at bucket structures and for general weights we consider refined heap implementations.
3.1.1 Bucket Data Structures In many applications, edge weights can only be positive integers (sometimes for fractional values it is also possible and beneficial to achieve this by rescaling). As a general assumption we state that the difference between the largest key and the smallest key is less than or equal to a constant C.
Buckets A simple implementation for the priority queues is a 1-Level Bucket. This priority queue implementation consists of an array of C + 1 buckets, each of which is the first link in a linked list of elements. With the array we associate the three numbers minValue, minPos, and n: minValue denotes the smallest f value in the queue, minPos fixes the index of the bucket with the smallest key, and n is the number of stored elements. The ith bucket b[i] contains all elements v with f (v) = (minValue + (i − minPos)) mod (C + 1), 0 ≤ i ≤ C. Figure 3.1 illustrates an example for the set of keys {16, 16, 18, 20, 23, 25}. The implementations for the four main priority queue operations Initialize, Insert, DeleteMin, and DecreaseKey are shown in Algorithms 3.1 through 3.4. With doubly linked lists (each element has a predecessor and successor pointer) we achieve constant runtimes for the Insert and DecreaseKey operations, while the DeleteMin operation consumes O(C) time in the worst-case for searching a nonempty bucket. For DecreaseKey we generally assume that a pointer to the element to be deleted is available. Consequently, Dijkstra’s algorithm and A* run in O(e + nC) time, where e is the number of edges (generated) and n is the number of nodes (expanded). C=9 minValue = 16 minPos = 6 n=6
0 1 2 3 4 5 6 7 8 9 20
23
25 16 16
FIGURE 3.1 Example for a 1-LEVEL BUCKET data structure.
18
3.1 Priority Queues
91
Procedure Initialize Input: 1-LEVEL BUCKET array b[0..C] (implicit constant C) Side Effect: Updated 1-LEVEL BUCKET b[0..C] n←0 minValue ← ∞
;; No element in so far ;; Default value for current minimum
Algorithm 3.1 Initializing a 1-LEVEL BUCKET.
Procedure Insert Input: 1-LEVEL BUCKET b[0..C], element x with key k Side Effect: Updated 1-LEVEL BUCKET b[0..C] n ← n+1 if (k < minValue) minPos ← k mod (C + 1) minValue ← k Insert x in b[k mod (C + 1)]
;; Increase number of elements ;; Element with smallest key ;; Update location of minimum ;; Update current minimum ;; Insert into list
Algorithm 3.2 Inserting an element into a 1-LEVEL BUCKET.
Procedure DeleteMin Input: 1-LEVEL BUCKET b[0..C] Output: Element x with key minPos Side Effect: Updated 1-LEVEL BUCKET b[0..C] Remove x in b[minPos] from doubly ended list n ← n−1 if (n > 0) while (b[minPos] = ∅) minPos ← (minPos + 1) mod (C + 1) minValue ← Key(x), x ∈ b[minPos] else minValue ← ∞ return x
;; Eliminate element ;; Decrease number of elements ;; Structure nonempty ;; Bridge possible gaps ;; Update location of pointer ;; Update current minimum ;; Structure empty ;; Feedback result
Algorithm 3.3 Deleting the minimum element in a 1-L EVEL BUCKET.
Given that the f -value can often be bounded by a constant fmax in a practical state space search, authors usually omit the modulo operation mod (C + 1), which reduces the space for array b to O(C), and take a plain array addressed by f instead. If fmax is not known in advance a doubling strategy can be applied.
92
CHAPTER 3 *Dictionary Data Structures
Procedure DecreaseKey Input: 1-LEVEL BUCKET b[0..C], element x, key k Side Effect: Updated 1-LEVEL BUCKET b[0..C] with x moved Remove x from doubly ended list n ← n−1 Insert x with key k in b
;; Eliminate element ;; Decrease number of elements ;; Reinsert element
Algorithm 3.4 Updating the key in a 1-LEVEL BUCKET.
Multilayered Buckets In state space search, we often have edge weights that are of moderate size, say realized by a 32-bit integer for which a bucket array b of size 232 is too large, whereas 216 can be afforded. The space complexity and the √ worst-case time complexity O(C) for DeleteMin can be reduced to by using a 2-Level Bucket data structure with one an amortized complexity of O( C) operations √ top and one bottom level, both of length d C + 1e + 1. In this structure we have two pointers for the minimum position, minPosTop and minPosBottom, and a number nbot of bottom elements. Although each bucket in the bottom array holds a list of elements with the same key as before, the top layer points to lower-level arrays. If after a DeleteMin operation that yields a minimum key k no insertion is performed with a key less than k (as it is the case for a consistent heuristic in A*), it is sufficient to maintain only one bottom bucket (at minPosTop), and collect elements in higher buckets in the top level; the lower-level buckets can be created only when the current bucket at minPosTop becomes empty and minPosTop moves on to a higher one. One √ advantage is that in the case of maximum distance between keys, DeleteMin has to inspect only the d C + 1e + 1 buckets of the top level; moreover, it saves space if only a small fraction of the available range C is actually filled. As an example, take C = 80, minPosTop = 2, minPosBottom = 1, and the set of element keys {7, 7, 11, 13, 26, 35, 48, 57, 63, 85, 86}. The intervals and elements in the top buckets are b[2] : [6, 15] = {7, 7, 11, 13}, b[3] : [16, 25] = ∅, b[4] : [26, 35] = {26, 35}, b[5] : [36, 45] = ∅, b[6] : [46, 55] = {48}, b[7] : [56, 65] = {57, 63}, b[8] : [66, 75] = ∅, b[9] : [76, 85] = {85}, b[0] : [86, 95] = {86}, and b[1] : [96, 105] = ∅. Bucket b[2] is expanded with nonempty bottom buckets 1, 5, and 7 containing the elements 7, 11, and 13, respectively. Figure 3.2 illustrates the example. Since DeleteMin reuses the bottom bucket in case it becomes empty, in some cases it is fast and in other cases it is slow. In our case of the 2-Level Bucket, let √ 8l be the number of elements in in the worst-case, the top-level bucket, for the lth operation, then DeleteMin uses O( C + ml ) time √ where ml is the number of elements that move from top to bottom. The term O( C) is the worstcase distance passed by in the top bucket, and ml are efforts for the reassignment, which costs are equivalent to the number of elements that move from top to bottom. Having to wait until all moved elements in the bottom layer√ are dealt with, the worst-case work √ is amortized over a longer time period. By amortization we have O( C + ml + (8l − 8l−1 )) = O( C) operations. Both operations Insert and DecreaseKey run in real and amortized constant time.
3.1 Priority Queues
93
C = 80 valTop = 6 minPosTop = 2
btop :
bbot : nbot = 4
0 1 2 3 4 5 6 7 8 9 .. .. .. .. .. .. 86 .... .... 35 48 57 85 .. .. .. .. ... ... .. .. 26 63 .. .. .. .. .. ........... .. .................................... .. .. . . 0 1 2 3 4 5 6 7 8 9 7
11
13
7
FIGURE 3.2 Example for 2-LEVEL BUCKET data structure.
Radix Heaps For achieving an even better amortized runtime, namely O(lg C), a so-called Radix Heap maintains a list of dlg(C + 1)e + 1 buckets of sizes 1, 1, 2, 4, 8, 16, and so on (see Fig. 3.3). The main difference to layered buckets is to use buckets of exponentially increasing sizes instead of a hierarchy. Therefore, only O(lg C) buckets are needed. For the implementation we maintain buckets b[0..B] and bounds u[0..B + 1] with B = dlg(C + 1)e + 1 and u[B + 1] = ∞. Furthermore, the bucket number φ(k) denotes the index of the actual bucket for key k. The invariants of the algorithms are (1) all keys in b[i] are in [u[i], u[i + 1]]; (2) u[1] = u[0] + 1; and (3) for all i ∈ {1, . . . , B − 1} we have 0 ≤ u[i + 1] − u[i] ≤ 2i−1 . The operations are as follows. Initialize generates an empty Radix Heap according to the invariants (2) and (3). The pseudo code is shown in Algorithm 3.5. To insert an element with key k, in a linear scan a bucket i is searched, starting from the largest one (i = B). Then the new element with key k is inserted into the bucket b[i] with i = min{j | k ≤ u[j]}. The pseudo-code implementation is depicted in Algorithm 3.6. 1 0
1 1
2 2
4 4
8 8
16 16
32 32
FIGURE 3.3 Example for a RADIX HEAP. The bottom row numbers denote current values of the bounds u and the top row numbers denote the size of the interval defined by two successive u-values.
94
CHAPTER 3 *Dictionary Data Structures
Procedure Initialize Input: Array b[0..B] of lists and array u[0..B] of bounds Side Efect: Initialized RADIX HEAP with arrays b and u for each i in {0, . . . , B} b[i] ← ∅ u[0] ← 0; u[1] ← 1 for each i in {2, . . . , B} u[i] ← u[i − 1] + 2i−2
;; Initialize buckets ;; Initialize bounds ;; Initialize bounds
Algorithm 3.5 Creating a RADIX HEAP.
Procedure Insert Input: RADIX HEAP with array b[0..B + 1] of lists and array u[0..B + 1], key k Side Effect: Updated RADIX HEAP i←B while (u[i] > k) i ← i − 1 Insert k in b[i]
;; Initialize index ;; Decrease index ;; Insert element in list
Algorithm 3.6 Inserting an element into a RADIX HEAP.
Procedure DecreaseKey Input: RADIX HEAP with array b[0..B + 1] of lists and array u[0..B + 1], index i in which old key k is stored, new key k0 Side Effect: Updated RADIX HEAP while (u[i] > k0 ) i ← i − 1 Insert k0 in b[i]
;; Decrease index ;; Insert element in list
Algorithm 3.7 Inserting an element into a RADIX HEAP.
For DecreaseKey, bucket i for an element with key k is searched linearly. The difference is that the search starts from the actual bucket i for key k as stored in φ(k). The implementation is shown in Algorithm 3.7. For DeleteMin we first search for the first nonempty bucket i = min{j | b[j] 6= ∅} and identify the element with minimum key k therein. If the smallest bucket contains an element it is returned. For the other case u[0] is set to k and the bucket bounds are adjusted according to the invariances; that is, u[1] is set to k + 1 and for j > 2 bound u[j] is set to min{u[j − 2] + 2j−2 , u[i + 1]}. Lastly, the elements of b[i] are distributed to buckets b[0], b[1], . . . , b[i − 1] and the minimum element is extracted from the nonempty smallest bucket. The implementation is shown in Algorithm 3.8.
3.1 Priority Queues
95
Procedure DecreaseMin Input: RADIX HEAP with array b[0..B + 1] of lists and array u[0..B + 1] Output: Minimum element Side Effect: Updated RADIX HEAP ;; Start with first bucket ;; Select (any) minimum key ;; Eliminate minimum key ;; Search for first nonempty bucket ;; First bucket empty ;; Select smallest key ;; Update bounds ;; Loop on array indices ;; Update bounds ;; Initialize index ;; Keys to distribute ;; Increase index ;; Distribute ;; Output minimum element
i←0 r ← Select(b[i]) b[i] ← b[i] \ {r} while (b[i] = ∅) i ← i + 1 if (i > 0) k ← min b[i] u[0] ← k, u[1] ← k + 1 for each j in {2, . . . , i} u[j] ← min{u[j − 1] + 2j−2 , u[i + 1]} j←0 for each k in b[i] while (k > u[j + 1]) j ← j + 1 b[j] ← b[j] ∪ {k} return r Algorithm 3.8 Delete the minimum from a RADIX HEAP.
0 0
6,7 1
2
4
8
16
32
7
8
8
8
16
32
6,7 6
FIGURE 3.4 Example for DeleteMin operation in a RADIX HEAP.
As a short example for DeleteMin consider the following configuration (written as [u[i]] : b[i]) of a Radix Heap [0] : {0}, [1] : ∅, [2] : ∅ [4] : {6, 7}, [8] : ∅, [16] : ∅ (see Fig. 3.4). Extracting key 0 from bucket 1 yields [6] : {6, 7}, [7] : ∅, [8] : ∅, [8] : ∅, [8] : ∅, [16] : ∅. Now, key 6 and 7 are distributed. If b[i] 6= ∅ then the interval size is at most 2i−1 . In b[i] we have i − 1 buckets available. Since all keys in b[i] are in [k, min{k + 2i−1 − 1, u[i + 1] − 1}] all elements fit into b[0], . . . , b[i − 1]. P The amortized analysis of the costs of maintaining a Radix Heap uses the potential 8l = x∈R φl (x) for operation l. We have that Initialize runs in O(B), and Insert runs in O(B). DecreaseKey has an amortized time complexity in O(φl (x) − φl−1 (x)) + 1 + (8lP − 8l−1 ) = O((φ Pl (x) − φl−1 (x)) − (φl (x) − φl−1 (x)) + 1) = O(1), and DeleteMin runs in time O(B + ( x∈b[i] φl (x) − x∈b[i] φl−1 (x)) + (8l − 8l−1 )) = O(1) amortized. In total we have a running time of O(m lg C + l) for m Insert and l DecreaseKey and ExtractMin operations.
96
CHAPTER 3 *Dictionary Data Structures
Utilizing this representation, A* runs in time O(e + n lg C) time. For current computers, the value of lg C for encompassing the entire integer range is small (32 or 64), so that A* on integers using a Radix Heap runs in linear time in practice.
Van Emde Boas Priority Queues A Van Emde Boas Priority Queue is efficient when n > lg N for a universe U = {0, . . . , N − 1} of keys. In this implementation, all priority queue operations reduce to successor computation, which takes O(lg lg N) time. The space requirements are O(N lg lg N). We start by considering a data structure TN on the elements {0, . . . , N − 1} defining only three operations: Insert(x), Delete(x), and Succ(x), where the two first ones have an obvious semantics and the last one returns the smallest item in TN that is larger than or equal to x. All priority queue operations use the recursive operation Succ(x) that finds the smallest y in the structure TN with y > x. For the priority queue data structure, DeleteMin is simply implemented as Delete(Succ(0)), assuming positive key values, and DecreaseKey is a combination of a Delete and an Insert operation. Using an ordinary bitvector, Insert and Delete are constant-time operations, but Succ is inefficient. Using balanced trees, √all operations run in time O(lg N). A better solution is to implement a recursive representation with N distinct versions of T√N . The latter trees are called bottom, and an element √ i = a · N + b is represented by the entry b in bottom(a). The conversion from i to a and b in bitvector representation is simple, since a and b refer to the most and least significant half of the bits. Moreover, we have another version T√N called top that contains a only if a is nonempty. Algorithm√3.9 depicts a pseudo-code implementation of Succ. The recursion for the runtime is T(N) = T( N) + O(1). If we set N ∼ 2k then T(2k ) = T(2k/2 ) + O(1) so that T(2k ) = O(lg k) and T(N) = O(lg lg N). The subsequent implementations for Insert and Delete are shown in Algorithms 3.10 and 3.11. Inserting element x in TN locates a possible place by first seeking the successor Succ(x) of x. This leads to a running time of O(lg lg N). Deletion used the doubly linked structure and the successor relation. It also runs in O(lg lg N) time. A Van Emde Boas Priority Queue k-structure is recursively defined. Consider the example k = 4 (implying N = 16) with the set of five elements S = {2, 3, 7, 10, 13}. Set top is a 2-structure
Procedure Succ √ Input: VAN EMDE BOAS PRIORITY QUEUE structure TN , i = a N + b Output: min{k ∈ TN | k ≥ i} Side Effect: Updated VAN EMDE BOAS PRIORITY QUEUE structure TN if (maxValue(bottom(a)) ≥ b) √ j ← a N + Succ(bottom(a), b) else z ← Succ(top, a + 1) √ j ← c z + minValue(bottom(z)) return j
;; Maximum in bottom exceeds b ;; Search in bottom list ;; Maximum in bottom structure smaller than b ;; Compute temporary ;; Search in next-to-bottom ;; Return obtained value
Algorithm 3.9 Finding the successor in a VAN EMDE BOAS PRIORITY QUEUE.
3.1 Priority Queues
97
Procedure Insert √ Input: VAN EMDE BOAS PRIORITY QUEUE structure TN , i = a N + b Side Effect: Updated VAN EMDE BOAS PRIORITY QUEUE structure TN if (Size(bottom(a)) = 0) Insert(top, a) Insert(bottom, b)
;; Bottom structure empty ;; Recursive call ;; Insert element to bottom structure
Algorithm 3.10 Inserting an element in a VAN EMDE BOAS PRIORITY QUEUE.
Procedure Delete √ Input: VAN EMDE BOAS PRIORITY QUEUE structure TN , i = a N + b Side Effect: Updated VAN EMDE BOAS PRIORITY QUEUE structure TN Delete(bottom, b) if (Size(bottom(a)) = 0) Delete(top, a)
;; Remove element from bottom structure ;; Bottom structure now empty ;; Recursive call
Algorithm 3.11 Deleting an element from a VAN EMDE BOAS PRIORITY QUEUE.
on {0, 1, 2, 3} based on the set of possible prefixes in the binary encoding of the values in S. Set bottom is a vector of 2-structures (based on the suffixes of the binary state encodings in S) with bottom(0) = {2, 3}, bottom(1) = {3}, bottom(2) = {2}, and bottom(3) = {1}, since (2)2 = 00|10, (3)2 = 00|11, (7)2 = 01|11, (10)2 = 10|10, and (13)2 = 11|01. Representing top as a 2-structure implies k = 2 and N = 4, such that the representation of {0, 1, 2, 3} with (0)2 = 0|0, (1)2 = 0|1, (2)2 = 1|0, and (3)2 = 1|1 leads to a sub-top structure on {0, 1} and two sub-bottom structures bottom(0) = {0, 1} and bottom(1) = {0, 1}. To realize the structures in practice, a mixed representation of the element set is appropriate. On one hand, a doubly connected linked list contains the elements sorted according to the values they have in the universe. On the other hand, a bitvector b is devised, with bit i denoting if an element with value bi is contained in the list. The two structures are connected via links that point from each nonzero element to an item in the doubly connected list. The mixed representation (bitvector and doubly ended leaf list) for the earlier 4-structure (without unrolling the references to the single top and four bottom structures) is shown Figure 3.5.
3.1.2 Heap Data Structures Let us now assume that we can have arbitrary (e.g., floating-point) keys. Each operation in a priority queue then divides into compare-exchange steps. For this case, the most common implementation of a priority queue (besides a plain list) is a Binary Search Tree or a Heap.
98
CHAPTER 3 *Dictionary Data Structures
0 0 1 1 0 0 0 1 0 0 1 0 0 1 0 0
2
3
7
10
13
0010
0011
0111
1010
1101
FIGURE 3.5 An example of a 4-structure for the VAN EMDE BOAS PRIORITY QUEUE.
Binary Search Trees A Binary Search Tree is a binary tree implementation of a priority queue in which each internal node x stores an element. The keys in the left subtree of x are smaller than (or equal) to the one of x, and keys in the right subtree of x are larger than the one of x. Operations on a binary search tree take time proportional to the height of the tree. If the tree is a linear chain of nodes, linear comparisons might be induced in the worst-case. If the tree is balanced, a logarithmic number of operations for insertion and deletion suffice. Because balancing can be involved, in the following we discuss more flexible and faster data structures for implementing a priority queue.
Heaps A Heap is a complete binary tree; that is, all levels are completely filled except possibly the lowest one, which is filled from the left. This means that the depth of the tree (and every path length from the root to a leaf) is 2(lg n). Each internal node v satisfies the heap property: The key of v is smaller than or equal to the key of either of its two children. Complete binary trees can be embedded in an array A as follows. The elements are stored levelwise from left to right in ascending cells of the array; A[1] is the root; the left and right child of A[i] are A[2i] and A[2i + 1], respectively; and its parent is A[bi/2c]. On most current microprocessors, the operation of multiplication by two can be realized as a single shift instruction. An example of a Heap (including its array embedding) is provided in Figure 3.6. To insert an element into a Heap, we first tentatively place it in the next available leaf. As this might violate the heap property, we restore the heap property by swapping the element with its parent, if the parent’s key is larger; then we check for the grandparent key, and so on, until the heap property is valid or the element reaches the root. Thus, Insert needs at most O(lg n) time. In the array embedding we start with the last unused index n + 1 in array A and place key k into A[n + 1]. Then, we climb up the ancestors until a correct Heap is constructed. An implementation is provided in Algorithm 3.12. DecreaseKey starts at the node x that has changed its value. This reference has to be maintained with the elements that are stored. Algorithm 3.13 shows a possible implementation. To extract the minimum key is particularly easy: It is always stored at the root. However, we have to delete it and guarantee the heap property afterward. First, we tentatively fill the gap at the root with the last element on the bottom level of the tree. Then we restore the heap property using two comparisons per node while going down. This operation is referred to as SiftDown. That is, at a node we determine the minimum of the current key and that of the children; if the node is actually the minimum of the three, we are done, otherwise it is exchanged with the minimum, and the balancing
3.1 Priority Queues
2 4 6 9
8
7 5
8
1
2
4
5
99
10
6
3
12
7
9
FIGURE 3.6 Example of a HEAP. Array indices are attached to the nodes.
Procedure Insert Input: Key k, HEAP of size n embeded in Array A Side Effect: Updated HEAP of size n + 1 A[n + 1] ← k; x ← n + 1 ;; Place element at empty place at end of array while (x 6= 1) and (A[parent(x)] > A[x]) ;; Unless finished or root visited Swap(parent(x), x) ;; Exchange keys x ← parent(x) ;; Climb up structure n ← n+1 ;; Increase size Algorithm 3.12 Inserting an element into a HEAP.
Procedure DecreaseKey Input: HEAP, index x of element that has improved to value k Side Effect: Updated HEAP A[x] ← k while (x 6= 1) and (A[parent(x)] > A[x]) Swap(parent(x), x) x ← parent(x)
;; Update key value ;; Unless finished or root visited ;; Exchange keys ;; Climb up structure
Algorithm 3.13 Decreasing the key of an element in a HEAP.
continues at its previous position. Hence, the running time for DeleteMin is again O(lg n) in the worstcase. The implementation is displayed in Algorithm 3.14. Different SiftDown procedures are known: (1) top-down (as in Alg. 3.15); (2) bottom-up (first following the special path of smaller children to the leaf, then sifting up the root element as in Insert); or (3) with binary search (on the special path).
100
CHAPTER 3 *Dictionary Data Structures
Procedure DeleteMin Input: HEAP of size n Output: Minimum element Side Effect: Updated HEAP of size n − 1 Swap(A[1], A[n]) SiftDown(1) n ← n−1 return A[n + 1]
;; Swap last element to root position ;; Restore heap property ;; Decrease size ;; Return minimum element
Algorithm 3.14 Extracting the minimum element from a HEAP.
Procedure SiftDown Input: HEAP of size n, index i Output: Restored HEAP j ← 2i while (j ≤ n) if (j + 1 ≤ n) and (A[j + 1] ≤ A[j]) j ← j+1 if (A[j] ≤ A[i]) Swap(i, j) i←j j ← 2i else return
;; First child ;; Leaf not reached ;; Compare both children ;; Select second child ;; Heap property violated ;; Exchange elements at i and j ;; Follow path ;; First child ;; Rearranging heap
Algorithm 3.15 Rearrange HEAP.
An implementation of the priority queue using a Heap leads to an O((e + n) lg n) algorithm for A*, where n (resp. e) is the number of generated problem graph nodes (resp. edges). The data structure is fast in practice if n is small, say a few million elements (an accurate number depends on the efficiency of the implementation).
PAIRING HEAPS A Pairing Heap is a heap-ordered (not necessarily binary) self-adjusting tree. The basic operation on a Pairing Heap is pairing, which combines two Pairing Heaps by attaching the root with the larger key to the other root as its left-most child. More precisely, for two Pairing Heaps with respective root values k1 and k2 , pairing inserts the first as the left-most subtree of the second if k1 > k2 , and otherwise inserts the second into the first as its left-most subtree. Pairing takes constant time and the minimum is found at the root. In a multiway tree representation realizing the priority queue operations is simple. Insertion pairs the new node with the root of the heap. DecreaseKey splits the node and its subtree from the heap (if the node is not the root), decreases the key, and then pairs it with the root of the heap. Delete splits
3.1 Priority Queues
101
the node to be deleted and its subtree, performs a DeleteMin on the subtree, and pairs the resulting tree with the root of the heap. DeleteMin removes and returns the root, and then, in pairs, pairs the remaining trees. Then, the remaining trees from right to left are incrementally paired (see Alg. 3.16). Since the multiple-child representation is difficult to maintain, the child-sibling binary tree representation for Pairing Heaps is often used, in which siblings are connected as follows. The left link of a node accesses its first child, and the right link of a node accesses its next sibling, so that the value of a node is less than or equal to all the values of nodes in its left subtree. It has been shown that in this representation Insert takes O(1) √ and DeleteMin takes O(lg n) amortized, and DecreaseKey takes at least (lg lg n) and at most O(2 lg lg n ) steps.
WEAK HEAPS A Weak Heap is obtained by relaxing the Heap requirements. It satisfies three conditions: the key of a node is smaller than or equal to all elements to its right, the root has no left child, and leaves are found on the last two levels only. The array representation uses extra bits Reverse[i] ∈ {0, 1}, i ∈ {0, . . . , n − 1}. The location of the left child is located at 2i + Reverse[i] and the right child is found at 2i + 1 − Reverse[i]. By flipping Reverse[i] the locations of the left child and the right child are exchanged. As an example take A = [1, 4, 6, 2, 7, 5, 3, 8, 15, 11, 10, 13, 14, 9, 12] and Reverse = [0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1] as an array representation of a Weak Heap. Its binary tree equivalent is shown in Figure 3.7.
Procedure DeleteMin Input: PAIRING HEAP, h pointer to root Output: Restored PAIRING HEAP h ← first(h); parent(h) ← 0; h1 ← h; h2 ← right(h) while(h2 ) h ← right(right(h1 )) pairing(h1 , h2 ); if (h) if(right(h)) h2 ← right(h); h1 ← h; else h2 ← 0; else h ← h1 ; h2 ← 0 h1 ← parent(h); h2 ← h; while(h1 ) pair(h1 , h2 ); h ← h1 ; h2 ← h1 ; h1 ← parent(h1 ); return h; Algorithm 3.16 Rearrange PAIRING HEAP.
;; Eliminate root node ;; Pass 1 ;; Left to right ;; Successive pairs of root nodes ;; Link nodes ;; First node exists ;; Second node exists ;; Update pointers ;; Second node does not exist ;; Update pointers ;; First node does not exist ;; Update pointers ;; Pass 2 ;; Right to left ;; Always the two right-most nodes ;; Update pointers ;; Pointer to the very first node
102
CHAPTER 3 *Dictionary Data Structures
1
0
4
2 8 12
14
1
6
3
3
7
9
13
5
6
14
12
13
11
2
7
5
10
10
11
9
4
15
8
FIGURE 3.7 Example of a WEAK HEAP. Reflected nodes are shown in gray.
FIGURE 3.8 Grandparent relationship in a WEAK HEAP indicated using dashed arrows.
The function Grandparent is defined as Grandparent(i) = Grandparent(parent(i)) in case i is a left child, and parent(i) if i is a right one. In a Weak Heap, Grandparent(i) refers to the index of the deepest element known to be smaller than or equal to the one at i. An illustration is given in Figure 3.8. Let node v be the root of a balanced tree T and let node u with the left subtree of T and v with the right subtree of T each form a Weak Heap. Merging u and v yields a new Weak Heap. If A[u] ≤ A[v] then the tree with root u and right child v is a Weak Heap. If, however, A[v] < A[u] we swap A[v] with A[u] and reflect the subtrees in T (see Fig. 3.9, right). Algorithm 3.17 provides the pseudo-code implementation for Merge and Grandparent. To restore the Weak Heap all subtrees corresponding to grandchildren of the root are combined. Algorithm 3.18 shows the implementation of this Merge-Forest procedure. The element at position m serves as a root node. We traverse the grandchildren of the root in which the second largest element is located. Then, in a bottom-up traversal, the Weak Heap property is restored by a series of Merge operations. For DeleteMin we restore the Weak Heap property after exchanging the root element with the last one in the underlying array. Algorithm 3.19 gives an implementation. To construct a Weak Heap from scratch all nodes at index i for decreasing i are merged to their grandparents, resulting in the minimal number of n − 1 comparisons.
3.1 Priority Queues
u
103
v v
A
u
B
B
A
FIGURE 3.9 Merging operation in a WEAK HEAP.
Procedure Grandparent Input: Index j Output: Index for the grandparent for j while (Even(j)) j ← j/2 return bj/2c
;; Left child ;; Right child
Procedure Merge Input: Indices i and j, i is (virtual) grandparent of j Output: Combined sub–WEAK HEAPS rooted at i and j if (A[i] > A[j]) Swap(i, j); Reverse[j] ← ¬Reverse[j]
;; Wrong order ;; Swap elements and flip bit
Algorithm 3.17 Implementation of different subroutines for WEAK HEAPS.
Procedure Merge-Forest Input: Index m Side Effect: Restored WEAK HEAP in a bottom-up merging phase x←1 while (2x + Reverse[x] < m) x ← 2x + Reverse[x] while (x > 0) Merge(m, x); x ← bx/2c
;; Start at second index ;; Go left ;; Climb up
Algorithm 3.18 Restoration of WEAK HEAPS.
For Insert given a key k, we start with the last unused index x in array A and place k into A[x]. Then we climb up the grandparents until the Weak Heap property is satisfied (see Alg. 3.20). On the average, the path length of grandparents from a leaf node to a root is approximately half of the depth of the tree.
104
CHAPTER 3 *Dictionary Data Structures
Procedure DeleteMin Input: WEAK HEAP of size n Output: Minimum element Side Effect: Updated WEAK HEAP of size n − 1 Swap(A[0], A[n − 1]) Merge-Forest(0) n ← n−1 return A[n]
;; Swap last element to root position ;; Restore WEAK HEAP property ;; Decrease size ;; Return minimum element
Algorithm 3.19 Extracting the minimum element from a WEAK HEAP.
Procedure Insert Input: Key k, WEAK HEAP of size n Side Effect: Updated WEAK HEAP of size n + 1 A[n] ← k; x ← n ;; Place element at empty place at end of array Reverse[x] ← 0 ;; Initialize bit while (x 6= 0) and (A[Grandparent(x)] > A[x]) ;; Unless finished or root node found Swap(Grandparent(x), x) ;; Exchange keys Reverse[x] ← ¬Reverse[x] ;; Rotate subtree rooted at x x ← Grandparent(x) ;; Climb up structure n ← n+1 ;; Increase size Algorithm 3.20 Inserting an element into a WEAK HEAP.
For the DecreaseKey operation we start at the node x that has changed its value. Algorithm 3.21 shows an implementation.
FIBONACCI HEAPS A Fibonacci Heap is an involved data structure with a detailed presentation that exceeds the scope of this book. In the following, therefore, we only motivate Fibonacci Heaps. Intuitively, Fibonacci Heaps are relaxed versions of Binomial Queues, which themselves are extensions to Binomial Trees. A Binomial Tree Bn is a tree of height n with 2n nodes in total and n nodes in depth i. The structure of Bn is found by unifying 2-structure Bn−1 , where one is added as i an additional successor to the second. Binomial Queues are unions of heap-ordered Binomial Trees. An example is shown in Figure 3.10. Tree Bi is represented in queue Q if the ith bit in the binary representation of n is set. The partition of a Binomial Queue structure Q into trees Bi is unique as there is only one binary representation of a given number. Since the minimum is always located at the root of one Bi , operation Min takes O(lg n) time. Binomial Queues Q1 and Q2 of sizes n1 and n2 are meld by simulating binary addition of n1 and n2 . This corresponds to a parallel scan of the root lists of Q1 and Q2 . If
3.1 Priority Queues
105
Procedure DecreaseKey Input: WEAK HEAP, index x of element that has improved to k Side Effect: Updated WEAK HEAP A[x] ← k while (x 6= 0) and (A[Grandparent(x)] > A[x]) Swap(Grandparent(x), x) Reverse[x] ← ¬Reverse[x] x ← Grandparent(x)
;; Update key value ;; Unless finished or root node found ;; Exchange keys ;; Rotate subtree rooted at x ;; Climb up structure
Algorithm 3.21 Decreasing the key of an element in a WEAK HEAP.
7
6
8
10
9
2
1
5
3
4
11
FIGURE 3.10 Example of a BINOMIAL QUEUE.
n ∼ n1 + n2 then meld can be performed in time O(lg n). Having to meld the queues Q1 = (B2 , B1 , B0 ) and Q2 = (B0 ) leads to a queue Q3 = (B3 ). Binomial Queues are themselves priority queues. Operations Insert and DeleteMin both use procedure meld as a subroutine. The former creates a tree B0 with one element, and the latter extracts tree Bi containing the minimal element and splits it into its subtrees B0 , . . . , Bi−1 . In both cases the resulting trees are merged with the remaining queue to perform the update. DecreaseKey for element v updates the Binomial Tree Bi in which v is located by propagating the element change bottom-up. All operations run in O(lg n). A Fibonacci Heap is a collection of heap-ordered Binomial Trees, maintained in the form of a circular doubly linked unordered list of root nodes. In difference to Binomial Queues, more than one Binomial Tree of rank i may be represented in one Fibonacci Heap. Consolidation traverses the linear list and merges trees of the same rank (each rank is unique). For this purpose, an additional array is devised that supports finding the trees of the same rank in the root list. The minimum element in a Fibonacci Heap is accessible in O(1) time through a pointer in the root list. Insert performs a meld operation with a singleton tree. For the critical operation consolidate (see Algorithm 3.22) a node is marked if it loses a child. Before it is marked twice, a cut is performed, which separates the node from its parent. The subtree of the node is inserted in the root list (where the node becomes unmarked again). The cut may cascade as it is propagated to the parent node. An example for a cascading cut is shown in Figure 3.11. Nodes
106
CHAPTER 3 *Dictionary Data Structures
Procedure Consolidate Input: FIBONACCI HEAP, of size n, bitvector o, p Side Effect: Simplified FIBONACCI HEAP of size n + 1 1 ← 1 + 1.45 lg n ;; Heuristic degree if (|o| ≤ 1) return ;; loop, if only a few trees r ← head ;; Start at head pointer of list do ;; Construct temporary array A and bitvectors d ← degree(r) ;; Binomial tree size set(o, d) ;; Set occupancy bit if(A[d]) ;; List not empty set(p, d) ;; Set bit in pairs bitvector link(r) ← A[d]; A[d] ← r; r ← right(r) ;; Progress to next element while(r 6= head) ;; Circular list completely processed while(|p|) ;; Bits in pairs bitvector exist d ← Select(p) ;; Choose any bit x ← A[d]; y ← link(x); link(x) ← 0 ;; Remove x z ← link(y); link(y) ← 0; A[d] ← z ;; Remove y if (z = 0) ;; List empty clear(o, d); clear(p, d) ;; Delete bit in bitvectors else if(link(z) = 0) clear(p, d) ;; Delete bit in pair bitvector set(o, d + 1) ;; Delete bit in occupancy bitvector if (A[d + 1]) set(p, d + 1) ;; Set bit in pairs bitvector next degree if (x ≤ y) ;; Key comparison Swap(x, y) ;; Exchange links Cut(x, y) ;; Cut x and join y with x link(y) ← A[d + 1] A[d + 1] ← y ;; Insert y if (head = x) head ← y ;; New head of root list Algorithm 3.22 Consolidation with bitvectors and heuristic factor in a FIBONACCI HEAP.
with the keys 3, 6, and 8 are already marked. Now we decrease the key 9 to 1, so that 3, 6, and 8 will lose their second child. DecreaseKey performs the update on the element in the heap-ordered tree. It removes the updated node from the child list of its parent and inserts it into the root list while updating the minimum. DeleteMin extracts the minimum and includes all subtrees into the root list and consolidates it. A heuristic parameter can be set to call consolidation less frequently. Moreover, a bitvector can improve the performance of consolidation, as it avoids additional links and faster access to the trees of the same rank to be merged. In an eager variant Fibonacci heaps maintain the consolidation heap store at any time.
RELAXED WEAK QUEUES Relaxed Weak Queues are worst-case efficient priority queues, by means that all running times of Fibonacci Heaps are worst-case instead of amortized.
3.1 Priority Queues
107
2
3
4 5
7
6 8
11
10 9
FIGURE 3.11 Cascading cut in heap-ordered tree.
Weak Queues contribute to the observation that Perfect Weak Heaps inherit a one-to-one correspondence to Binomial Queues by only taking edges that are defined by the Grandparent relation. Note that in Perfect Weak Heaps the right subtree of the root is a complete binary tree. A Weak Queue stores n elements and is a collection of disjoint (nonembedded) Perfect Weak Heaps based Pblg nc on the binary representation of n = i=0 ci 2i . In its basic form, a Weak Queue contains a Perfect Weak Heap Hi of size 2i if and only if ci = 1. Relaxed Weak Queues relax the requirement of having exactly one Weak Heap of a given rank in the Weak Queue and allow some inconsistent elements that violate the Weak Heap property. A structure (of logarithmic size) called the heap store maintains Perfect Weak Heaps of the same rank similar to Fibonacci Heaps. At most two heaps per rank suffice to efficiently realize injection and ejection of the heaps. To keep the worst-case complexity bounds, merging Weak Heaps of the same rank is delayed by maintaining the following structural property on the sequence of numbers of Perfect Weak Heaps of the same rank. The rank sequence (r−1 , r0 , . . . , rk ) ∈ {0, 1, 2}k+1 is regular if any digit 2 is preceded by a digit 0, possibly having some digits 1 in between. A subsequence of the form (01l 2) is called a block. That is, every digit 2 must be part of a block, but there can be digits, 0s and 1s, that are not part of a block. For example, the rank sequence (1011202012) contains three blocks. For injecting a Weak Heap, we join the first two Weak Heaps that are of the same size, if there are any. They are found by scanning the rank sequence. For O(1) access, a stack of pending joins, the so-called join schedule implements the rank sequence of pending joins. Then we insert the new Weak Heap, which will preserve the regularity of the rank sequence. For ejection, the smallest Weak Heap is eliminated from the heap sequence and, if this Perfect Weak Heap forms a pair with some other Perfect Weak Heap, the top of the join schedule is also popped. To keep the complexity for DecreaseKey constant, resolving Weak Heap order violations is also delayed. The primary purpose of a node store is to keep track and reduce the number of potential violation nodes at which the key may be smaller than the key of its grandparent. A node that is a potential violation node is marked. A marked node is tough if it is the left child of its parent and also the parent is marked. A chain of consecutive tough nodes followed by a single nontough marked node is called a run. All tough nodes of a run are called its members; the single nontough marked node of
108
CHAPTER 3 *Dictionary Data Structures
that run is called its leader. A marked node that is neither a member nor a leader of a run is called a singleton. To summarize, we can divide the set of all nodes into four disjoint node type categories: unmarked nodes, run members, run leaders, and singletons. A pair (type, height) with type being either unmarked, member, leader, or singleton and height being a value in {0, 1, . . . , blg nc − 1} denotes the state of a node. Transformations induce a constant number of state transitions. A simple example of such a transformation is a join, where the height of the new root must be increased by one. Other operations are cleaning, parent, sibling, and pair transformations (see Fig. 3.12). A cleaning transformation rotates a marked left child to a marked right one, provided its neighbor and parent are unmarked. A parent transformation reduces the number of marked nodes or pushes the marking one level up. A sibling transformation reduces the markings by eliminating two markings in one level, while generating a new marking one level up. A pair transformation has a similar effect, but also operates on disconnected trees. All transformations run in constant time. The node store consists of different list items containing the type of the node marking, which can either be a fellow, a chairman, a leader, or a member of a run, where fellows and chairmen refine the concept of singletons. A fellow is a marked node, with an unmarked parent, if it is a left child. If more than one fellow has a certain height, one of them is elected a chairman. The list of chairmen is required for performing a singleton transformation. Nodes that are left children of a marked parent are members, while the parent of such runs is entitled the leader. The list of leaders is needed for performing a run transformation. The four primitive transformations are combined to a λ-reduction, which invokes either a singleton or run transformation (see Alg. 3.23). A singleton transformation reduces the number of markings in a given level by one, not producing a marking in the level above; or it reduces the number of markings in a level by two, producing a marking in the level above. A similar observation applies to a run transformation, so that in both transformations the number of markings is reduced by at least one in a constant amount of work and comparisons. A λ-reduction is invoked once for each DecreaseKey operation. It invokes either a singleton or a run transformation and is enforced, once the number of marked nodes exceeds blg nc − 1. Table 3.1 measures the time in µ-seconds (for each operation) for inserting n integers (randomly assigned to values from n to 2n − 1). Next, their values are decreased by 10 and then the minimum element is deleted n times. (The lack of results in one row is due to the fact that Fibonacci Heaps ran out of space.)
Table 3.1 Performance of priority queue data structures on n integers. n = 250 0000 000
RELAXED WEAK QUEUES PAIRING HEAPS FIBONACCI HEAPS HEAPS
n = 500 0000 000
Insert
Dec.Key
Del.Min
Insert
Dec.Key
Del.Min
0.048 0.010 0.062 0.090
0.223 0.020 0.116 0.064
4.38 6.71 6.98 5.22
0.049 0.009 — 0.082
0.223 0.020 — 0.065
5.09 8.01 — 6.37
3.1 Priority Queues
u
u w
v
A
B
C
w
D
A
v
D
C
B
(a) u
u w
v
A
B
C
v
D
A
w
B
u w
B
C
v
or
D
A
u
B
u
v
A
w
C
A
C
w
v
D
D
w
B
C
v
or
D
A
u
B
D
C
(b) u
v w
v
A
B
C
w
u
D
A
w
B
C
u
or
D
A
v
C
D
B
(c) w
u
u
y
A
z
B
C
w
D
y
w
A
u
or
C
C
z z
and
A
B
y
or
D
D
(d)
FIGURE 3.12 Primitives used in a λ-reduction: (a) cleaning transformation, (b) parent transformation, (c) sibling transformation, and (d) pair transformation.
B
109
110
CHAPTER 3 *Dictionary Data Structures
Procedure λ-Reduction In/Output: RELAXED WEAK QUEUE if (chairmen 6= ∅) ;; Fellow pair on some level f ← first(chairmen); firstparent ← parent(f ) ;; 1st item and its parent if (left(firstparent) = f and marked(right(firstparent)) or ;; 2 childs . . . left(firstparent) 6= f and marked(left(firstparent))) ;; . . . marked siblingtrans(firstparent); return ;; Case (c) suffices s ← second(chairmen); secondparent ← parent(s) ;; 2nd item if (left(secondparent) = s and marked(right(secondparent)) or ;; 2 childs . . . left(secondparent) 6= s and marked(left(secondparent)) ;; . . . are marked siblingtrans(secondparent); return ;; Case (c) suffices if (left(firstparent) = first) cleaningtrans(firstparent) ;; Toggle children marking if (left(secondparent) = second) cleaningtrans(secondparent) ;; Case (a) applies if (marked(firstparent) or root(firstparent)) ;; Parent also marked parenttrans(firstparent); return ;; Case (b) applies if (marked(secondparent) or root(secondparent)) ;; Parent also marked parenttrans(secondparent); return ;; Case (b) applies pairtrans(firstparent, secondparent) ;; Case (d) applies else if (leaders 6= ∅) ;; Leader exists on some level leader ← first(leaders) ; leaderparent ← parent(leader) ;; Select leader and parent if (leader = right(leaderparent)) ;; Leader is right child parenttrans(leaderparent) ;; Transform into left child if (¬marked(leaderparent) ∧ marked(leader)) ;; Parent also marked if (marked(left(leaderparent))) siblingtrans(leaderparent); return ;; Case (c) parenttrans(leaderparent) ;; Case (b) applies first time if (marked(right(leaderparent))) parenttrans(leader) ;; Case (b) applies again else ;; Leader is left child sibling ← right(leaderparent) ;; Temporary variable if (marked(sibling)) siblingtrans(leaderparent); return ;; Case (c) suffices cleaningtrans(leaderparent) ;; Toggle marking of leader’s children if (marked(right(sibling))) siblingtrans(sibling); return ;; Case (c) suffices cleaningtrans(sibling) ;; Toggle marking of sibling’s children parenttrans(sibling) ;; Case (b) applies if (marked(left(leaderparent))) siblingtrans(leaderparent) ;; Case (c) suffices Algorithm 3.23 Reducing number of markings in a RELAXED WEAK QUEUE.
3.2 HASH TABLES Duplicate detection is essential for state space search to avoid redundant expansions. As no access to all states is given in advance, a dynamically growing dictionary to represent sets of states has to be provided. For the Closed list, we memorize nodes that have been expanded and for each generated state we check whether it is already stored. We also have to search for duplicates in the Open list, so
3.2 Hash Tables
111
another dictionary is needed to assist lookups in the priority queue. The Dictionary problem consists of providing a data structure with the operations Insert, Lookup, and Delete. In search applications, deletion is not always necessary. The slightly easier membership problem neglects any associated information. However, many implementations of membership data structures can be easily generalized to dictionary data structures by adding a pointer. Instead of maintaining two dictionaries for Open and Closed individually, more frequently, the Open and Closed lists are maintained together in a combined dictionary. There are two major techniques for implementing dictionaries: (balanced) search trees and hashing. The former class of algorithms can achieve all operations in O(lg n) worst-case time and O(n) storage space, where n is the number of stored elements. Generally, for hashing constant time for lookup operations is required, so we concentrate on hash dictionaries. We first introduce different hash functions and algorithms. Incremental hashing will be helpful to enhance the efficiency of computing hash addresses. In perfect hashing we consider bijective mapping of states to addresses. In universal hashing, we consider a class of hash functions that will be useful for more general perfect hashing strategies. Because memory is a big concern in state space search we will also address memory-saving dictionary data structures. At the end of this section, we show how to save additional space by being imprecise (saying in the dictionary when it is not).
3.2.1 Hash Dictionaries Hashing serves as a method to store and retrieve states u ∈ S efficiently. A dictionary over a universe S = {0, . . . , N − 1} of possible keys is a partial function from a subset R ⊆ S (the stored keys) to some set I (the associated information). In state space hashing, every state x ∈ S is assigned to a key k(x), which is a part of the representation that uniquely identifies S. Note that every state representation can be interpreted as a binary integer number. Then not all integers in the universe will correspond to valid states. For simplicity, in the following we will identify states with their keys. The keys are mapped into a linear array T[0..m − 1], called the hash table. The mapping h : S → {0, . . . , m − 1} is called the hash function (see Fig. 3.13). The lack of injectiveness yields address collisions; that is, different states that are mapped to the same table location. Roughly speaking, hashing is all about computing keys and detecting collisions. The overall time complexity for hashing depends on the time to compute the hash function, the collision strategy, and the ratio between the number of stored keys and the hash table size, but usually not on the size of the keys. Universe Stored keys Hash function
Linear array Hash table
FIGURE 3.13 Basic principle of hashing.
112
CHAPTER 3 *Dictionary Data Structures
The choice of a good hash function is the central problem for hashing. In the worst-case, all keys are mapped to the same address; for example, for all x ∈ S we have h(x) = const, with 0 ≤ const < m. In the best case, we have no collisions and the access time to an element is constant. A special case is that of a fixed stored set R, and a hash table of at least m entries; then a suitable hash function is h(xi ) = i with xi ∈ R and 0 ≤ i < m. These two extreme cases are more of theoretical interest. In practice, we can avoid the worst-case by a proper design of the hash function.
3.2.2 Hash Functions A good hash function is one that can be computed efficiently and minimizes the number of address collisions. The returned addresses for given keys should be uniformly distributed, even if the set of chosen keys in S is not, which is almost always the case. Given a hash table of size m and the sequence k1 , . . . , kn of keys to be inserted, for each pair (ki , kj ) of keys, i, j ∈ {1, . . . , n}, we define a random variable ( 1 if h(ki ) = h(kj ) . Xij = 0 otherwise P Then X = i<j Xij is the sum of collisions. Assuming a random hash function with uniform distribution, the expected value of X is X 1 n 1 X X E(Xij ) = Xij = E(X) = E = · . m 2 m i<j
i<j
i<j
Using a hash table of size m = 107 , for 1 million elements, we expect about collisions.
106 1 2 ·m
≈ 4, 999 address
Remainder Method If we can extend S to ZZ, then ZZ/mZZ is the quotient space with equivalence classes [0], . . . , [m − 1] induced by the relation z ∼ w if and only if z mod m = w mod m. Therefore, a mapping h : S → {0, 1, . . . , m − 1} with h(x) = x mod m distributes S on T. For the uniformity, the choice of m is important; for example, if m is even then h(x) is even if and only if x is. P The choice m = rw , for some w ∈ IN, is also not appropriate, since for x = li=0 ai ri we have x mod m =
l X i=w
i
ai r +
w−1 X i=0
! ai r
i
mod m =
w−1 X
! ai r
i
i=0
This means that the distribution takes only the last w digits into account.
mod m
3.2 Hash Tables
113
A good choice for m is a prime that does not divide a number ri ± j for small j, because m | ri ± j is equivalent to ri mod m = ∓j so that (case +) x mod m = j ·
l X
ai mod m;
i=0
that is, keys with same sum of digits are mapped to the same address.
Multiplicative Hashing In this approach the product of the key and an irrational number φ is computed and the fractional part is preserved, resulting in a mapping into [0, 1) ⊂ IR. This can be used for a hash function that maps the key x to {0, . . . , m − 1} as follows: h(x) = bm(xφ − bxφc)c. √ One of the best choices for φ for multiplicative hashing is ( 5 − 1)/2 ≈ 0.6180339887, the golden ratio. As an example take k = 123, 456 and m = 10, 000; then h(k) = b10, 000 · (123456 · φ) c = 41.
Rabin and Karp Hashing For incremental hashing based on the idea of Rabin and Karp, states are interpreted as strings over a fixed alphabet. In case no natural string representation exists it is possible to interpret the binary representation of a state as a string over the alphabet {0, 1}. To increase the effectiveness of the method the string of bits may be divided into blocks. For example, a state vector consisting of bytes yields 256 different characters. The idea of Rabin and Karp originates in matching a pattern string M[1..m] ∈ 6 m to a text T[1..n] ∈ 6 n . For a certain hash function h, pattern M is mapped to the number h(M), assuming that h(M) fits into a single memory cell and can be processed in constant time. For 1 ≤ j ≤ n − m + 1 the algorithm checks if h(M) = h(T[j..j + m − 1]). Due to possible collisions, this check is a necessary but not a sufficient condition for a valid match of M and T[j..j + m − 1]. To validate that the match is indeed valid in case h(M) = h(T[j..j + m − 1]), a character-by-character comparison has to be performed. To compute h(T[j + 1..j + m]) in constant time, the value is calculated incrementally—the algorithm takes the known value h(T[j..j + m − 1]) into account to determine h(T[j + 1..j + m]) with a few CPU operations. The hash function has to be chosen carefully to be suited to the incremental computation; for example, linear hash functions based on a radix number representation such as P i mod q are suitable, where q is a prime and the radix r is equal to |6|. h(M) = m M[i]r i=1 Algorithmically, the approach works as follows. Let q be a sufficiently large prime and q > m. We assume that numbers of size q · |6| fit into a memory cell, so that all operations can be performed with single precision arithmetic. To ease notation, we identify characters in 6 with their order. The algorithm of Rabin and Karp as presented in Algorithm 3.24 performs the matching process. The algorithm is correct due to the following observation.
114
CHAPTER 3 *Dictionary Data Structures
Procedure Rabin-Karp Input: String T, pattern M, alphabet 6 Output: Occurrence of M in T p ← t ← 0; u ← |6|m−1 mod q ;; Initialization for each i in {1, . . . , m} ;; Traverse pattern positions p ← (|6| · p + M[i]) mod q ;; Precompute hash function of pattern for each i in {1, . . . , m} ;; Traverse text prefix t ← (|6| · p + T[i]) mod q ;; Precompute hash function for text prefix for each j in {1, . . . , n − m + 1} ;; Main comparison loop if (p = t) ;; Hash function matches if (check (M, T[j..j + m − 1])) ;; Exact string comparison required return j ;; Pattern found at position j if (j ≤ n − m) ;; Text fully processed t ← ((t − T[j] · u) · |6| + T[j + m]) mod q ;; Shift using Horner’s rule Algorithm 3.24 Algorithm of Rabin and Karp.
Theorem 3.1. (Correctness Rabin-Karp) Let the steps of Algorithm 3.24 be numbered wrt. the loop counter j. At the start of the jth iteration we have tj =
m+j−1 X
T[i]|6|m−i+j−1 mod q.
i=j
Proof. Certainly, t1 =
Pm
m−i i=1 T[i]|6|
mod q and inductively we have
tj−1 − T[j − 1] · u · |6| + T[j + m − 1] mod q m+j−2 X = T[i]|6|m−i+j−2 − T[j − 1] · u · |6| + T[j + m − 1]mod q
tj =
i=j−1
m+j−1 X
=
T[i]|6|m−i+j−1 mod q.
i=j
As an example take 6 = {0, . . . , 9} and q = 13. Furthermore, let M = 31415 and T = 2359023141526739921. The application of the mapping h is illustrated in Figure 3.14. We see h produces collisions. The incremental computation works as follows. h(14, 152) ≡ (h(31, 415) − 3 · 10, 000) · 10 + 2 (mod 13) ≡ (7 − 3 · 3) · 10 + 2 (mod 13) ≡ 8 (mod 13).
3.2 Hash Tables
115
23590 231415 267399 21 8
7
7
FIGURE 3.14 Example of Rabin-Karp hashing for string matching.
The computation of all hash addresses has a resulting running time of O(n + m), which is also the best-case overall running time. In the worst-case, the matching is still of order (nm), as the example problem of searching M = 0m in T = 0n shows.
Incremental Hashing For a state space search, we have often the case that a state transition changes only a part of the representation. In this case, the computation of the hash function can be executed incrementally. We refer to this approach as incremental state space hashing. The alphabet 6 denotes the set of characters in the string to be hashed. In the state space search, the set 6 will be used for denoting the domain(s) of the state variables. Take, for example, the Fifteen-Puzzle. With 6 = {0, . . . , 15}, a natural vector representation for state u is (t0 , . . . , t15 ) ∈ 6 16 , where ti = l means that the tile labeled with l is located at position i, and l = 0 is the blank. Because successor generation is fast and Manhattan distance heuristic can be computed incrementally in constant time (using a table addressed by the tile’s label l ∈ 6 \ {0}, the tile’s move direction d ∈ {U, D, L, R}, and the position p ∈ 6 of the tile that is being moved), the computational burden is on computing the hash function. P i 0 One hash value of a Fifteen-Puzzle state u is h(u) = ( 15 i=0 ti · 16 ) mod q. Let state u with 0 0 representation (t0 , . . . , t15 ) be a successor of u. We know that there is only one transposition in the vectors t and t0 . Let j be the position of the blank in u and k be the position of the blank in u0 . We have tj0 = tk , tk0 = 0, and for all 1 ≤ i ≤ 16, with i 6= j, i 6= k, it holds that ti0 = ti . Therefore, h(u ) = 0
15 X
! i
! j
ti · 16
− tj · 16
+ tj0 · 16j − tk
+ tk0
· 16
+ tj0 · 16j − tk
k
· 16
k
k
mod q
i=0
=
15 X
! i
!
ti · 16 mod q − 0 · 16
! j
k
· 16 + 0 · 16 mod q mod q
i=0
= (h(u) + (tj0 · 16j ) mod q − (tk · 16k ) mod q) mod q. To save time, we may precompute (k · 16l ) mod q for each k and l in {0, . . . , 15}. If we were to store (k · 16j ) mod q − (k · 16l ) mod q for each value of j, k, and l, we would save another addition. As h(u) ∈ {0, . . . , q − 1} and (k · 16j ) mod q − (k · 16k ) mod q ∈ {0, . . . , q − 1}, we may further substitute the last mod by faster arithmetic operations. As a particular case, we look at an instance of the Fifteen-Puzzle, where the tile 12 is to be moved downward from its position 11 to position 15. We have h(u0 ) = (h(u) − 12 · (1611 ) mod q + 12 · (1615 ) mod q) mod q.
116
CHAPTER 3 *Dictionary Data Structures
Next we generalize our observations. The savings are larger, when the state vector grows. For the (n2 − 1)-Puzzle nonincremental hashing results in (n2 ) time, whereas in incremental hashing the efforts remain constant. Moreover, incremental hashing is available for many search problems that obey a static vector representation. Hence, we assume that state u is a vector (u1 , . . . , uk ) with ui in finite domain 6i , i ∈ {1, . . . , k}.
Theorem 3.2. (Efficiency of Incremental Hashing) Let I(a) be the set of indices in the state vector that change when applying a, and Imax = maxa∈A |I(a)|. The hash value of v for successor u of v via a given the hash value for u is available in time: 1. O(|I(a)|); using an O(k)-size table. k 2. O(1); using an O( Imax · (6max )Imax )-size table. where 6max = max1≤i≤k {|6i |}. P Proof. We define h(u) = ki=1 ui Mi mod q as the hash function, with M1 = 1 and Mi = |61 | · . . . · |6i−1 | for 1 < i ≤ k. For case 1 we store Mi modP q for all 1 ≤ i ≤ k in a precomputed table, so that |I(a)| lookups are needed. For case 2 we compute j∈I(a) −uj Mj + vj Mj mod q for all possible actions k k a = (u, v). The number of possible actions is bounded by Imax · (6max )Imax , since at most Imax indices I max may change to at most (6max ) different values. Note that the number of possible actions is much smaller in practice. The effectiveness of incremental hashing relies on two factors: on the state vector’s locality (i.e., how many state variables are affected by a state transition) and on the node expansion efficiency (i.e., the running time of all other operations to generate one successor). In the Rubik’s Cube, exploiting locality is limited. If we represent position and orientation of each subcube as a number in the state vector, then for each twist, 8 of the 20 entries will be changed. In contrast, for Sokoban the node expansion efficiency is small; as during move execution, the set of pushable balls has to be determined in linear time to the board layout, and the (incremental) computation of the minimum matching heuristic requires at least quadratic time in the number of balls. For incremental hashing the resulting technique is very efficient. However, it can also have drawbacks, so take care. For example, as with ordinary hashing, the suggested schema induces collisions, which have to be resolved.
Universal Hash Functions Universal hashing requires a set of hash functions to have on average a good distribution for any subset of stored keys. It is the basis for FKS and cuckoo hashing and has a lot of nice properties. Universal hashing is often used in a state space search, when restarting a randomized incomplete algorithm with a different hash function. Let {0, . . . , m − 1} be the set of hash addresses and S ⊆ IN be the set of possible keys. A set of hash function H is universal, if for all x, y ∈ S, |{h ∈ H | h(x) = h(y)}| ≤ 1/m. |H| The intuition in the design of universal hash functions is to include a suitable random number generator inside the hash computation. For example, the Lehmer generator refers to linear congruences.
3.2 Hash Tables
117
It is one of the most common methods for generating random numbers. With respect to a triple of constants a, b, and c a sequence of pseudo-random numbers xi is generated according to the recursion x0 ← b xi+1 ← (axi + c) mod m
i ≥ 0.
Universal hash functions lead to a good distribution of values on the average. If h is drawn randomly from H and S is the set of keys to be inserted in the hash table, the expected cost of each Lookup, Insert, and Delete operation is bounded by (1 + |S|/m). We give an example of a class of universal hash functions. Let S ⊆ IN, p be prime with p ≥ |S|. For 1 ≤ a ≤ p − 1, 0 ≤ b ≤ p − 1, define ha,b = ((ax + b) mod p) mod m. Then H = {ha,b | 1 ≤ a ≤ p − 1, 0 ≤ b ≤ p − 1} is a set of universal hash functions. As an example, take m = 3 and p = 5. Then we have 20 functions in H: x+0
2x + 0
3x + 0
4x + 0
x+1
2x + 1
3x + 1
4x + 1
x+2
2x + 2
3x + 2
4x + 2
x+3
2x + 3
3x + 3
4x + 3
x+4
2x + 4
3x + 4
4x + 4
all taken mod 5 mod 3. Hashing 1 and 4 yields the following address collisions: (1 · 1 + 0) mod 5 mod 3 = 1 = (1 · 4 + 0) mod 5 mod 3 (1 · 1 + 4) mod 5 mod 3 = 0 = (1 · 4 + 4) mod 5 mod 3 (4 · 1 + 0) mod 5 mod 3 = 1 = (4 · 4 + 0) mod 5 mod 3 (4 · 1 + 4) mod 5 mod 3 = 0 = (4 · 4 + 4) mod 5 mod 3 To prove that H is universal, let us look at the probability that two keys x 6= y are mapped to locations r and s by the inner part of the hash function, P ([(ax + b) = r(mod p)] and [(ay + b) = s(mod p)]) . This means that a(x − y) = r − s(mod p), which has exactly one solution (mod p) since Zp∗ = (ZZ/pZZ \ {[0]}, ·) is a field (we needed p ≥ |S| to ensure that x 6= y mod p). Value r cannot be equal to s, since this would imply a = 0, contrary to the definition of the hash function. Therefore, we now assume r 6= s. Then there is a 1 in (p − 1) chance that a has the right value. Given this value of a, we need b = r − ax(mod p), and there is a 1/p chance that b gets this value. Consequently, the overall probability that the inner function maps x to r and y to s is 1/p(p − 1).
118
CHAPTER 3 *Dictionary Data Structures
Now, the probability that x and y collide is equal to this 1/p(p − 1), times the number of pairs r 6= s ∈ {0, . . . , p − 1} such that r = s(mod m). We have p choices for r, and subsequently at most dp/me − 1 choices for s (the −1 is for disallowing s = r). Using dv/we ≤ v/w + 1 − 1/w for integers v and w, the product is at most p(p − 1)/m. Putting this all together, we obtain for the probability of a collision between x and y, P ((ax + b mod p) mod m = (ay + b mod p) mod m) ≤
p(p − 1) 1 1 · = . m p(p − 1) m
Perfect Hash Functions Can we find a hash function h such that (besides the efforts to compute the hash function) all lookups require constant time? The answer is yes—this leads to perfect hashing. An injective mapping of R with |R| = n ≤ m to {1, . . . , m} is called a perfect hash function; it allows an access without collisions. If n = m we have a minimal perfect hash function. The design of perfect hashing yields an optimal worst-case performance of O(1) accesses. Since perfect hashing uniquely determines an address, a state S can often be reconstructed given h(S). If we invest enough space, perfect (and incremental) hash functions are not difficult to obtain. In the example of the Eight-Puzzle for a state u in vector representation (t0 , . . . , t8 ) we may choose (. . . ((t0 · 9 + t1 ) · 9 + t2 ) . . .) · 9 + t8 for 99 = 387, 420, 489 different hash addresses (equivalent to about 46 megabytes space). Unfortunately, this approach leaves most hash addresses vacant. A better hash function is to compute the rank of the permutation in some given ordering, resulting in 9! states or about 44 kilobytes.
Lexicographic Ordering The lexicographic rank of permutation π (of size N) is defined as rank(π ) = d0 · (N − 1)! + d1 · (N − 2)! + · · · + dN−2 · 1! + dN−1 · 0! , where the coefficients di are called the inverted index or factorial base. By looking at a permutation tree it is easy to see that such a hash function exists. Leaves in the tree are all permutations and at each node in level i, the ith vector value is selected, reducing the range of available values in level i + 1.PThis leads to an O(N 2 ) algorithm. A linear algorithm for this maps a permutation to its factorial base k−1 i=0 di · i! with di being equal to ti minus the number of elements tj , j < i that are smaller than ti ; that is; di = ti − ci with the number of inversions ci being set to |{0 ≤ l < ti | l ∈ {t0 , . . . , ti−1 }| . For example, the lexicographic rank of permutation (1, 0, 3, 2) is equal to (1 − 0) · 3! + (0 − 0) · 2! + (3 − 2) · 1! + (2 − 2) · 0! = 7, corresponding to c = (0, 0, 2, 2) and d = (1, 0, 1, 0). The values ci are computed in linear time using a table lookup in a 2k−1 P-size table T. In the table T we store the number of ones in the binary representation of a value, T(x) = m i=0 bi with (x)2 = (bm , . . . , b0 ). For computing the hash value, while processing vector position ti we mark bit ti in bitvector x (initially set to 0). Thus, x denotes the tiles we have seen so far and we can take T(x0 , . . . , xi−1 ) as the value for ci . Since this approach consumes exponential space, time-space trade-offs have been discussed. For the design of a minimum perfect hash function of the sliding-tile puzzles we observe that in a lexicographic ordering every two successive permutations have an alternating signature (parity of the number of inversions) and differ by exactly one transposition. For minimal perfect hashing a (n2 − 1)Puzzle state to {0, . . . , n2 ! /2 − 1} we consequently compute the lexicographic rank and divide it by 2. For unranking, we now have to determine which one of the two uncompressed permutations of the
3.2 Hash Tables
119
Procedure Rank Input: Depth N, permutation π, inverse permutation π −1 Output: Rank of π Side Effect: (π and π −1 are modified) if (N = 1) return 0 l ← πN−1 Swap(πN−1 , ππ −1 ) N−1
−1 Swap(πl−1 , πN−1 ) return l · (N − 1)! +Rank(N − 1, π, π −1 )
;; End of recursion ;; Memorize location ;; Update in π ;; Update in π −1 ;; Recursive call
Algorithm 3.25 Rank operation for permutations.
puzzle is reachable. This amounts to finding the signature of the permutation, which allows us to P separate solvable from insolvable states. It is computed as sign(π ) = ( N−1 d ) mod 2. For example, i i=0 with N = 4 we have sign(17) = (2 + 2 + 1)mod 2 = 1. There is one subtle problem with the blank. Simply taking the minimum perfect hash value for the alternation group in Sn2 does not suffice, since swapping a tile with the blank does not necessarily toggle the solvability status (e.g., it may be a move). To resolve this problem, we partition state space along the position of the blank. Let B0 , . . . , Bn2 denote the sets of blank-projected states. Then each Bi contains (n2 − 1)! /2 elements. Given index i and the rank inside Bi , it is simple to reconstruct the state.
Myrvold Ruskey Ordering We next turn to alternative permutation indices proposed by Myrvold and Ruskey. The basic motivation is the generation of a random permutation according to swapping πi with πr , where r is a random number uniformly chosen in 0, . . . , i, and i decreases from N − 1 down to 1. One (recursive) algorithm Rank is shown in Algorithm 3.25. The permutation π and its inverse π −1 are initialized according to the permutation, for which a rank has to be determined. The inverse π −1 of π can be computed by setting ππ−1 = i, for all i ∈ {0, . . . , k − 1}. Take as i an example permutation π = π −1 = (1, 0, 3, 2). Then its rank is 2 · 3! + Rank(102). This unrolls to 2 · 3! + 2 · 2! + 0 · 1! + 0 · 0! = 16. It is also possible to compile a rank back into a permutation in linear time. The inverse procedure Unrank, initialized with the identity permutation, is shown in Algorithm 3.26. The depth value N is initialized with the size of the permutation, and the rank r is the value computed with Algorithm 3.25. (As a side effect, if the algorithm is terminated at the Nth step, the positions N − l, . . . , N − 1 hold a random l-permutation of the numbers {0, . . . , N − 1}.) Algorithm 3.27 shows another (in this case nonrecursive) unrank algorithm proposed by Myrvold and Ruskey. It also detects the parity of the number of inversions (the signature of the permutation) efficiently and fits to the ranking function in Algorithm 3.28. All permutations of size N = 4 together with their signature and ranked according to the two approaches are listed in Table 3.2.
Theorem 3.3. (Myrvold-Ruskey Permutation Signature) Given the Myrvold-Ruskey rank (as computed by Alg. 3.28), the signature of a permutation can be computed in O(N) time within Algorithm 3.27.
120
CHAPTER 3 *Dictionary Data Structures
Procedure Unrank Input: Value N, rank r, permutation π Side Effect: Updated global permutation if (N = 0) return l ← br/(k − 1)! c Swap(πN−1 , πl ) Unrank(N − 1, r − l · (N − 1)! , π )
;; End of recursion ;; Determine swapping location ;; Perform the exchange ;; Recursive call
Algorithm 3.26 Unrank operation for permutations.
Procedure Unrank Input: Value r, size N Output: Permutation π and its signature π ← id parity ← false while (N > 0) i ← N − 1 ; j ← r mod N if (i 6= j) parity ← ¬parity swap(πi , πj ) r ← r div N n ← n−1 return (parity, π )
;; Initialize permutation with identity ;; Initialize sign of permutation ;; Loop on size of permutation ;; Temporary variables ;; Only in case there is change ;; Toggle signature ;; Exchange values ;; Compute reduced number ;; Reduce size ;; Permutation found
Algorithm 3.27 Recursion-free unranking and signature computation.
Proof. In the unrank function we always have N − 1 element exchanges. For swapping two elements u and v at respective positions i and j with i = j we count 2 · (j − i − 1) + 1 transpositions: uxx . . . xxv → xux . . . xxv → · · · → xx . . . xxuv → xx . . . xxvu → · · · → vxx . . . xxu. As 2 · ( j − i − 1) + 1 mod 2 = 1, each transposition either increases or decreases the parity of the number of inversion, so that the parity for each iteration toggles. The only exception is if i = j, where no change occurs. Hence, the sign of the permutation can be determined by executing the Myrvold-Ruskey algorithm in O(N) time.
Theorem 3.4. (Compression of Alternation Group) Let π(i) denote the value returned by the Myrvold and Ruskey’s Unrank function (Alg. 3.28) for index i. Then π(i) matches π(i + N! /2) except for transposing π0 and π1 . Proof. The last call for swap(n − 1, r mod n) in Algorithm 3.27 is swap(1, r mod 2), which resolves to either swap(1, 1) or swap(1, 0). Only the latter one induces a change. If r1 , . . . , rN−1 denote the
3.2 Hash Tables
121
Table 3.2 Myrvold and Ruskey’s perfect permutation hash functions. Index
Unrank (Alg. 3.26)
Signature
Unrank (Alg. 3.27)
Signature
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
(2,1,3,0) (2,3,1,0) (3,2,1,0) (1,3,2,0) (1,3,2,0) (3,1,2,0) (3,2,0,1) (2,3,0,1) (2,0,3,1) (0,2,3,1) (3,0,2,1) (0,3,2,1) (1,3,0,2) (3,1,0,2) (3,0,1,2) (0,3,1,2) (1,0,3,2) (0,1,3,2) (1,2,0,3) (2,1,0,3) (2,0,1,3) (0,2,1,3) (1,0,2,3) (0,1,2,3)
0 1 0 1 1 0 1 0 1 0 0 1 0 1 0 1 1 0 1 0 1 0 0 1
(1,2,3,0) (3,2,0,1) (1,3,0,2) (1,2,0,3) (2,3,1,0) (2,0,3,1) (3,0,1,2) (2,0,1,3) (1,3,2,0) (3,0,2,1) (1,0,3,2) (1,0,2,3) (2,1,3,0) (2,3,0,1) (3,1,0,2) (2,1,0,3) (3,2,1,0) (0,2,3,1) (0,3,1,2) (0,2,1,3) (3,1,2,0) (0,3,2,1) (0,1,3,2) (0,1,2,3)
0 0 0 1 0 0 0 1 1 1 1 0 1 1 1 0 1 1 1 0 0 0 0 1
indices of r mod n in the iterations 1, . . . , N − 1 of Myrvold and Ruskey’s Unrank function, then rN−1 = b. . . br/(N − 1)c . . . /2c, which is 1 for r ≥ n! /2 and 0 for r < n! /2.
3.2.3 Hashing Algorithms There are two standard options for dealing with colliding items: chaining or open addressing. In hashing with chaining, keys x are kept in linked overflow lists. The dictionary operations Lookup, Insert, and Delete amount to computing h(x) and then performing pure list manipulations in T[h(x)]. Their pseudo-code implementation is provided in Algorithms 3.29 through 3.31. They assume a null pointer ⊥ and a link Next to the successor in the chained list. Operations Insert and Delete suggest a call to Lookup prior to their invocation to determine whether or not the element is contained in the hash table. An example for hashing the characters in heuristic search in a table of 10 elements with respect to their lexicographical order modulo 10 is depicted in Figure 3.15.
122
CHAPTER 3 *Dictionary Data Structures
Procedure Rank Input: Depth N, permutation π , inverse permutation π −1 Output: Rank of π Side Effect: (π and π −1 are modified) for each i in {1, . . . , N − 1} l ← πN−i swap(πN−i , ππ −1 )
;; Traverse the vector ;; Temporary variable ;; Update π
N−i
−1 swap(πl−1 , πN−i ) ranki ← l Q return N−1 i=1 (rankN−i+1 + i)
;; Update π −1 ;; Store intermediate result ;; Compute result
Algorithm 3.28 Recursion-free ranking operation for permutations.
Procedure Lookup Input: Chained hash table T, key x Output: Pointer to element or ⊥ if not in T p ← T[h(x)] while (p 6= ⊥) and (p 6= x) p ← Next(p) if (p 6= ⊥) return p else return ⊥
;; Table entry ;; Until found or empty ;; Go to next element in chained list ;; Feedback result, element found ;; Feedback result, element not found
Algorithm 3.29 Searching a chained hash table.
Procedure Insert Input: Chained hash table T, key x Output: Updated hash table T p ← T[h(x)] if (p = ⊥) T[h(x)] ← x; return while (Next(p) 6= ⊥) and (p 6= x) p ← Next(p) if (p 6= x) Next(p) ← ⊥ Algorithm 3.30 Inserting an element into a chained hash table.
;; Table entry ;; Free location, set table entry and exit ;; Until found or empty ;; Go to next element in chained list ;; Insert if not already contained
3.2 Hash Tables
123
Procedure Delete Input: Chained hash table T, key x Output: Updated hash table T ;; Table entry ;; Delete and feedback modified list
p ← T[h(x)] T[h(x)] ← RecDelete(p, x) Procedure RecDelete Input: Table entry p, key x Output: Pointer to modified chain if (p = ⊥) return ⊥ if (p = x) return Next(p) Next(p) ← RecDelete(Next(p), x)
;; End of list detected ;; Element found ;; Recursive call
Algorithm 3.31 Deleting an element from a chained hash table.
h
s
r
i
a
c
e
r
s
u
c
e
h
i
t
FIGURE 3.15 Hashing the characters of the term heuristic search with chaining.
Hashing with open addressing integrates the colliding elements at free locations in the hash table; that is, if T[h(x)] is occupied, it searches for an alternative location for x. Searching a key x starts at h(x) and continues in the probing sequence until either x or an empty table entry is found. When deleting an element, some keys may have to be moved back to fill the hole in the lookup sequence. The linear probing strategy considers (h(x) − j) mod m for 0 ≤ j < m. In general, we have the sequence (h(x) − s(j, x)) mod m 0 ≤ j < m
124
CHAPTER 3 *Dictionary Data Structures
Procedure Lookup Input: Open hash table T of size q, key x, probing function s Output: Pointer to element, or ⊥ if x not in T i ← h(x) j←1 while (Tag[i] 6= Empty) and (x 6= T[i]) i ← (h(k) − s(j, x)) mod q j ← j+1 if (x = T[i]) and (Tag[i] = Occupied) return T[i] else return ⊥
;; Compute initial location ;; Index in probing sequence ;; Traverse sequence ;; Next location ;; Next index ;; Element found ;; Feedback element ;; Element not found
Algorithm 3.32 Searching an element in an open hash table.
for probing function s( j, x). There is a broad spectrum of suitable probing sequences, for example, (linear probing) 2 j s(j, x) = (−1)j · (quadratic probing) 2 s(j, x) = j · h0 (x) (double hashing) s(j, x) = rx (ideal hashing), s(j, x) = j
where rx is a random number depending on x, and h0 is a second function, which determines the step size of the probing sequence in double hashing. To exploit the whole table, (h(x) − s(0, x)) mod m, (h(x) − s(1, x)) mod m, . . . , (h(x) − s(m − 2, x)) mod m, and (h(x) − s(m − 1, x)) mod m should be a permutation of {0, . . . , m − 1}. An implementation of the procedure Lookup for a generic probing function s is provided in Algorithm 3.32. The implementation assumes an additional array Tag that associates one of the values Empty, Occupied, and Deleted with each element. Deletions (see Alg. 3.33) are handled by setting the Deleted tag for the cell of the deleted key. Lookups skip over deleted cells, and insertions (see Alg. 3.34) overwrite them. When the hash table is nearly full, unsuccessful searches lead to long probe sequences. An optimization is ordered hashing, which maintains all probe sequences sorted. Thus, we can abort a Lookup operation as soon as we reach a larger key in the probe sequence. The according algorithm for inserting a key x is depicted in Algorithm 3.35. It consists of a search phase and an insertion phase. First, the probe sequence is followed up to a table slot that is either empty or contains an element that is larger than x. The insertion phase restores the sorting condition to make the algorithm work properly. If x replaces an element T[i], the latter has to be reinserted into its respective probe sequence, in turn. This leads to a sequence of updates that end when an empty bin is found. It can be shown that the average number of probes to insert a key into the hash table is the same as in ordinary hashing.
3.2 Hash Tables
Procedure Delete Input: Open hash table T, key x Output: Updated hash table T p ← Lookup(x) if (p 6= ⊥) Tag[p] ← Deleted
;; Find location of key ;; State is contained in table ;; Update flag
Algorithm 3.33 Inserting an element into an open hash table.
Procedure Insert Input: Open hash table T of size q, key x Side Effect: Updated hash table T j←1 i ← h(x) while (Tag[i] = Occupied) i ← (h(k) − s(j, x)) mod q j ← j+1 T[i] ← x Tag[i] ← Occupied
;; Next index in probing sequence ;; Compute initial location ;; Traverse sequence ;; Next location ;; Next index ;; Insert element ;; Update flag
Algorithm 3.34 Deleting an element from an open hash table.
Procedure Insert Input: Key x, hash table T Side Effect: Updated table T i ← h(x) while (Tag[i] = Occupied) and (T[i] ≥ x) if (T[i] = x) return i ← (i + h0 (x)) mod m while (Tag[i] = Occupied) if (T[i] < x) Swap(T[i], x) i ← (i + h0 (x)) mod m T[i] ← x Tag[i] ← Occupied Algorithm 3.35 Inserting an element for ordered hashing.
;; Compute hash function ;; Search phase ;; Key already present ;; Next probe location ;; Insertion phase ;; x is at correct place in its probe chain ;; Net probe location ;; Free space at end of chain found ;; Update flag
125
126
CHAPTER 3 *Dictionary Data Structures
For a hash table of size m that stores n keys, the quotient α = n/m is called the load factor. The load factor crucially determines the efficiency of hash table operations. The analysis assumes uniformness of h; that is, P (h(x) = j) = 1/m for all x ∈ S and 0 ≤ j ≤ m − 1. Under this precondition, the expected number of memory probes for insertion and unsuccessful lookup is 1 1 1+ linear probing ≈ 2 (1 − α)2 1 α quadratic probing ≈ 1 − + ln 2 1−α 1 1−α chained hashing ≈ 1 + α 1 1 ideal hashing ≈ ln α 1−α double hashing ≈
Thus, for any α ≤ 0.5, in terms of number of probes we obtain the following rank order: ideal hashing, chained hashing, double hashing, quadratic probing, and linear probing. The order of the last four methods is true for any α. Although chaining scores quite favorably in terms of memory probes, the comparison is not totally fair, since it dynamically allocates memory and uses extra linear space to store the pointers.
FKS Hashing Scheme With a hash function h of a class H of universal hash functions, we can easily obtain constant lookup time if we don’t mind spending a quadratic amount of memory. Say we allocate a hash table of size m = n(n − 1). Since there are n2 pairs in R, each with a chance 1/m of colliding with each other, the probability of a collision in the hash table is bounded by n2 /m ≤ 1/2. In other words, the chance of drawing a perfect hash function for the set of stored keys is 1/2. While for each given hash function there is a worst set of stored keys that maps all of them into the same bin, the crucial element of the algorithm is a randomized rehashing: If the chosen h actually leads to a collision, just try again with another hash function drawn with uniform probability from H. Perfect hashing has important advances in storing and retrieving information in the visited list and, equally important, for fast lookup of pattern databases (see Ch. 4). The apparent question for practical search is whether memory consumption for perfect hashing can be reduced. The so-called FKS hashing scheme (named after the initials of the inventors Fredman, Komlo´ s, and Szemere´ di) ended a long dispute in research about whether it is also possible to achieve constant access time with a linear storage size of O(n). The algorithm uses a two-level approach: First, hash into a table of size n, which will produce some collisions, and then, for each resulting bin, rehash it as just described, squaring the size of the hash bucket to get zero collisions. Denote the subset of elements mapped to bin i as Ri , with |Ri | = ni . We will use the property that E
" n−1 # X ni i=0
2
1 and none of u’s neighbors’ neighbors can have h > 2, and so on. Therefore, we have at least one node with h = 0, at least one node with h = 1, and so on up to d − 1. For the rest of the at most n − d nodes we have h ≤ d. This yields h(G) ≤ d2 + d(n − d) = d(2n − d − 1)/2. According to the second lemma, the total value of h at time t is at least t, so that after at most d(2n − d − 1)/2 steps the graph is covered. 4. If the graph has a Hamiltonian cycle, following this cycle is clearly the shortest way to cover the graph. Recall that a closed path in a graph is a Hamiltonian cycle if it visits each node exactly once. We shall see that a Hamiltonian cycle is a possible limit of VAW. Moreover, if the ant happens to follow the cycle for n consecutive times, it will follow this cycle forever. Recall that upon leaving a node u, we have ht (ut ) = ht (ut+1 ) + 1. Let us now assume that at time t the ant has completed a sequence of n Hamiltonian cycles. Then ut+1 has not been visited since time t − n + 1 and ht (ut+1 ) = ht−n+1 (ut+1 ) = ht−n+1 (ut−n+1 ). Substituting the first equation into the second yields ht (ut ) = ht−n+1 (ut−n+1 ) + 1 = ht−2(n+1) (ut−2(n+1) ) + 2 .. . = ht−n(n+1) (ut−n(n+1) ) + n = ht−n(n+1) (ut ) + n.
14.9 *Lagrange Multipliers
657
FIGURE 14.10 A hard test-bet for VAW.
During the (n + 1)st cycle, the ant is confronted with the same relative h pattern with which it was confronted in the first cycle. The value n that is added to each h value does not change the ordering relation between the nodes. Therefore, the same decisions are taken. The bound of O(nd) is tight. There are examples of graphs, where the cover time is indeed O(nd). Consider a graph that consists of triangles that are connected in a single chain, with one additional node between the triangles (see Fig. 14.10). It is easy to validate that the triangles are in fact traps for VAW that cause the ant to go back to its starting point. There are n vertices, and the diameter is about 0.8n. The time needed to traverse the graph is (nd) = (n2 ). The last results hold for a single ant. They are not in general true for multiple ants, but it seems reasonable to say that if the graph is large and the ants are fairly distributed in the beginning, the load will be more or less balanced. In edge ant walk (EAW) edges rather than nodes are marked. For this process it can be shown that k small-oriented ants can cover a graph in at most O(δ · n2 /k) steps, where δ is the maximum vertex-degree and n is the number of nodes. In practice, VAW often performs better than edge ant walk, since in general, nd < δ · n2 .
14.9 *LAGRANGE MULTIPLIERS In continuous nonlinear programming (CNLP), we have continuous and differential functions f , h = (h1 , . . . , hm )T , and g = (g1 , . . . , gr )T . The nonlinear program Pc given as min f (x), where x = (x1 , . . . , xv ) ∈ IRv x
subject to h(x) = 0 and g(x) ≤ 0 is to be solved by finding a constrained local minimum x with respect to the continuous neighborhood Nc (x) = {x0 | ||x0 − x|| ≤ } of x for some > 0. A point x∗ is a constraint local minimum (CLM) if x∗ is feasible and f (x∗ ) ≤ f (x) for all feasible x ∈ Nc (x∗ ). Based on Lagrange-multiplier vectors λ = (λ1 , . . . , λm )T and µ = (µ1 , . . . , µr )T , the Lagrangian function of Pc is defined as L(x, λ, µ) = f (x) + λT h(x) + µT g(x).
658
CHAPTER 14 Selective Search
14.9.1 Saddle-Point Conditions A sufficient saddle-point condition for x∗ in Pc is established if there exist λ∗ and µ∗ such that L(x∗ , λ, µ) ≤ L(x∗ , λ∗ , µ∗ ) ≤ L(x, λ∗ , µ∗ ) for all x satisfying ||x − x∗ || < and all λ ∈ IRm and µ ∈ IRr . To illustrate that the condition is only sufficient, consider the following CLNP: min f (x) = −x2 subject to h(x) = x − 5 = 0. x
It is obvious that x∗ = 5 is a CLM. Differentiating the Lagrangian L(x, λ) = x2 + λ(x − 5) with respect to x and evaluating it at x∗ = 5 yields −10 + λ = 0, which implies λ∗ = 10. However, since the second derivative is −2 < 0, we know that L(x, λ) is at a local maximum at x∗ instead of a local minimum. Hence, there exists no λ∗ that satisfies the sufficient saddle-point condition. To devise a sufficient and necessary saddle-point condition we take the transformed Lagrangian for Pc defined as Lc (x, α, β) = f (x) + α T |h(x)| + β T max{0, g(x)}, where |h(x)| is defined as (|h1 (x)|, . . . , |hm (x)|)T and max{0, g(x)} is given by (max{0, g1 (x)}, . . . , max{0, gr (x)})T . A point x ∈ IRv is regular with respect to the constraints, if the gradient vectors of the constraints are linearly independent.
Theorem 14.3. (Extended Saddle-Point Condition) Suppose x∗ ∈ IRv is regular. Then x∗ is a CLM of Pc if and only if there exist finite α ∗ ≥ 0 and β ∗ ≥ 0 such that, for any α ∗∗ > α ∗ and β ∗∗ > β ∗ , the following condition is satisfied: Lc (x∗ , α, β) ≤ Lc (x∗ , α ∗∗ , β ∗∗ ) ≤ Lc (x, α ∗∗ , β ∗∗ ). Proof. The proof consists of two parts. First, given x∗ , we need to prove that there exist finite α ∗∗ > α ∗ ≥ 0 and β ∗∗ > β ∗ ≥ 0 that satisfy the preceding condition. The inequality on the left side is true for all α and β because x∗ is a CLM, which implies that |h(x∗ )| = 0 and max{0, g(x∗ )} ≤ 0. To prove the inequality on the right side, we know that the gradient vectors of the equality and the active inequality constraints at x∗ are linear-independent, because x∗ is a regular point. According to the necessary condition on the existence of a CLM by Karush, Kuhn, and Tucker (see Bibliographic Notes) there exist unique λ∗ and µ∗ that satisfy ∇x L(x∗ , λ∗ , µ∗ ) = 0, where µ ≥ 0 and µj = 0 if gj (x∗ ) < 0. When we divide the index sets for h and g into negative and nonnegative sets, we get
... .
Pe (x) = {i ∈ {1, . . . , m}| hi (x) ≥ 0} Ne (x) = {i ∈ {1, . . . , m}| hi (x) < 0} A(x) = { j ∈ {1, . . . , r}| gj (x) = 0} Ap (x) = { j ∈ {1, . . . , r}| gj (x) ≥ 0}
14.9 *Lagrange Multipliers
659
Differentiating the Lagrangian function L(x, λ, µ) = f (x) + λT h(x) + µT g(x) with respect to x yields ∇x f (x∗ ) +
m X
λ∗i ∇x hi (x∗ ) +
i=1
r X
µ∗j ∇x gj (x∗ ) = 0.
j=1
Assuming x ∈ Nc (x∗ ) and α ∗ = |λ∗ | and β ∗ = µ∗ we evaluate L(x, α ∗∗ , β ∗∗ ) for all α ∗∗ > α ∗ and > β ∗ as follows:
β ∗∗
L(x, α ∗∗ , β ∗∗ ) = f (x) +
m X
αi∗∗ |hi (x)| +
i=1
X
= f (x) +
r X
βj∗∗ max{0, gj (x∗ )}
j=1
X
αi∗∗ hi (x) −
i∈Pe (x)
αi∗∗ hi (x) +
i∈Ne (x)
X
βj∗∗ gj (x∗ ).
j∈Ap (x)
Assuming x = x + x and using a Taylor series expansion of the functions around x∗ we have X
L(x, α ∗∗ , β ∗∗ ) = f (x∗ ) + ∇x f (x∗ )T x + +
αi∗∗ ∇x hi (x∗ )T x
i∈Pe (x)
−
X i∈Ne (x)
.. ..
X
αi∗∗ ∇x hi (x∗ )T x +
βj∗∗ ∇x gj (x∗ )T x + o(x2 ).
j∈Ap (x)
Since for all i ∈ Pe (x) : αi∗∗ ∇x hi (x∗ )T x for all i ∈ Ne (x) : αi∗∗ ∇x hi (x∗ )T x < 0 for all j ∈ Ap (x) : βj∗∗ ∇x gj (x)x > 0 for all j ∈ Ap (x) \ A(x) : βj∗∗ ∇x gj (x)x > 0
with α ∗∗ > |λ∗ | and β ∗∗ > µ∗ ≥ 0 we have L(x, α ∗∗ , β ∗∗ ) > f (x∗ ) + ∇x f (x∗ )T x + +
X
∗ T λ∗∗ i ∇x hi (x ) x
i∈Pe (x)
−
X
X
∗ T λ∗∗ i ∇x hi (x ) x +
i∈Ne (x)
≥ f (x∗ ) + ∇x f (x∗ )T x + +
j ∈ Ap (x) m X
∗ T λ∗∗ i ∇x hi (x ) x
i=1
+
X j∈A(x)
∗ T 2 µ∗∗ j ∇x gj (x ) x + o(x )
∗ T 2 µ∗∗ j ∇x gj (x ) x + o(x )
660
CHAPTER 14 Selective Search
= f (x∗ ) + ∇x f (x∗ ) +
m X
T ∗ λ∗∗ i ∇x hi (x ) +
i=1
X
∗ x + o(x2 ) µ∗∗ j ∇x gj (x )
j∈A(x)
= f (x∗ ) + o(x2 ) ≥ f (x∗ ) = L(x∗ , α ∗∗ , β ∗∗ ), which proves the right side of the inequality. The second part of the proof assumes that the condition is satisfied, and we need to show that x∗ is a CLM. Point x∗ is feasible because the inequality on the left side can only be satisfied when h(x∗ ) = 0 and g(x∗ ) ≤ 0. Since |h(x∗ )| = 0 and max{0, g(x∗ )} ≤ 0, the inequality of the right side ensures that x∗ is a local minimum when compared to all feasible points in Nc (x∗ ). Therefore, x∗ is a CLM. The theorem requires α ∗∗ > α ∗ and β ∗∗ > β ∗ instead of α ∗∗ ≥ α ∗ and β ∗∗ ≥ β ∗ because Lc may not be a strict local minimum when α ∗∗ = α ∗ and β ∗∗ = β ∗ . Consider the example CNLP with LC (x, α) = −x2 + α|x − 5|. At the only CLM x∗ = 5, Lc (x, α) is not a strict local minimum when α = α ∗ = 10, but when α = 20 > α ∗ . The algorithmic solution according to the theorem is iterative in nature with the pseudo code given in Algorithm 14.16. Theorem 14.3 transfers to discrete and mixed (continuous and discrete) state spaces. The difference in discrete (mixed) space is the definition discrete (mixed) neighborhood Nd (Nm ). Intuitively, Nd represents points that can be reached from y in one step, regardless whether there is a valid action to effect the transition. We require y0 ∈ Nd (y) if and only if y ∈ Nd (y0 )). A mixed neighborhood Nm (x, y) of a point x in continuous space and a point y in discrete space can be defined as [ Nm (x, y) = (x0 , y)| x0 ∈ Nc (x) (x, y0 ) | y0 ∈ Nd (y) .
Procedure Extended-Saddle-Point Input: CNLP for Pc Output: CLM x∗ α ← 0; β ← 0 while CLM of Pc not found if (hi (x) 6= 0 resp. gi (x) 6≤ 0) incr. αi resp. βi by δ while (local minimum not found) perform decent on Lc with respect to x return CLM Algorithm 14.16 Saddle-point iteration method for finding a CLM.
;; Initialize Lagrange multipliers ;; Until completion ;; Determine slack ;; Update multipliers ;; Local improvement ;; Local search algorithm ;; Feedback solution
14.9 *Lagrange Multipliers
661
14.9.2 Partitioned Problems The goal of solving state space problems can be reduced to the previous setting. Our formulation assumes that the (possibly continuous) time horizon is partitioned in k + 1 stages, with ul local variables, ml local equality constraints, and rl local inequality constraints in stage l, l ∈ {0, . . . , k}. Such partitioning decomposes the state variable vector S of the problem into k + 1 subvectors S0 , . . . , Sk , where Sl = (S1 (l), . . . , Sut (l))T is a ul -element state vector in (mixed) state space at stage l, and Si (l) is the ith dynamic state variable in stage l. Usually ut is fixed. A solution to such a problem is a path that consists of the assignments of all variables in S. A state space search problem can be written as minS J(S) subject to hl (Sl ) = 0, gl (Sl ) ≤ 0, t = 0, . . . , k (the local constraints), and H(S) = 0, G(S) ≥ 0 (the global constraints). Here, hl and gl are vectors of local-constraint functions that involve Sl and time in stage t; and H and G are vectors of global-constraint functions that involve state variables and time in two or more stages. We define the neighborhood of a solution path p = (S0 , . . . , Sk ) as follows. The partitionable (mixed) neighborhood of a path p is defined as
N( p) =
k [
N (l) ( p) =
l=0
k [ 0 0 p | Sl ∈ N(Sl ) and ∀ i 6= l : Si = Si0 , , l=0
where N( pl ) is the state space neighborhood of state vector Sl in stage l. Intuitively, N( p) is partitioned into k + 1 disjoint sets of neighborhoods, each perturbing one of the stages. Here N( p) includes all paths that are identical to S in all stages except l, where S(l) is perturbed to a neighboring state in N(Sl ). For example, let N(2) = {1, 3} for each stage in a three-stage problem and p = (2, 2, 2). Then N( p) is given by {(1, 2, 2), (3, 2, 2)}, {(2, 1, 2), (2, 3, 2)}, and {(2, 2, 1), (2, 2, 3)}; that is, the union of the perturbation of p in stages 1, 2, and 3. Algorithm 14.17 gives the iterative algorithm for computing an optimal solution. For a fixed γ and ν the program finds Sl that solves the following mixed-integer linear program in stage l: minSl J(S) + γ T H(S) + ηT G(S) subject to hl (Sl ) = 0 and gl (Sl ) ≤ 0. As a result, the solution of the original problem is now reduced to solving multiple smaller subproblems of which the solutions are collectively necessary for the final solution. Therefore, the approach reduces significantly the efforts in finding a solution, since the size of each partition will lead to a reduction of the base of the exponential complexity when a problem is partitioned. The entire Lagrangian function that is minimized is
L(S, α, β, γ , η) = J(S) +
k X
α(l)T |hl (Sl )| + β(l)T max{0, gl (Sl )} + γ T |H(S)| + ηT max{0, G(S)}.
l=0
As in Theorem 14.3, necessary and sufficient conditions for L can be established, showing that algorithm Lagrangian Search will terminate with an optimal solution.
662
CHAPTER 14 Selective Search
Procedure Lagrangian-Search Input: State space problem Output: Solution path that minimizes objective function γ ← 0; η ← 0 ;; Initialize global Lagrange multipliers while CLM is not found ;; Global constraints satisfied incr. γi (resp. ηi ) by δ if Hi (S) 6= 0 (resp. Gj (S) 6≤ 0) ;; Update global multipliers α(t) ← 0; β(t) ← 0 ;; Initialize local Lagrange multipliers while h(Sl ) 6= 0 or g(Sl ) > 0 ;; Local constraints satisfied if (hi (Sl ) 6= 0 resp. gi (Sl ) 6≤ 0) ;; Determine slack increase αi (l) resp. βi (l) by δ ;; Update local multipliers while local minimum of L not found ;; Local improvement perform decent on L with respect to S ∈ N l (S) ;; Local search algorithm return CLM ;; Feedback solution Algorithm 14.17 Lagrangian method for finding a CLM.
14.10 *NO-FREE-LUNCH Despite all successes in problem solving, it is clear that a general problem solver which solves all optimization problems is not to be expected. With their no-free-lunch theorems, Wolpert and Macready have shown that any search strategy performs exactly the same when averaged over all possible cost functions. If some algorithm outperforms another on some cost function, then the latter one must outperform the former one on others. A universally best algorithm does not exist. Even random searchers will perform the same on average on all possible search spaces. Other no-free-lunch theorems show that even learning does not help. Consequently, there is no universal search heuristic. However, there is some hope. By considering specific domain classes of practical interest, the knowledge of these domains can certainly increase performance. Loosely speaking, we trade the efficiency gain in the selected problem classes with the loss in other classes. The knowledge we encode in search heuristics reflects state space properties that can be exploited. A good advice for a programmer is to learn different state space search techniques and understand the problem to be solved. The ability to devise effective and efficient search algorithms and heuristics in new situations is a skill that separates the master programmer from the moderate one. The best way to develop that skill is to solve problems.
14.11 SUMMARY In this chapter, we studied search methods that are not necessarily complete but often find solutions of high quality fast. We did this in the context of solving optimization problems in general and used,
14.11 Summary
663
for example, traveling salesperson problems as examples. Many of these search methods then also apply to path planning problems, for example, by ordering the actions available in states and then encoding paths as sequences of action indices. The no-free-lunch theorems show that a universally best-search algorithm does not exist since they all perform the same when averaged over all possible cost functions. Thus, search algorithms need to be specific to individual classes of search problems. Complete search methods are able to find solutions with maximal quality. Approximate search methods utilize the structure of search problems to find solutions of which the quality is only a certain factor away from maximal. Approximate search methods are only known for a small number of search problems. More general search methods typically cannot make such guarantees. They typically use hill-climbing (local search) to improve an initial random solution repeatedly until it can no longer be improved, a process that is often used in nature, such as in evolution or for path finding by ants. They often find solutions of high quality fast but do not know how good their solutions are. To use search methods based on hill-climbing, we need to carefully define which solutions are neighbors of a given solution, since search methods based on hill-climbing always move from the current solution to a neighboring solution. The main problem of search methods based on hill-climbing are local maxima since they cannot improve the current solution any longer once they are at a local maximum. Thus, they use a variety of techniques to soften the problem of local maxima. For example, random restarts allow search methods based on hill-climbing to find several solutions and return the one with the highest quality. Randomization allows search methods based on hill-climbing to be less greedy yet simple, for example, by moving to any neighboring solution of the current solution that increases the quality of the current solution rather than only the neighboring solution that increases the quality of the current solution the most. Simulated annealing allows search methods based on hill-climbing to move to a neighboring solution of the current solution that decreases the quality. The probability of making such a move is larger the less the quality decreases and the sooner the move is made. Tabu search allows search methods based on hill-climbing to avoid previous solutions. Genetic algorithms allow search methods based on hill-climbing to combine parts of two solutions (recombinations) and to perturb them (mutations). Although most of the chapter was dedicated to discrete search problems, we also showed how hillclimbing applies to continuous search problems in the context of hill-climbing for continuous nonlinear programming. In Table 14.1 we have summarized the selective search strategies as proposed in this chapter. All algorithms find local optimum solutions, but in some cases arguments are given for why the local optimum should not be far off from the global optimum. In this case we wrote Global together with a star denoting that this will be achieved only in the theoretical limit, not in practice. We give some hints on the nature of theoretical analyses behind it, and the main principle that is simulated to overcome the state explosion problem. Table 14.2 summarizes the results of randomized search in k-SAT problems, showing the base α in the runtime complexity of O(α n ). We see that for larger values of k the values converge to 2. In fact, compared to the naive O(2k ) algorithm with base α = 2, there is no effective strategy with better α in general SAT problems.
664
CHAPTER 14 Selective Search
Table 14.1 Overview of selective search algorithms. Algorithm
Optimum
Neighbors
Principle
Simulated annealing (14.2) Tabu (14.3) Randomized tabu (14.4) Randomized local search (14.5)
Global∗ Local Local Local
General General General Boolean
Temperature Forced cuts Forced/random cuts Selective/mutation
(1 + 1) GA (14.6)
Global∗
Boolean
Selective/mutation
Simple GA (14.7)
Global∗
General
Selective/mutation/recombination
Vertex Ant search (14.15) Ant search (14.13) Flood (14.14)
Cover Global∗ Local
Specific Specific General
Pheromones Pheromones Water level
Lagrangian (14.16,14.17)
CLM
MIXED
Multipliers
Table 14.2 Runtime results for k-SAT. k-SAT,
k=
Brute-force Backtrack Monien-Speckenmeyer (14.9) ´ Paturi-Pudlak-Zane (14.10) Hamming-sphere (14.11) Random-walk (14.12)
3
4
5
6
7
8
2 1.91 1.61 1.58 1.5 1.33
2 1.97 1.83 1.68 1.6 1.5
2 1.99 1.92 1.74 1.66 1.6
2 1.99 1.96 1.78 1.71 1.66
2 1.99 1.98 1.81 1.75 1.71
2 1.99 1.99 1.83 1.77 1.75
14.12 EXERCISES 14.1
Validate empirically that the phase transition for 3-SAT is located at m ≈ 4.25n by randomly generating 3-SAT formulas and running an SAT solver.
14.2
In this exercise we develop a randomized (3/4)-approximation of MAX-2-SAT. 1. Give a randomized (1 − 2−k )-approximation (RA) that simply selects a random assignment. Given clauses C of length k show that the probability that clause C is satisfied is 1 − 2−k . 2. Illustrate the working of randomized rounding (RR) where an SAT formula is substituted by a linear program (LP), for example, clause Cj = (x1 ∨ x2 ) is converted to
max
m X j=1
zj
subject to y1 + (1 − y2 ) ≥ zj for 0 ≤ yi , zj ≤ 1.
14.12 Exercises
665
Then the solutions are computed with an efficient LP solver. The solutions are taken as probabilities to draw Boolean values for the assignment variables. 3. Show that the combined run of RA and RR yields a (3/4)-approximation for MAX-2-SAT. Instead of proving the theorem formally, you may work out a small example. 14.3
As another example for a randomized algorithm we chose the probabilistic reduction of threedimensional matching (3-DM) on 2-SAT. The idea is as follows. With probability of 1/3 one of the colors in f : V → {1, 2, 3} is omitted. The resulting problem is converted into a 2-SAT instance with variables xv, j (v for the node and j for the color). The clauses are of the form (xv,i ∨ xv, j ) and (xu,1 ∨ xv,1 ) ∧ (xu,2 ∨ xv,2 ) ∧ (xu,3 ∨ xv,3 ). 1. Show that the probability of the correct choice of colors is (2/3)n . 2. Show that we need t ∈ O(1.5n · ln(1/)) = O(1.5n ) iterations for a running time of . O( poly(n) · 1.5n ) = O(1.5n ). 3. Using this reduction principle to show that a CSP with binary constraints (the domain of each variable is D) is solvable in time O( p(n) · (|D|/2)n ).
14.4
Most k-SAT solvers can be extended to constraint satisfaction problems (CSP), where k is the order of the constraints and assignments. For the sake of simplicity assume that the domains of all variables are the same (D). n
k 1. For Hamming sphere infer a runtime of O |D| · k+1 . 2. For random walk establish a runtime of O((|D| · (1 − 1/k))n ). Show that for k = 2, this bound for random walk matches the one obtained for reduction in the previous exercise.
14.5
The algorithm of Monien-Speckenmeyer has been improved by using autarkic assignments. An assignment b is called autarkic for f , if all clauses, with at least one b variable, are already satisfied. For example, the assignment b = (0, 0) is autarkic for f = (¬x1 ∨ x2 ∨ x4 ) ∧ (x1 ∨ ¬x2 ∨ x3 ) ∧ (x3 ∨ ¬x4 ) ∧ (x3 ∨ x4 ∨ x5 ), since only the first two clauses contain x1 and x2 , and these clauses are set to 1 by b. 1. Give another autarkic assignment for f . 2. Describe the changes to the algorithm of Monien and Speckenmeyer to include autarkic assignments.
14.6
Change the order of Ws and Bs in WWWBBB to WWWBBB . You are allowed to jump over at most two places provided that the target location is free. It is not required that the empty place is in the front. 1. Determine an optimal solution by hand. 2. Use an evaluation function that counts the number of Bs to the left of each W, summed over all three Ws. Apply genetic heuristic search to find a solution.
14.7
Consider Simple-GA on the fitness function f (x) = 3 − (x − 2)2 , with x ∈ {1, . . . , 10} by using a binary string encoding of the two individuals p = 1 and q = 10. 1. Determine the maximum of the function analytically. 2. Does the algorithm arrive at the optimum using bit mutation and 1-point crossover, both with regard to random bit positions?
14.8
Implement and run genetic heuristic search to the same instance. Use 100 randomly generated paths of length 65 to start with and apply 1,000 iterations of the algorithm.
666
14.9
CHAPTER 14 Selective Search
Consider the two parents p = (01001101) and q = (11100011) for a crossover application. Obtain the children of p and q obtained by 1. 1-point crossover (at index l = 5). 2. 1-point crossover (l = 3, r = 6). 3. Uniform crossover (b = (00110011)).
14.10
Perform VAW on the graph of Figure 14.11. 1. Denote the tuples (ut , h(ut ), τ (ut )), t ∈ {1, . . . , 18} starting at node 1. 2. When is the graph completely covered? 3. How long is the limit cycle? 4. Denote the node sequence in the final tour as a regular expression. 5. Is the limit cycle Hamiltonian?
14.11
Perform VAW on the graph of Figure 14.12. 1. Denote the tuples (ut , h(ut ), τ (ut )), t ∈ {1, . . . , 36} starting at node 1. 2. When is the graph completely covered? 3. How long is the limit cycle? 4. Denote the node sequence in the final tour as a regular expression. 5. Is the limit cycle Hamiltonian?
5
6
2
3
1
4
FIGURE 14.11 An example graph for the vertex ant walk.
3
2
4
FIGURE 14.12 Another example graph for the vertex ant walk.
5
1
6
14.12 Exercises
667
14.12
Devise an undirected graph that omits a Hamiltonian path that is not recognized by the VAW process. (There is one with nine nodes.)
14.13
For algorithm Flood take function height(x, y) = −(x − 4)2 + −(y − 6)4 to be optimized, with respect to a 10 × 10 grid. Start with n = 20 active ants at random position. Initialize W to 0 and increase it by 0.1 for each iteration.
14.14
Express the previous exercises now with real values on [0, 10] × [0, 10] as a continuous nonlinear programming task. 1. What is the constraint local minimum (CLM) for this function? 2. Express the optimization problem with Lagrangian multipliers. 3. Is it the global optimum?
14.15
Heuristics for discrete domains are often found by relaxation of the problem formulation from an integer program to a linear program. 1. Formulate Knapsack as a (0/1) integer program. 2. Relax the integrality constraints to derive an upper bound on Knapsack.
14.16
In the Ladder problem a ladder leans across a five-foot fence, just touching a high wall three feet behind the fence. 1. What is the minimum possible length l of the ladder? Use standard calculus. Hint: The formula (a + 3)2 + (b + 5)2 = l2 describes a circle with center (−3, −5) and radius L. The proportionality of base and height for the two smaller right triangles yields ab = 15. Substitute this in the first equation to obtain the single-variable function. 2. Provide the objective function F(a, b) with constraint function G(a, b) = 0 and solve the problem using Lagrange multipliers to find a set of three equations in three unknowns.
14.17
Consider now the Two Ladder problem with two ladders of lengths l and l0 leaning across two walls of given heights h = 10 and h0 = 15 bordering a gap of given width W = 50 (see Fig. 14.13). The lower ends of the ladders are placed at distances d0 and d0 from the walls, so that their upper ends meet at a point above the water. The two ladders are supported in place by each other as well as by the two walls. The problem is to find this minimal sum of l and l0 . 1. Model and solve the problem by ordinary calculus. 2. Model and solve the problem as a Lagrange optimization problem.
l
l′ h
d
FIGURE 14.13 The TWO LADDER problem.
h′ w
d′
668
CHAPTER 14 Selective Search
14.13 BIBLIOGRAPHIC NOTES Hill-climbing and gradient decent algorithms belong to the folklore of computer science. Algorithm flood is a version of simulated annealing, which has been introduced by Kirkpatrick, Jr., and Vecchi (1983). Randomized tabu search appeared in Faigle and Kern (1992). Annealing applies to optimization problems where direct methods are trapped; while simulated tempering, for example, by Marinari and Parisi (1992) and swapping by Zheng (1999) are applied when direct methods perform poorly. The standard approach for sampling via Markov chain Monte Carlo from nonuniform distributions is the Metropolis algorithm (Metropolis, Rosenbluth, Rosenbluth, Teller, and Teller, 1953). There is a nice discussion about lifting space and solution state spaces in the beginning by Hoos and Stu¨ tzle (2004). Ant walk generalized the use of diminishing pebbles by a model of odor markings. Vertex ant walk has been introduced by Wagner, Lindenbaum, and Bruckstein (1998). It is a reasonable trade-off between sensitive DFS and self-avoiding walk by Madras and Slade (1993). Edge ant walk has been proposed by Wagner, Lindenbaum, and Bruckstein (1996). Thrun (1992) has described counterbased exploration methods, which is similar to VAW, but the upper bound shown there on the cover time is O(n2 d), where d is the diameter and n is the number of vertices. Satisfiability problems have been referenced in the previous chapter. Known approximation ratios for MAX-SAT are 0.7846; MAX-3-SAT, 7/8, upper bound 7/8; MAX-2-SAT, 0.941, upper bound 21/22=0.954; MAX-2-SAT with additional cardinality constraints, 0.75; see Hofmeister (2003). Many inapproximability results are based on the PCP theory, denoting that the class of NP is equal to a certain class of probabilistically checkable proofs (PCP). For example, this theory implies that there is an > 0, so that it is NP-hard to find an (1 − ) approximation for MAX-3-SAT. PCP theory has been introduced by Arora (1995). The technical report based on the author’s PhD thesis contains the complete proof of the PCP theorem, and basic relations to approximation algorithms. The algorithms of Monien and Speckenmeyer (1985) and of Paturi, Pudla´ k, and Zane (1977) have been improved by the analysis of Scho¨ ning (2002), who has also studied random walk and Hamming sphere as presented in the text. Hofmeister, Scho¨ ning, Schuler, and Watanabe (2002) have improved the runtime of a randomized solution to 3-SAT to O(1.3302n ), and Baumer and Schuler (2003) have 2 n ) ) further reduced it to O(1.329n ). A deterministic algorithm with a performance bound of O((2 − k+1 n−2(n/ lg n) has been suggested by Dantsin, Goerdt, Hirsch, and Scho¨ ning (2000). The (2 ) lower-bound result of Miltersen, Radhakrishnan, and Wegener (2005) shows that a conversion of conjunctive normal for (CNF) to disjunctive normal form (DNF) is almost exponential. This suggest that O(α n ) algorithms for general SAT with α < 2 are not immediate. Genetic algorithms are of widespread use with their own community and conferences. Initial work on genetic programming including the Schema Theorem has been presented by Holland (1975). A broad survey has been established in the triology by Koza (1992, 1994) and Koza, Bennett, Andre, and Keane (1999). Schwefel (1995) has applied evolutionary algorithms to optimize airplane turbines. Genetic path search has been introduced in the context of model checking by Godefroid and Khurshid (2004). Ant algorithms also span a broad community with their own conferences. A good starting point is the special issue on Ant Algorithms and Swarm Intelligence by Dorigo, Gambardella, Middendorf, and Stu¨ tzle (2002), and a book by Dorigo and Stu¨ tzle (2004). The ant algorithm for TSP is due to Gambardella and Dorigo (1996). It has been generalized by Dorigo, Maniezzo, and Colorni (1996).
14.13 Bibliographic Notes
669
There is a rising interest in (particle) swarm optimization algorithms (PSO), a population-based stochastic optimization technique that originally has been developed by Kennedy and Eberhart. It closely relates to genetic algorithms with different recombination and mutation operators (Kennedy, Eberhart, and Shi, 2001). Applications include time-tabling as considered by Chu, Chen, and Ho (2006), or stuff scheduling as studied by Gu¨ nther and Nissen (2010). Mathematical programming has a long tradition with a broad spectrum of existing techniques especially for continuous and mixed-integer optimization. The book Nonlinear Programming by Avriel (1976) provides a good starting point. For CNLP, Karush, Kuhn, and Tucker (see Bertsekas, 1999) have given another necessary condition. If only equality constraints are present in Pc , we have n + m equations with n + m unknowns (x, λ) to be solved by iterative approaches like Newton’s method. A static penalty approach transforms Pc into the unconstraint problem Lρ (x, α, β) = f (x) + α T |h(x)|ρ + β T max{0, g(x)}ρ very similar to the one considered in the text (set ρ = 1). However, the algorithm may be hard to carry out in practice because the global optimum of Lρ needs to hold for all points in the search space, making α and β very large. Mixed-integer NLP methods generally decompose MINLP into subproblems in such a way that after fixing a subset of the variables, each resulting subproblem is convex and easily solvable, or can be relaxed and approximated. There are four main types: generalized Benders decomposition by Geoffrion (1972), outer approximation by Duran and Grossmann (1986), generalized crossdecomposition by Holmberg (1990), and branch and reduce methods by Ryoo and Sahinidis (1996). There is some notion of completeness for selective algorithms called probabilistic approximate completeness (PAC) (Hoos and Stu¨ tzle, 1999). Randomized algorithms, which are not PAC, are essentially incomplete. The intuition is that if the algorithm is left to run infinitely, a PAC algorithm will almost certainly find a solution, if it exists. In other words, algorithms that are PAC can never get trapped in nonsolution regions of the search space. However, they may still require a very long time to escape from such regions; see, for example, Hoos and Stu¨ tzle (2004). Whether this theoretical property has practical impact is uncertain. This may change, if combined with results on the failure probability’s rate of convergence. The first no-free-lunch theorems have been given by Wolpert and Macready (1996). Culberson (1998b) has given an algorithmic view of no-free-lunch. More recent results on the NFL theory have been established by Droste, Jansen, and Wegener (1999, 2002).
This page intentionally left blank
PART
Heuristic Search Applications
V
This page intentionally left blank
CHAPTER
Action Planning
15
In domain-independent action planning, a running system must be able to find plans and exploit search knowledge fully automatically. In this chapter we concentrate on deterministic planning (each action application produces exactly one successor) with no uncertainty in the environment and no observation to infer otherwise inaccessible state variables. The input of a planning problem consists of a set of state variables, an initial state in the form of value assignments to the variables, a goal (condition), and a set of actions. A plan is a sequence (or schedule) of actions that eventually maps the initial state into one that satisfies the goal. The problem domain description language (PDDL) allows flexible specifications of domain models and problem instances. Starting from problems described in Strips notation (as introduced in Ch. 1), PDDL has grown to an enormous expressive power, including large fragments of first-order logic to combine propositional expressions, numerical state variables to feature the handling of real-valued quantities, and constraints to impose additional restrictions for the set of valid plans. Metric planning introduces planning with costs, and temporal planning covers action duration. The agreed standard for PDDL encompasses the following hierarchy of expressiveness. Level 1: Propositional Planning. This level includes all sorts of propositional description languages. It unifies Strips-type planning with the abstract description language (ADL). ADL allows typed domain objects and any bounded quantification over these. ADL also includes negated and disjunctive preconditions, and conditional effects. While the former two language extensions can be easily compiled away (by introducing negated predicates and by splitting the actions), the latter ones are essential in the sense that their compilation may induce an exponential increase in the problem specification. Propositional planning is decidable, but PSPACE-hard. Level 2: Metric Planning. This level introduces numerical state variables, so-called fluents, and an objective function to be optimized (the domain metric) that judges plan quality. Instead of Boolean values to be associated with each grounded atom, the language extension enables the processing of continuous quantities, an important requirement for modeling many real-world domains. This growing expressiveness comes at a high price. Metric planning is undecidable even for very restricted problem classes (a decision problem is undecidable if is impossible to construct one computable function that always terminates and leads to a correct answer). This, however, does not mean that metric planners cannot succeed in finding plans for concrete problem instances. Level 3: Temporal Planning. This level introduces duration, which denotes action execution time. The duration can be a constant quantity or a numerical expression dependent on the current assignment to state variables. Two different semantics have been proposed. In the PDDL
673
674
CHAPTER 15 Action Planning
semantics each temporal action is divided into an initial, an invariant, and a final happening. Many temporal planners, however, assume the simpler black-box semantics. The common task is to find a temporal plan, i.e., a set of actions together with their starting times. This plan is either sequential (simulating additive action costs) or parallel (allowing the concurrent execution of actions). The minimal execution time of such a temporal plan is its makespan, and can be included as one objective in the domain metric. More and more features have been attached to this hierarchy. Domain axioms in the form of derived predicates introduce inference rules, and timed initial facts allow action execution windows and deadlines to be specified. Newer developments of PDDL focus on temporal and preference constraints for plans. Higher levels support continuous processes and triggered events. The results of the biennial international planning competitions (started in 1998) show that planners keep aligned with the language extensions, while preserving good performances in finding and optimizing plans. Besides algorithmic contributions, the achievements also refer to the fact that computers have increased in their processing power and memory resources. As a consequence, modern action planning is apparently suited to provide prototypical solutions to specific problems. In fact, action planning becomes more and more application oriented. To indicate the range and flavor of applicability of modern action planning, we list some examples that have been proposed as benchmarks in the context of international planning competitions. Airport The task is to control the ground traffic on an airport, assigning travel routes and times to the airplanes, so that the outbound traffic has taken off and the inbound traffic is parked. The main problem constraint is to ensure the safety of the airplanes. The aim is to minimize the total travel time of all airplanes. Pipesworld The task is to control the flow of different and possibly conflicting oil derivatives through a pipeline network, so that certain product amounts are transported to their destinations. Pipeline networks are modeled as graphs consisting of areas (nodes) and pipes (edges), where the pipes can differ in length. Promela The task is to validate state properties in systems of communicating processes. In particular, deadlock states shall be detected, i.e., states where none of the processes can apply a transition. For example, a process may be blocked when trying to read data from an empty communication channel. Power Supply Restoration The task is to reconfigure a faulty electricity network, so that a maximum of nonfaulty lines is supplied. There is uncertainty about the status of the network, and various numerical parameters must be optimized. Satellite The domain is inspired from a NASA application, where satellites have to take images of spatial phenomena and send them back to Earth. In an extended setting, timeframes for sending messages to the ground stations are imposed. Rovers The domain (also inspired from a NASA application) models the problem of planning for a group of planetary rovers to explore the planet they are on, for example, by taking pictures and samples from interesting objects. Storage The domain involves spatial reasoning and is about moving a certain number of crates from some containers to some depots by hoists. Inside a depot, each hoist can move according to a specified spatial map connecting different areas of the depot.
15.1 Optimal Planning
675
Traveling Purchase Problem A generalization of the TSP. We have a set of products and a set of markets. Each market is provided with a limited amount of each product at a known price. The task is to find a subset of the markets such that a given demand of each product can be purchased, minimizing the routing and the purchasing costs. Openstack A manufacturer has a number of orders, each for a combination of different products, and can make one product at a time only. The total required quantity of each product is made at the same time. From the time that the first product (included in an order) is made to the time that all products (included in the order) have been made, the order is said to be open. During this time it requires a stack. The problem is to order the production of the different products, so that the maximum number of stacks that are in use simultaneously is minimized. Trucks Essentially, this is a logistics domain about moving packages between locations by trucks under certain constraints. The loading space of each truck is organized by areas: a package can be loaded onto an area of a truck only if the areas between the area under consideration and the truck door are free. Moreover, some packages must be delivered within given deadlines. Settlers The task is to build up an infrastructure in an unsettled area, involving the building of housing, railway tracks, sawmills, etc. The distinguishing feature of the domain is that most of the domain semantics are encoded with numeric variables. UMTS The task is the optimization of the call setup for mobile applications. A refined schedule for the setup is needed to order and accelerate the execution of the application modules that are invoked during the call setup. Probably the most important contribution to cope with the intrinsic difficulty of domainindependent planning was the development of search guidance in the form of generic heuristics. In the following, we introduce designs for planning heuristics and show how to tackle more expressive planning formalisms, like metric and temporal planning, as well as planning with constraints.
15.1 OPTIMAL PLANNING Optimal planners compute the best possible plan. They minimize the number of (sequential or parallel) plan steps or optimize the plan with respect to the plan metric. There are many different proposals for optimal planning, ranging from plan graph encoding, satisfiability solving, integer programming to constraint satisfaction, just to name a few. Many modern approaches consider heuristic search planning based on admissible estimates. We first introduce optimal planning via layered planning graphs and via satisfiability planning. Next, admissible heuristics are devised that are based on dynamic programming or on pattern databases.
15.1.1 Graphplan Graphplan is a parallel-optimal planner for propositional planning problems. The rough working of the Graphplan algorithm is the following. First, the parametric input is grounded. Starting with a planning graph, which only consists of the initial state in the first layer, the graph is incrementally constructed. In one stage of the algorithm, the planning graph is extended with one action and one propositional layer followed by a graph extraction phase. If this search terminates with no solution, the plan horizon
676
CHAPTER 15 Action Planning
is extended with one additional layer. As an example, consider the Rocket domain for transporting cargo in space (see Fig. 15.1). The layered planning graph is shown in Table 15.1. In the forward phase the next action layer is determined as follows. For each action and each instantiation of it, a node is inserted, provided that no two preconditions are marked as mutually exclusive (mutex). Two propositions a and b are marked mutex, if all options to generate a are exclusive to all options to generate b. Additionally, so-called noop actions are included that merely propagate existing propositions to the next layer. Next, the actions are tested for exclusiveness and for each action a list of all other actions is recorded, for which they are exclusive. To generate the next propositional layer, the add-effects are inserted and taken as the input for the next stage.
(:action move :parameters (?r - rocket ?from ?to - place) :precondition (and (at ?r ?from) (has-fuel ?r)) :effect (and (at ?r ?to) (not (at ?r ?from)) (not (has-fuel ?r)))) (:action load :parameters (?r - rocket ?p - place ?c - cargo) :precondition (and (at ?r ?p) (at ?c ?p)) :effect (and (in ?c ?r) (not (at ?c ?p)))) (:action unload :parameters (?r - rocket ?p - place ?c - cargo) :precondition (and (at ?r ?p) (in ?c ?r)) :effect (and (at ?c ?p) (not (in ?c ?r)))) FIGURE 15.1 Some actions in the ROCKET domain.
Table 15.1 Layered planning graph for the ROCKET domain. Propositional and action levels alternate. First propositional level includes the initial state. The action layer i contains all actions with preconditions satisfied in propositional layer i − 1. A proposition is added to layer i if it is already contained in layer i − 1 or there is an applicable action that has the proposition as an add-effect. Prop. Level 1
(at a l) (at b l) (at r l) (fuel r)
Action Level 1
Prop. Level 2
(load b l) (load a l) (move l p)
(in b r) (in a r) (at r p)
(noop) (noop) (noop) (noop)
(at a l) (at b l) (at r l) (fuel r)
Action Level 2
(noop) (noop) (noop) (unload a p) (unload b p) (noop) (noop) (noop) (noop)
Prop. Level 3
(in b r) (in a r) (at r p) (at a p) (at b p) (at a l) (at b l) (at r l) (fuel r)
15.1 Optimal Planning
677
A fixpoint is reached when the set of propositions no longer changes. As one subtle problem, this test for termination is not sufficient. Consider a goal in Blocksworld given by (on a b), (on b c), and (on c a). Every two conditions are satisfiable but not all three all together. Thus, the forward phase terminates if the set of propositions and the goal set in the previous stage have not changed. It is not difficult to see that the size of the planning graph is polynomial in the number n of objects, the number m of action schemas, the number p of propositions in the initial state, the length l of the longest add-list, and the number of layers in the planning graph. Let k be the largest number of action parameters. The number of instantiated effects is bounded by O(lnk ). Therefore, the maximal number of nodes in every propositional layer is bounded by O(p + mlnk ). Since every action schema can be instantiated in at most O(nk ) different ways, the maximal number of nodes in each action layer is bounded by O(mnk ). In the generated planning graph, Graphplan constructs a valid plan, chaining backward from the set of goals. In contrast to most other planners, this processing works layer by layer to take care of preserving the mutex relations. For a given time step t, Graphplan tries to extract all possible actions (including noops) from time step t − 1, which has the current subgoal as add-effects. The preconditions for these actions build the subgoals to be satisfied in time step t − 1 to satisfy the chosen subgoal at time step t. If the set of subgoals is not solvable, Graphplan chooses a different set of actions, and recurs until all subgoals are satisfied or all possible combinations have been exhausted. In the latter case, no plan (with respect to the imposed depth threshold) exists, as it can be shown that Graphplan terminates with failure if and only if there is no solution to the current planning problem. The complexity of the backward phase is exponential (and has to be unless PSPACE = P). By its layered construction, Graphplan constructs a plan that has the smallest number of parallel plan steps.
15.1.2 Satplan To cast a fully instantiated action planning task as a satisfiability problem we assign to each proposition a time stamp denoting when it is valid. As an example, for the initial state and goal condition of a sample Blocksworld instance, we may have generated the formula (on a b 1) ∧ (on b t 1) ∧ (clear a 1) ∧ (on b a 3). Further formulas express action execution. They include action effects, such as ∀ x, y, z, i : (on x y i) ∧ (clear x i) ∧ (clear z i) ∧ (move x y z i) ⇒ (on x z i + 1) ∧ (clear y i + 1) and noop clauses for propositions to persist. To express that no action with unsatisfied precondition is executed, we may introduce rules, in which additional action literals imply their preconditions, such as ∀ x, y, z, i : (move x y z i) ⇒ (clear x i) ∧ (clear z i) ∧ (on x y i). Effects are dealt with analogously. Moreover, (for sequential plans) we have to express that at one point in time only one action can be executed. We have ∀x, x0 , y, y0 , z, z0 , i : x 6= x0 ∨ y 6= y0 ∨ z 6= z0 ⇒ ¬(move x y z i) ∨ ¬(move x0 y0 z0 i).
678
CHAPTER 15 Action Planning
Finally, for a given step threshold N we require that at every step i < N at least one action has to be executed; for all i < N we require ∃x, y, z : (move x y z i). The only model of this planning problem is (move a b t 1), (move b t a 2). Satplan is a combination of a planning problem encoding and an SAT solver. The planner’s performance participates in the development of more and more efficient SAT solvers. Extensions of Satplan to parallel planning encode the planning graph and the mutexes of Graphplan. For this approach, Satplan does not find the plan with the minimal total number of steps, but the one with the minimal number of parallel steps.
15.1.3 Dynamic Programming One of the first estimates for heuristic search planning is the max-atom heuristic. It is an approximation of the optimal cost for solving a relaxed problem in which the delete lists are ignored. An illustration is provided in Figure 15.2 (left). The heuristic is based on dynamic programming. Consider a propositional and grounded propositional planning problem P P = (S, A, s, T) (see Ch. 1) with planning states u and v, and propositions p and q. Value h(u) = p∈T g(u, p) is the sum of the approximations g(u, p), to reach p from u, where g(u, p) = min{g(u, p), 1 + max g(u, q) | p ∈ add(a), a ∈ A} q∈pre(a) is a fixpoint equation. The recursion starts with g(u, p) = 0, for p ∈ u, and g(u, p) = ∞, otherwise. The values of g are computed P iteratively, until the values no longer change. The costs g(u, C) for the set C is computed as g(u, C) = p∈C g(u, p). In fact, the cost of achieving all the propositions in a set can be computed as either a sum (if sequentiality is assumed) or as a max (if parallelism is assumed instead). The max-atom heuristic chooses the maximum of the cost values with g(u, C) = maxp∈C g(u, p). The pseudo code is shown in Algorithm 15.1. This heuristic is consistent, since by taking the maximum cost values, the heuristic on an edge can decrease by at most 1. Preconditions
Operator +
+
+
−
−
−
+
+
+
−
−
−
Effects
FIGURE 15.2 Schematic view on action abstractions for max-atom (left) and pattern database heuristic (right). The preconditions of the abstract actions are shown in the form of boxes on top of it, while the effects (separated in add (+) and delete (−) effects) are shown in the form of boxes below it. Marked boxes refer to facts that have been eliminated in the relaxation of the problem.
15.1 Optimal Planning
679
Procedure Max-Atom Input: State space planning problem P Output: Max atom heuristic for T for each p ∈ AP : g(p) ← ∞ ;; Initialize distance array to default for each p ∈ u : g(p) ← 0 ;; Initialize distance array to current state v ← u; u ← ∅ ;; Initialize relaxed traversal while (u 6= v) ;; Termination criterion: no change for each a ∈ {a0 ∈ A | pre(a0 ) ⊆ v} ;; For all enabled actions pmax ← arg maxp∈pre(a) {g(p)} ;; Most costly precondition for each r ∈ add(a) ;; Consider all add-effects if (1 + pmax ≤ g(r)) g(r) ← 1 + pmax ;; Improve value u←v ;; Mark previous state v ← u ∪ add(a) ;; Apply op (without delete list) return maxp∈T g(p) Algorithm 15.1 Max-atom heuristic.
As the heuristic determines the backward distance of atoms with respect to the initial state, the previous definition of the heuristic is of use only for backward or regression search. However, it is not difficult to implement a variant that is applicable to forward or progression search, too. The max-atom heuristic has been extended to max-atom-pair to include larger atom sets, which enlarges the extracted information (without losing admissibility) by approximating the costs of atom pairs: g2 (u, { p, q}) = min{ min [1 + g2 (u, pre(a))], a∈A( p&q)
min [1 + g2 (u, pre(a) ∪ {p}), min [1 + g2 (u, pre(a) ∪ {q})},
a∈A( p|q)
a∈A(q|p)
where p&q denotes that p and q are both contained in the add list of the action, and where p|q denotes that p is contained in the add list and q is neither contained in the add list nor in the delete list. If all goal distances are precomputed, then these distances can be retrieved from a table, yielding a fast heuristic. The extension to hm with atom sets of m ≥ 2 elements has to be expressed with the following recursion: if C ⊆ u and |C| ≤ m 0 m m h (C) = min(D,O)∈R(C) {1 + h (D)} if C 6⊆ u and |C| ≤ m, max m if |C| > m D⊆C,|D|=m h (D) where R(C) denotes all pairs (D, O) that contain C ∩ add(a) 6= ∅, C ∩ del(a) 6= ∅, and D = (C \ add(a)) ∪ pre(a). It is rarely used in practice. It has been argued that the layered arrangement of propositions in Graphplan can be interpreted as a special case of a search with h2 .
680
CHAPTER 15 Action Planning
15.1.4 Planning Pattern Databases In the following, we study how to apply pattern databases (see Ch. 4) to action planning. For a fixed state vector (in the form of a set of instantiated predicates) we provide a general abstraction function. The ultimate goal is to create admissible heuristics for planning problems fully automatically. Planning patterns omit propositions from the planning space. Therefore, in an abstract planning problem with regard to a set R ⊆ AP, a domain abstraction is induced by φ(u) = u|R = u ∩ R. (Later on we will discuss how R can be selected automatically.) The interpretation of φ is that all Boolean variables for propositions not in R are mapped to don’t care. An abstract planning problem P|R = (S|R , A|R , s|R , T|R ) of a propositional planning problem (S, A, s, T) with respect to a set of propositional atoms R is defined by s|R = s ∩ R, S|R = {u|R | u ∈ S}, T|R = {t|R | t ∈ T}, A|R = {a|R | a ∈ A}, where a|R for a = ( pre(a), add(a), del(a)) ∈ A is given as a|R = ( pre(a)|R , add(a)|R , del(a)|R ). An illustration is provided in Figure 15.2 (right). This means that abstract actions are derived from concrete ones by intersecting their precondition, add, and delete lists with the subset of predicates in the abstraction. Restriction of actions in the concrete space may yield noop actions φR (a) = (∅, ∅, ∅) in the abstract planning problem, which are discarded from the action set A|R . A planning pattern database with respect to a set of propositions R and a propositional planning problem P = (S, A, s, T) is a collection of pairs (d, v) with v ∈ S|R and d being the shortest distance to the abstract goal. Restriction |R is solution preserving; that is, for any sequential plan π for the propositional planning problem P there exists a plan πR for the abstraction P|R = (S|R , A|R , s|R , T|R ). Moreover, an optimal abstract plan for P|R is shorter than or equal to an optimal plan for P. Strict inequality holds if some abstract actions are noops, or if there are even shorter paths in the abstract space. We can also prove consistency of pattern database heuristics as follows. For each action a that maps u to v in the concrete space, we have φ(a)(φ(u)) = φ(v). By the triangular inequality of shortest paths, the abstract goal distance for φ(v) plus one is larger than or equal to the abstract goal distance φ(u). Figure 15.3 illustrates a standard (left) and multiple pattern database (right) showing that different abstractions may refer to different parts of the state vector.
R
Q
R
FIGURE 15.3 Standard (left) and multiple pattern (right) databases on sets of propositions R and Q. The horizontal ruler indicates the state vector. The rectangles illustrate the generated pattern databases on top of the selected support atoms (the rectangle widths correspond to the selected sets of propositions and rectangle heights correspond to the sizes of the databases).
15.1 Optimal Planning
681
Encoding Propositional encodings are not necessarily the best state space representations for solving propositional planning problems. A multivalued variable encoding is often better. It transforms a propositional planning task into an SAS+ planning problem, which is defined as a quintuple P = (S, X, A, s, T), with X = {v1 , . . . , vn } being a set of state variables of states in S (each v ∈ X has finite-domain Dv ), A being a set of actions given by a pair (P, E) for preconditions and effects, and s and T being the initial and goal state s, respectively, in the form of a partial assignment. A partial assignment for X is a function s over X, such that s(v) ∈ Dv , if s(v) is defined. The process of finding a suitable multivalued variable encoding is illustrated with a simple planning problem, where a truck is supposed to deliver a package from Los Angeles to San Francisco. The initial state is defined by the atoms (ispackage package), (istruck truck), (location los-angeles), (location sanfrancisco), (at package los-angeles), and (at truck los-angeles). Goal states have to satisfy the condition (at package san-francisco). The domain provides three action schemas named load to load a truck with a certain package at a certain location, the inverse operation unload, and drive to move a truck from one location to another. The first preprocessing step will detect that only the at (denoting the presence of a given truck or package at a certain location) and in predicates (denoting that a package is loaded in a certain truck) change over time and need to be encoded. The labeling predicates ispackage, istruck, location are not affected by any action and thus do not need to be specified in a state encoding. In a next step, some mutual exclusion constraints are discovered. In our case, we will detect that a given object will always be at or in at most one other object, so propositions such as (at package los-angeles) and (in package truck) are mutually exclusive. This result is complemented by fact space exploration: Ignoring negative (delete) effects of actions, we exhaustively enumerate all propositions that can be satisfied by any legal sequence of actions applied to the initial state, thus ruling out illegal propositions, such as (in los-angeles package), (at package package), or (in truck san-francisco). Now all the information that is needed to devise an efficient state encoding schema for this particular problem is at the planner’s hands. We discover that three multivalued variables are needed. The first one is required for encoding the current city of the truck and the other two variables are required to encode the status of the package. Using the multivalued variable encoding the number of possible planning states shrinks drastically, whereas the number of reachable planning states remains unchanged. As another consequence, the multivalued variable encoding provides better predictions to the expected sizes of the abstract planning spaces.
Multiple Pattern Databases As abstract planning problems are defined by a selection R of atoms there are several different candidates for a pattern database. This remains true when projecting multivalued variables. We exemplify our considerations in Blocksworld. The domain is specified with the four action schemas pick-up, put-down, stack, and unstack, and the propositions on, ontable, handempty, and clear. The example problem contains four blocks a, b, c, and d used for grounding. For example, (pick–up a) is defined as the precondition list {(clear a), (ontable a), (handempty)}, the add list {(holding a)}, and the delete list {(ontable a), (clear a), (handempty)}. The goal of the instance is {(on d c), (on c a), (on a b)} and the initial state is given by {(clear b), (ontable d), (on b c), (on c a), (on a d)}.
682
CHAPTER 15 Action Planning
One possible multivalued variable encoding for the domain, consisting of groups of mutually exclusive propositions, which has been automatically inferred by a static analyzer (as explained earlier) has nine variable domains: Dv1 = {(on c a), (on d a), (on b a), (clear a), (holding a)} (for the blocks on top of a); Dv2 = {(on a c), (on d c), (on b c), (clear c), (holding c)} (for the blocks on top of c); Dv3 = {(on a d), (on c d), (on b d), (clear d), (holding d)} (for the blocks on top of d); Dv4 = {(on a b), (on c b), (on d b), (clear b), (holding b)} (for the blocks on top of b); Dv5 = {(ontable a), none} (is block a bottom-most in tower); Dv6 = {(ontable c), none} (is block c bottom-most in tower); Dv7 = {(ontable d), none} (is block d bottom-most in tower); Dv8 = {(ontable b), none} (is block b bottom-most in tower); and Dv9 = {(handempty), none} (for the gripper). Each state can be expressed by selecting one proposition for each variable and none refers to the absence of all other propositions in the group. We may select variables with even index to define the abstraction φeven and variables with odd index to define the abstraction φodd . The resulting planning databases are depicted in Table 15.2. Note that there are only three atoms present in the goal state so that one of the pattern databases only contains patterns of length one. Abstraction φeven corresponds to v1 and φodd corresponds to the union of v2 and v4 . Table 15.2 Two pattern databases for the example problem. Pairs of pattern and goal distances are shown. The upper one refers to the projection onto group of v1 with its set of possible assignments (on c a), (on d a), (on b a), (clear a), and (holding a). It is generated starting from (on c a). The second database projects to the cross-product of v2 covering (on a c), (on d c), (on b c), (clear c), (holding c), and v4 covering (on a b), (on c b), (on d b), (clear b), and (holding b); starting from the partial goal state (on d c), (on a b). ((on c a),0) ((clear a),1) ((holding a),2) ((on b a),2) ((on d a),2) ((on d c), (on a b),0) ((on d c)(clear b),1) ((on d c)(holding b),2) ((on d c)(on d b),2) ((on a c)(on a b) ,2) ((clear c)(holding b),3) ((on a c)(clear b),3) ((holding c)(holding b),4) ((on a c)(holding b),4) ((on d b)(holding c),4) ((on b c)(holding b),5) ((on d b)(on b c),5) ((on a c)(on c b),5)
((on a b)(clear c),1) ((clear c)(clear b),2) ((on a b)(holding c),2) ((clear b)(holding c),3) ((on d b)(clear c),3) ((on b c)(clear b),4) ((on c b)(clear c),4) ((on a c)(on d b),4) ((on a b)(on b c),5) ((on c b)(holding c),5) ((on c b)(on d c),5)
15.1 Optimal Planning
683
To construct an explicit-state pattern database, one can use a hash table for storing the goal distance for each abstract state. In contrast, symbolic planning pattern databases are planning pattern databases that have been constructed with BDD exploration for latter use either in symbolic or explicit heuristic search. Each search layer is represented by a BDD. In planning practice, a better scaling seems to favor symbolic pattern database construction.
Pattern Addressing To store the pattern databases, large hash tables are required. The estimate of a state is then a mere hash lookup (one for each pattern database). To improve efficiency of the lookup, it is not difficult to devise an incremental hashing scheme. we assume a propositional encoding. For u ⊆ AP = { p1 , p2 , . . . , p|AP| } we select h(u) = PFirst, i mod q as the hash function with prime q denoting the size of the hash table. The hash pi ∈u 2 value of v = (u \ del(a)) ∪ add(a) can be incrementally calculated as
X
h(v) =
2i mod q =
=
X
2i −
2i mod q −
pi ∈u
X
pi ∈u
ai ∈(u\del(a))∪add(a)
X
= h(u) −
X
2i mod q
pi ∈add(a)
pi ∈del(a)
X
2i mod q +
2i mod q mod q
pi ∈add(a)
2i mod q +
pi ∈del(a)
X
2i +
pi ∈del(a)
X
X
2i mod q mod q.
pi ∈add(a)
Of course, hashing induces a (clearly bounded) number of collisions that have to be resolved by using one of the techniques presented in Chapter 3. Since 2i mod q can be precomputed for all pi ∈ AP, we have an incremental running time to compute the hash address that is of order O(|add(a)| + |del(a)|), which is almost constant for most P proposii tional planning problems (see Ch. 1). For constant time complexity we store mod q − pi ∈add(a) 2 P i mod q together with each action a. Either complexity is small, when compared with pi ∈del(a) 2 the size of the planning state. It is not difficult to extend incremental hash addressing to multivalued variables. According to the partition into variables, a hash function is defined as follows. Let vi1 , vi2 , . . . , vik be the selected variables Q in the current abstraction and offset(k) = kl=1 |Dvil−1 |. Furthermore, let variable( p) and value( p) be, respectively, the variable index and the position of proposition p in its variable group. Then, the hash value of state u is X value( p) · offset(variable( p)) mod q. h(u) = p∈u
The incremental computation of h(v) for v = (u \ del(a)) ∪ add(a) is immediate.
684
CHAPTER 15 Action Planning
Automated Pattern Selection Even in our simple example planning problem, the number of variables and the sizes of the generated pattern databases for φeven and φodd differ considerably. Since we perform a complete exploration for pattern database construction, time and space resources may become exhausted. Therefore, an automatic way to find a balanced partition with regard to a given memory limit is required. Instead of imposing a bound on the total size for all pattern databases altogether, we impose a threshold for the sizes of the individual pattern databases, which has to be adapted to a given infrastructure. As shown in Chapter 4, one option for pattern selection is Pattern Packing: According to the domain sizes of the variables, it finds a selection of pattern databases so that their combined sizes do not exceed the given threshold. In the following, we consider genetic algorithms for improved pattern selection, where pattern genes denote which variable appears in which pattern. Pattern genes have a two-dimensional layout (see Fig. 15.4). It is recommended to initialize the genes with Pattern Packing. To avoid that all genes of the initial population are identical, the variable ordering for Pattern Packing can be randomized. A pattern mutation flips bits with respect to a small probability. This allows us to add or delete variables in patterns. We extended the mutation operator to enable insertion and removal of entire patterns. Using selection, an enlarged population produced by recombination is truncated to its original size, based on their fitness. The (normalized) fitness for the population is interpreted as a distribution function for selecting the next population. Consequently, genes with higher fitness are chosen with higher probability. The higher the distance-to-goal values in abstract space, the better the quality of the corresponding database in accelerating the search in the concrete search space. As a consequence, we compute the mean heuristic value for each of the databases and superimpose it over a pattern partitioning. If PDBi ,
1 2 3 4 5 6 7 8 .. . p
v1 1 0 0 1 0 1 0 0 .. . 1
v2 0 0 1 0 1 0 0 1 .. . 1
v3 0 1 1 0 0 1 0 1 .. . 0
v4 0 0 0 1 0 0 1 0 .. . 0
v5 1 1 1 0 1 0 1 0 .. . 0
v6 1 0 1 0 0 1 0 1 .. . 0
v7 0 1 0 1 1 0 1 0 .. . 0
v8 1 0 1 1 0 0 0 0 .. . 1
··· ··· ··· ··· ··· ··· ··· ··· ··· .. . ...
n 1 0 1 0 0 0 1 0 .. . 0
FIGURE 15.4 Gene representation of a planning pattern selection. In the columns variables are listed; in the rows the patterns are enumerated. In the first pattern, the v1 , v5 , v6 , v8 , and vn are present, whereas in the second pattern v3 , v5 , and v7 are chosen.
15.2 Suboptimal Planning
685
1 ≤ i ≤ p is the ith pattern database and himax its maximal h-value, then the fitness for gene g is p
h(g) = max i=1
himax
X i · |{u ∈ PDBi | h(u) = x}| , |PDBi | x=1
or i
p hX max X i · |{u ∈ PDBi | h(u) = x}| , h(g) = |PDBi | i=1 x=1
where the operator depends on the disjointness of the multiple pattern databases.
15.2 SUBOPTIMAL PLANNING For suboptimal planning we first introduce the causal graph heuristic based on the multivalued variable encoding. Then we consider extensions of the relaxed planning heuristic (as introduced in Ch. 1) to metric and temporal planning domains.
15.2.1 Causal Graphs There are two main problems of the relaxed planning heuristic (see Ch. 1). First, unsolvable problems can become solvable, and, second, the distance approximations may become weak. Take, for example, the two Logistics problems in Figure 15.5. In both cases, we have to deliver a package to its destination (indicated with a shaded arrow) using some trucks (initially located at the shaded nodes). In the first case (illustrated on the left) a relaxed plan exists, but the concrete planning problem (assuming traveling constraints induced by the edges) is actually unsolvable. In the second case (illustrated on the top right) a concrete plan exists. It requires moving the truck to pick up the package and return it to its home. The relaxed planning heuristic returns a plan that is about half as good. If we scale the problem as indicated to the lower part of the figure, heuristic search planners based on the relaxed planning heuristic quickly fail. The causal graph analysis is based on the following multivalued variable encoding X = {v1 , v2 , vc }, Dv1 = Dv2 = {A, B, C, D, E, F}, Dvc = {A, B, C, D, E, t1 , t2 }, A = {({v1 ← A}, {v1 ← B}), ({v1 ← A}, {v1 ← C}), ({v1 ← A}, {v1 ← D}), ({v2 ← A}, {v2 ← B}), . . . , ({vc ← F, v1 ← F}, {vc ← t1 }), . . . }, s = {v1 ← C, v2 ← F, vc ← E}, and T = {vc ← B}. The causal graph of an SAS+ planning problem P with variable set X is a directed graph (X, A0 ), where (u, v) ∈ A0 if and only if u 6= v and there is an action ( pre, eff ) ∈ A, such that eff(v) is defined and either pre(u) or eff (u) is defined. This implies that an edge is drawn from one variable to another if the change of the second variable is dependent on the current assignment of the first variable. The causal graph of the first example (Fig. 15.5, left) is shown in Figure 15.6. These (in practice acyclic) graphs are divided into high-level (vc ) and low-level variables (v1 and v2 ). Given an SAS+ planning problem with v ∈ X, the domain transition graph Gv is a directed labeled graph with node set Dv . Being a projection of the original state space it contains an edge (d, d0 ) if
686
CHAPTER 15 Action Planning
C
F
D
A
B
E
A
B
C
D
A’
B’
C’
D’
A’’
B’’
C’’
D’’
FIGURE 15.5 Problems with the relaxed planning heuristic. The relaxed plan for the first problem (left) is to move the right truck to pick up the package, move to D, and drop it. Then move the left truck to D, pick up the package, move it to B, and drop it. For the second problem (right) in the relaxed plan the package is teleported from D to A as (at truck A) is already true in the initial state. v1
v2
vc
FIGURE 15.6 The causal graph for the example problem with one variable for the truck and two variables for the packages. Edges are drawn if the variables labeling the nodes are dependent. More precisely, an edge connects vi and vj if the change of vj depends on the current assignment of vi .
there is an action (pre, eff ) with pre(v) = d (or pre(v) undefined) and eff(v) = d0 . The edge is labeled by pre(X\{v}). The domain transition graph for the example problem is shown in Figure 15.7. Plan existence in SAS+ planning problems is provably hard. Hence, depending on the structure of the domain transition graph(s), a heuristic search planning algorithm approximates the original problem. The approximation, measured in the number of executed plan steps, is used as a (nonadmissible) heuristic to guide the search in the concrete planning space. Distances are measured between different value assignments to variables. The (minimal) cost δv (d, d0 ) to change the assignment of v from d to d0 is computed as follows. If v has no causal predecessor, δv (d, d0 ) is the shortest path distance from d to d0 in the domain transition graph, or ∞, if no such path exists. Let Xv be the set of variables that have v and all immediate predecessors of v in the causal graph of P. Let Pv be the subproblem induced by Xv with the initial value of v being d and the goal value of v being d0 . Furthermore, let δv (d, d0 ) = |π |, where π is the shortest plan computed by the approximation algorithm (see later). The costs of the low-level variables are the shortest path
15.2 Suboptimal Planning
v1 = A
t1
A
v2 = A
v1 = B
B
v2 = B
v1 = C
C
v2 = C
v1 = D v1 = E v1 = F
C
t2
v2 = D D E
687
F
D
A
v2 = E v2 = F
B
E
F
FIGURE 15.7 The domain transition graph for the cargo variable vc , which is at the location A, B, C, D, E, or F, or in the truck t1 or t2 (left), and for the truck variables v1 and v2 that are moving between locations on a map (right).
costs in the domain transition graph, and 1 for the high-level variables. Finally, we define the heuristic estimate h(u) of the multivalued planning state u as X δv (ds (v), dT (v)). h(u) = v∈X
The approximation algorithm uses a queue for each high-level variable. It has polynomial running time but there are solvable instances for which no solution is obtained. Based on a queue Q it roughly works as shown in Algorithm 15.2. Applied to an example (see Fig. 15.5, right), Q initially contains the elements {A, B, C, D, t}. The stages of the algorithms are as follows. First, we remove D from the queue, such that u = (vH ← D, vL ← A). Choosing (pickup D) yields π(t) = ((move A B), (move B C), (move C D), (pickup D)). Next, we remove t from the queue, such that u = (vH ← t, vL ← D). Choosing (drop A) yields π(A) = ((move A B), (move B C), (move C D), (pickup D), (move D C), (move C B), (move B A), (drop A)). Choosing (drop B), (drop C), (drop D) produces similar but shorter plans. Afterward, we remove C from the queue, such that u = (vH ← C, vL ← C) yields no improvement. Subsequently, B is removed from the queue, such that u = (vH ← B, vL ← B) yields no improvement. Lastly, A is removed from the queue and the algorithm terminates and returns π(A).
15.2.2 Metric Planning Metric planning involves reasoning about continuous state variables and arithmetic expressions. An example for an according PDDL action is shown in Figure 15.8. Many existing planners terminate with the first solution they find. Optimization in metric planning, however, calls for improved exploration algorithms. The state space of a metric planning instance is the set of assignments to the state variables with valid values. The logical state space is the result of projecting the state space to the components that
688
CHAPTER 15 Action Planning
Procedure Causal Graph Input: State space planning problem P Output: Causal graph heuristic for T if (dH = ds (vH )) π(dH ) ← ∅ ;; Initialize plan else π(dH ) ← ⊥ ;; High-level plan undefined Q ← DH ;; Initialize queue with high-level variables while Q 6= ∅ ;; No solution found Delete dH from Q that minimizes |π(dH )| ;; Given that π(dH ) is defined π ← π(dH ) ;; Initialize partial plan 0 with precondition pre ;; High-level transition for each t from dH to dH if (pre satisfied) ;; Search in domain transition graph of low-level variables πL ← min-plan satisfying pre ;; Minimal step plan π 0 ← (π , πL , t) ;; Concatenate plans 0 )| > |π 0 |) if (|π(dH ;; Improvement found 0 ) ← π0 π(dH ;; Update partial plan Algorithm 15.2 Approximation of a plan with causal graph.
(:action fly :parameters (?a - aircraft ?c1 ?c2 - city) :precondition (and (at ?a ?c1) (>= (fuel ?a) (* (distance ?c1 ?c2) (slow-burn ?a)))) :effect (and (not (at ?a ?c1)) (at ?a ?c2) (increase total-fuel-used (* (distance ?c1 ?c2) (slow-burn ?a))) (decrease (fuel ?a) (* (distance ?c1 ?c2) (slow-burn ?a))))) FIGURE 15.8 An action in PDDL, Level 2. The parameters in the action fly are typed, fuel and slow-burn are unary predicates, and distance is a binary predicate. Moreover, total-fuel-used is a global variable that is increased by the amount fuel is decreased.
are responsible for representing predicates. Analogously, the numerical state space is the result of projecting the state space to the components that represent functions. Figure 15.10 shows an instantiated problem, which refers to the domain Boxes shown in Figure 15.9. In metric planning problems, preconditions and goals are of the form exp ⊗ exp0 , where exp and exp0 are arithmetic expressions over the sets of variables and operators {+, −, ∗, /} and where ⊗ is selected from {≥,≤,>, 8.5. For the application in relaxed metric planning, assume that an assignment of the form h ← exp is subject to a postcondition exp0 . The weakest precondition of it is established by substituting the occurrence of h in exp0 with exp. In a tree representation this corresponds to insert exp at all leaves that correspond to h as subtrees in exp0 . Usually, a simplification algorithm refines the resulting representation of exp[h \ exp0 ]. In Algorithm 15.3 we illustrate the plan construction process in pseudo code. For each layer t in the relaxed planning graph a set of active propositional and numerical constraints is determined. We use p(·) to select valid propositions and v(·) to select the variables. To determine the set of applicable actions At , we assume to have implemented a recursive procedure Test. The input of this procedure is a numerical expression and a set of intervals [minit , maxit ], 1 ≤ i ≤ |X| that describe lower and upper assignment bounds for each variable vi . The output is a Boolean value that indicates whether the current assignment fits into the corresponding bounds. We also assume a recursive implementation for Update to adjust the bounds mint and maxt to mint+1 and maxt+1 according to a given expression exp. For the extraction process as shown in Algorithm 15.4 we first search for the minimal layer in which the chosen condition is satisfied. The propositional and numerical pending queues in layer i are denoted by p(Gi ) and v(Gi ). These pending queues represent the conditions for the particular layer that have to be achieved while constructing the relaxed plan. Although the initialization for the propositional part given the compound goal condition is rather simple (see with the relaxed planning heuristic in Ch. 1), for the initialization of the numerical condition queue the variable intervals [mini , maxi ] for an increasing layer i are utilized to test the earliest satisfaction of the goal condition.
15.2 Suboptimal Planning
691
Procedure Relax Input: Current planning state u, planning goal T Output: Relaxed planning graph P0 ← p(u) ;; Initialize propositions for each i ∈ {1, . . . , |X|} ;; For each variable index mini0 ← maxi0 ← vi (u) ;; Initialize propositions and intervals t←0 ;; Initialize iteration counter while (p(T) 6⊆ Pt or ∃exp ∈ v(T) : Test(exp, mint , maxt )) ;; Information to process At ← {a ∈ A | p ∈ pre(a) ⊆ Pt , ;; Update action set ∀expS ∈ v(pre(a)) : Test(exp, mint , maxt )} ;; Update propositional information Pt+1 ← Pt ∪ pre(a)⊆Pt add(a) [mint+1 , maxt+1 ] ← [mint , maxt ] ;; Initialize interval information for a ∈ At , exp ∈ v(eff(a)) ;; Traverse action set Update(exp, mint , maxt , mint+1 , maxt+1 ) ;; Update interval information if (relaxed problem unsolvable) return ∞ ;; Termination criterion, failure t ← t+1 ;; Increase iteration counter Algorithm 15.3 Plan graph construction for numerical relaxed planning heuristic.
Now the constructed planning graph is traversed backward, layer by layer. To find the set of active actions, we reuse the set Ai and recompute the vectors mini+1 and maxi+1 as determined in the forward phase. We continue until either an add-effect of an action in Ai is detected or the numerical conditions of an effect become satisfied. In both cases we add the corresponding action to the relaxed plan and propagate the propositional preconditions of the chosen action to the layer in the relaxed planning graph, where they are satisfied for the first time as still to be processed. The remaining code fragment (starting with for each exp0 ∈ v(eff(a)) considers how numeric postconditions are propagates by themselves. For the ease of presentation we restrict to ordinary assignments. After an assignment is chosen, we determine the weakest precondition for the expression as described earlier. It is also added to the pending queue of the shallowed level, in which it is satisfied. This layer can easily be determined by iteratively calling Test for the layers j ∈ {1, . . . , i}. For example, if we have a postcondition of v ≥ 100 and an assignment v ← v + 1 in one of the action effects, the weakest precondition to be progressed (according to Hoare’s assignment rule) is v + 1 ≥ 100, which is equivalent to v ≥ 99. The latest layer in which this condition is satisfied might be the one where we started. So if we have the interval [0, 100] for v in the current layer i, and [0, 75] in the previous layer i − 1, we include the action in the relaxed plan 25 times until v ≤ 75, at which time the condition is included in the pending queue of layer i − 1.
15.2.3 Temporal Planning Temporal planning domains include temporal modifiers at start, over all, and at end, where label at start denotes the preconditions and effects at invocation time of the action, over all refers to an
692
CHAPTER 15 Action Planning
Procedure Extract Input: Relaxed planning graph, planning goal T Output: Approximation for relaxed plan length A←∅ ;; Initialize relaxed plan for i ∈ {1, . . . , t} ;; Process layers forward p(Gi ) ← {g ∈ p(T) | layer(g) = i} ;; Initialize propositional information in Layer i for each exp ∈ v(T) ;; Initialize numerical information in Layer i if (Test(exp, mini maxi )) v(Gi ) ← v(Gi ) ∪ {exp}; v(T) ← v(T) \ {exp} for i ∈ {t, . . . , 1} ;; Process layers backward [mini+1 , maxi+1 ] ← [mini , maxi ] ;; Reinitialize interval information for each a ∈ Ai ;; Retraverse action set in Layer i for each exp ∈ v(eff(a)) ;; For each numerical effect Update (exp, mini , maxi , mini+1 , maxi+1 ) ;; Recompute interval information for e ∈ add(a) e ∈ p(Gi ) ;; Add-effect condition matches list A ← A ∪ {a}; p(Gi ) ← p(Gi ) \ add(a) ;; Update propositional list for each p ∈ p(pre(a)): ;; Update propositional information p(Glayer(p) ) ← p(Glayer(p) ) ∪ {p} for each exp ∈ v(pre(a)) ;; Update numerical information v(Glayer(exp) ) ← v(Glayer(exp) ) ∪ {exp} for each exp ∈ v(Gi ) ;; Traverse numerical list if Test(exp, mini+1 , maxi+1 ) ;; Interval condition match A ← A ∪ {a}; v(Gi ) ← v(Gi ) \ {exp} ;; Update numerical list p(Gi ) ← p(Gi ) \ add(a) ;; Update propositional list for each p ∈ p(pre(a)) ;; Update propositional information p(Glayer(p) ) ← p(Glayer(p) ) ∪ {p} for each exp ∈ v(pre(a)) ;; Update numerical information v(Glayer(exp) ) ← p(Glayer(exp) ) ∪ {exp} for each exp0 ∈ v(eff(a)) ;; Matching effect found exp ← exp[head(exp0 ) \ exp0 ] ;; Compute weakest precondition for each j ∈ {1, . . . , i} ;; Determine earliest matching layer if (Test(exp, minj , maxj )) l ← j v(Gl ) ← v(Gl ) ∪ {exp} ;; Update numerical information return |A| ;; Estimate is size of action set Algorithm 15.4 Extraction of a numerical relaxed plan.
invariance condition that must hold, and at end refers to the finalization conditions and consequences of the action. An example for a PDDL action with numbers and durations is shown in Figure 15.11.
Temporal Model There are mainly two different options to translate the temporal information back to metric planning problems with preconditions and effects. In the first case, the compound action is split into three smaller parts: one for action invocation, one for invariance maintenance, and one for action termination. This is the suggested semantic of PDDL2.1 (see Fig. 15.12, top right). As expected, there are no effects
15.2 Suboptimal Planning
(:durative-action fly :parameters (?a - aircraft ?c1 ?c2 - city) :duration (= ?duration (/ (distance ?c1 ?c2) (slow-speed :condition (and (at start (at ?a ?c1)) (at start (>= (fuel ?a) (* (distance ?c1 ?c2) (slow-burn :effect (and (at start (not (at ?a ?c1))) (at end (at ?a ?c2)) (at end (increase total-fuel-used (* (distance ?c1 ?c2) (slow-burn (at end (decrease (fuel ?a) (* (distance ?c1 ?c2) (slow-burn
693
?a)))
?a)))))
?a)))) ?a))))))
FIGURE 15.11 An action in PDDL, Level 3.
at-start
over-all
at-end
cond:
A
B
C
eff:
A'
B'
C'
pre: eff:
pre: eff:
pre: eff:
A A'
B B'
C C'
pre: ABC
eff: A' B' C'
FIGURE 15.12 Compiling temporal modifiers into actions. The original action (left) with preconditions and effects partitioned in at-start, at-end, and over-all events, respectively, is transformed into either the intended semantics (top right) or into the black-box semantic (bottom right).
in the invariance pattern, so that B0 = ∅. Moreover, for benchmarks it is uncommon that new effects in at-start are preconditioned for termination control or invariance maintenance, such that A0 ∩ (B ∪ C) = ∅. In these problems, a simpler model can be applied, using only one untimed variant for each temporal action (see Fig. 15.12, bottom right). For most planning benchmarks there are no deficiencies by assuming this temporal model, in which each action starts immediately after a previous one has terminated. These black-box semantics allow the modifiers to be dropped since conditions are checked at the beginning and effects are checked at the end. The instantiation of a timed version of the Boxes domain is provided in Figure 15.13.
Action Dependency The purposes of defining action dependency are twofold. First, at least one execution order of two independent actions can be pruned from the search tree and, more importantly, it is possible to compute optimal schedules of sequential plans with respect to the generated action sequence and its causal
694
CHAPTER 15 Action Planning
(define (domain Boxes) (:predicates (in-A-Box1) (in-A-Box2) (in-B-Box1) (in-B-Box2) (in-C-Box1) (in-C-Box2)) (:functions (weight-Box1) (weight-Box2) ) (:durative-action move-A-Box1-Box2 :duration (= ?duration 2.5) :condition (in-A-Box1) :effect (and (not (in-A-Box1)) (in-A-Box2) (decrease weight-Box1 5) (increase weight-Box2 (:durative-action move-A-Box2-Box1 :duration (= ?duration 2.5) :condition (in-A-Box2) :effect (and (not (in-A-Box2)) (in-A-Box1) (decrease weight-Box2 5) (increase weight-Box1 (:durative-action move-B-Box1-Box2 :duration (= ?duration 0.9) :condition (in-B-Box1) :effect (and (not (in-B-Box1)) (in-B-Box2) (decrease weight-Box1 3) (increase weight-Box2 (:durative-action move-B-Box2-Box1 :duration (= ?duration 0.9) :condition (in-B-Box2) :effect (and (not (in-B-Box2)) (in-B-Box1) (decrease weight-Box2 3) (increase weight-Box1 (:durative-action move-C-Box1-Box2 :duration (= ?duration 6.45) :condition (in-C-Box1) :effect (and (not (in-C-Box1)) (in-C-Box2) (decrease weight-Box1 8) (increase weight-Box2 (:durative-action move-C-Box2-Box1 :duration (= ?duration 6.45) :condition (in-C-Box2) :effect (and (not (in-C-Box2)) (in-C-Box1) (decrease weight-Box2 8) (increase weight-Box1
5)))
5)))
3)))
3)))
8)))
8))))
FIGURE 15.13 The domain Boxes stated for black-box semantics.
structure. If all actions are dependent (or void with respect to the optimizer function), the problem is inherently sequential and no schedule leads to any improvement. Two grounded actions are dependent if one of the following conditions holds: 1. The propositional precondition set of one action has a nonempty intersection with the add or the delete lists of the other one (propositional conflict). 2. The head of a numerical modifier of one action is contained in some condition of the other one. Intuitively, an action modifies variables that appear in the condition of the other (direct numerical conflict). 3. The head of the numerical modifier of one action is contained in the formula body of the modifier of the other one (indirect numerical conflict). In an implementation (at least for temporal and numerical planning) the dependence relation is computed beforehand and tabulated for constant time access. To improve the efficiency of precomputation, the set of leaf variables is maintained in an array, once the grounded action is constructed. To
15.2 Suboptimal Planning
695
detect domains for which any parallelization leads to no improvement, a planning domain is said to be inherently sequential if all actions in any sequential plan are dependent or instantaneous (i.e., with zero duration). The static analyzer may check an approximation by comparing each action pair prior to the search.
Parallelizing Sequential Plans A parallel plan πc = ((a1 , t1 ), . . . , (ak , tk )) is a schedule of actions ai ∈ A, i ∈ {1, . . . , k} that transforms the initial state s into one of the goal states t ∈ T, where ai is executed at time ti . A precedence ordering d induced by the set of actions {a1 , . . . , ak } and a dependency relation is given by ai d aj , if ai and aj are dependent and 1 ≤ i < j ≤ k. Precedence is not a partial ordering, since it is neither reflexive nor transitive. By computing the transitive closure of the relation, however, precedence could be extended to a partial ordering. A sequential plan a1 , . . . , ak produces an acyclic set of precedence constraints ai d aj , 1 ≤ i < j ≤ k on the set of actions. It is also important to observe that the constraints are already topologically sorted according to d by taking the node ordering {1, . . . , k}. Let d(a) for a ∈ A be the duration of action a in a sequential plan. For a parallel plan πc = ((a1 , t1 ), . . . , (ak , tk )) that respect d , we have ti + d(ai ) ≤ tj for ai d aj , 1 ≤ i < j ≤ k. An optimal parallel plan with regard to a sequence of actions a1 , . . . , ak and precedence ordering d is a parallel plan π ∗ = ((a1 , t1 ), . . . , (ak , tk )) with minimal execution time among all alternative parallel plans πc = ((a1 , t10 ), . . . , (ak , tk0 )) that respect d . Possible implementation of such schedulers can be based on the project evaluation and review technique or on simple temporal networks (see Ch. 13).
15.2.4 Derived Predicates Derived predicates are predicates that are not affected by any of the actions available to the planner. Instead, the predicate’s truth values are derived by a set of rules of the form if φ(x) then P(x). An example of a derived predicate is the above predicate in Blocksworld, which is true between blocks x and y, whenever x is transitively (possibly with some blocks in between) on y. This predicate can be defined recursively as follows: (:derived (above ?x ?y - block) (or (on ?x ?y) (exists (?z - block) (and (on ?x ?z) (above ?z ?y))))).
The semantics, roughly, are that an instance of a derived predicate is satisfied if and only if it can be derived using the available rules. More formally, let R be the set of rules for the derived predicates, where the elements of R have the form (P(x), φ(x)) – if φ(x) then P(x). Then D(u), for a set of basic facts u, is defined as follows: \ D(u) = {v ⊇ u | ∀(P(x), φ(x)) ∈ R : ∀c, |c| = |x| : (v |= φ(c) ⇒ P(c) ∈ v)}. This definition uses the standard notations of the modeling relation |= between states (represented as sets of facts in our case) and formulas, and of the substitution φ(c) of the free variables in formula φ(x) with a constant vector c. In words, D(u) is the intersection of all supersets of u that are closed under application of the rules R. D(u) can be computed by the simple process shown in Algorithm 15.5.
696
CHAPTER 15 Action Planning
Procedure Derive Input: State u, rule set R Output: Extension for state u v←u while (∃c : |c| = |x|, v |= φ(c), P(c) 6∈ v, (P(x), φ(x)) ∈ R) v ← v ∪ {P(c)} D(u) ← v
;; Make a copy of input state ;; Choose instantiation ;; Update copy ;; Update derived set
Algorithm 15.5 Fixpoint for applying a set of rules to a planning state.
Hence, derivation rules can be included in a forward chaining heuristic search planner by inferring the truth of the derived rule for each step. Suppose that we have grounded all derived predicates to the rules (p, φ). In φ there can be further derived predicates, which by the acyclic definition of derived predicates cannot be directly or indirectly dependent from p. For the rule (p, φ) the values p and φ are equivalent. This implies that p is nothing more than a macro for the expression φ. All derived predicates can be eliminated from the planning instance by the substitution with more complex descriptions. The advantage with regard to alternative methods for handling derived predicates is that the state vector does not have to be extended.
15.2.5 Timed Initial Literals Timed initial literals are an extension for temporal planning. Syntactically they are a very simple way of expressing a certain restricted form of exogenous events: facts that will become true or false at time points that are known to the planner in advance, independent of the actions that the planner chooses to execute. Timed initial literals are thus deterministic unconditional exogenous events. An illustrative example considers a planning task for shopping. There is a single action that achieves the goal, which requires a shop to be open as its precondition. The shop opens at time step 9 relative to the initial state, and closes at time step 20. We can express the shop opening times by two timed initial literals: (:init (at 9 (shop-open)) (at 20 (not (shop-open)))).
Timed initial literals can be inserted into a heuristic search planner as follows. We associate with each (grounded) action so-called action execution time windows that specify the interval of a save execution. This is done by eliminating the preconditions that are related to the time initial literal. For ordinary literals and Strips actions, the conjunction of precondition leads to the intersection of action execution time windows. For repeated literals or disjunctive precondition lists, time windows have to be kept, while simple execution time windows can be integrated into the PERT scheduling process.
15.2.6 State Trajectory Constraints State trajectory or plan constraints provide an important step of PDDL toward temporal control knowledge and temporally extended goals. They assert conditions that must be satisfied during the execution
15.3 Bibliographic Notes
697
of a plan. Through the decomposition of temporal plans into plan happenings, state trajectory constraints feature all levels of the PDDL hierarchy. For example, the constraint a fragile block can never have something above it can be expressed as (always (forall (?b - block) (implies (fragile ?b) (clear ?b)))).
As illustrated in Chapter 13 plan constraints can be compiled away. The approach translates the constraints in linear temporal logic and compiles them into finite-state automata. The automata are simulated in parallel to the search. The initial state of the automaton is added to the initial state of the problem and the automation transitions are compiled to actions. A synchronization mechanism controls that the original actions and the automata actions alternate. Planning goals are extended with the accepting states of the automata.
15.2.7 Preference Constraints Annotating individual goal conditions or state trajectory constraints with preferences model soft constraints and allow the degree of satisfaction to be scaled with respect to hard constraints that have to be fulfilled in a valid plan. The plan objective function includes special variables referring to the violation of the preference constraints and allows planners to optimize plans. Quantified preference rules like (forall (?b - block) (preference p (clear ?b)))
are grounded (one for each block), while the inverse expression (preference p (forall (?b - block) (clear ?b)))
leads to only one constraint. Preferences can be treated as variables using conditional effects, so that the heuristics derived earlier remain appropriate for effective plan-finding.
15.3 BIBLIOGRAPHIC NOTES Drew McDermott and a committee have created the specification language (PDDL) in 1998 in the form of a Lisp-like input language description format that includes planning formalisms like Strips by Fikes and Nilsson (1971). Later, ADL as proposed by Pednault (1991) was used. Planning in temporal and metric domains started in 2002. For this purpose, Fox and Long (2003) developed the PDDL hierarchy, of which the first three levels were shown in the text. This hierarchy was attached later. Domain axioms in the form of derived predicates introduce inference rules, and timed initial facts allow deadlines to be specified (Hoffmann and Edelkamp, 2005). Newer developments of PDDL focus on temporal and preference constraints (Gerevini and Long, 2005) and object fluents (Geffner, 2000). Complexity analyses for standard benchmarks have been provided by Helmert (2003, 2006a). Approximation properties of such benchmarks have been studied by Helmert, Mattmu¨ ller, and Ro¨ ger (2006). The complexity of planning with multivalued variables (SAS+ planning) has been analyzed by Ba¨ ckstro¨ m and Nebel (1995). Graphplan has been developed by Blum and Furst (1995), and Satplan is due to Kautz and Selman (1996). The set of admissible heuristics based on dynamic programming have been proposed
698
CHAPTER 15 Action Planning
by Haslum and Geffner (2000). Planning with pattern databases has been invented by Edelkamp (2001a), and the extension to symbolic pattern databases has been addressed by Edelkamp (2002). Various packing algorithms have been suggested by Haslum, Bonet, and Geffner (2005). Incremental hashing for planning pattern databases has been proposed by Mehler and Edelkamp (2005). The automated pattern selection for domain-independent explicit-state and symbolic heuristic search planning with genetic algorithms has been proposed by Edelkamp (2007). Zhou and Hansen (2006b) have used general abstractions for planning domains together with structured duplicate detection (see Ch. 8). The relaxed planning heuristic as proposed by Hoffmann and Nebel (2001) has been analyzed by Hoffmann (2001), providing a heuristic search topology for its effectiveness in known benchmark domains. Bonet and Geffner (2008) have derived a functional representation of the relaxed planning heuristic in symbolic form as a DNNF. Alca´ zar, Borrajo, and Linares Lo´ pez (2010) have proposed using information extracted from the last actions in the relaxed plan to generate intermediate goals backward. Hoffmann (2003) has shown how to extend the heuristic by omitting the delete list to numerical state variables. An extension of the approach to nonlinear tasks has been given by Edelkamp (2004). A unified heuristic for deterministic planning has been investigated by Rintanen (2006). Coles, Fox, Long, and Smith (2008) have refined the heuristic by solving linear programs to improve the relaxation. Fuentetaja, Borrajo, and Linares Lo´ pez (2008) have introduced an approach for dealing with cost-based planning that involves the use of look-ahead states to boost the search, based on a relaxed plan graph heuristic. How to add search diversity to the planning process has been studied by Linares Lo´ pez and Borrajo (2010). Borowsky and Edelkamp (2008) have proposed an optimal approach to metric planning. State sets and actions are encoded as Presburger formulas and represented using minimized finite-state machines. The exploration that contributes to the planning via a model checking paradigm applies symbolic images to compute the finite-state machine for the sets of successors. The causal graph heuristic has been discussed extensively by Helmert (2006b) and been implemented in the Fast-Downward planner. Helmert and Geffner (2008) have shown that the causal graph heuristic can be viewed as a variant of the max-atom heuristic with additional context. They have provided a recursive functional description of the causal graph heuristic that, without restriction to the dependency graph structure, extends the existing one. Automated planning pattern database design has been studied by Haslum, Botea, Helmert, Bonet, and Koenig (2007). A more flexible design that goes back to work by Dra¨ ger, Finkbeiner, and Podelski (2009) has been pursued by Helmert, Haslum, and Hoffmann (2007), and pattern database heuristics for nondeterministic planning have been studied by Mattmu¨ ller, Ortlieb, Helmert, and Bercher (2010). In Katz and Domshlak (2009) structural pattern database heuristics have been proposed that lead to polynomial-time calculations based on substructures of the causal graph. Moreover, a general method for combining different heuristics has been given. Good heuristics have also been established by the extraction of landmarks in Richter, Helmert, and Westphal (2008), a work that refers to Hoffmann, Porteous, and Sebastia (2004). A theoretical analysis of the advances in the design of heuristics has lead to the heuristic LM-cut with very good results (Helmert and Domshlak, 2009). Bonet and Helmert (2010) have improved this heuristic by computing hitting sets.
15.3 Bibliographic Notes
699
Alternative characterizations that have been derived of hm have been given by Haslum (2009). Limits of heuristic search in planning domains have been documented by Helmert and Ro¨ ger (2008). Pruning techniques for the use of actions have been studied by Wehrle, Kupferschmid, and Podelski (2008). A reduced set of actions has been looked at in Haslum and Jonsson (2000). It is known that achieving approximate solutions in Blocksworld is easy (Slaney and Thie´ baux, 2001) and that domain-dependent cuts drastically reduce the search space. For compiling temporal logic control into PDDL, Rintanen (2000) has compared formula progression as in TLPlan by Bacchus and Kabanza (2000) with a direct translation into planning actions. For efficient optimization in complex domains, planner LPG by Gerevini, Saetti, and Serina (2006) and SGPlan by Chen and Wah (2004) apply Lagrangian optimization techniques to gradually improve a (probably invalid) first plan. Both planners extend the relaxed planning heuristics; the first one optimizes an action graph data structure, and the latter applies constraint partitioning (into less restricted subproblems). As shown in Gerevini, Saetti, and Serina (2006), the planner LPG-TD can efficiently deal with multiple action time windows. The outstanding performance of constraint partitioning, however, is likely due to manual help. Further planers like Crikey by Coles, Fox, Halsey, Long, and Smith (2009) link planning and scheduling algorithms into a planner that is capable of solving many problems with required concurrency, as defined by Cushing, Kambhampati, Mausam, and Weld (2007). Alternatively, we can build domain-independent (heuristic) forward chaining planners that can handle durative actions and numeric variables. Planners like Sapa by Do and Kambhampati (2003) follow this approach. Sapa utilizes a temporal version of planning graphs first introduced in TGP by Smith and Weld (1999) to compute heuristic values of time-stamped states. A more recent approach has been contributed by Eyerich, Mattmu¨ ller, and Ro¨ ger (2009).
This page intentionally left blank
CHAPTER
Automated System Verification
16
The presence of a vast number of computing devices in our environment imposes a challenge for designers to produce reliable software. In medicine, aviation, finance, transportation, space technology, and communication, we are more and more aware of the critical role correct hardware and software plays. Failure leads to financial and commercial disaster, human suffering, and fatalities. However, systems are harder to verify than in earlier days. Testing if a system works as intended becomes increasingly difficult. Nowadays, design groups spend 50% to 70% of the design time on verification. The cost of the late discovery of bugs is enormous, justifying the fact that, for a typical microprocessor design project, up to half of the overall resources spent are devoted to its verification. In this chapter we give evidence of the important role of heuristic search in this context. The process of fully automated property verification is referred to as model checking and will cover most of the presentation here. Given a formal model of a system and a property specification in some form of temporal logic, the task is to validate whether or not the specification is satisfied in the model. If not, a model checker returns a counterexample for the system’s flawed behavior helping the system designer to debug the system. The major disadvantage of model checking is that it scales poorly; for a complete verification each state has to be looked at. With the integration of heuristics into the search process (known as directed model checking) we look at various options for improved search. The applications range from checking models of communication protocols, Petri nets, real-time as well as graph transition systems, to the verification of real software. We emphasize the tight connection between model checking and action planning. Another aspect of automated system verification that is especially important for AI applications is to check whether or not a knowledge-based system is consistent or contains anomalies. We address how symbolic search techniques can be of help here. We give examples of symbolic search in solving (multiple-fault) diagnosis problems. Most of the work in heuristic search for automated system verification concentrates on accelerated falsification. With directed automated theorem proving, algorithms like A* and greedy best-first search are integrated in a deductive system. As theorem provers draw inferences on top of axioms of an underlying logic, the state space is the set of proof trees. More precisely, sets of clauses for a proof state are represented in the form of a finite tree and rules describe how a clause is obtained by manipulating a finite set of other input clauses. Inference steps are performed mainly via resolution. Since such systems are provided in functional programming languages, we look at functional implementations of search algorithms.
701
702
CHAPTER 16 Automated System Verification
16.1 MODEL CHECKING Model checking has evolved into one of the most successful verification techniques. Examples range from mainstream applications such as protocol validation, software checking, and embedded system verification, to exotic areas such as business work-flow analysis and scheduler synthesis. The success of model checking is largely based on its ability to efficiently locate errors. If an error is found, a model checker produces a counterexample that shows how the errors occur, which greatly facilitates debugging. In general, counterexamples are executions of the system, which can be paths (if linear logics are used) or trees (if branching logics are used). However, while current model checkers find error states efficiently, the counterexamples are often unnecessarily complex, which hampers error explanation. This is due to the use of naive search algorithms. There are two primary approaches to model checking. First, symbolic model checking applies a symbolic representation for the state set, usually based on binary decision diagrams. Property validation in symbolic model checking amounts to some form of symbolic fixpoint computation. Explicit-state model checking uses an explicit representation of the system’s global state graph, usually given by a state transition function. An explicit-state model checker evaluates the validity of the temporal properties over the model, and property validation amounts to a partial or full exploration of a certain state space. The success of model checking lies in its potential for push-button automation and in its error reporting capabilities. A model checker performs an automated complete exploration of the state space of a software model, usually using a depth-first search strategy. When a property violating a state is encountered the search stack contains an error trail that leads from an initial system state into the encountered state. This error trail greatly helps software engineers in interpreting validation results. The sheer size of the reachable state space of realistic software models imposes tremendous challenges on model checking technology. Full exploration of the state space is often impossible, and approximations are needed. Also, the error trails reported by depth-first search model checkers are often exceedingly lengthy—in many cases they consist of multiple thousands of computation steps, which greatly hampers error interpretation. In the design process of systems two phases are distinguished. In a first explanatory phase, we want to locate errors fast; in a second fault-finding phase, we look for short error trails. Since the requirements of the two phases are not the same, different strategies apply. In safety property checking the idea is to use state evaluation functions to guide the state space exploration into a property violating state. Greedy best-first search is one of the most promising candidate for the first phase, but yield no optimal solution counterexamples. For the second phase, the A* algorithm has been applied with success. It delivers optimally short error trails if the heuristic estimate for the path length to the error trail is admissible. Even in cases where this cannot be guaranteed, A* delivers very good results. The use of heuristic search renders erstwhile unanalyzable problems to ones that are analyzable for many instances. The quality of the results obtained with A* depends on the quality of the heuristic estimate, and heuristic estimates were devised that are specific for the validation of concurrent software, such as specific estimates for reaching deadlock states and invariant violations.
16.1.1 Temporal Logics Models with propositionally labeled states can be described in terms of Kripke structures. More formally, a Kripke structure is a quadruple M = (S, R, I, L), where S is a set of states, R is the transition
16.1 Model Checking
703
relation between states using one of the enabled operators, I is the set of initial states, and L : S → 2AP is a state labeling function. This formulation is close to the definition of a state space problem in Chapter 1 up to the absence of terminal states. That I may contain more than one start state helps to model some uncertainty in the system. In fact, by considering the set of possible states as one belief state set, this form of uncertainty can be compiled away. For model checking, the desired property of the system is to be specified in some form of temporal logic. We already introduced linear temporal logic (LTL) in Chapter 13. Given a Kripke structure and a temporal formula f , the model checking problem is to find the set of states in M that satisfy f , and check whether the set of initial states belongs to this state set. We shortly write M |= f in this case. The model checking problem is solved by searching the state space of the system. Ideally, the verification is completely automatic. The main challenge is the state explosion problem. The problem occurs in systems with many components that can interact with each other, so that the number of global states can be enormous. We observe that any propositional planning problem can be modeled as an LTL model checking problem as any propositional goal g can be expressed in the form of a counterexample to the temporal formula f = A(G ¬g) in LTL. If the problem is solvable, the LTL model checker will return a counterexample, which manifests a solution for the planning problem. The inverse is also often true. Several model checking problems can be modeled as state space problems. In fact, the class of model checking problems that fit into the representation of a state space problem with a simple predicate should be evaluated at each individual state. Such problems are called safety properties. The intuition behind such a property is to say that something bad should not happen. In contrast, liveness properties refer to infinite runs with (lasso-shaped) counterexamples. The intuition is to say that something good will eventually occur. In automata-based model checking the model and the specification are both transformed into automata for accepting infinite words. Such automata look like ordinary automata but accept if during the simulation of an infinite word one accepting state is visited infinitely often. This assumes that a system can be modeled by an automaton, which is possible when casting all states in the underlying Kripke structure for the model as being accepting. Any LTL formula can be transformed into an automata over infinite words even if this construction may be exponential in the size of the formula. Checking correctness is reduced to checking language emptiness. More formally, the model checking procedure validates that a model represented by an automaton M satisfies its specification represented by an automaton M 0 . The task is to verify if the language induced by the model is included in the language induced by the specification, L(M) ⊆ L(M 0 ) for short. We have L(M) ⊆ L(M 0 ) if and only if L(M) ∩ L(M 0 ) = ∅. In practice, checking language emptiness is more efficient than checking language inclusion. Moreover, we often construct the property automaton N for negation of the LTL formula, avoiding the posterior complementation of the automaton over infinite words. The property automaton is nondeterministic, such that both the model and the formula introduce branching to the search process.
16.1.2 The Role of Heuristics Heuristics are evaluation functions that order the set of states to be explored, such that the states that are closer to the goal are considered first. Most search heuristics are state-to-goal distance estimates that are based on solving simplifications or abstractions of the overall search problems. Such heuristics are computed either offline, prior to the search in the concrete state space, or online for each encountered state (set). In a more general setting, heuristics are evaluation functions on generating paths rather than on states only.
704
CHAPTER 16 Automated System Verification
The design of bug hunting estimates heavily depends on the type of error that is searched for. Example error classes for safety properties are system deadlocks, assertion or invariance violations. To guide the search, the error description is analyzed and evaluated for each state. In trail-directed search we search for a short counterexample for a particular error state that has been generated, for example, by simulating the system. Abstractions often refer to relaxations of the model. If the abstraction is an overapproximation (each behavior in the abstract space has a corresponding one in the concrete space, which we will assume here), then a correctness proof for the specification in the abstract space implies the correctness in the concrete space. Abstraction and heuristics are two sides of the same medal. Heuristics correspond to exact distances in some abstract search space. This leads to the general approach of abstraction-directed model checking (see Fig. 16.1). The model under verification is abstracted into some abstract model checking problem. If the property holds, then the model checker returns true. If not, in a directed model checking attempt the same abstraction can be used to guide the search in the concrete state space to falsify the property. If the property does not hold, a counterexample can be returned, and if it does hold, the property has been verified. This framework does not include recursion as in counterexample-guided error refinement, a process illustrated in Figure 16.2. If the abstraction (heuristic) turns out to be too coarse, it is possible to iterate the process with a better one.
Model checking problem Abstraction-directed model checking Abstraction
Abstract model checking problem
Abstract model checking Success
No error
Failure
Directed model checking Success
Failure
Error found
FIGURE 16.1 Abstraction-directed model checking. First, an abstraction is computed. If the abstract system is not correct, the abstraction serves as a heuristic for guiding the search toward the error.
16.2 Communication Protocols
705
Model checking problem Counterexample-guided abstraction refinement Abstraction Refinement Abstract model checking problem Failure Abstract model checking Success
Concretization
Failure Success Error found
No error
Error found
FIGURE 16.2 Counterexample-guided error refinement. First, an abstraction is computed. If the abstract system is not correct, based on the validity of the counterexample, either it is returned or the abstraction is refined and the system iterates.
16.2 COMMUNICATION PROTOCOLS Communication protocols are examples for finite reactive concurrent asynchronous systems that are applied to organize the communication in computer networks. One important representative of this class is TCP/IP, which organizes the information exchange in the Internet. Control and data flows are essential for communication protocols and are organized either by access to global/shared variables or via communication queues, which are basically FIFO channels. Guards are Boolean predicates associated with each transition and determine whether or not it can be executed. Boolean predicates over variables are conditions on arithmetic expressions, while predicates over queues are either static (e.g., capacity, length) or dynamic (e.g., full, empty). Boolean predicates can be combined via ordinary Boolean operations to organize the flow of control. In the following we introduce search heuristics used in the analysis of (safety properties for) communication protocols, mainly to detect deadlocks and violations of system invariants or assertions.
16.2.1 Formula-Based Heuristic System invariants are Boolean predicates that hold in every global system state u. When searching for invariant violations it is helpful to estimate the number of system transitions until a state is reached
706
CHAPTER 16 Automated System Verification
where the invariant is violated. For a given formula f , let hf (u) be an estimate of the number of transitions required until a state v is reached where f holds, starting from state u. Similarly, let hf (u) denote the heuristic for the number of transitions necessary until f is violated. In Figure 16.3, we illustrate a recursive definition of hf as a function of f . In the definition of hf for f = f1 ∧ f2 the use of addition suggests that f1 and f2 are independent, which may not be true. Consequently, the estimate is not a lower bound, affecting the optimality of algorithms like A*. If the aim is to obtain short but not necessarily optimal paths, we may tolerate inadmissibilities; otherwise, we may replace addition by maximization. Formulas describing system invariants may contain other terms, such as relational operators and Boolean functions over queues. We extend the definition of hf and hf as shown in Figure 16.4. Note that the estimate is coarse but nevertheless very effective in practice. It is possible to refine these definitions for specific cases. For instance, ha=b can be defined as a − b in case a ≥ b and a is only ever decremented and b is only ever incremented. The control state predicate definition is given in Figure 16.5. The distance matrix δi can be computed with the All Pairs Shortest Paths algorithm of Floyd and Warshall in cubic time (see Ch. 2). The statement assert extends the model with logical assertions. Given that an assertion a labels a transition t = (u, v), with t ∈ Ti , then we say a is violated if the formula f = ui ∧ ¬a is satisfied.
f true false a ¬f1 f1 ∨ f2 f1 ∧ f2
hf (u) 0 ∞ if a then 0 else 1 hf1 (u) min{hf1 (u), hf2 (u)} hf1 (u) + hf2 (u)
hf (u) ∞ 0 if a then 1 else 0 hf1 (u) hf1 (u) + hf2 (u) min{hf1 (u), hf2 (u)}
FIGURE 16.3 Definition of hf for Boolean expressions f . Value a is a basic proposition; f1 and f2 are logical subformulas.
f full(q) empty(q) q?[t] a⊗b
hf (u) capacity(q) − length(q) length(q) length of minimal prefix of q without t (+1 if q lacks message tagged with t) if a ⊗ b then 0, else 1
hf (u) if full(q) then 1, else 0 if empty(q) then 1, else 0 if head(q) 6= t then 0, else maximal prefix of t’s if a ⊗ b then 1, else 0
FIGURE 16.4 Definition of hf for queue expressions and relational operators in f . Function q?[t] refers to the expression that is true when the message at the head of queue q is tagged with a message of type t. All other predicates are self-explaining. Symbol ⊗ is a wild card for the relational operators =, 6=, ≤, , or ≥.
16.2 Communication Protocols
f si
hf (u) δi (ui , si )
707
hf (u) if ui = si 1, else 0
FIGURE 16.5 Definition of hf for control state predicates in f . The value δi (ui , vi ) is the minimal number of transitions necessary for the process i to reach state ui starting from state vi .
label(t) q?x, q asynchronous channel q?t, q asynchronous channel q!m, q asynchronous channel condition c
executable(t, u) ¬empty(q) q?[t] ¬full(q) c
FIGURE 16.6 Function executable for asynchronous communication operations and Boolean conditions, where x is a variable, and t is a tag.
16.2.2 Activeness Heuristic In concurrent systems, a deadlock occurs if at least a subset of processes and resources is in a cyclic wait situation. State u is a deadlock if there is no outgoing transition from u to a successor state v and at least one end state of a process of the system is not valid. A local control state can be labeled as end to indicate that it is valid; that is, that the system may terminate if the process is in that state. Some statements are always executable; among others, assignments, else statements, and run statements used to start processes. Other statements, such as send or receive operations or statements that involve the evaluation of a guard, depend on the current state of the system. For example, a send operation q!m is only executable if the queue q is not full, indicated by the predicate ¬full(q). Asynchronous untagged receive operations (q?x, with x variable) are not executable if the queue is empty; the corresponding formula is ¬ empty(q). Asynchronous tagged receive operations (q?t, with t tag) are not executable if the head of the queue is a message tagged with a tag different from t; yielding the formula q?[t]. Moreover, conditions are not executable if the value of the condition corresponding to the term c is false. The Boolean function executable, ranging over tuples of statements and global system states, is summarized for asynchronous operations and Boolean conditions in Figure 16.6. To estimate the smallest number of transitions from the current state to a deadlock state, we observe that in a deadlock state all processes are necessarily blocked. Hence, the active process heuristics use the number of active or nonblocked processes in a given state: X ha (u) = 1, Pi ∈P∧active(i,u)
where active(i, u) is defined as active(i, u) ≡
_ t=(ui ,vi )∈Ti
executable(t).
708
CHAPTER 16 Automated System Verification
Assuming that the range of ha is contained in {0, . . . , |P|}, the active processes heuristic is not very informative for protocols involving a small number of processes. Deadlocks are global system states in which no progress is possible. Obviously, in a deadlock state each process is blocked in a local state that does not possess an enabled transition. It is not trivial to define a logical predicate that characterizes a state as a deadlock state that could at the same time be used as an input to the estimation function hf . We first explain what it means for a process Pi to be blocked in its local state ui . This can be expressed by the predicate blockedi , which states that the program counter of process Pi must be equal to ui and that no outgoing transition t from state ui is executable: ^ blockedi (ui ) ≡ ¬executable(t, ui ). t=(ui ,vi )∈Ti
Suppose we are able to identify those local states in which a process i can block; that is, in which it can perform a potentially blocking operation. Let Ci be the set of potentially blocking states within process i. A process is blocked if its control resides in some of the local states contained in Ci . Hence, we define a predicate for determining whether a process Pi is blocked in a global state u as the disjunction of blockedi (c) for every local state c contained in Ci : _ blockedi (c). blockedi (u) ≡ c∈Ci
Deadlocks, however, are global states in which every process is blocked. Hence, the disjunction of blockedi (u) for every process Pi yields a formula that establishes whether a global state u is a deadlock state or not: deadlock(u) =
n ^
blockedi (u).
i=1
Now we address the problem of identifying those local states in which a process can block. We call these states dangerous. A local state is dangerous if every outgoing local transition can block. Note that some transitions are always executable, for example, those corresponding to assignments. To the contrary, conditional statements and communication operations are not always executable. Consequently, a local state that has only potentially nonexecutable transitions should be classified as dangerous. Additionally, we may allow the protocol designer to identify states as dangerous. Chaining backward from these states, local distances to critical program counterlocations can be computed in linear time. The deadlock characterization formula deadlock is constructed before the verification starts and is used during the search by applying the estimate hf , with f being a deadlock. Due to the first conjunction of the formula, estimating the distance to a deadlock state is done by summing the estimated distances for blocking each process separately. This assumes that the behavior of processes is entirely independent and obviously leads to a nonoptimistic estimate. We estimate the number of transitions required for blocking a process by taking the minimum estimated distance for a process to reach a local dangerous state and negate the enabledness of each outgoing transition in that state. This could lead again to a nonadmissible estimate, since we are assuming that the transitions performed to reach the dangerous state have no effect on disabling the outgoing transitions of that state.
16.2 Communication Protocols
709
It should be noted that deadlock characterizes many deadlock states that are never reached by the system. Consider two processes Pi , Pj having local dangerous states u, v, respectively. Assume that u has an outgoing transition for which the enabledness condition is the negation of the enabledness condition for the outgoing transition from v. In this particular case it is impossible to have a deadlock in which Pi is blocked in local state u and Pj is blocked in local state v, since either one of the two transitions must be executable. As a consequence the estimate could prefer states unlikely to lead to deadlocks. Another concern is the size of the resulting formula.
16.2.3 Trail-Directed Heuristics We describe now two heuristics that exploit the information of an already established error state. The first heuristic is designed to focus at exactly the state that was found in the error trail, while the second heuristic focuses on equivalent error states.
Hamming Distance Let u be a global state given in a suitable binary vector encoding, as a vector (u1 , . . . , uk ). Further on, let v be the error state we are searching for. One estimate for the number of transitions necessary to get from u to v is called the Hamming distance hd (u, v) that is defined as: hd (u, v) =
k X
|ui − vi |.
i=1
Obviously, in a binary encoding, |ui − vi | ∈ {0, 1} for all i ∈ {1, . . . , k}. Obviously, computing hd (u, v) is available in time linear in the size of the (binary) encoding of a state. The heuristic is not admissible, since one transition might change more than one position in the state vector at a time. Nevertheless, the Hamming distance reveals a valuable ordering of the states according to their goal distances.
FSM Distance Another distance metric centers around the local states of component processes. The FSM heuristic is the sum of the goal distances for each local process Pi , i ∈ {1, . . . , n}. Let ui be the program counter of state u in process i. Moreover, let δi (ui , vi ) be the shortest path distance between the program counters ui and vi in Pi . Then hm (u) =
n X
δi (ui , vi ).
i=1
Another way for defining the FSM heuristic is by constructing the Boolean predicate f as V i∈{1,...,n} ui = vi . Applying the formula-based heuristic yields hf (u) = hm (u). Since the distances between local states can be precomputed, each one can be gathered in constant time resulting in an overall time complexity that is linear to the number of processes of the system. In contrast to the Hamming distance, the FSM distance abstracts from the current queue load and from values of the local and global variables. We expect that the search will then be directed into equivalent error states that could potentially be reachable through shortest paths. The reason is that some kind of errors depend on the local state of each component process, while variables play no role.
710
CHAPTER 16 Automated System Verification
16.2.4 Liveness Model Checking The liveness as safety model checking approach proposes to convert a liveness model checking problem into a safety model checking problem by roughly doubling the state vector size. The most important observation is that the exploration algorithms do not have to be rewritten. In the lifted search space we search for shortest lasso-shaped counterexamples, without knowing the start of the cycle beforehand. We use the consistent heuristic ha (u) = min {δN (uN , vN | v is accepting in N} of distances in N for finding accepting states in the original search space. States in the lifted search space are abbreviated by tuples (u, v), with u recording the start state of the cycle, and v being the current search state. If we reach an accepting state, we immediately switch to a secondary search. Therefore, we observe two distinct cases: primary search, for which the accepting state has not yet reached; and cycle detection search, for which an accepting state has to be revisited. The state u = v reached in secondary search is the goal. Because it is a successor of a secondary state, we can distinguish the situation from reaching such a state for the first time. For all extended states x = (u, v) in the lifted search space, let ha (x) = ha (u) and hm (x) = hm (u, v). Now we are ready to merge the heuristics to one estimate: ( ha (u) if u = v (16.1) h(x) = 0 hm (u, v) if u 6= v. As each counterexample has to contain at least one accepting state in N, for primary states x we have that h = ha (x) is a lower bound. For secondary states x, we have h(x) = hm (u, v) = max{hm (u, v), δN (uN , vN )}, a lower bound to close the cycle and the lasso in total. Therefore, h is admissible. Moreover, we can strengthen the result. It is not difficult to see that h is consistent; that is, h(x) − h(x 0 ) ≤ 1 for all successor states x 0 of x. As both ha and h0m are monotone, only one of them is true at a time. Hence, we have to show that h is monotone in case of reaching an accepting state. Here we have that a predecessor x with an evaluation of h(x) = ha (x) = 0 spawns successors x0 with evaluation values of hm (x 0 ) > 0. However, this incurs no problem as h(x) − h(x 0 ) ≤ 1 preserves monotonicity. The model checking algorithm for directed external LTL search is an extension of external A* (see Ch. 8), which traverses the bucket file list along growing f = g + h diagonals. On disk we store (packed) state pairs. Figure 16.7 illustrates a prototypical execution.
16.2.5 Planning Heuristics To encode communication protocols in PDDL, each process is represented by a finite-state automaton. Since is not difficult to come up with a specialized description, we are interested in a generic translation routine; the propositional encoding should reflect the graph structures of the processes and the communication queues.
16.2 Communication Protocols
711
h − value
g−value
FIGURE 16.7 Directed model checking LTL. For primary nodes (illustrated using two white half circles) heuristic ha applies, whereas for secondary nodes (illustrated using circles half white/half black) estimate hm applies. Once a terminal state with matching half circles (illustrated using two black half circles) is reached, an accepting cycle is established.
In the example problem for converting the Dining Philosophers problem (see Ch. 10) the initial state is shown in Figure 16.8. The encoding of the communication structure is based on representing updates in the channel as changes in an associated graph. The message-passing communication model realizes the ring-based implementation of the queue data structure. A queue is either empty (or full) if both pointers refer to the same queue state. A queue may consist of only one queue state, so the successor bucket of queue state 0 is the queue state 0 itself. In this case the grounded propositional encoding includes actions where the add and the delete lists share an atom. Here we make the standard assumption that deletion is done first. In Figure 16.8 (bottom) the propositions for one queue and the connection of two queues to one process are shown. Globally shared and local variables are modeled using numerical variables. The only difference of local variables compared to shared ones is their restricted visibility scope, so that local variables are simply prefixed with the process in which they appear. If the protocol relies on pure message passing, no numerical state variable is needed, yielding a pure propositional model for the Dining Philosophers problem. The PDDL domain encoding uses seven actions, named activate-trans, queue-read, queue-write, advance-queue-head, advance-empty-queue-tail, advance-nonempty-queue-tail, and process-trans. We show the activation of a process in Figure 16.9. Briefly, the actions encode the protocol semantics as follows. Action activate-trans activates a transition in a process of a given type from local state s1 to s2 . Moreover, the action sets the predicate activate. This Boolean flag is a precondition of the queue-read and queue-write actions, which set propositions that initialize the reading/writing of a message. For queue Q in an activated transition
712
CHAPTER 16 Automated System Verification
(is-a-process philosopher-0 philosopher) (at-process philosopher-0 state-1) (trans philosopher trans-3 state-1 state-6) (trans philosopher trans-4 state-6 state-3) (trans philosopher trans-5 state-3 state-4) (trans philosopher trans-3 state-4 state-5) (trans philosopher trans-6 state-5 state-6) [...] (is-a-queue forks-0 queue-1) (queue-head forks-0 qs-0) (queue-tail forks-0 qs-0) (queue-next queue-1 qs-0 qs-0) (queue-head-msg forks-0 empty) (queue-size forks-0 zero) (settled forks-0) [...] (writes philosopher-0 forks-0 trans-3) (trans-msg (reads philosopher-0 forks-0 trans-4) (trans-msg (reads philosopher-0 forks-1 trans-5) (trans-msg (writes philosopher-0 forks-1 trans-6) (trans-msg
trans-3 trans-4 trans-5 trans-6
fork) fork) fork) fork)
FIGURE 16.8 PDDL encoding for one philosopher’s process, for a (single-cell) communication channel, and for connecting communication to local state transitions.
(:action activate-trans :parameters (?p - process ?pt - proctype ?t - transition ?s1 ?s2 - state) :precondition (and (forall (?q - queue) (settled ?q)) (trans ?pt ?t ?s1 ?s2) (is-a-process ?p ?pt) (at-process ?p ?s1) :effect (and (activate ?p ?t))) FIGURE 16.9 Testing if a transition is enabled and activating it. A pending process is activated if all queues have finalized their updates and if there is a transition that matches the current process state.
querying message m, this corresponds to the expression Q?m, respectively Q!m. After the read/write operation has been initialized, the queue update actions: advance-queue-head, advance-empty-queuetail, or advance-nonempty-queue-tail have to be applied. The actions respectively update the head and the tail positions, as needed to implement the requested read/write operation. The actions also set a settled flag, which is a precondition of every queue access action. Action process-trans can then be invoked. It executes the transition from local state s1 to s2 ; that is, sets the new local process state and resets the flags.
16.3 Program Model Checking
713
(:derived (blocked-trans ?p - process ?t - transition) (exists (?q - queue ?m - message ?n - number) (and (activate ?p ?t) (reads ?p ?q ?t) (settled ?q) (trans-msg ?t ?m) (queue-size ?q ?n) (is-zero ?n)))))) (:derived (blocked ?p - process) (exists (?s - state ?pt - proctype) (and (at-process ?p ?s) (is-a-process ?p ?pt) (forall (?t - transition) (or (blocked-trans ?p ?t) (forall (?s2 - state) (not (trans ?pt ?t ?s ?s2))))))))) FIGURE 16.10 Derivation of a deadlock in a concurrent system in PDDL. A process is blocked if all its enabled transitions are blocked and a system is in a deadlock if all processes are blocked.
If the read message does not match the requested message, or the queue capacity is either too small or too large, then the active local state transition will block. If all active transitions in a process block, the process itself will block. If all processes are blocked, we have a deadlock in the system. Detection of such deadlocks can be implemented, either as a collection of specifically engineered actions or, more elegantly, as a set of derived predicates. In both cases we can infer, along the lines of argumentation outlined earlier, that a process/the entire system is blocked. The goal condition that makes the planners detect the deadlocks in the protocols is simply a conjunction of atoms requiring that all processes are blocked. The PDDL description for the derivation of a deadlock based on blocked read accesses is shown in Figure 16.10. Extensions to feature LTL properties with PDDL are available via state trajectory constraints or temporally extended goals.
16.3 PROGRAM MODEL CHECKING An important application of automated verification lies in the inspection of real software, because they can help to detect subtle bugs in safety-critical programs. Earlier approaches to program model checking rely on abstract models that were either constructed manually or generated from the source code of the investigated program. As a drawback, the program model may abstract from existing errors, or report errors that are not present in the actual program. The new generation of program model checkers builds on architectures capable of interpreting compiled code to avoid the construction of abstract models. The used architectures include virtual machines and debuggers. We exemplify our considerations in program model checking on the object code level. Based on a virtual processor, it performs a search on machine code, compiled, for example, from a c/c++ source. The compiled code is stored in ELF, a common object file format for binaries. Moreover, the virtual machine was extended with multithreading, which makes it also possible to model-check concurrent programs. Such an approach provides new possibilities for model checking software. In the design phase we can check whether the specification satisfies the required properties or not. Rather than using
714
CHAPTER 16 Automated System Verification
m2
s2
PC FP SP R0 R1
m1
s1
PC FP SP R0 R1
FP0 FP1
Code−section Zerol ebd0 Movel (4,%r2),%r 3
FP0 FP1
. . .
int d = 12 int e = 17 int f = −1
BSS−memory
mn
sn
Memory−pool mn1
PC FP SP R0 R1
mn2
FP0 FP1
mn3
= Physical memory
= VM memory
Data−section
. . .
li2
li3
BSS−section
int a,b,c ....
Lock−pool li1
Obj. file mem. image (MI)
a=4 b=6 c = 42
Dyn. alloc. regions
= Program memory
FIGURE 16.11 A state in an assembly language level model checker. Accessed and nonreleased shared variables are maintained in the lock pool, dynamic memory blocks are maintained in the memory pool, the current execution structure (of the active thread) is kept in stacks, and global data such as the program itself and some global variables are already reserved in the object code file that is loaded before the model checker is started.
a model written in the input language of a model checker, the developers provide a test implementation written in the same programming language as the end product. In assembly language level program model checking there are no syntactic or semantic restrictions to the programs that can be checked as long as they can be compiled. Figure 16.11 displays the components of a state, which is essentially composed of the stack contents and machine registers of the running threads, as well as the lock- and memory-pools. The pools store the set of locked resources and the set of dynamically allocated memory regions. The other sections contain the program’s global variables. The state vector in Figure 16.11 can be large and we may conclude that model checking machine code is infeasible due to the memory required to store the visited states. In practice, however, most states of a program differ only slightly from their immediate predecessors. If memory is only allocated
16.3 Program Model Checking
#include "IVMThread.h" #include "MyThread.h" extern int glob; class IVMThread; MyThread::MyThread() :IVMThread::IVMThread(){ } void MyThread::start() { run(); die(); } void MyThread::run() { glob=(glob+1)*ID; } void MyThread::die() { } int MyThread::id_counter;
715
#include #include "MyThread.h" #define N 2 class MyThread; MyThread * t[N]; int i,glob=0; void initThreads () { BEGINATOMIC for(i=0;istart(); } ENDATOMIC } void main() { initThreads(); VASSERT(glob!=8); }
FIGURE 16.12 The source of the program glob. The main program applies an atomic block of code to create the threads. Such a block is defined by a pair of BEGINATOMIC and ENDATOMIC statements. Upon creation, each thread is assigned a unique identifier ID by the constructor of the super class. An instance of MyThread uses ID to apply the statement glob=(glob+1)*ID. The VASSERT statement evaluates the Boolean expression glob!=8.
for changed components, by using pointers to unchanged components in the predecessor state, it is possible to explore large parts of the program’s state space before running out of memory. Figure 16.12 shows an example program, which generates two threads from an abstract thread class that accesses the shared variable glob. If the model checker finds an error trail of program instructions that leads to the line of the VASSERT statement, and the corresponding system state violates the Boolean expression, the model checker prints the trail and terminates. Figure 16.13 shows the error trail. The assertion is only violated if Thread 3 is executed before Thread 2. Otherwise, glob would take the values 0, 2, and 9. Heuristics have been successfully used to improve error detection in concurrent programs. States are evaluated by an estimator function, measuring the distance to an error state, so that states closer to the faulty behavior have a higher priority and are considered earlier in the exploration process. If the system contains no error, there is no gain.
Deadlock Heuristics The model checker automatically detects deadlocks during the program exploration. A thread can gain and release exclusive access to a resource using the statements VLOCK and VUNLOCK, which take as their parameter a pointer to a base type or structure. When a thread attempts to lock an already locked
716
Step Step Step Step Step Step Step Step
CHAPTER 16 Automated System Verification
1: 2: 3: 4: 5: 6: 7: 8:
Thread Thread Thread Thread Thread Thread Thread Thread
1 1 3 3 2 2 1 1
-
Line Line Line Line Line Line Line Line
10 src-file: glob.c - initThreads 16 src-file: glob.c - main 15 src-file: MyThread.cc - MyThread::run 16 src-file: MyThread.cc - MyThread::run 15 src-file: MyThread.cc - MyThread::run 16 src-file: MyThread.cc - MyThread::run 20 src-file: glob.c - main src-file: glob.c - main
FIGURE 16.13 The error trail for the glob program. First, the instances of MyThread are generated and started in one atomic step. Then the run-method of Thread 3 is executed, followed by the run-method of Thread 2. After step 3, we have glob=(0+1)*3=3 and after step 5 we have glob=(3+1)*2=8. Finally, the line containing the VASSERT statement is reached.
resource, it must wait until the lock is released by the thread that holds it. A deadlock describes a state, where all running threads wait for a lock to be released. An appropriate example for the detection of deadlocks is the most-block heuristic. It favors states, for which more threads are blocked.
Structural Heuristics Another established estimate used for error detection in concurrent programs is the interleaving heuristic. It relies on a quantity for maximizing the interleaving of thread executions. The heuristic does not assign values to states but to paths. The objective is that by prioritizing interleavings concurrency bugs are found earlier in the exploration process. The lock heuristic additionally prefers states with more variable locks and more threads alive. Locks are the obvious precondition for threads to become blocked and only threads that are still alive can get in a blocked mode in the future. If threads have the same program code and the threads differ only in their (thread) ID, their internal behavior is only slightly different. In the thread-ID heuristic the threads are ordered linear according to their ID. This means that we avoid all those executions in the state exploration, where for each pair of threads, a thread with a higher ID has executed less instruction than threads with a lower ID. States that do not satisfy this condition will be explored later in a way not to disable complete exploration. Finally, we may consider the access to shared variables. In the shared variable heuristic we prefer a change of the active thread after a global read or write access. Trail-directed heuristics target trail-directed search; that is, given an error trail for the instance, find a possibly shorter one. This turns out to be an apparent need of the application programmer, for whom long error trails are an additional burden to simulate the system and to understand the nature of the faulty behavior. Examples for the trail-directed heuristic are the aforementioned Hamming distance and FSM heuristics. In assembly language level program model checking the FSM heuristic is based on the finite-state automaton representation of the object code that is statically available for each compiled class. The export of parsed programs into planner input for applying a tool-specific heuristic extends to include real numbers, threading, range statements, subroutine calls, atomic regions, deadlocks, as well
16.4 Analyzing Petri Nets
717
as assertion violation detection. Such an approach, however, is limited by the static structure of PDDL, which hardly covers dynamic needs as present in memory pools, for example.
16.4 ANALYZING PETRI NETS Petri nets are fundamental to the analysis of distributed systems, especially infinite-state systems. Finding a particular marking corresponding to a property violation in Petri nets can be reduced to exploring a state space induced by the set of reachable markings. Typical exploration approaches are undirected and do not take into account any knowledge about the structure of the Petri net. More formally, a standard Petri net is a 4-tuple (P, T, I − , I + ), where P = {p1 , . . . , pn } is the set of places, T = {t1 , . . . , tm } is the set of transitions with 1 ≤ n, m < ∞, and P ∩ T = ∅. The backward and forward incidence mappings I − and I + , respectively, map elements of P × T and T × P to the set of natural numbers and fix the Petri net structure and the transition labels. A marking maps each place to a number; with M(p) we denote the number of tokens at place p. It is natural to represent M as a vector of integers. Markings correspond to states in a state space. Petri nets are often supplied with an initial marking M0 , the initial state. A transition t is enabled if all its input places contain at least one token, M(p) ≥ I − (p, t) for all p ∈ P. If a transition is fired, it deletes one token from each of its input places and generates one on each of its output places. A transition t enabled at marking m may fire and generate a new marking M 0 (p) = M(p) − I − (p, t) + I + (p, t) for all p ∈ P, written as M → M 0 . ∗ ∗ A marking M 0 is reachable from M, if M → M 0 , where → is the reflexive and transitive closure of →. The reachability set R(N) of a Petri net N is the set of all markings M reachable from M0 . A Petri net N is bounded if for all places p there exists a natural number k, such that for all M in ∗ R(N) we have M(p) ≤ k. A transition t is live, if for all M in R(N), there is a M 0 in R(N) with M → M 0 0 and t is enabled in M . A Petri net N is live if all transitions t are live. A firing sequence σ = t1 , . . . , tn starting at M0 is a finite sequence of transitions such that ti is enabled in Mi−1 and Mi is the result of firing ti in Mi−1 . In the analysis of complex systems, places model conditions or objects such as program variables, transitions model activities that change the values of conditions and objects, and markings represent the specific values of the condition or object, such as the value of a program variable. An example of an ordinary Petri net for the Dining Philosophers example with 2 and 4 philosophers is provided in Figure 16.14. Different philosophers correspond to different columns, and the places in the rows denote their states: thinking, waiting, and eating. The markings for the 2-philosophers case correspond to the initial state of the system; for the 4-philosophers case, we show the markings that resulted in a deadlock. There are two different analysis techniques for Petri nets: the analysis of the reachability set and the invariant analysis. The latter approach concentrates on the Petri net structure. Unfortunately, invariant analysis is applicable only if studying |P| × |T| is tractable. Hence, we concentrate on the analysis of the reachability set. Recall that the number of tokens for a node in a Petri net is not bounded a priori, so that the number of possible states is infinite. Heuristics estimate the number of transitions necessary to achieve a condition on the goal marking. Evaluation functions in the context of Petri nets associate a numerical value to each marking to
718
CHAPTER 16 Automated System Verification
FIGURE 16.14 Place-transition Petri nets for 2- and 4-DINING PHILOSOPHERS. The graphical representation consists of circles for places, dots for tokens, rectangles for transitions, and arrows for arcs between places and transitions. The left net is in its initial states; the net to the right is in a deadlock state. Moreover, the left net can be viewed as an abstraction of the right net.
prioritize the exploration of some successors with respect to some others. The shortest firing distance δN (M, M 0 ) in a net N is defined as the length of the shortest firing sequence between M and M 0 . The distance is infinite if there exists no firing sequence between M and M 0 . Moreover, δN (M, ψ) is the shortest path to a marking that satisfies condition ψ starting at M, δN (M, ψ) = min{δN (M, M 0 ) | M 0 |= ψ}. Subsequently, heuristic h(M) estimates δN (M, ψ). It is admissible, if h(M) ≤ δN (M, ψ) and monotone if h(M) − h(M 0 ) ≤ 1 for a successor marking M 0 of M. Monotone heuristics with h(M 0 ) = 0 for all M 0 |= ψ are admissible. We distinguish two search stages. In the explanatory mode, we explore the set of reachable markings having just the knowledge on what kind of error φ we aim at. In this phase we are just interested in finding such errors fast, without aiming at concise counterexample firing sequences. For the faultfinding mode we assume that we know the marking where the error occurs. This knowledge is to be inferred by simulation, test, or a previous run in the explanatory mode. To reduce the firing sequence a heuristic estimate between two markings is needed.
Hamming Distance Heuristic A very intuitive heuristic estimate is the Hamming distance heuristic X [M(p) 6= M 0 (p)]. hH (M, M 0 ) = p∈P
Here, the truth of [M(p) 6= M 0 (p)] is interpreted as an integer in {0, 1}. Since a transition may add or delete more than one token at a time, the heuristic is neither admissible nor consistent. However, if we divide hH (M, M 0 ) by the maximum number of infected places of a transition, we arrive at an
16.4 Analyzing Petri Nets
719
admissible value. In the 4-Dining Philosophers problem, an initial estimate of 4 matches the shortest firing distance to a deadlock.
Subnet Distance Heuristic A more elaborate heuristic that approximates the distance between M and M 0 works as follows. Via abstraction function φ it projects the place transition network N to φ(N) by omitting some places, transitions, and corresponding arcs. In addition, the initial set of marking M and M 0 is reduced to φ(M) and φ(M 0 ). As an example, the 2-Dining Philosophers Petri net in Figure 16.14 (left) is in fact an abstraction of the 4-Dining Philosophers Petri net to its right. The subnet distance heuristic is the shortest path distance required to reach φ(M 0 ) from φ(M), formally hφ (M, M 0 ) = δφ(N) (φ(M), φ(M 0 )). In the example of 4-Dining Philosophers we obtain an initial estimate of 2. The heuristic estimate is admissible, i.e., δN (M, M 0 ) ≥ δφ(N) (φ(M), φ(M 0 )). Let M be the current marking and M 00 be its immediate successor. To prove that the heuristic hφ is consistent, we show that hφ (M) − hφ (M 00 ) ≤ 1. Using the definition of hφ , we have that δφ(N) (φ(M), φ(M 0 )) ≤ 1 + δφ(N) (φ(M 00 ), φ(M 0 )). This inequality is always true since the shortest path cost from φ(M) to φ(M 0 ) cannot be greater than the shortest path cost that traverses φ(M 00 ) (triangular property). To avoid recomputations, it is appropriate to precompute the distance prior to the search and to use table lookups to guide the exploration. The subnet distance heuristic completely explores the coverage of φ(N) and runs an All Pairs Shortest Paths algorithm on top of it. If we apply two different abstractions φ1 and φ2 , to preserve admissibility, we can only take their maximum, 0 0 0 hmax φ1 ,φ2 (M, M ) = max{hφ1 (M, M ), hφ2 (M, M )}.
However, if the supports of φ1 and φ2 are disjoint—that is, the corresponding set of places and the set of transitions are disjoint φ1 (P) ∩ φ2 (P) = ∅ and φ1 (T) ∩ φ2 (T) = ∅—the sum of the two individual heuristics 0 0 0 hadd φ1 ,φ2 (M, M ) = hφ1 (M, M ) + hφ2 (M, M )
is still admissible. If we use an abstraction for the first two and the second two philosophers we obtain the perfect estimate of four firing transitions.
Activeness Heuristic While the preceding two heuristics measure the distance from one marking to another, it is not difficult to extend them for a goal by taking the minimum of the distance of the current state to all possible markings that satisfy the desired goal. However, as we concentrate on deadlocks, specialized heuristics can be established that bypass the enumeration of the goal set.
720
CHAPTER 16 Automated System Verification
A deadlock in a Petri net occurs if no transition can fire. Therefore, a simple distance estimate to the deadlock is simply to count the number of active transitions. In other words, we have X enabled(t). ha (M) = t∈T
As with the Hamming distance the heuristic is not consistent nor admissible, since one firing transition can change the enableness of more than one transition. For our running example we find four active transitions in the initial states.
Planning Heuristics In the following we derive a PDDL encoding for Petri nets, so that we can use in-built planning heuristic to accelerate the search. We declare two object types place and transition. To describe the topology of the net we work with the predicates (incoming ?s - place ?t - transition) and (outgoing ?s - place ?t - transition), representing the two sets I − and I + . For the sake of simplicity all transitions have weight 1. The only numerical information that is needed is the number of tokens at a place. This marking mapping is realized via the fluent predicate (number-of-tokens ?p - place). The transition firing action is shown in Figure 16.15. The initial state encodes the net topology and the initial markings. It specifies instances to the predicates incoming and outgoing and a numerical predicate (number-of-tokens) to specify M0 . The condition that a transition is blocked can be modeled with a derived predicate as follows: (:derived blocked (?t - transition) (exists (?p - place) (and (incoming ?p ?t) (= (number-of-tokens ?p) 0))))
Consequently, a deadlock to be specified as the goal condition is derived as (:derived deadlock (forall (?t - transition) (blocked ?t)))
It is obvious that the PDDL encoding inherits a one-to-one correspondence to the original Petri net. (:action fire-transition :parameters (?t - transition) :preconditions (forall (?p - place) (or (not (incoming ?p ?t)) (> (number-of-tokens ?p) 0))) :effects (forall (?p - place) (when (incoming ?p ?t) (decrease (number-of-tokens ?p)))) (forall (?p - place) (when (outgoing ?t ?p) (increase (number-of-tokens ?p))))) FIGURE 16.15 Numerical planning action of a Petri net transition.
16.5 Exploring Real-Time Systems
721
16.5 EXPLORING REAL-TIME SYSTEMS Real-time model checking with timed automata is an important verification scenario, and cost-optimal reachability analysis as considered here has a number of industrial applications including resourceoptimal scheduling.
16.5.1 Timed Automata Timed automata can be viewed as an extension of classic finite automata with clocks and constraints defined on these clocks. These constraints, when corresponding to states, are called invariants, and restrict the time allowed to stay at the state. When connected to transitions these constraints are called guards. They restrict the use of the transitions. The clocks C are real-valued variables and measure durations. The values of all the clocks in the system are denoted as a vector, also called clock valuation function, v : C → IR+ . The constraints are defined over clocks and can be generated by the following grammar: For x, y ∈ C, a constraint α is defined as α ::= x ≺ d | x − y ≺ d | ¬α | (α ∧ α), where d ∈ ZZ and ≺∈ { 0 means the driver is pessimistic about the actual driving time. The larger it is, the more likely the driver will arrive at his destination before the estimated arrival time. This is especially useful for individuals that have an important appointment. Exactly as in the previous section, we have to ensure the time consistency of the graph to guarantee the Bellman precondition. Taking into account the preference parameters, we have to show for all allowed values for β (or γ ), for all times t1 ≤ t2 , and all pairs of adjacent edges e1 and e2 , that t1 + tr (e1 , e2 , t1 ) + µ(te (e2 , t1 + tr (e1 , e2 , t1 ))) + β · σ (te (e2 , t1 + tr (e1 , e2 , t1 ))) ≤ t2 + tr (e1 , e2 , t2 ) + µ(te (e2 , t2 + tr (e1 , e2 , t2 ))) + β · σ (te (e2 , t2 + tr (e1 , e2 , t2 ))).
17.3 Cutting Corners
749
Consequently, the test needs to be performed with the minimum and the maximum allowed value for β.
17.3 CUTTING CORNERS As mentioned earlier, the requirement of real-time operation, combined with a road graph that can consist of millions of nodes, poses hard time and memory constraints on the search algorithm. Therefore, various pruning schemes have been proposed. Some of the techniques described in Chapter 10 can be applied; in the following, we introduce some methods that are specific to geometric domains. Nonadmissible pruning reduces computation time or memory requirements by compromising the guarantee of finding an optimal solution. For example, most commercial navigation systems of today incorporate the rationale that when far away from start and goal, the optimal route most likely uses only freeways, highways, and major connections. The system maintains maps on different levels of detail (based on the road class), where the highest one might only contain the highway network, and the lowest level is identical to the entire map. Given a start and destination point, it selects a section of the lowest-level map only within a limited range of both; within larger ranges, it might use an intermediate level, and for the highest distance only the top-level map. This behavior reduces computation time considerably, while still being a good solution in most cases. Similarly, we know that the Euclidean distance is overly optimistic most of the time. Multiplying it by a small factor, say, 1.1, yields more realistic estimates and can reduce the computation time dramatically, while the solution is often almost identical. This is an instance of nonoptimal A* described in Chapter 6. The next two sections present two admissible schemes for the reduction of search time.
17.3.1 Geometric Container Pruning In a domain like route planning, where a multitude of shortest path queries have to be answered on the same problem graph, it is possible to accelerate search by means of pieces of information computed prior to the arrival of the queries. As an extreme case, we could compute and memorize all distances and starting edges for the paths between all pairs of nodes using the Floyd-Warshall (Ch. 2) or Johnson’s algorithm; this can reduce the query processing to a mere linear backtracking from target to source. However, the space required for saving this information is O(n2 ), which is often not feasible because of n being very large. In the next section, we present an approach that reduces the search time in return for more reasonable memory requirements. Research on annotating a graph by geometric containers to guide a search algorithm has shown significant gains in terms of the number of expanded nodes. The basic idea is to reduce the size of the search space of Dijkstra’s algorithm or the A* algorithm by pruning edges that can be safely ignored because they are already known not to lie on a shortest path to the target. The two stages for geometric speedups are as follows: 1. In a preprocessing step, for each edge e = (u, v), store the set of nodes t such that a shortest path from u to t starts with this particular edge e (as opposed to other edges emanating from u). 2. While running Dijkstra’s algorithm or A*, do not insert edges into the priority queue of which the stored set does not contain the target.
750
CHAPTER 17 Vehicle Navigation
Procedure Create-Containers Input: Explicit-state space problem graph G = (V, E, w) Output: Rectangular containers Box : e → V 0 ⊆ V for each s ∈ V Insert(Open, (s, 0)) for each v ∈ V \ {s} Insert(Open, (v, ∞)) while (Open 6= ∅) u ←− DeleteMin(Open) Succ(u) ← Expand(u) for each v ∈ Succ(u) if (f (v) > f (u) + w(u, v)) f (v) ← f (u) + w(u, v) DecreaseKey(Open, (v, f (v))) if (u = s) ancestor(v) ← (s, v) else ancestor(v) ← ancestor(u) for each y ∈ V \ {s} Enlarge(Box(ancestor( y)), y)
;; All nodes serve as initial node ;; Insert init node with zero priority ;; For all other nodes ;; Insert into list with infinite cost ;; As long as there are horizon nodes ;; Extract best one ;; Generate successors by node expansion ;; For all successor nodes ;; If better path established ;; Update costs ;; Update priority queue ;; Special case, initial node reached ;; No contraction at s ;; Usual case ;; Contraction of shortest path tree ;; For all nodes ;; Update bounding-box container
Algorithm 17.1 Creating shortest path containers.
The problem that arises is that for n nodes in the graph we would need O(n2 ) space to store this information, which is not practically feasible. Hence, we do not remember the set of possible target nodes explicitly, but approximations of it, so-called geometric containers. For containers with constant space requirement, the overall storage will be in O(n). A simple example for a container would be an axis-parallel rectangular bounding box around all possible targets. However, this is not the only container class we can think of. Other options are enclosing circles or the convex hull of a set of points P, which is defined as the smallest convex set that contains P. Recall that a set M ⊆ S is called convex if for every two elements a, b ∈ M the line segment between a and b is also completely contained in M. A container will generally contain nodes that do not belong to the target node set. However, this does not hurt an exploration algorithm in the sense that it still returns the correct result, but increases only the search space. Incorporating this geometric pruning scheme into an exploration algorithm like Dijkstra or A* will retain its completeness and optimality, since all shortest paths from the start to the goal node are preserved. The containers can be computed by Algorithm 17.1 in time O(n2 lg n). It essentially solves a sequence of single-source-all-targets problems, for all nodes; a variable ancestor(u) remembers the respective outgoing edge from s used on the shortest path to u. Figure 17.5 shows the result of computing a container for the starting point C and the resulting container for edge (C, D).
17.3 Cutting Corners
T (C,D)
B
H
A
D 7
(C, D)
9
6
6
4
5
(C, D)
C
751
11
E
(C, D)
G
8 6
4
7
(C, D)
F
(C, F)
FIGURE 17.5 Example for creating the target container for C.
Procedure Bounding-Box-Graph-Search Input: Graph G, start node s, target node t Output: Shortest path from s to t [...] while (Open 6= ∅) u ←− DeleteMin(Open) if (Goal(u)) return Path(u) Succ(u) ← Expand(u) for each v ∈ Succ(u) if (t ∈ / Box(u, v)) continue Improve(u, v)
;; Search space not explored completely ;; Take most promising state ;; Terminate with shortest path ;; Generate successors ;; Consider all successors ;; Enforce pruning ;; Otherwise, continue search
Algorithm 17.2 Bounding-box graph search algorithm.
The application of containers in explicit graph search is shown in Algorithm 17.2. While running any optimal exploration algorithm on query (s, t), we do not insert edges into the horizon list that are definitely not part of a shortest path to the target. The time required for the computation of these containers pays off well during the main search. Empirical results show a reduction of 90% to 95% in the number of explored nodes in rail networks of different European countries. Figure 17.6 illustrates the effect of bounding-box pruning in the reduction of traversed edges. It is instructive to compare shortest path pruning to the related approach of pattern database heuristics (see Ch. 15). In the latter case, state-to-goal instead of state-to-state information is stored. Pattern databases are used to refine the search for a fixed goal and varying initial state. In contrast, shortest path pruning uses precomputed shortest path information for a varying initial state and goal state.
752
CHAPTER 17 Vehicle Navigation
FIGURE 17.6 Shortest path search without (left) and with (right) container pruning (bold edges are searched).
17.3.2 Localizing A* Consider the execution of the A* algorithm on a search space that is slightly larger than the internal memory capacity of the computer, yet not as large to require external search algorithms. We often cannot simply rely on the operating system’s virtual memory mechanism for moving pages to and from the disk; the reason is that A* does not respect locality at all; it explores nodes strictly according to the order of f -values, regardless of their neighborhood, and hence jumps back and forth in a spatially unrelated way only for marginal differences in the estimation value. In the following, we present a heuristic search algorithm to overcome this lack of locality. Local A* is a practical algorithm that takes advantage of the geometric embedding of the search graph. In connection with software paging, it can lead to a significant speedup. The basic idea is to organize the graph structure such that node locality is preserved as much as possible, and to prefer to some degree local expansions over those with globally minimum f -value. As a consequence, the algorithm cannot stop with the first solution found; we adopt the Node-Ordering-A* framework of Chapter 2. However, the overhead in the increased number of expansions can be significantly outweighed by the reduction in the number of page faults. In the application of the algorithm to route planning we can partition the map according to the two-dimensional physical layout, and store it in a tile-wise fashion. Ideally, the tiles should roughly have a size such that a few of them fit into main memory. The Open list is represented by a new data structure, called Heap of Heaps (see Fig. 17.7). It consists of a collection of k priority queues H1 , . . . , Hk , one for each page. At any instant, only one of the heaps, Hactive , is designated as being active. One additional priority queue H keeps track of the root nodes of all Hi with i 6= active. It is used to quickly find the overall minimum across all of these heaps.
17.3 Cutting Corners
753
FIGURE 17.7 Example for the HEAP OF HEAPS data structure.
Procedure IsEmpty Output: Boolean value, indicating if number of elements is zero return
Vk
i=1 IsEmpty(Hi )
;; All Open lists empty
Procedure Insert Input: Node u with key f (u) Side effect: Updated structure if (φ(u) 6= active ∧ f (u) < f (Min(Hφ(u) ))) DecreaseKey(H,(Hφ(u) , f (u))) Insert(Hφ(u) ,(u, f (u)))
;; If improvement to overall heap ;; Update overall heap ;; Inserting in relevant heap
Procedure DecreaseKey Input: Node u with key f (u) Side effect: Updated structure if (φ(u) 6= active ∧ f (u) < f (Min( Hφ(u) ))) DecreaseKey( H,( Hφ(u) , f (u))) DecreaseKey( Hφ(u) ,(u,f (u)))
;; If improvement to overall heap ;; Update overall heap ;; Forward operation to relevant heap
Algorithm 17.3 Access operations on HEAP OF HEAPS.
Let node u be mapped to tile φ(u). The following priority queue operations are delegated to the member priority queues Hi in the straightforward way. Whenever necessary, H is updated accordingly. The Insert and DecreaseKey operations (see Alg. 17.3) can affect all heaps. However, the hope is that the number of adjacent pages of the active page is small and that they are already in memory or
754
CHAPTER 17 Vehicle Navigation
Procedure DeleteSome Output: Node u with minimal key Side effect: Updated structure CheckActive return DeleteMin(Hactive )
;; Evaluate page changing condition ;; Perform extraction
Procedure CheckActive Side effect: Updated structure if (IsEmpty(Hactive ) ∨ (f (Min(Hactive )) − f (Min(Min(H))) > 1 ∧ f (Min(Hactive )) > 3)) Insert(H, Hactive , f (Min(Hactive ))) Hactive ← DeleteMin(H )
;; Forced change if active page is empty ;; First condition satisfied ;; Second condition satisfied ;; Flush current active page ;; Find next active page
Algorithm 17.4 Maintenance of active heap.
have to be loaded only once; for example, in route planning, with a rectangular tiling each heap can have at most four neighbor heaps. All other pages and priority queues remain unchanged and thus do not have to reside in main memory. The working set of the algorithm will consist of the active heap and its neighbors for some time, until it shifts attention to another active heap. To improve locality of the search, DeleteMin is substituted by a specialized DeleteSome operation that prefers node expansions with respect to the current page. Operation DeleteSome performs DeleteMin on the active heap (see Alg. 17.4). As the aim is to minimize the number of switches between pages, the algorithm favors the active page by continuing to expand its nodes, although the minimum f -value might already exceed the minimum of all remaining priority queues. There are two control parameters: an activeness bonus 1 and an estimate 3 for the cost of an optimum solution. If the minimum f -value of the active heap is larger than that of the remaining heaps plus the activeness bonus 1, the algorithm may switch to the priority queue satisfying the minimum root f -value. Thus, 1 discourages page switches by determining the proportion of a page to be explored. As it increases to large values, in the limit each activated page is searched to completion. However, the active page still remains valid, unless 3 is exceeded. The rationale behind this second heuristic is that we can often provide a heuristic for the total least-cost path that is, on the average, more accurate than that obtained from h, but that might be overestimating in some cases. With this implementation of the priority queue, the algorithm Node-Ordering-A* remains essentially unaltered; the data structure and page handling is transparent to the algorithm. Traditional A* arises as a special case for 1 = 0 and 3 < h∗ (s), where h∗ (s) denotes the actual minimum cost of a path between the source and a goal node. Optimality is guaranteed, since we leave the heuristic estimates unaffected by the heap prioritizing scheme, and since each node inserted into the Heap of Heaps must eventually be returned by a DeleteMin operation.
17.3 Cutting Corners
755
The algorithm has been incorporated into a commercially available route planning system. The system covers an area of approximately 800 × 400 km at a high level of detail, and comprises approximately 910,000 nodes (road junctions) linked by 2,500,000 edges (road elements). For long-distance routes, conventional A* expands the nodes in a spatially uncorrelated way, jumping to a node as far away as some 100 km, but possibly returning to the successor of the previous one in the next step. Therefore, the working set gets extremely large, and the virtual memory management of the operating system leads to excessive paging and is the main burden on the computation time. As a remedy, we achieve memory locality of the search algorithm by exploiting the underlying spatial relation of connected nodes. Nodes are geographically sorted according to their coordinates in such a way that neighboring nodes tend to appear close to each other. A page consists of a constant number of successive nodes (together with the outgoing edges) according to this order. Thus, pages in densely populated regions tend to cover a smaller area than those representing rural regions. For not too small sizes, the connectivity within a page will be high, and only a comparably low fraction of road elements cross the boundaries to adjacent pages. Figure 17.8 shows some bounding rectangles of nodes belonging to the same page. There are three parameters controlling the behavior of the algorithm with respect to secondary memory: the algorithm parameters 1 and 3 and the (software) page size. The latter one should be adjusted so that the active page and its adjacent pages together roughly fit into available main memory. The optimum solution estimate 3 is obtained by calculating the Euclidean distance between the start and the goal and adding a fixed percentage. Figure 17.9 juxtaposes the number of page faults to the number of node expansions for varying page size and 1. We observe that the rapid decrease of page faults compensates the increase of expansions (note the logarithmic scale). Using an activeness bonus
FIGURE 17.8 Granularity of the partition (lines indicate page boundaries).
756
CHAPTER 17 Vehicle Navigation
Expansions Page faults 900000 800000 700000 600000 500000 400000 300000
0
200000
5000
100000
10000 Page size
0 1
10
100
15000
Delta [km]
FIGURE 17.9 Number of page faults and node expansions for varying page size and activeness bonus 1.
of about 2 km suffices to decrease the value by more than one magnitude for all page sizes. At the same time the number of expanded nodes increases by less than 10%.
17.4 BIBLIOGRAPHIC NOTES Astronomical positioning and dead reckoning are nautical techniques thousands of years old. However, though determining latitude had been mastered early on, measuring longitude proved to be extremely harder. Thus, English ships were being wrecked, thousands of lives were lost, and precious cargo wasn’t making its scheduled delivery. Competing with the most renowned astronomers of his time, in the early 1700s a simple clockmaker named John Harrison thought that a well-built clock with a dual face would solve the problem. Sobel (1996) has given a fascinating account of Harrison’s struggle against enormous obstacles put in his way by an ingrained scientific establishment. Comprehensive overviews of the components of modern navigation systems and their interaction can be found in Schlott (1997) and Zhao (1997). Advanced vehicle safety applications and the requirements they impose on future digital maps are discussed in the final reports of the EDMap (CAMP Consortium, 2004) and NextMAP (Ertico, 2002) projects. An approach to generate high-precision digital maps from unsupervised GPS traces has been described in Schro¨ dl, Wagstaff, Rogers, Langley, and Wilson (2004). An incremental learning approach for constructing maps based on GPS traces has been proposed by Bru¨ ntrup, Edelkamp, Jabbar, and Scholz (2005). GPS route planning on the superposition of traces is proposed by Edelkamp, Jabbar, and Willhalm (2003). It determines intersections of GPS traces efficiently using the sweepline segment intersection algorithm of Bentley and Ottmann (1979), which is one of the first output-sensitive algorithms in computational geometry. The geometric travel
17.4 Bibliographic Notes
757
planning approach included Voronoi diagrams for query point location search and A* heuristic graph traversal for finding the optimal route. Winter (2002) has discussed modifications to the search algorithm to accommodate turn restrictions in road networks. Our account of time-dependent and stochastic routing is based on the excellent work of Flinsenberg (2004), which should also be consulted for further references on different aspects of routing algorithms. An overview of research concerning real-time vehicle routing problems has been presented by Ghiani, Guerriero, Laporte, and Musmanno (2003). Shortest path containers have been introduced by Wagner and Willhalm (2003) and been adapted to dynamic edge changes in Wagner, Willhalm, and Zaroliagis (2004). Contraction hierarchies by Geisberger and Schieferdecker (2010) and transit-route routing by Bast, Funke, Sanders, and Schultes (2007) further speed up search. This approach links to initial work by Schulz, Wagner, and Weihe (2000) on shortest path angular sectors. A GPS route planner implementation using shortest path containers in A* has been provided by Edelkamp et al. (2003). Further algorithmic details on dynamic changes to the inferred structures have been discussed in Jabbar (2003). Local A* based on the Heap of Heaps data structure has been proposed by Edelkamp and Schro¨ dl (2000) in the context of a commercial route planning system.
This page intentionally left blank
CHAPTER
Computational Biology
18
Computational biology or bioinformatics is a large research field on its own. It is dedicated to the discovery and implementation of algorithms that facilitate the understanding of biological processes. The field encompasses different areas, such as building evolutionary trees and operating on molecular sequence data. Many approaches in computational biology refer to statistical and machine learning techniques. We concentrate on aspects for which the paradigm of state space search applies. First of all, we observe a tight analogy between biological and computational processes. For example, generating test sequences for a computational system relates to generating experiments for a biological system. On the other hand, many biochemical phenomena reduce to the interaction between defined sequences. We selected two problems as representatives for the field and in which heuristics have been applied for increasing the efficiency of the exploration. On one hand, we analyze Biological Pathway problems, which have been intensively studied in the field of molecular biology for a long time. We show how these problems can be casted as state space search problems and we illustrate how one problem can be implemented as a planning domain to participate from the general planning heuristics. On the other hand, we consider what has been denoted as the holy grail in DNA and protein analyses. Throughout the book, we have already made several references to Multiple Sequence Alignment. The core of this chapter aims at providing a coherent perspective and points out recent trends in research of this ubiquitous problem in computational biology.
18.1 BIOLOGICAL PATHWAY The understanding of biological networks, such as (metabolic and signal transduction) pathways, is crucial for understanding molecular and cellular processes in the organism or system under study. One natural way to study biological networks is to compare known with newly discovered networks and look for similarities between them. A Biological Pathway is a sequence of chemical reactions in a biological organism. Such pathways specify mechanisms that explain how cells carry out their major functions by means of molecules and reactions that produce regular changes. Many diseases can be explained by defects in pathways, and new treatments often involve finding drugs that correct those defects. An example of signaling pathways in a cell is illustrated in Figure 18.1. We can model parts of the functioning of a pathway as a search problem by simply representing chemical reactions as actions. One example of the Biological Pathway domain is the pathway of the
759
760
CHAPTER 18 Computational Biology
Receptors
DNA Nuclear membrane Plasma membrane
FIGURE 18.1 Signaling pathways in a cell.
mammalian cell cycle control. There are different kinds of basic actions corresponding to the different kinds of reactions that appear in the pathway. A simple qualitative encoding of the reactions of the pathway has five different actions: an action for choosing the initial substrates, an action for increasing the quantity of a chosen substrate (in the propositional version, quantity coincides with presence, and it is modeled through a predicate indicating if a substrate is available or not), an action modeling biochemical association reactions, an action modeling biochemical association reactions requiring catalysts, and an action modeling biochemical synthesis reactions. An encoding as a planning domain is provided in Figure 18.2. The goals refer to substances that must be synthesized by the pathway, and are disjunctive with two disjuncts each. Furthermore, there is a limit on the number of input substrates that can be used in the pathway. In extended versions both the products that must be synthesized by the pathway and the number of the input substrates that are used by the network are turned into preferences. The challenge here is finding paths that achieve a good trade-off between the different kinds of preferences. Reactions have different durations and can happen if their input substrates reach some concentration level. Moreover, reactions generate their products in specific quantities. The refined goals are summations of substance concentrations that must be generated by the pathway.
18.2 MULTIPLE SEQUENCE ALIGNMENT Despite their limitation to the moderate number of sequences, the research on exact algorithms for the Multiple Sequence Alignment problem is still going on, trying to push the practical boundaries further. They still form the building block of heuristic techniques, and incorporating them into existing
18.2 Multiple Sequence Alignment
761
(define (domain pathways) (:requirements :typing :adl) (:types simple complex - molecule) (:predicates (association-reaction ?x1 ?x2 - molecule ?x3 - complex) (catalyzed-association-reaction ?x1 ?x2 - molecule ?x3 - complex) (synthesis-reaction ?x1 ?x2 - molecule) (possible ?x - molecule) (available ?x - molecule) (chosen ?s - simple) (next ?l1 ?l2 - level) (num-subs ?l - level)) (:action choose :parameters (?x - simple ?l1 ?l2 - level) :precondition (and (possible ?x) (not (chosen ?x)) (num-subs ?l2) (next ?l1 ?l2)) :effect (and (chosen ?x) (not (num-subs ?l2)) (num-subs ?l1))) (:action initialize :parameters (?x - simple) :precondition (and (chosen ?x)) :effect (and (available ?x))) (:action associate :parameters (?x1 ?x2 - molecule ?x3 - complex) :precondition (and (association-reaction ?x1 ?x2 ?x3) (available ?x1) (available ?x2)) :effect (and (not (available ?x1)) (not (available ?x2)) (available ?x3))) (:action associate-with-catalyze :parameters (?x1 ?x2 - molecule ?x3 - complex) :precondition (and (catalyzed-association-reaction ?x1 ?x2 ?x3) (available ?x1) (available ?x2)) :effect (and (not (available ?x1)) (available ?x3))) (:action synthesize :parameters (?x1 ?x2 - molecule) :precondition (and (synthesis-reaction ?x1 ?x2) (available ?x1)) :effect (and (available ?x2))) FIGURE 18.2 PDDL encoding of BIOLOGICAL PATHWAY.
tools could improve them. For example, an algorithm iteratively aligning two groups of sequences at a time could do this with three or more, to better avoid local minima. Moreover, it is theoretically important to have the “gold standard” available for evaluation and comparison, even if not for all problems.
762
CHAPTER 18 Computational Biology
Since MSA can be cast as a minimum-cost path finding problem, it is amenable to heuristic search algorithms developed in the AI community; these are actually among the currently best approaches. Therefore, though many researchers in this area have often used puzzles and games in the past to study heuristic search algorithms, recently there has been a rising interest in MSA as a test bed with practical relevance. A number of exact algorithms have been developed that compute alignments for a moderate number of sequences. Some of them are constrained by available memory, some by the required computation time, and some by both. It is helpful to roughly group the approaches into two categories: those based on the dynamic programming paradigm, which proceed primarily in breadth-first fashion; and best-first search, utilizing lower and/or upper bounds to prune the search space. Some recent research, including the one introduced in Section 18.2.2, attempts to beneficially combine these two approaches. The earliest Multiple Sequence Alignment algorithms were based on dynamic programming (see Sec. 2.1.7). We have seen how Hirschberg’s algorithm (see Sec. 6.3.2) is able to reduce the space complexity by one dimension from O(N k ) to O(kN k−1 ), for k sequences of length at most N, by deleting each row as soon as the next one is completed; only a few relay nodes are maintained. To finally recover the solution path, a divide-and-conquer strategy recomputes the (much easier) partial problems between the relays. Section 6.3.1 described how dynamic programming can be cast in terms of Dijkstra’s algorithm, to do essentially the same, but relieving us from the necessity of explicitly allocating a matrix of size N 3 ; this renders dynamic programming quickly infeasible when more than two sequences are involved. Reference counting has been introduced for Closed list reduction, already having a big practical impact on the feasibility of instances. For integer edge costs, the priority queue (also referred to as the heap) can be implemented as a bucket array pointing to doubly linked lists, so that all operations can be performed in constant time. To expand a vertex, at most 2k − 1 successor vertices have to be generated, since we have the choice of introducing a gap in each sequence. Thus, like dynamic programming, Dijkstra’s algorithm can solve the Multiple Sequence Alignment problem in O(2k N k ) time and O(N k ) space for k sequences of length ≤ N. On the other hand, although dynamic programming and Dijkstra’s algorithm can be viewed as variants of breadth-first search, we achieve best-first search if we expand nodes v in the order of an estimate (lower bound) of the total cost of a path from s to the t passing through v. Rather than the gvalue as in Dijkstra’s algorithm, we use f (v) := g(v) + h(v) as the heap key, where h(v) is a lower bound on the cost of an optimal path from v to t; most of the time, the sum of optimal pairwise alignments is used. Unfortunately, the standard linear-memory alternative to A*, IDA*, is not applicable in this case: Although it works best in tree-structured spaces, lattice-structured graphs like in the Multiple Sequence Alignment problem induce a huge overhead in duplicate expansions due to the huge number of paths between any two given nodes. It should be mentioned that the definition of the Multiple Sequence Alignment problem as given earlier is not the only one; it competes with other attempts at formalizing biological meaning, which is often imprecise or depends on the type of question the biologist investigator is pursuing. In the following, we are only concerned with global alignment methods, which find an alignment of entire sequences. Local methods, in contrast, are geared toward finding maximally similar partial sequences, possibly ignoring the remainder.
18.2 Multiple Sequence Alignment
763
18.2.1 Bounds Let us now have a closer look on how lower and upper bounds are derived. Obtaining an inaccurate upper bound on δ(s, t) is fairly easy, since we can use the cost of any valid path through the lattice. Better estimates are available from heuristic linear-time alignment programs. In Section 1.7.6, we have already seen how lower bounds on the k-alignment are often based on optimal pairwise alignments; usually, prior to the main search, these subproblems are solved in a backward direction, by ordinary dynamic programming, and the resulting distance matrix is stored for later access. Let U ∗ be an upper bound on the cost of an optimal multiple sequence alignment G. The sum of all optimal alignment costs Li,j = d(si,j , ti,j ) for pairwise subproblems i, j ∈ {1, . . . , k}, i < j, call it L, is a lower bound on G. Carrillo and Lipman pointed out that by the additivity of the sum-of-pairs cost function, any pairwise alignment induced by the optimal multiple sequence alignment can at most be δ = U − L larger than the respective optimal pairwise alignment. This bound can be used to restrict the number of values that have to be computed in the preprocessing stage and have to be stored for the calculation of the heuristic: For the pair of sequences i, j, only those nodes v are feasible such that a path from the start node si, j to the goal node ti, j exists with total cost no more than Li, j + δ. To optimize the storage requirements, we can combine the results of two searches. First, a forward pass determines for each relevant node v the minimum distance d(si,j , v) from the start node. The subsequent backward pass uses this distance like an exact heuristic and stores the distance d(v, ti,j ) from the target node only for those nodes with d(si,j , v) + d(v, ti,j ) ≤ d(s, t) + δ. Still, for larger alignment problems the required storage size can be extensive. In some solvers, the user is allowed to adjust δ individually for each pair of sequences. This makes it possible to generate at least heuristic alignments if time or memory doesn’t allow for the complete solution; moreover, it can be recorded during the search if the δ-bound was actually reached. In the negative case, optimality of the found solution is still guaranteed; otherwise, the user can try to run the program again with slightly increased bounds. The general idea of precomputing simplified problems and storing the solutions for use as a heuristic is the same as in searching with pattern databases. However, these approaches usually assume that the computational cost can be amortized over many search instances to the same target. In contrast, many heuristics are instance-specific, such that we have to strike a balance.
18.2.2 Iterative-Deepening Dynamic Programming As we have seen, a fixed search order as in dynamic programming can have several advantages over pure best-first selection.
. .
Since Closed nodes can never be reached more than once during the search, it is safe to delete useless ones (those that are not part of any shortest path to the current Open nodes) and to apply path compression schemes, such as the Hirschberg algorithm. No sophisticated schemes for avoiding back leaks are required, such as core set maintenance and dummy node insertion into Open. Besides the size of the Closed list, the memory requirement of the Open list is determined by the maximum number of nodes that are open simultaneously at any time while the algorithm is running. When the f -value is used as the key for the priority queue, the Open list usually contains all nodes with f -values in some range ( fmin , fmin + δ); this set of nodes is generally spread across
764
.
CHAPTER 18 Computational Biology
the search space, since g (and accordingly h = ( f − g)) can vary arbitrarily between 0 and fmin + δ. As opposed to that, if dynamic programming proceeds along levels of antidiagonals or rows, at any iteration at most k levels have to be maintained at the same time, and hence the size of the Open list can be controlled more effectively. For practical purposes, the running time should not only be measured in terms of iterations, but we should also take into account the execution time needed for an expansion. By arranging the exploration order such that edges with the same head node (or more generally, those sharing a common coordinate prefix) are dealt with one after the other, much of the computation can be cached, and edge generation can be sped up significantly. We will come back to this point in Section 18.2.5.
The remaining issue of a static exploration scheme consists of adequately bounding the search space using the h-values. A* is known to be minimal in terms of the number of node expansions. If we knew the cost δ(s, t) of a cheapest solution path beforehand, we could simply proceed level by level of the grid, however, only immediately prune generated edges e whenever f (e) > δ(s, t). This would ensure that we only generate those edges that would have been generated by algorithm A* as well. An upper threshold would additionally help reduce the size of the Closed list, since a node can be pruned if all of its children lie beyond the threshold; additionally, if this node is the only child of its parent, this can give rise to a propagating chain of ancestor deletions. We propose to apply a search scheme that carries out a series of searches with successively larger thresholds until a solution is found (or we run out of memory or patience). The use of such an upper bound parallels that in the IDA* algorithm.
18.2.3 Main Loop The resulting algorithm, which we will refer to as iterative-deepening dynamic programming (IDDP), is sketched in Algorithm 18.1. The outer loop initializes the threshold with a lower bound (e.g., h(s)), and, unless a solution is found, increases it up to an upper bound. In the same manner as in the IDA* algorithm, to make sure that at least one additional edge is explored in each iteration, the threshold has to be increased correspondingly at least to the minimum cost of a fringe edge that exceeded the previous threshold. This fringe increment is maintained in the variable minNextThresh, initially estimated as the upper bound, and repeatedly decreased in the course of the following expansions. In each step of the inner loop, we select and remove a node from the priority queue of which the level is minimal. As explained later in Section 18.2.5, it is favorable to break ties according to the lexicographic order of target nodes. Since the total number of possible levels is comparatively small and known in advance, the priority queue can be implemented using an array of linked lists; this provides constant time operations for insertion and deletion.
Edge Expansion The expansion of an edge e is partial (see Alg. 18.2). A child edge might already exist from an earlier expansion of an edge with the same head vertex; we have to test if we can decrease the g-value. Otherwise, we generate a new edge if its f -value exceeds the search threshold of the current iteration and its memory is immediately reclaimed. In a practical implementation, we can prune unnecessary accesses to partial alignments inside the calculation of the heuristic as soon as the search threshold has already been reached.
18.2 Multiple Sequence Alignment
765
Procedure IDDP Input: Edges es , et , LOWER BOUND L, UPPER BOUND U ∗ Output: Optimal alignment U←L ;; Initialize threshold while (U ≤ U ∗ ) ;; Outer loop, iterative-deepening phases Open ← {se } ;; Initialize frontier list U0 ← U ;; Inner loop while (Open 6= ∅) ;; Bounded dynamic programming Remove e from Open with min. level(e) ;; Select edge for expansion if (e = et ) ;; Optimal alignment found return Path(es , et ) ;; Find actual alignment Expand(e, U, U 0 ) ;; Generate and process successors, Alg. 18.2 1 ← ComputeIncr ;; Compute search threshold for next iteration U ← max{U + 1, U 0 ) ;; Update search threshold Algorithm 18.1 Iterative-deepening dynamic programming.
Procedure Expand Input: Edge e, threshold U, next threshold U 0 Side effects: Initialize/update g-values of successors of e for each c in Succ(e)
;; Retrieve child or tentatively generate it if not . . . ;; . . . yet existing, set Boolean variable created accordingly g0 ← g(e) + GapCost(e, c) + GetCost(c) ;; Determine new g-value f = g0 + h(c) ;; Determine new f -value if (( f ≤ U) and (g0 < g(c))) ;; Shorter path than current best found . . . g(c) ← g0 ;; . . . estimate within threshold UpdateEdge(e, c, h) ;; Edge relaxation (Alg. 18.3) else if ( f > U) ;; Larger path than currently best U 0 ← min{U 0 , f } ;; Record minimum of pruned edges if(created) ;; Child new Delete(c) ;; Make sure only promising edges are stored if (ref(e) = 0) ;; Reference count zero DeleteRec(e) ;; No promising children could be inserted into the heap Algorithm 18.2 Edge expansion in IDDP.
The relaxation of a successor edge within the threshold is performed by the subprocedure UpdateEdge (see Alg. 18.3). This is similar to the corresponding relaxation step in A*, updating the child’s g- and f -values, its parent pointers, and inserting it into Open, if it is not already contained. However, in contrast to best-first search, it is inserted into the heap according to the antidiagonal level
766
CHAPTER 18 Computational Biology
Procedure UpdateEdge Input: Edges p (parent), c (child), HEAP Open Side effects: Update Open, delete unused ancestors of c ref(p) ← ref(p) + 1 ref(ancestor(c)) ← ref(ancestor(c)) − 1 if (ref(ancestor(c)) = 0) DeleteRec(ancestor(c))
;; Increment reference count of new parent ;; Decrement reference count of old one ;; The former parent has lost its last child ... ;; ... and becomes useless
ancestor(c) ← p if (c not in Open) Insert c into Open with level(c)
;; Update ancestor ;; Not yet generated
Algorithm 18.3 Edge relaxation step for IDDP.
Procedure DeleteRec Input: Edge e if (ancestor(e) 6= ∅) ref(ancestor(e)) ← ref(ancestor(e)) − 1 if (ref(ancestor(e)) = 0) DeleteRec(ancestor(e)) Delete(e)
;; Decrease reference counter ;; No remaining reference ;; Recursive call ;; Remove edge from memory
Algorithm 18.4 Recursive deletion of edges that are no longer part of any solution path.
of its head vertex. Note that in the event that the former parent loses its last child, propagation of deletions (see Alg. 18.4) can ensure that only those Closed nodes continue to be stored that belong to some solution path. Edge deletions can also ensure deletion of dependent vertex and coordinate data structures (not shown in the pseudo code). The other situation that gives rise to deletions is if immediately after the expansion of a node no children are pointing back to it (the children might either be reachable more cheaply from different nodes, or their f -value might exceed the threshold). The correctness of the algorithm can be shown analogously to the soundness proof of A*. If the threshold is smaller than δ(s, t), dynamic programming will terminate without encountering a solution; otherwise, only nodes are pruned that cannot be part of an optimal path. The invariant holds that there is always a node in each level that lies on an optimal path and is in the Open list. Therefore, if the algorithm terminates only when the heap runs empty, the best found solution stored will indeed be optimal. The iterative-deepening strategy results in an overhead computation time due to reexpansions, and we are trying to restrict this overhead as much as possible. More precisely, we want to minimize the ratio ν = nIDDP /nA∗ , where nIDDP and nA∗ denote the number of expansions in IDDP and A*, respectively. We choose a threshold sequence U1 , U2 , . . . such that the number of expansions ni in
18.2 Multiple Sequence Alignment
767
stage i satisfies ni = 2ni−1 ; if we can at least double ni in each iteration, we will expand at most four times as many nodes as A*. Procedure ComputeIncr stores the sequence of expansion numbers and thresholds from the previous search stages, and then uses curve fitting for extrapolation (in the first few iterations without sufficient data available, a very small default threshold is applied). We found that the distribution of nodes n(U) with an f -value smaller or equal to threshold U can be modeled very accurately according to the exponential approach n(U) = A · BU . Consequently, to attempt to double the number of expansions, we choose the next threshold according to Ui+1 = Ui + lg1 B . 2
18.2.4 Sparse Representation of Solution Paths When the search progresses along antidiagonals, we do not have to fear back leaks, and are free to prune Closed nodes. We only want to delete them lazily and incrementally when being forced to by the algorithm approaching the computer’s memory limit, however. When deleting an edge e, the backtrack pointers of its child edges that refer to it are redirected to the respective predecessor of e, the reference count of which is increased accordingly. In the resulting sparse solution path representation, backtrack pointers can point to any optimal ancestors. After termination of the main search, we trace back the pointers starting with the goal edge; this is outlined Alg. 18.5, which prints out the solution path in reverse order. Whenever an edge e points back to an ancestor e0 that is not its direct parent, we apply an auxiliary search from start edge e0 to goal edge e to reconstruct the missing links of the optimal solution path. The search threshold can now be fixed at the known solution cost; moreover, the auxiliary search can prune those edges that cannot be ancestors of e because they have some coordinate greater than the corresponding coordinate in e. Since also the shortest distance between e and e0 is known, we can stop at the first path that is found at this cost. To improve the efficiency of the auxiliary search even further, the heuristic could be recomputed to suit the new target. Therefore, the cost of restoring the solution path is usually marginal compared to that of the main search. Which edges are we going to prune, in which order? For simplicity, assume for the moment that the Closed list consists of a single solution path. According to the Hirschberg approach, we would keep only one edge, preferably lying near the center of the search space (e.g., on the longest antidiagonal), to minimize the complexity of the two auxiliary searches. With additional available space allowing us Procedure Path Input: Edges es , e Side effects: Output MSA solution if (e = es ) return if (target(ancestor(e)) 6= source(e)) IDDP(ancestor(e), e, f (e), f (e)) OutputEdge(e) Path(es , ancestor(e))
;; End of recursion ;; Relay node ;; Recursive path reconstruction ;; Print information ;; Continue path construction
Algorithm 18.5 Divide-and-conquer solution reconstruction in reverse order.
768
CHAPTER 18 Computational Biology
to store three relay edges, we would divide the search space into four subspaces of about equal size (e.g., additionally storing the antidiagonals halfway between the middle antidiagonal and the start node respectively the target node). By extension, to incrementally save space under diminishing resources we would first keep only every other level, then every fourth, and so on, until only the start edge, the target edge, and one edge halfway on the path would be left. Since in general the Closed list contains multiple solution paths (more precisely, a tree of solution paths), we would like to have about the same density of relay edges on each of them. For the case of k sequences, an edge reaching level l with its head node can originate with its tail node from level l − 1, . . . , l − k. Thus, not every solution path passes through each level, and deleting every other level could result in leaving one path completely intact, while extinguishing another totally. Thus, it is better to consider contiguous bands of k levels each, instead of individual levels. Bands of this size cannot be skipped by any path. The total number of antidiagonals in an alignment problem of k sequences of length N is k · N − 1; thus, we can decrease the density in blg Nc steps. A technical implementation issue concerns the ability to enumerate all edges that reference some given prunable edge, without explicitly storing them in a list. However, the reference counting method described earlier ensures that any Closed edge can be reached by following a path bottom-up from some edge in Open. The procedure is sketched in Algorithm 18.6. The variable sparse denotes the interval between level bands that are to be maintained in memory. In the inner loop, all paths to Open nodes are traversed in a backward direction; for each edge e0 that falls into a prunable band, the pointer of the successor e on the path is redirected to its respective backtrack pointer. If e was the last edge referencing e0 , the latter one is deleted, and the path traversal continues up to the start edge. When all Open nodes have been visited and the memory bound is still exceeded, the outer loop tries to double the number of prunable bands by increasing sparse.
Procedure SparsifyClosed Input: Size n for each sparse in {1, . . . , blg nc} ;; Increase interval between stored level bands while (usedMem > maxMem and ∃e ∈ Open GetLastSparse(e) < sparse) pred ← ancestor(e) ;; Trace back solution path while (pred 6= ∅ and GetLastSparse(e) < sparse) SetLastSparse(sparse) ;; Mark to avoid repeated traceback if (blevel(GetHead(pred ))/kc mod 2sparse 6= 0) ;; In prunable band ancestor(e) ← ancestor(pred ) ;; Adjust pointer and . . . ref(ancestor(e)) ← ref(ancestor(e)) + 1 ;; . . . reference ref(pred ) ← ref(pred ) − 1 ;; Decrease reference count if (ref(pred ) = 0) ;; Last remaining edge referring to predecessor DeleteRec(pred ) ;; Predecessor not in prunable band else ;; Continue traversal e ← ancestor(e) ;; Choose continuation pred ← ancestor(e) ;; Set according predecessor Algorithm 18.6 Sparsification of Closed list under restricted memory.
18.2 Multiple Sequence Alignment
769
The procedure SparsifyClosed is called regularly during the search, for example, after each expansion. However, a naive version as described earlier would incur a huge overhead in computation time, particularly when the algorithm’s memory consumption is close to the limit. Therefore, some optimizations are necessary. First, we avoid tracing back the same solution path at the same (or lower) sparse interval by recording for each edge the interval when it was traversed the last time (initially zero); only for an increased variable sparse can there be anything left for further pruning. In the worst case, each edge will be inspected blg Nc times. Second, it would be very inefficient to actually inspect each Open node in the inner loop, just to find that its solution path has been traversed previously, at the same or higher sparse value; however, with an appropriate bookkeeping strategy it is possible to reduce the time for this search overhead to O(k).
18.2.5 Use of Improved Heuristics As we have seen, the estimator hpair , the sum of optimal pairwise goal distances, gives a lower bound on the actual path length. The tighter the estimator is, the smaller the search space the algorithm has to explore.
Beyond Pairwise Alignments Kobayashi and Imai suggested applying more powerful heuristics by considering optimal solutions for subproblems of size m > 2. They proved that the following heuristics are admissible and more informed than the pairwise estimate. k−2 . hall,m is the sum of all m-dimensional optimal costs, divided by m−2 hone,m splits the sequences into two sets of sizes m and k − m; the heuristic is the sum of the optimal cost of the first subset, plus that of the second one, plus the sum of all two-dimensional optimal costs of all pairs of sequences in different subsets. Usually, m is chosen close to k/2.
..
These improved heuristics can reduce the main search effort by orders of magnitudes. However, in contrast to pairwise subalignments, time and space resources devoted to compute and store higherdimensional heuristics are in general no longer negligible compared to the main search. Kobayashi and Imai noticed that even for the case m = 3 of triples of sequences, it can be impractical to compute the entire subheuristic hall,m . As one reduction, they show that it suffices to restrict the search to nodes where the path cost does not exceed the optimal path cost of the subproblem by more than X k−2 δ= U− d(si1 ,...,im , ti1 ,...,im ). m−2 i1 ,...,im
This threshold can be seen as a generalization of the Carrillo-Lipman bound. However, it can still incur excessive overhead in space and computation time for the computation of the mk lowerdimensional subproblems. A drawback is that it requires an upper bound, on which the accuracy of the algorithm’s efficiency also hinges. We could improve this bound by applying more sophisticated heuristic methods, but it seems counterintuitive to spend more time doing so that we would rather use to calculate the exact solution. In spite of its advantages for the main search, the expensiveness of the heuristic calculation appears as a major obstacle. An alternative is to partition the heuristic into (hyper-) cubes using a hierarchical oct-tree data structure; in contrast to “full” cells, “empty” cells only retain the values at their surface. When the
770
CHAPTER 18 Computational Biology
main search tries to use one of them, its interior values are recomputed on demand. Still, this work assumes that each node in the entire heuristic is calculated at least once using dynamic programming. One cause of the dilemma lies in the implicit assumption that a complete computation is necessary. The previous bound δ refers to the worst-case scenario, and can generally include many more nodes than actually required in the main search. However, since we are only dealing with the heuristic, we can actually afford to miss some values occasionally; although this might slow down the main search, it cannot compromise the optimality of the final solution. Therefore, we propose to generate the heuristics with a much smaller bound δ. Whenever the attempt to retrieve a value of the m-dimensional subheuristic fails during the main search, we simply revert to replacing it by the sum of the m2 -optimal pairwise goal distances it covers. The IDDP algorithm lends itself well to make productive use of higher-dimensional heuristics. First and most important, the strategy of searching to adaptively increasing thresholds can be transferred to the δ-bound as well. Second, as far as a practical implementation is concerned, it is important to take into account not only how a higher-dimensional heuristic affects the number of node expansions, but also their time complexity. This time is dominated by the number of accesses to subalignments. With k sequences, in the worst case an edge has 2k − 1 successors, leading to a total of (2k − 1) mk evaluations for hall,m . One possible improvement is to enumerate all edges emerging from a given vertex in lexicographic order, and to store partial sums of heuristics of prefix subsets of sequences for In this way, if we P later ireuse. i−1 ; allow for a cache of linear size, the number of accesses is reduced to i=k 2 i=m m−1 correspondingly, Pi=k i i−2 for a quadratic cache we only need i=m 2 m−2 evaluations. For instance, in aligning 12 sequences using hall,3 , a linear cache reduces the evaluations to about 37% within one expansion. As mentioned earlier, in contrast to A*, IDDP gives us the freedom to choose any particular expansion order of the edges within a given level. Therefore, when we sort edges lexicographically according to the target nodes, much of the cached prefix information can be shared additionally across consecutively expanded edges. The higher the dimension of the subalignments, the larger the savings.
Trade-Off between Computation of Heuristic and Main Search As we have seen, we can control the size of the precomputed subalignments by choosing the bound δ up to which f -values of edges are generated beyond the respective optimal solution cost. There is obviously a trade-off between the auxiliary and main searches. It is instructive to consider the heuristic miss ratio r, the fraction of calculations of the heuristic h during the main search when a requested entry in a partial Multiple Sequence Alignment has not been precomputed. The optimum for the main search is achieved if the heuristic has been computed for every requested edge (r = 0). Going beyond that point will generate an unnecessarily large heuristic containing many entries that will never be actually used. On the other hand, we are free to allocate less effort to the heuristic, resulting in r > 0 and consequently decreasing performance of the main search. Generally, the dependence has an S-shaped form. Unfortunately, in general we do not know in advance the right amount of auxiliary search. As mentioned earlier, choosing δ according to the Carrillo-Lipman bound will ensure that every requested subalignment cost will have been precomputed; however, in general we will considerably overestimate the necessary size of the heuristic.
18.3 Bibliographic Notes
771
As a remedy, algorithm IDDP gives us the opportunity to recompute the heuristic in each threshold iteration in the main search. In this way, we can adaptively strike a balance between the two. When the currently experienced fault rate r rises above some threshold, we can suspend the current search, recompute the pairwise alignments with an increased threshold δ, and resume the main search with the improved heuristics. Like for the main search, we can accurately predict the auxiliary computation time and space at threshold δ using an exponential fitting. Due to the lower dimensionality, it will generally increase less steeply; however, the constant factor might be higher for the heuristic, due to the combinatorial number of mk alignment problems to be solved. A doubling scheme as explained previously can bound the overhead to within a constant factor of the effort in the last iteration. In this way, when also limiting the heuristic computation time by a fixed fraction of the main search, we can ensure as an expected upper bound that the overall execution time stays within a constant factor of the search time that would be required when using only the pairwise heuristic. If we knew the exact relation between δ, r, and the speedup of the main search, an ideal strategy would double the heuristic whenever the expected computation time is smaller than the time saved in the main search. However, this dependence is more complex than simple exponential growth; it varies with the search depth and specifics of the problem. Either we would need a more elaborate model of the search space, or the algorithm would have to conduct explorative searches to estimate the relation.
18.3 BIBLIOGRAPHIC NOTES Gusfield (1997) and Waterman (1995) have given comprehensive introductions to computational molecular biology. The definition of a pathway has been given by Thagard (2003). The mammalian cell cycle control has been described by Kohn (1999). It appeared as an application domain in the fifth international planning competition in 2006, where it was modeled by Dimopoulos, Gerevini, and Saetti. A recent search tool for the alignment of metabolic pathways has been presented by Pinter, Rokhlenko, Yeger-Lotem, and Ziv-Ukelson (2005). Given a query pathway and a collection of pathways, it finds and reports all approximate occurrences of the query in the collection. Bosnacki (2004) has indicated a natural analogy between biochemical networks and (concurrent) systems with an unknown structure. Both are considered as a black box with unknown internal workings about which we want to check some property; that is, verify some hypothesis about their behavior. Test sequences can be casted as counterexamples obtained by search as observed by Engels, Feijs, and Mauw (1997). A suitable algorithm for inducing a model of a system has been developed by Angluin (1987). The algorithm requires an oracle that in this case is substituted by a conformance testing. Unlike model checking that is applied to the model of the system, (conformance) testing is performed on the system implementation. Also, conformance testing does not try to cover all execution sequences of the implementation. Rather than understanding the networks, the goal of Rao and Arkin (2001) is to design biological networks for a certain task. FASTA and BLAST (see Altschul, Gish, Miller, Myers, and Lipman, 1990), are standard methods for database searches. Davidson (2001) has employed a local beam search scheme. Gusfield (1993) has proposed an approximation called the star-alignment. Out of all the sequences to be aligned, one consensus sequence is chosen such that the sum of its pairwise alignment costs to the rest of the
772
CHAPTER 18 Computational Biology
sequences is minimal. Using this “best” sequence as the center, the other ones are aligned using the “once a gap, always a gap” rule. Gusfield has shown that the cost of the optimal alignment is greater than or equal to the cost of this star alignment, divided by (2 − 2/k). The program MSA due to Gupta, Kececioglu, and Schaffer (1996) allows the user to adjust δ to values below the Carrillo-Lipman bound individually for each pair of sequences (Carrillo and Lipman, 1988). For Multiple Sequence Alignment problems in higher dimensions, A* is clearly superior to dynamic programming. However, in contrast to the Hirschberg algorithm, it still has to store all the explored nodes in the Closed list to avoid “back leaks.” As a remedy, Korf (1999) and Korf and Zhang (2000) have proposed to store a list of forbidden operators with each node, or to place the parents of a deleted node on Open with an f -value ∞. The approach by Zhou and Hansen (2004a) only requires the boundary to be stored. The main algorithm IDDP as described in this chapter has been published by Schro¨ dl (2005). The work by Korf, Zhang, Thayer, and Hohwald (2005) refers to a related incremental dynamic programming algorithm called iterative-deepening bounded dynamic programming. McNaughton, Lu, Schaeffer, and Szafron (2002) have suggested an oct-tree data structure for storing the heuristic function. A different line of research tries to restrict the search space of the breadth-first approaches by incorporating bounds. Ukkonen (1985) has presented an algorithm for the pairwise alignment problem, which is particularly efficient for similar sequences; its computation time scales as O(dm), where d is the optimal solution cost. Another approach for Multiple Sequence Alignment is to make use of the lower bounds h from A*. The key idea is the following: Since all nodes with an f -value lower than δ(s, t) have to be expanded anyway to guarantee optimality, we might as well explore them in any reasonable order, like that of Dijkstra’s algorithm or dynamic programming, if we only knew the optimal cost. Even slightly higher upper bounds will still help pruning. Spouge (1989) has proposed to bound dynamic programming to nodes v where g(v) + h(v) is smaller than an upper bound for δ(s, t). Linear bounded diagonal alignment (LBD-Align) by Davidson (2001) uses an upper bound to reduce the computation time and memory in solving a pairwise alignment problem by dynamic programming. The algorithm calculates the dynamic programming matrix one antidiagonal at a time, starting in the top-left corner, and working down toward the bottom-right corner. While A* would have to check the bound in every expansion, LBD-Align only checks the top and bottom cell of each diagonal. If, for example, the top cell of a diagonal has been pruned, all the remaining cells in that row can be pruned as well, since they are only reachable through it; this means that the pruning frontier on the next row can be shifted one down. Thus, the pruning overhead can be reduced from a quadratic to a linear amount in terms of the sequence length. Progresses have been made to improve the scaling of the Multiple Sequence Alighnment algorithms. Niewiadomski, Amaral, and Holte (2006) have applied large-scale parallel frontier search with delayed duplicate detection to solve challenging (Balibase) instances, and Zhou and Hansen (2006a) have successfully improved the sparse-memory graph search with a breadth-first heuristic search.
CHAPTER
Robotics
19 Sven Koenig and Craig Tovey
A difference between search in robotics and typical search testbeds in artificial intelligence, like the Eight-puzzle or the Rubik’s cube, is that state spaces in robotics are continuous and need to be discretized. Another difference is that robots typically have a priori incomplete knowledge of the state spaces. In these cases, they cannot predict with certainty which observations they will make after they have moved nor the feasibility or outcomes of their future moves. Thus, they have to search in nondeterministic state spaces, which can be time consuming due to the large number of resulting contingencies. Complete AND-OR searches (i.e., minimax searches) minimize the worst-case trajectory length but are often intractable since the robots have to find large conditional plans. Yet, search has to be fast for robots to move smoothly. Thus, we need to speed up search by developing robot-navigation methods that sacrifice the minimality of their trajectories.
19.1 SEARCH SPACES Consider the motion-planning problem of changing an unblocked start configuration of a robot to a goal configuration. This is a search problem in the configuration space, where the configuration of a robot is typically specified as a vector of real numbers. For example, the configuration of a mobile robot that is omnidirectional and not subject to acceleration constraints is given by its coordinates in the workspace. Configurations are either unblocked (i.e., possible or, alternatively, in freespace) or blocked (i.e., impossible or, alternatively, part of obstacles). Configurations are blocked, for example, because the robot would intersect an obstacle in the workspace. The configuration space is formed by all configurations. An example motion-planning problem in a two-dimensional workspace with a robot arm that has two joints and is bolted to the ground at the first joint is shown in Figure 19.1(a). An obstacle blocks one quadrant of the plane. The robot arm has to move from its start configuration to the goal configuration. There are different choices of defining the configuration space. If we only want to find an unblocked trajectory from the start configuration to the goal configuration then the choice is usually unimportant. However, if the planning objective includes the optimization of some cost, such as minimizing time or energy, then it is preferable to define the configuration space so that this cost is represented as a norm-induced or other natural metric on the configuration space. One configuration space is shown in Figure 19.1(b), where the configurations are given by the two joint angles θ1 and θ2 . The region in the
773
774
CHAPTER 19 Robotics
Goal configuration
θ1 θ2
Start configuration
(a) Workspace θ2 − θ1
θ2 360°
360°
Goal vertex
270°
270°
180°
180° Start vertex
90° 0°
0°
90°
180°
90°
270°
(b) Configuration space 1
360°
θ1
0°
Start vertex 0°
90°
Goal vertex 180°
270°
360°
θ1
(c) Configuration space 2
FIGURE 19.1 Robot arm example.
figure wraps around because angles are measured modulo 360◦ , so that the four corners in the figure represent the same configuration. Some configurations are blocked because the robot arm would intersect an obstacle in the workspace (but they could also be blocked because a joint angle is out of range). Horizontal movement in the figure requires the robot arm to actuate both joints. Movement along the diagonal with slope one results if only the first joint actuates. Thus, horizontal movement requires more energy than diagonal movement, contrary to what the figure suggests visually. It may then be preferable to define the vertical axis of the configuration space as θ2 − θ1 , as shown in Figure 19.1(c). Robot moves in the workspace are continuous out of physical necessity. The configuration space is therefore continuous and thus needs to get discretized to allow us to use search methods to find trajectories from the start configuration to the goal configuration. We model the configuration space ˆ V, E), where Vˆ is the set of (blocked and unblocked) vertices, as a (vertex-blocked) graph G = (V, ˆ V ⊆ V is the set of unblocked vertices, and E ⊆ Vˆ × Vˆ is the set of edges. The configuration of the robot is represented by exactly one unblocked vertex at any instant. We say, for simplicity, that the robot visits that vertex. Edges connect vertices that correspond to configurations that the robot
19.1 Search Spaces
775
can potentially move between. The vertices are blocked or unblocked depending on whether the corresponding configurations are blocked or unblocked. The robot needs to move on a trajectory in the resulting graph from the vertex that corresponds to the start configuration to the vertex that corresponds to the goal configuration. We assume that paths and trajectories do not contain blocked vertices (unless stated otherwise) and measure their lengths as well as all other distances in number of moves (i.e., edge traversals). We can obtain the graph in different ways.
.
We can obtain the graph by partitioning the configuration space into cells (or some other regular or irregular tessellation of the space), where a cell is considered unblocked if and only if it does not contain obstacles. The vertices are the cells and are unblocked if and only if the corresponding cells are unblocked. Edges connect adjacent cells (i.e., cells that share a border) and are thus (about) equally long. One problem is the granularity of the discretization. If the cells are large, then an existing trajectory might not be found, as shown in Figure 19.2. Blocked configurations are black, and unblocked configurations are white. The circle and cross show the start and goal configuration, respectively. On the other hand, the smaller we make the cells, the more numerous they become, which results in a quadratic explosion. It can therefore make sense to have cells of different sizes: small cells close to obstacles in configuration space to be able to find gaps between them and large cells otherwise. One particular method for obtaining a nonuniform discretization is the parti-game algorithm. It starts with large cells and splits them as needed while trying to move the robot from the start configuration to the cell that contains the goal configuration (goal cell). A simplified version of the parti-game algorithm is illustrated in Figure 19.3. It starts with a uniform coarse-grained discretization of the configuration space. The vertices of the graph represent the cells, and edges connect vertices that correspond to adjacent cells. Thus, it initially ignores obstacles and makes the optimistic assumption that it can move from each cell to any adjacent cell ( freespace assumption). It uses the graph to find a shortest path from its current cell to the goal cell. It then follows the path
(a) Uniform coarse-grained discretization
(b) Uniform fine-grained discretization
FIGURE 19.2 Cell-based discretization.
776
CHAPTER 19 Robotics
FIGURE 19.3 Parti-game algorithm.
by always moving toward the center of the successor cell of its current cell. If it gets blocked by an obstacle (which can be determined in the workspace and thus without modeling the shape of obstacles in the configuration space), then it is not always able to move from its current cell to the successor cell and therefore removes the corresponding edge from the graph. It then replans and finds another shortest path from its current cell to the goal cell. If it finds such a path, then it repeats the process. If it does not find such a path, then it uses the graph to determine from which cells it can reach the goal cell (solvable cells) and from which cells it cannot reach the goal cell (unsolvable cells, shaded gray in the figure). It then splits all unsolvable cells that border solvable cells (and have not yet reached the resolution limit) along their shorter axes. (It also splits all solvable cells that border unsolvable cells along their shorter axes to prevent adjacent cells from having very different sizes, which is not necessary but makes it efficient to determine the neighbors of a cell with kd-trees.) It deletes the vertices of the split cells from the graph and adds one vertex for each new cell, again assuming that it can move from each new cell to any adjacent cell and vice versa. (It could remember where it got blocked by obstacles to delete some edges from the graph right away but does not. Rather, it deletes the edges automatically when it gets blocked again by the obstacles in the future.) It then replans and finds another shortest path from its current cell to the goal cell and repeats the process until the goal cell is reached or no cell can be split any further because the resolution limit is reached. The final discretization is then used as initial discretization for the next motion-planning problem in the same configuration space.
19.2 Search under Incomplete Knowledge
.
777
We can also obtain the graph by picking a number of unblocked configurations (including the start and goal configurations). The vertices are these configurations and are unblocked. Edges connect vertices of which the connecting straight line (or path of some simple controller) does not pass through obstacles (which can perhaps be determined in the workspace and thus without modeling the shapes of obstacles in the configuration space). We can leave out long edges (e.g., edges longer than a threshold) to keep the graph sparse and the edges about equally long. In case all obstacles are polygons, we can pick the corners of the polygons as configurations (in addition to the start and goal configurations). The resulting graph is called the visibility graph. A shortest trajectory in the visibility graph is also a shortest trajectory in a two-dimensional configuration space (but not necessarily in a three- or higher-dimensional configuration space). However, the obstacles are often not polygons and can only be approximated with complex polygons, resulting in a large number of configurations and thus large search times. Probabilistic roadmaps therefore pick a number of unblocked configurations randomly (in addition to the start and goal configurations). The larger the number of picked configurations, the larger the search time tends to be. On the other hand, the larger the number of picked configurations, the more likely it is that a trajectory is found if one exists and the shorter the trajectory tends to be. So far, we assumed that the configuration space is first discretized and then searched. However, it is often faster to pick random configurations during the search. Rapidly exploring random trees, for example, grow search trees by picking configurations randomly and then try to connect them to the search tree.
There are also other models of the configuration space, for example, Voronoi graphs, which have the advantage that trajectories remain as far away from obstacles as possible and the safety distance to obstacles is thus maximal. By definition, the robot cannot leave the connected component of unblocked vertices in which it starts. We therefore assume that the graph has only one component of unblocked vertices (i.e., that there is a path between any two unblocked vertices). We draw our examples principally from robotnavigation problems in (two-dimensional four-neighbor) grid graphs, where the configuration space is the workspace itself, and thus use the terms “terrain” and “position” in the following instead of “configuration space” and “configuration.” In general, grid graphs model (two-dimensional four-neighbor) Gridworlds of square cells. Gridworlds (including evidence and occupancy grids) are widely used to model the terrain of mobile robots by partitioning it into square cells, lend themselves readily to illustration, and form challenging testbeds for search under a priori incomplete knowledge.
19.2 SEARCH UNDER INCOMPLETE KNOWLEDGE We assume that the graph is undirected and make the following minimal assumptions about the robot capabilities throughout this chapter, called the base model: The robot is able to move from its current vertex to any desired adjacent unblocked vertex. The robot is capable of error-free moves and observations. For example, it can identify its absolute position with GPS or its relative position with respect to its start position with dead-reckoning (which keeps track of how the robot has moved in the terrain). The robot is able to identify vertices uniquely, which is equivalent to each vertex having a unique identifier that the robot might a priori not know. The robot is able to observe at least the identifier and blockage status of its current vertex and all vertices adjacent to its current vertex. The robot always
778
CHAPTER 19 Robotics
1 2 3 4 5 6 7 8 A B C D E F (a) Example GRIDWORLD
(b) Graph (terrain)
(c) Graph with blocked vertices removed (freespace)
FIGURE 19.4 Different kinds of graphs.
makes the same observation when it visits the same vertex. The robot is able to remember the sequence of moves that it has executed and the sequence of observations it has made in return. The base model guarantees that the robot can maintain the subgraph of the graph, including the vertices (with their identifiers and their blockage status) and the edges (i.e., vertex neighborships) that the robot either a priori knew about or has observed already. In a minimal base model, the robot is able to observe exactly the identifier of its current vertex and the identifier and blockage status of all vertices adjacent to its current vertex. We will give an example of a robot that has the capabilities required by the minimal base model shortly in the context of Figure 19.4.
19.3 FUNDAMENTAL ROBOT-NAVIGATION PROBLEMS Robots typically have a priori only incomplete knowledge of their terrain or their current position. We therefore study three fundamental robot-navigation problems under a priori incomplete knowledge that underlie many other robot-navigation problems.
19.3 Fundamental Robot-Navigation Problems
779
Mapping means to obtain knowledge of the terrain, often the blockage status of all positions, called a map. There are two common approaches of handling a priori incomplete knowledge of the terrain. The first approach of handling incomplete knowledge of the terrain is characterized by the robot a priori knowing the topology of the graph. The second approach of handling a priori incomplete knowledge of the terrain is characterized by the robot a priori not knowing anything about the graph, not even its topology. The objective of the robot is to know everything about the graph that it possibly can, including its topology and the blockage status of every vertex. The robot either a priori knows the topology of the graph and the identifier of each vertex but not which vertices are blocked (Assumption 1) or neither the graph nor the identifier or blockage status of each vertex (Assumption 2). Assumption 1 is a possible assumption for grid graphs, and Assumption 2 is a possible assumption for grid graphs, visibility graphs, probabilistic roadmaps, and Voronoi graphs. The graph can contain blocked and unblocked vertices under Assumption 1 but contains only unblocked vertices under Assumption 2. An example Gridworld is shown in Figure 19.4(a). Blocked cells (and vertices) are black, and unblocked cells are white. The circle shows the current cell of the robot. We assume that the robot has only the capabilities required by the minimal base model. It always observes the identifier and blockage status of the adjacent cells in the four compass directions and then moves to an unblocked adjacent cell in one of the four compass directions, resulting in a grid graph. This grid graph is shown in Figure 19.4(b) for Assumption 1 and in Figure 19.4(c) for Assumption 2. Initially, the robot knows that it visits cell E2 and observes that cells E1 and F2 are blocked and cells E3 and D2 are unblocked. We denote this observation using a “+” for an unblocked adjacent cell and a “−” for a blocked adjacent cell in the compass directions north, west, south, and east (in this order). Thus, the initial observation of the robot is denoted as “D2 +, E1 −, F2 −, E3 +” or “+ − − +” in short. The example in Figure 19.5 shows that it can make a difference whether we make Assumption 1 or 2. The robot moves along the arrow. Figures 19.5(c) and (d) show the knowledge of the robot. Cells (and vertices) that the robot knows to be blocked are black, cells (and vertices) that the robot knows to be unblocked are white, and cells (and vertices) of which the blockage status is unknown to the robot are gray. The circle shows the current cell of the robot. The robot needs to enter the center cell to rule out the possibility that it operates in the graph shown in Figure 19.6 under Assumption 2. On the other hand, it does not need to enter the center cell to know the graph under Assumption 1. Localization means to identify the current position of a robot, usually a mobile robot rather than a robot arm. We assume that the robot has a map of the terrain available and a priori knows its orientation relative to the map (e.g., because it is equipped with a compass) but not its start position. The robot a priori knows the graph, including which vertices are blocked. Its objective is to localize, which means to identify its current vertex or the fact that its current vertex cannot be identified uniquely because the a priori known map has at least two isomorphic connected components of unblocked vertices and it is located in one of them. The robot a priori does not know the identifier of each vertex. Thus, the robot is not trivially localized after it observes the identifier of a vertex. This assumption is, for example, realistic if the robot uses dead-reckoning to identify the vertices. Goal-directed navigation in a priori unknown terrain means to move a robot to a goal position in a priori unknown terrain. The robot a priori knows the topology of the graph and the identifier of each vertex but not which vertices are blocked. It knows the goal vertex but may not know the geometric embedding of the graph. Its objective is to move to the goal vertex.
780
CHAPTER 19 Robotics
1
2
3
A B C (a) Example GRIDWORLD
(b) Graph
(c) Knowledge of the robot: Assumption 1
(d) Knowledge of the robot: Assumption 2
FIGURE 19.5 A priori knowledge of the graph.
FIGURE 19.6 Alternative graph.
19.4 SEARCH OBJECTIVE We perform a worst-case analysis of the trajectory length because robot-navigation methods with small worst-case trajectory lengths always perform well, which matches the concerns of empirical robotics researchers for guaranteed performance. We describe upper and lower bounds on the worst-case trajectory length in graphs with the same number of unblocked vertices. The lower bounds are usually proved by example and thus need to be derived scenario by scenario since the trajectories depend on both the graph and the knowledge of the graph. The upper bounds, however, hold for all scenarios
19.5 Search Approaches
781
of topologies of graphs and observation capabilities of the robot that are consistent with the base model. Researchers sometimes use online rather than worst-case criteria to analyze robot-navigation methods. For example, they are interested in robot-navigation methods with a small competitive ratio. The competitive ratio compares the trajectory length of a robot to the trajectory length needed by an omniscient robot with complete a priori knowledge to verify that knowledge. For localization, for example, the robot a priori knows its current vertex and only needs to verify it. Minimizing the ratio of these quantities minimizes regret in the sense that it minimizes the value of k such that the robot could have localized k times faster if it had a priori known its current vertex. The competitive ratio has little relation to the worst-case trajectory length if robots do not have complete a priori knowledge. Furthermore, the difference in trajectory length between robot-navigation methods that do and do not have a priori complete knowledge is often large. For goal-directed navigation, for example, the robot can follow a shortest path from the start vertex to the goal vertex if it a priori knows the graph, but usually has to try out many promising paths on average to get from the start vertex to the goal vertex if it a priori does not know the graph. This trajectory length can increase with the number of unblocked vertices while the shortest path can remain of constant length, making the competitive ratio arbitrarily large.
19.5 SEARCH APPROACHES A robot is typically able to observe the identifier and blockage status of only those vertices that are close to its current vertex. The robot thus has to move in the graph to observe the identifier and blockage status of new vertices, either to discover more about the graph or its current vertex. Therefore, it has to find a reconnaissance plan that determines how it should move to make new observations, which is called sensor-based search. The reconnaissance plan is a conditional plan that can take into account the a priori knowledge of the robot and the entire knowledge that it has already gathered (namely, the sequence of moves that it has executed and the sequence of observations it has made in return) when determining the next move of the robot. A deterministic plan specifies the move directly while a randomized plan specifies a probability distribution over the moves. No randomized plan that solves one of the robot-navigation problems has a smaller average worst-case trajectory length (where the average is taken with respect to the randomized choice of moves by the randomized plan) than a deterministic plan with minimal worst-case trajectory length. We therefore consider only deterministic plans. The robot can either first determine and then execute a complete conditional plan (offline search) or interleave partial searches and moves (online search). We now discuss these two options in greater detail, using localization as an example. Localization consists of two phases, namely hypothesis generation and hypothesis elimination. Hypothesis generation determines all vertices that could be the current vertex of the robot since they are consistent with the current observation made by it. This phase simply involves going through all unblocked vertices and eliminating those that are inconsistent with the observation. If the set contains more than one vertex, hypothesis elimination then tries to determine which vertex in this set is the current vertex by moving the robot in the graph. We discuss in the following how hypothesis elimination can use search to determine how to move the robot.
782
CHAPTER 19 Robotics
19.5.1 Optimal Offline Search Offline search finds a complete and thus potentially large conditional plan before the robot starts to move. A valid localization plan eventually correctly identifies either the current vertex of the robot or the fact that the current vertex cannot be identified uniquely, no matter which unblocked vertex the robot starts in. Consider, for example, the localization problem from Figure 19.7. Figure 19.8 shows part of the state space that the robot can move to from the start state. The states are sets of cells, namely the cells that the robot could be in. Initially, the robot observes “+ − − −”. The question marks indicate the cells that are consistent with this observation, namely cells E2, E4, and E6. The start state thus contains these three cells. (The robot can rule out cell B7 since it knows its orientation relative to the map.) Every state that contains only one cell is a goal state. In every nongoal state, the robot can choose a move (OR nodes of the state space), described as a compass direction. It then makes a new observation (AND nodes of the state space). The state space is nondeterministic since the robot cannot always predict the observation and thus the successor state resulting from a move. Deterministic localization plans assign a move to each OR node in the state space. Valid deterministic localization plans with minimal worst-case trajectory length can be found with a complete AND-OR search (i.e., minimax search), resulting in decision trees (i.e., trees where the root is the start state, all leaf nodes are goal states, every AND node has all of its successor nodes included, and every OR node has at most one of its successor nodes included) since states cannot repeat in valid localization plans with minimal worst-case trajectory length. Such a decision tree is shown in Figure 19.9. However, it is intractable to perform a complete AND-OR search. This is not surprising since the states are sets of unblocked vertices and their number is thus large (although not all sets of
1 2 3 4 5 6 7 8 A B C D E F (a) Example GRIDWORLD
{E2,E4,E6}
{D2,D4,D6}
{C2,C4,C6}
{B4,B6}
(b) Knowledge of the robot
FIGURE 19.7 Greedy localization.
{B5}
19.5 Search Approaches
783
Start {E2,E4,E6} n: + − + −
{E4,E6}
s: + − − −
n: + − + −
{D2,D4,D6} n: + − + −
{D4,D6}
s: + − + −
n: + − + −
{C2,C4,C6} −−++
n
e: − + + +
−+−+ {B5} Goal
{B3,B5}
{B2} Goal
w
s: + − + −
{B4,B6}
w: −+−+
−−++
s: + − + −
{C4,C6}
− + + + n: − + + +
{B2} Goal
s: + − − −
e
−+−− {B7} Goal
−+++ {B4} Goal
FIGURE 19.8 Partial state space for localization. {E2,E4,E6}
n: + − + − {D2,D4,D6}
n: + − + − {C2,C4,C6} n −−++ −+++
{B2} {B4,B6} Goal e −+−+ −+−− {B5} {B7} Goal Goal
FIGURE 19.9 Localization plan with minimal worst-case trajectory length.
unblocked vertices can appear in practice). In fact, it is NP-hard to localize with minimal worstcase trajectory length and thus very likely needs exponential search time, which is consistent with results that show the complexity of offline search under a priori incomplete knowledge to be high in general.
784
CHAPTER 19 Robotics
19.5.2 Greedy Online Search To search fast, we need to speed up search by developing robot-navigation methods that sacrifice the minimality of their trajectories. If done correctly, the suboptimality of the trajectory and thus the increase in the execution time are outweighed by the decrease of the search time so that the sum of search and execution times (i.e., the problem-completion time) decreases substantially, which is the idea behind limited rationality. For robot-navigation problems under a priori incomplete knowledge, this can be done by interleaving searches and moves to obtain knowledge about the graph or the current vertex in the graph early and then using this knowledge for the new searches right away. This knowledge makes subsequent searches faster since it reduces the uncertainty of the robot about the graph or its current vertex, which reduces the size of the state space that the robot can move to from its current state and thus also the amount of search performed for unencountered situations. Search in deterministic state spaces is fast. Greedy online search makes use of this property to solve search problems in nondeterministic state spaces by interleaving myopic searches in deterministic state spaces and moves. The result is a trade-off between search and execution time. We now introduce two greedy online search approaches, namely agent-centered search and assumption-based search. They differ in how they make search deterministic. Agent-centered search methods (in nondeterministic state spaces) search with limited lookahead by performing partial AND-OR searches, forward from the current state, instead of a complete one. They restrict the search to the part of the state space around the current state (resulting in local search), which is the part of the state space that is immediately relevant for the robot in its current situation because it contains the states that the robot will soon be in. Thus, agent-centered search methods decide on the part of the state space to search and then how to move within it. Then, they execute these moves (or only the first move) and repeat the overall process from the resulting state. Consequently, agent-centered search methods avoid a combinatorial explosion by finding only prefixes of complete plans. Since agent-centered search methods do not search all the way from the current state of the robot to a goal state, they need to avoid moving in a way that cycles forever. The agent-centered search methods that we describe in this chapter do this by making the lookahead large enough so that the subsequent execution obtains new knowledge, although real-time heuristic search methods can be used to get away with smaller lookaheads. Furthermore, the agent-centered search methods that we describe in this chapter use a simple approach to make search fast, namely by searching exactly in all of the deterministic part of the non-deterministic state space around the current state, with the objective to execute a move with more than one possible successor state and thus obtain new knowledge quickly. This is the part of the state space in Figure 19.8 that has a border around it. The robot then traverses the path, the last move of which has more than one possible successor state. It then observes the resulting state and repeats the process from the state that actually resulted from the move instead of all states that could have resulted from it. Figure 19.10(b) illustrates agent-centered search. The shaded areas represent the search spaces of agent-centered search, one for each search episode between consecutive moves. The shaded areas together are much smaller than the shaded area of the large triangle in Figure 19.10(a) that represents the search space of an optimal offline search method but the resulting trajectory is not shortest. Assumption-based search methods, on the other hand, search all the way from the current state to a goal state but make assumptions about the successor states of moves by ignoring some of them.
19.5 Search Approaches
Start
785
Goal
(a) Optimal offline search
Start
Goal
(b) Agent-centered search Trajectory anticipated during the first search episode Start
Actual trajectory
Goal
(c) Assumption-based search
FIGURE 19.10 Greedy online search.
Therefore, assumption-based search methods find a complete plan (under the assumptions made) from the current state to the goal state and execute the plan. If a move results in a successor state that was ignored during the search, then they repeat the overall process from the state that resulted from the move. Consequently, assumption-based search methods avoid a combinatorial explosion because they ignore some successor states of moves and thus do not consider all contingencies. The agentcentered search methods that we describe in this chapter use a simple approach to make search fast, namely by ignoring all successor states of each move but one, which makes the state space effectively deterministic.
786
CHAPTER 19 Robotics
Figure 19.10(c) illustrates assumption-based search. The shaded areas represent the search spaces of assumption-based search, one for each search episode. The shaded areas together are much smaller than the shaded area of the large triangle in Figure 19.10(a) that represents the search space of an optimal offline search method but the resulting trajectory is not shortest. Greedy online robot-navigation methods are commonsense robot-navigation methods that have often been discovered and implemented by empirical robotics researchers. We study greedy localization, greedy mapping, and search with the freespace assumption. They are related and can be analyzed in a common framework.
19.6 GREEDY LOCALIZATION Greedy localization uses agent-centered search to localize a robot. Greedy localization maintains a set of hypotheses, namely the unblocked vertices that the robot could be in because they are consistent with all previous observations. It always reduces the size of this set with as few moves as possible, until this is no longer possible. This corresponds to moving on a shortest path from its current vertex to a closest informative vertex until it can no longer move to an informative vertex. We define an informative vertex to be an unblocked vertex with the property that the robot can obtain knowledge about its current vertex that allows it to reduce the size of its set of hypotheses. Note that a vertex becomes and remains uninformative once the robot has visited it. Figure 19.7 illustrates the trajectory of greedy localization. Initially, it can be in cells E2, E4, and E6. The fastest way to reduce the size of the set of hypotheses in this situation is to move north twice. It could then observe “− − + +”, in which case it must be in cell B2. It could also observe “− + + +”, in which case it can be in cells B4 and B6. Either way, it has reduced the size of its set of hypotheses. After the robot executes the moves, it observes “− + + +” and thus can be in cells B4 and B6. The fastest way to reduce the size of its set of hypotheses in this situation is to move east. It could then observe “− + − +”, in which case it must be in cell B5. It could also observe “− + − −”, in which case it must be in cell B7. Either way, it has reduced the size of its set of hypotheses. After the robot executes the move, it observes “− + − +” and thus knows that it is cell B5 and has localized, in this particular case with minimal worst-case trajectory length. Greedy localization can use deterministic search methods and has low-order polynomial search times in the number of unblocked vertices because it performs an agent-centered search in exactly all of the deterministic part of the nondeterministic state space around the current state, namely exactly up to the instant when it executes a move that has more than one possible successor state and then reduces the size of its set of hypotheses, as shown with a border in Figure 19.8. It is NP-hard to localize better than logarithmically close to minimal worst-case trajectory length, including in grid graphs. Moreover, robots are unlikely to be able to localize in polynomial time with a trajectory length that is within a factor o(log2 |V|) of minimal. We analyze the worst-case trajectory length of greedy localization as a function of the number of unblocked vertices, where the worst case is taken over all graphs of the same number of unblocked vertices (perhaps with the restriction that localization is possible), and all start vertices of the robot and all tie-breaking strategies are used to decide which one of several equally close informative vertices to visit next. The worst-case trajectory length of
19.7 Greedy Mapping
787
|V|log|V| ˆ greedy localization is log log|V| moves in graphs G = (V, V, E) under the minimal base model and thus is not minimal. This statement continues to hold in grid graphs where localization is possible. It ˆ V, E) and thus is rather small. These results assume that the is O(|V|log|V|) moves in graphs G = (V, graph has only one connected component of unblocked vertices but that the a priori known map of the graph can be larger than the graph and contain more than one connected component of unblocked vertices.
19.7 GREEDY MAPPING Greedy mapping uses agent-centered search to learn a graph. The robot a priori knows either the topology of the graph and the identifier of each vertex but not which vertices are blocked or neither the graph nor the identifier or blockage status of each vertex. The robot maintains the currently known subgraph of the graph, regardless of what other knowledge it obtains. It always moves on a shortest path from its current vertex to a closest informative vertex in the currently known subgraph until it cannot move to an informative vertex any longer. We define an informative vertex to be an unblocked vertex with the property that the robot can obtain new knowledge for its map in it. Note that a vertex becomes and remains uninformative once the robot has visited it. (An alternative version of greedy mapping always moves to a closest unvisited vertex.) Figure 19.11 illustrates the trajectory of greedy mapping if the robot a priori knows the topology of the graph and the identifier of each vertex but not which vertices are blocked. Arrows show the paths determined by greedy mapping whenever greedy mapping determines them. The robot then traverses these paths without search, and an arrow is thus only shown for the first move on each path. Greedy mapping can use deterministic search methods and has a low-order polynomial search time in the number of unblocked vertices because it performs an agent-centered search in exactly all of the deterministic parts of the nondeterministic state space around the current state, namely exactly up to the instant when it executes a move that has more than one possible successor state and thus obtains new knowledge for its map. Greedy mapping has to search frequently. It can calculate the shortest paths from the current vertex to a closest informative vertex efficiently with incremental heuristic search methods, which combine two principles for searching efficiently, namely heuristic search (i.e., using estimates of the goal distances to focus the search) and incremental search (i.e., reusing knowledge obtained during previous search episodes to speed up the current one). We analyze the worst-case trajectory length of greedy mapping as a function of the number of unblocked vertices, where the worst case is taken over all graphs of the same number of unblocked vertices, and all possible start vertices of the robot and all possible tie-breaking strategies are used to decide which one of several equally close informative vertices to visit next. The worst-case trajectory |V|log|V| ˆ V, E) under the minimal base model length of greedy mapping is log log|V| moves in graphs G = (V, in case the robot a priori knows neither the graph nor the identifier or blockage status of each vertex. This statement continues to hold in grid graphs in case the robot a priori knows the topology of the graph and the identifier of each vertex but not which vertices are blocked. This lower bound shows that the worst-case trajectory length of greedy mapping is slightly superlinear in the number of unblocked vertices and thus not minimal (since the worst-case trajectory length of depth-first search is linear
788
CHAPTER 19 Robotics
1 2 3 4 5 6 7 8 A B C D E F (a) Example GRIDWORLD
(b) Knowledge of the robot
FIGURE 19.11 Greedy mapping.
19.8 Search with the Freespace Assumption
789
in the number of unblocked vertices). The worst-case trajectory length of greedy mapping is also ˆ V, E), whether the robot a priori knows the topology of the O(|V|log|V|) moves in graphs G = (V, graph or not. The small upper bound is close to the lower bound and shows that there is only a small penalty to pay for the following qualitative advantages of greedy mapping over depth-first search. First, greedy mapping is reactive to changes of the current vertex of the robot, which makes it easy to integrate greedy mapping into complete robot architectures because it does not need to have control of the robot at all times. Second, it is also reactive to changes in the knowledge that the robot has of the graph since each search makes use of all of the knowledge that the robot has of the graph. It takes new knowledge into account immediately when it becomes available and changes the moves of the robot right away to reflect its new knowledge. Uninformed real-time heuristic search methods can also be used for mapping graphs but their worstˆ V, E), whether the robot case trajectory lengths are typically 2(|V|2 ) moves or worse in graphs G = (V, a priori knows the topology of the graph or not, and thus is larger than the ones of greedy mapping.
19.8 SEARCH WITH THE FREESPACE ASSUMPTION Search with the freespace assumption uses assumption-based search for goal-directed navigation in a priori unknown terrain. Search with the freespace assumption maintains the blockage status of the vertices that the robot knows so far. It always moves on a shortest presumed unblocked path from its current vertex to the goal vertex until it visits the goal vertex or can no longer find a presumed unblocked path from its current vertex to the goal vertex. A presumed unblocked path is a sequence of adjacent vertices that does not contain vertices that the robot knows to be blocked. The robot moves on the presumed unblocked path toward the goal vertex but immediately repeats the process if it observes a blocked vertex on the planned path. Thus, it repeatedly makes the first move on a shortest presumed unblocked path from the current vertex to the goal vertex. This allows it to either follow the path successfully or obtain knowledge about the graph. If the robot visits the goal vertex, it stops and reports success. If it fails to find a presumed unblocked path from its current vertex to the goal vertex, it stops and reports that it cannot move to the goal vertex from its current vertex and, since the graph is undirected, neither from its start vertex. Figure 19.12 illustrates the trajectory of search with the freespace assumption. The cross shows the goal cell. Search with the freespace assumption can use deterministic search methods and has a loworder polynomial search time in the number of vertices (but not necessarily unblocked vertices). It can calculate the shortest presumed unblocked paths efficiently with incremental heuristic search methods. The computational advantage of incremental heuristic search methods, such as D* (Lite), over search from scratch is much larger for search with the freespace assumption than for greedy mapping. We analyze the worst-case trajectory length of search with the freespace assumption as a function of the number of unblocked vertices, where the worst case is taken over all graphs of the same number of unblocked vertices, and all start and goal vertices of the robot and all tie-breaking strategies are used to decide which one of several equally short presumed unblocked paths tomove along. The |V|log|V| worst-case trajectory length of search with the freespace assumption is log log|V| moves in graphs ˆ G = (V, V, E) under the minimal base model and thus is not minimal since the worst-case trajectory length of depth-first search is linear in the number of unblocked vertices. This statement continues ˆ V, E) and O(|V|log|V|) moves in to hold in grid graphs. It is O(|V|log2 |V|) moves in graphs G = (V,
790
CHAPTER 19 Robotics
1 2 3 4 5 6 7 8 A B C D E F (a) Example GRIDWORLD
(b) Knowledge of the robot
FIGURE 19.12 Search with the freespace assumption.
19.9 Bibliographic Notes
791
ˆ V, E), including grid graphs. The small upper bound is close to the lower bound planar graphs G = (V, and shows that there is only a small penalty to pay for the following qualitative advantages of search with the freespace assumption over depth-first search. First, search with the freespace assumptions attempts to move in the direction of the goal vertex. Second, it reduces its trajectory length over time (although not necessarily monotonically) when it solves several goal-directed navigation problems in the same terrain and remembers the blockage status of the vertices that the robot knows so far from one goal-directed navigation problem to the next one. Eventually, it moves along a shortest trajectory to the goal vertex because the freespace assumption makes it explore vertices with unknown blockage status and thus might result in the discovery of shortcuts.
19.9 BIBLIOGRAPHIC NOTES Overviews on motion planning and search in robotics have been given by Choset et al. (2005), LaValle (2006), and, for robot navigation in unknown terrain, Rao, Hareti, Shi, and Iyengar (1993). The partigame algorithm has been described by Moore and Atkeson (1995). Greedy online search is related to sensor-based search, which has been described by Choset and Burdick (1994). It can be implemented efficiently with incremental heuristic search methods, including D* by Stentz (1995) and D* Lite by Koenig and Likhachev (2005); see also the overview by Koenig, Likhachev, Liu, and Furcy (2004). Greedy localization has been described and analyzed by Mudgal, Tovey, and Koenig (2004); Tovey and Koenig (2000); and Tovey and Koenig (2010). It is implemented by the Delayed Planning Architecture (with the viable plan heuristic) by Genesereth and Nourbakhsh (1993) and Nourbakhsh (1997). Variants of greedy localization have been used by Fox, Burgard, and Thrun (1998) and Nourbakhsh (1996). Minimax LRTA* by Koenig (2001a) is a real-time heuristic search method that generalizes the Delayed Planning Architecture to perform agent-centered searches in only a part of the deterministic part of the nondeterministic state space. It deals with the problem that it might then not be able to reduce the size of its set of hypotheses and thus needs to avoid infinite cycles with a different method, namely real-time heuristic search. The NP-hardness of localization has been analyzed by Dudek, Romanik, and Whitesides (1998) and Koenig, Mitchell, Mudgal, and Tovey (2009). Guibas, Motwani, and Raghavan (1992) gave a geometric polynomial time method for robots with long-distance sensors in continuous polygonal terrain to determine the set of possible positions that are consistent with their initial observation. Localization has been studied principally with respect to the competitive ratio criterion of Sleator and Tarjan (1985), starting with Papadimitriou and Yannakakis (1991). Examples include Baeza-Yates, Culberson, and Rawlins (1993); Dudek, Romanik, and Whitesides (1998); Fleischer, Romanik, Schuierer, and Trippen (2001); and Kleinberg (1994). Greedy mapping has been described and analyzed by Koenig, Smirnov, and Tovey (2003) and Tovey and Koenig (2003). Variants of greedy mapping have been used by Thrun et al. (1998); Koenig, Tovey, and Halliburton (2001b); and Romero, Morales, and Sucar (2001). Mapping with depth-first search has been described by Wagner, Lindenbaum, and Bruckstein (1999). Mapping has been studied principally with respect to the competitive ratio criterion. Examples include Deng, Kameda, and Papadimitriou (1998); Hoffman, Icking, Klein, and Kriegel (1997); Albers and Henzinger (2000); and Deng and Papadimitriou (1990). Search with the freespace assumption has been described by Stentz (1995b) and described and analyzed by Koenig, Smirnov, and Tovey (2003); Mudgal, Tovey, Greenberg, and Koenig (2005);
792
CHAPTER 19 Robotics
and Mudgal, Tovey, and Koenig (2004). Variants of search with the freespace assumption have been used by Stentz and Hebert (1995) and, due to their work and follow-up efforts, afterwards widely in DARPA’s unmanned ground vehicle programs and elsewhere. Goal-directed navigation in a priori unknown terrain has been studied principally with respect to the competitive ratio criterion. Examples include Blum, Raghavan, and Schieber (1997) and Icking, Klein, and Langetepe (1999). The most closely related results to the ones described in this chapter are the bug algorithms by Lumelsky and Stepanov (1987).
Bibliography Adelson-Velskiy, G., Arlazarov, V., & Donskoy, M. (2003). Some methods of controlling the search tree in chess programs. Artificial Intelligence, 6(4), 361–371. Aggarwal, S., Alonso, R., & Courcoubetis, C. (1988). Distributed reachability analysis for protocol verification environments. In Discrete Event Systems: Models and Application, Vol. 103 of Lecture Notes in Control and Information Sciences (pp. 40–56). Aggarwal, A., & Vitter, J. S. (1987). Complexity of sorting and related problems. In ICALP no. (pp. 467–478). Aggarwal, A., & Vitter, J. S. (1988). The input/output complexity of sorting and related problems. Journal of the ACM, 31(9), 1116–1127. Agre, P., & Chapman, D. (1987). Pengi: An implementation of a theory of activity. In AAAI, (pp. 268–272). Aho, A. V., & Corasick, M. J. (1975). Efficient string matching: An aid to bibliographic search. Communications of the ACM, 18(6), 333–340. Ahuja, R. K., Magnanti, T. L., & Orlin, J. B. (1989). Networks flows. In Handbooks in Operation Research and Management Science. North-Holland. Ajwani, D., Malinger, I., Meyer, U., & Toledo, S. (2008). Graph search on flash memory. MPI-TR. Akers, S. B. (1978). Binary decision diagrams. IEEE Transactions on Computers, 27(6), 509–516. Albers, S., & Henzinger, M. (2000). Exploring unknown environments. SIAM Journal on Computing, 29(4), 1164– 1188. Alc´azar, V., Borrajo, D., & Linares L´opez, C. (2010). Using backwards generated goals for heuristic planning. In ICAPS (pp. 2–9). Allen, J. D. (2010). The Complete Book of Connect 4: History, Strategy, Puzzles. Sterling Publishing. Allis, L. V. (1998). A knowledge-based approach to connect-four. The game is solved: White wins. Master’s thesis, Vrije Univeriteit, The Netherlands. Allis, L. V., van der Meulen, M., & van den Herik, H. J. (1994). Proof-number search. Artificial Intelligence, 66, 91–124. Altschul, S., Gish, W., Miller, W., Myers, E., & Lipman, D. (1990). Basic local alignment search tool. Journal of Molecular Biology, 215, 403–410. Alur, R., & Dill, D. L. (1994). A theory of timed automata. Theoretical Computer Science, 126(2), 183–235. Ambite, J., & Knoblock, C. (1997). Planning by rewriting: Efficiently generating high-quality plans. In AAAI (pp. 706–713). Amir, A., Farach, M., Galil, Z., Giancarlo, R., & Park, K. (1994). Dynamic dictionary matching. Journal of Computer and System Sciences, 49(2), 208–222. Amir, A., Farach, M., Idury, R. M., La Poutr´e, J. A., & Sch¨affer, A. (1995). Improved dynamic dictionary matching. Information and Computation, 119(2), 258–282. Anantharaman, T. S., Campbell, M. S., & Hsu, F. H. (1990). Singular extensions: Adding selectivity to brute force search. Artificial Intelligence, 43(1), 99–110. Anderson, K., Schaeffer, J., & Holte, R. C. (2007). Partial pattern databases. In SARA (pp. 20–34). Angluin, D. (1987). Learning regular sets from queries and counterexamples. Information and Computation, 75, 87–106. Aragon, C. R., & Seidel, R. G. (1989). Randomized search trees. In FOCS (pp. 540–545). Arge, L. (1996). Efficient external-memory data structures and applications. PhD thesis, University of Aarhus. Arge, L., Knudsen, M., & Larsen, K. (1993). Sorting multisets and vectors in-place. In WADS (pp. 83–94). Arora, S. (1995). Probabilistic checking of proofs and hardness of approximation problems. Technical Report CS-TR-476-94, Princeton University.
793
794
Bibliography
Aspvall, B., Plass, M. B., & Tarjan, R. E. (1979). A linear-time algorithm for testing the truth of certain quantified Boolean formulas. Information Processing Letters, 8(3), 121–123. Atkinson, M. D., Sack, J. R., Santoro, N., & Strothotte, T. (1986). Min-max heaps and generalized priority queues. Communications of the ACM, 29, 996–1000. Auer, P., Cesa-Bianchi, N., & Fischer, P. (2002). Finite-time analysis of the multiarmed bandit problem. Machine Learning, 47(2/3), 235–256. Ausiello, G., Italiano, G., Marchetti-Spaccamela, A., & Nanni, U. (1991). Incremental algorithms for minimal length paths. Journal of Algorithms, 12(4), 615–638. Avriel, M. (1976). Nonlinear Programming: Analysis and Methods. Prentice-Hall. Bacchus, F., & Kabanza, F. (2000). Using temporal logics to express search control knowledge for planning. Artificial Intelligence, 116, 123–191. B¨ackstr¨om, C., & Nebel, B. (1995). Complexity results for SAS+ planning. Computational Intelligence, 11(4), 625–655. Baeza-Yates, R., Culberson, J., & Rawlins, G. (1993). Searching in the plane. Information and Computation, 2, 234–252. Baeza-Yates, R., & Gonnet, G. H. (1992). A new approach to text searching. Communications of the ACM, 35(10), 74–82. Bagchi, A., & Mahanti, A. (1983). Search algorithms under different kinds of heuristics—A comparative study. Journal of the ACM, 30(1), 1–21. Bagchi, A., & Mahanti, A. (1985). Three approaches to heuristic search in networks. Journal of the ACM, 32(1), 1–27. Baier, J. (2009). Effective search techniques for non-classical planning via reformulation. PhD thesis, University of Toronto. Baier, J., & McIlraith, S. A. (2006). Planning with first-order temporally extended goals using heuristic search. In AAAI (pp. 788–795). Bakera, M., Edelkamp, S., Kissmann, P., & Renner, C. D. (2008). Solving mu-calculus parity games by symbolic planning. In MOCHART (pp. 15–33). Balch, T., & Arkin, R. (1993). Avoiding the past: A simple, but effective strategy for reactive navigation. In International Conference on Robotics and Automation (pp. 678–685). Baldan, P., Corradini, A., K¨onig, B., & K¨onig, B. (2004). Verifying a behavioural logic for graph transformation systems. ENTCS, 104, 5–24. Ball, M., & Holte, R. C. (2008). The compression power of BDDs. In ICAPS (pp. 2–11). Ball, T., Majumdar, R., Millstein, T. D., & Rajamani, S. K. (2001). Automatic predicate abstraction of C programs. In PLDI (pp. 203–213). Barnat, J., Brim, L., Cern´a, I., Moravec, P., Rockai, P., & Simecek, P. (2006). DiVinE—A tool for distributed verification. In CAV (pp. 278–281). Barnat, J., Brim, L., & Chaloupka, J. (2003). Parallel breadth-first search LTL model-checking. In IEEE International Conference on Automated Software Engineering (pp. 106–115). IEEE Computer Society. Barnat, J., Brim, L., & Simecek, P. (2007). I/O-efficient accepting cycle detection. In CAV (pp. 316–330). Barras, B., Boutin, S., Cornes, C., Courant, J., Filliatre, J. C., Gim´enez, E., et al. (1997). The Coq Proof Assistant Reference Manual—Version V6.1. Technical Report 0203, INRIA. Barto, A., Bradtke, S., & Singh, S. (1995). Learning to act using real-time dynamic programming. Artificial Intelligence, 72(1), 81–138. Bartzis, C., & Bultan, T. (2006). Efficient BDDs for bounded arithmetic constraints. International Journal on Software Tools for Technology Transfer, 8(1), 26–36. Bast, H., Funke, S., Sanders, P., & Schultes, D. (2007). Fast routing in road networks with transit nodes. Science, 316(5824), 566.
Bibliography
795
Batalin, M., & Sukhatme, G. (2004). Coverage, exploration and deployment by a mobile robot and communication network. Telecommunication Systems Journal: Special Issue on Wireless Sensor Networks, 26(2), 181–196. Baumer, S., & Schuler, R. (2003). Improving a probabilistic 3-SAT algorithm by dynamic search and independent clause pairs. In SAT (pp. 150–161). Beacham, A. (2000). The complexity of problems without backbones. Master’s thesis, Department of Computing Science, University of Alberta. Behrmann, G., Hune, T. S., & Vaandrager, F. W. (2000). Distributed timed model checking—How the search order matters. In CAV (pp. 216–231). Bellman, R. (1958). On a routing problem. Quarterly of Applied Mathematics, 16(1), 87–90. Bentley, J. L., & Ottmann, T. A. (2008). Algorithms for reporting and counting geometric intersections. Transactions on Computing, 28, 643–647. Bercher, P., & Mattmu¨ ller, R. (2008). A planning graph heuristic for forward-chaining adversarial planning. In ECAI (pp. 921–922). Berger, A., Grimmer, M., & Mu¨ ller-Hannemann, M. (2010). Fully dynamic speed-up techniques for multi-criteria shortest path searches in time-dependent networks. In SEA (pp. 35–46). Berlekamp, E. R., Conway, J. H., & Guy, R. K. (1982). Winning Ways. Academic Press. Bertsekas, D. P. (1999). Nonlinear Programming. Athena Scientific. Bessiere, C. (1994). Arc-consistency and arc-consistency again. Artificial Intelligence, 65, 179–190. Bessiere, C., & Regin, J.-C. (2001). Refining the basic constraint propagation algorithm. In IJCAI (pp. 309–315). Bessiere, C., Freuder, E. C., & Regin, J.-C. (1999). Using constraint metaknowledge to reduce arc consistency computation. Artificial Intelligence, 107, 125–148. Biere, A. (1997). µcke-efficient µ-calculus model checking. In CAV (pp. 468–471). Biere, A., Cimatti, A., Clarke, E., & Zhu, Y. (1999). Symbolic model checking without BDDs. In TACAS (pp. 193–207) . Bisani, R. (1987). Beam search. In Encyclopedia of Artificial Intelligence (pp. 56–58). Bistarelli, S., Montanari, U., & Rossi, F. (1997). Semiring-based constraint satisfaction and optimization. Journal of the ACM, 44(2), 201–236. Bjørnsson, Y., Bulitko, V., & Sturtevant, N. (2009) “TBA*: Time-Bounded A*,” Proceedings of the International Joint Conference on Artificial Intelligence, 431–436. Bloem, R., Ravi, K., & Somenzi, F. (2000). Symbolic guided search for CTL model checking. In DAC (pp. 29–34). Bloom, B. (1970). Space/time trade-offs in hashing coding with allowable errors. Communication of the ACM, 13(7), 422–426. Blum, A., & Furst, M. L. (1995). Fast planning through planning graph analysis. In IJCAI (pp. 1636–1642). Blum, A., Raghavan, P., & Schieber, B. (1991). Navigation in unfamiliar terrain. In STOC (pp. 494–504). Blum, A., Raghavan, P., & Schieber, B. (1997). Navigating in unfamiliar geometric terrain. SIAM Journal on Computing, 26(1), 110–137. Bnaya, Z., Felner, A., & Shimony, S. E. (2009). Canadian traveler problem with remote sensing. In IJCAI (pp. 437–442). Bollig, B., Leucker, M., & Weber, M. (2001). Parallel model checking for the alternation free µ-calculus. In TACAS, (pp. 543–558). Bonasso, R., Kortenkamp, D., & Murphy, R. (1998). Xavier: A Robot Navigation Architecture Based on Partially Observable Markov Decision Process Models. MIT Press. Bonet, B. (2008). Efficient algorithms to rank and unrank permutations in lexicographic order. In AAAI-Workshop on Search in AI and Robotics. Bonet, B., & Geffner, H. (2000). Planning with incomplete information as heurstic search in belief space. In AIPS (pp. 52–61). Bonet, B., & Geffner, H. (2001). Planning as heuristic search. Artificial Intelligence, 129(1–2), 5–33. Bonet, B., & Geffner, H. (2005). An algorithm better than AO*? In AAAI (pp. 1343–1348).
796
Bibliography
Bonet, B., & Geffner, H. (2006). Learning depth-first: A unified approach to heuristic search in deterministic and non-deterministic settings, and its application to MDPs. In ICAPS (pp. 142–151). Bonet, B., & Geffner, H. (2008). Heuristics for planning with penalties and rewards formulated in logic and computed through circuits. Artificial Intelligence, 172, 1579–1604. Bonet, B., & Helmert, M. (2010). Strengthening landmark heuristics via hitting sets. In ECAI (pp. 329–334). Bonet, B., Haslum, P., Hickmott, S. L., & Thi´ebaux, S. (2008). Directed unfolding of petri nets. T. Petri Nets and Other Models of Concurrency, 1, 172–198. Bonet, B., Loerincs, G., & Geffner, H. (2008). A robust and fast action selection mechanism for planning. In AAAI (pp. 714–719). Bornot, S., Morin, R., Niebert, P., & Zennou, S. (2002). Black box unfolding with local first search. In TACAS (pp. 241–257). Borowsky, B., & Edelkamp, S. (2008). Optimal metric planning with state sets in automata representation. In AAAI (pp. 874–879). Bosnacki, D. (2004). Black box checking for biochemical networks. In CMSB (pp. 225–230). Bosnacki, D., Edelkamp, S., & Sulewski, D. (2009). Efficient probabilistic model checking on general purpose graphics processors. In SPIN (pp. 32–49). Botea, A., Mu¨ ller, M., & Schaeffer, J. (2005). Learning partial-order macros from solutions. In ICAPS (pp. 231– 240). Botelho, F. C., Pagh, R., & Ziviani, N. (2007). Simple and space-efficient minimal perfect hash functions. In WADS (pp. 139–150). Botelho, F. C., & Ziviani, N. (2007). External perfect hashing for very large key sets. In CIKM (pp. 653– 662). Brafman, R., & Chernyavsky, Y. (2005). Planning with goal preferences and constraints. In ICAPS (pp. 182–191). Barto, A. G., Bradtke, S. J., & Singh, S. P. (1995). Learning to act using real-time dynamic programming. Artificial Intelligence, 72(1), 81–138. Breiman, L., Friedman, J. H., Olshen, R. A., & Stone, C. J. (1984). Classification and Regression Trees. Wadsworth. Breitbart, Y., Hunt, H., & Rosenkrantz, D. (1992). Switching circuits by binary decision diagrams. Bell System Technical Journal, 38, 985–999. Breitbart, Y., Hunt, H., & Rosenkrantz, D. (1995). On the size of binary decision diagrams representing Boolean functions. Theoretical Computer Science, 145, 45–69. Brengel, K., Crauser, A., Meyer, U., & Ferragina, P. (1999). An experimental study of priority queues in external memory. In WAE (pp. 345–359). Breyer, T. M., & Korf, R. E. (2008). Recent results in analyzing the performance of heuristic search. In AAAI, Workshop on Search Techniques in Artificial Intelligence and Robotics. Breyer, T. M., & Korf, R. E. (2010a). Independent additive heuristics reduce search multiplicatively. In AAAI (pp. 33–38). Breyer, T. M., & Korf, R. E. (2010b). 1.6-bit pattern databases. In AAAI (pp. 39–44). Briel, M., Sanchez, R., Do, M., & Kambhampati, S. (2004). Effective approaches for partial satisfaction (oversubscription) planning. In AAAI (pp. 562–569). Brodal, G. S. (1996). Worst-case efficient priority queues. In SODA (pp. 52–58). Brodnik, A., & Munro, J. M. (1999). Membership in constant time and almost-minimum space. SIAM Journal of Computing, 28(3), 1627–1640. Brooks, R. (1986). A robust layered control system for a mobile robot. IEEE Journal of Robotics and Automation, RA-2, 14–23. Bruegmann, B. (1993). Monte-Carlo Go. Unpublished manuscript. Bruengger, A., Marzetta, A., Fukuda, K., & Nievergelt, J. (1999). The parallel search bench ZRAM and its applications. Annals of Operation Research, 90, 25–63.
Bibliography
797
Brumitt, B., & Stentz, A. (1998). GRAMMPS: A generalized mission planner for multiple mobile robots. In ICRA. Bru¨ ntrup, R., Edelkamp, S., Jabbar, S., & Scholz, B. (2005). Incremental map generation with GPS traces. In ITSC, 2005. Bruun, A., Edelkamp, S., Katajainen, J., & Rasmussen, J. (2010). Policy-based benchmarking of weak heaps and their relatives. In SEA (pp. 424–435). Bryant, R. E. (1992). Symbolic Boolean manipulation with ordered binary-decision diagrams. ACM Computing Surveys, 24(3), 142–170. Buchsbaum, A., Goldwasser, M., Venkatasubramanian, S., & Westbrook, J. (2000). On external memory graph traversal. In Symposium on Discrete Algorithms (SODA) (pp. 859–860). Bulitko, V., & Lee, G. (2006). Learning in real-time search: A unifying framework. Journal of Artificial Intelligence Research, 25, 119–157. Bulitko, V., Sturtevant, N., & Kazakevich, M. (2005). Speeding up learning in real-time search via automatic state abstraction. In AAAI (pp. 1349–1354). Burgard, W., Fox, D., Moors, M., Simmons, R., & Thrun, S. (2000). Collaborative multi-robot exploration. In ICRA (pp. 476–481). Burns, E., Lemons, S., Ruml, W., & Zhou, R. (2009a). Suboptimal and anytime heuristic search on multi-core machines. In ICAPS (2009a). Burns, E., Lemons, S., Zhou, R., & Ruml, W. (2009b). Best-first heuristic search for multi-core machines. In IJCAI (pp. 449–455). Bylander, T. (1994). The computational complexity of propositional STRIPS planning. Artificial Intelligence, 165–204. Caires, L., & Cardelli, L. (2003). A spatial logic for concurrency (part I). Information and Computation, 186(2), 194–235. CAMP Consortium. (2004). Enhanced digital mapping project final report. Submitted to the U.S. department of transportation, federal highway administration, and national highway traffic and safety administration, 11, 2004. Campbell Jr., M., Hoane, A. J., & Hsu, F. (2002). Deep blue. Artificial Intelligence, 134(1–2), 57–83. Cantone, D., & Cinotti, G. (2002). QuickHeapsort, an efficient mix of classical sorting algorithms. Theoretical Computer Science, 285(1), 25–42. Carlsson, S. (1987). The deap—A double-ended heap to implement double-ended priority queues. Information Processing Letters, 26, 33–36. Carrillo, H., & Lipman, D. (1988). The multiple sequence alignment problem in biology. SIAM Journal of Applied Mathematics, 5(48), 1073–1082. Cederman, D., & Tsigas, P. (2008). A practical quicksort algorithm for graphics processors. Technical Report 2008-01, Chalmers University of Technology. Chakrabarti, P. P., Ghose, S., Acharya, A., & DeSarkar, S. C. (1989). Heuristic search in restricted memory. Artificial Intelligence, 41(2), 197–221. Chakrabarti, S., van den Berg, M., & Dom, B. (1999). Focused crawling: A new approach to topic-specific web resource discovery. Computer Networks, 31, 1123–1640. Charikar, M., Indyk, P., & Panigrahy, R. (2002). New algorithms for subset query, partial match, orthogonal range searching, and related problems. In ICALP (pp. 451–462). Cheadle, A. M., Harvey, W., Sadler, A. J., Schimpf, J., Shen, K., & Wallace, M. G. (2003). ECLiPSe: An introduction. Technical Report. Cheeseman, P., Kanefsky, B., & Taylor, W. (2001). Where the really hard problems are. In IJCAI (pp. 331–340). Chen, Y., & Wah, B. W. (2004). Subgoal partitioning and resolution in planning. In Proceedings of the International Planning Competition. Cherkassy, B. V., Goldberg, A. V., & Ratzig, T. (1997a). Shortest path algorithms: Theory and experimental evaluation. Mathematical Programming, 73, 129–174.
798
Bibliography
Cherkassy, B. V., Goldberg, A. V., & Silverstein, C. (1997b). Buckets, heaps, list and monotone priority queues. In SODA (pp. 82–92). Choset, H., & Burdick, J. (1994). Sensor based planning and nonsmooth analysis. In ICRA (pp. 3034–3041). Choset, H., Lynch, K., Hutchinson, S., Kantor, G., Burgard, W., Kavraki, L., et al. (2005). Principles of Robot Motion. MIT Press. Choueka, Y., Fraenkel, A. S., Klein, S. T., & Segal, E. (1986). Improved hierarchical bit-vector compression in document retrieval systems. ACM SIGIR (pp. 88–96). Christofides, N. (1976). Worst-case analysis of a new heuristic for the travelling salesman problem. Technical Report 388, Graduate School of Industrial Administration, Carnegie-Mellon University. Chu, S. C., Chen, Y. T., & Ho, J. H. (2006). Timetable scheduling using particle swarm optimization. In ICICIC (Vol. 3, pp. 324–327). Cimatti, A., Giunchiglia, E., Giunchiglia, F., & Traverso, P. (1997). Planning via model checking: A decision procedure for AR. In ECP (pp. 130–142). Clarke, E. M., Grumberg, O., Jha, S., Lu, Y., & Veith, H. (2001). Counterexample-guided abstraction refinement. In CAV (pp. 154–169). Clarke, E. M., Grumberg, O., & Long, D. E. (1994). Model checking and abstraction. ACM Transactions on Programming Languages and Systems, 16(5), 1512–1542. Cleaveland, R., Iyer, P., & Yankelevich, D. (1995). Optimality in abstractions of model checking. In Static Analysis Symposium (pp. 51–53). Clune, J. (2007). Heuristic evaluation functions for general game playing. In AAAI (pp. 1134–1139). Coego, J., Mandow, L., & P´erez de-la Cruz, J.-L. (2009). A new approach to iterative deepening multiobjective A*. In AI*IA (pp. 264–273). Cohen, J. D. (1997). Recursive hashing functions for n-grams. ACM Transactions on Information Systems, 15(3), 291–320. Coles, A., Fox, M., Halsey, K., Long, D., & Smith, A. (2009). Managing concurrency in temporal planning using planner-scheduler interaction. 173(1), 1–44. Coles, A., Fox, M., Long, D., & Smith, A. (2008). A hybrid relaxed planning GraphLP heuristic for numeric planning domains. In ICAPS (pp. 52–59). Cook, S. A. (1971). The complexity of theorem-proving procedures. In STOC (pp. 151–158). Cook, D. J., & Varnell, R. C. (1998). Adaptive parallel iterative deepening A*. Journal of Artificial Intelligence Research, 9, 136–166. Cooperman, G., & Finkelstein, L. (1992). New methods for using Cayley graphs in interconnection networks. Discrete Applied Mathematics, 37/38, 95–118. Cormen, T. H., Leiserson, C. E., & Rivest, R. L. (1990). Introduction to Algorithms. MIT Press. Corradini, A., Montanari, U., Rossi, F., Ehrig, H., Heckel, R., & L¨owe, M. (1997). Algebraic approaches to graph transformation I: Basic concepts and double pushout approach. In G. Rozenberg (Ed.), Handbook of Graph Grammars and Computing by Graph Transformation (Vol. 1, chap. 3). Foundations. World Scientific. Coulom, R. (2006). Efficient selectivity and backup operators in Monte-Carlo tree search. In CG (pp. 72–83). Cox, I. (1997). Blanche—An experiment in guidance and navigation of an autonomous robot vehicle. SIAM Journal on Computing, 26(1), 110–137. Crauser, A. (2001). External memory algorithms and data structures in theory and practice. PhD thesis, MPIInformatik, Universit¨at des Saarlandes. Culberson, J. C. (1998a). Sokoban is PSPACE-complete. In FUN (pp. 65–76). Culberson, J. C. (1998b). On the futility of blind search: An algorithmic view of no free lunch. Evolutionary Computing, 6(2), 109–127. Culberson, J. C., & Schaeffer, J. (1998). Pattern databases. Computational Intelligence, 14(4), 318–334. Cung, V.-D., & LeCun, B. (1994). A suitable data structure for parallel A*. Technical Report 2165, INRIA, France.
Bibliography
799
Cushing, W., Kambhampati, S., Mausam, & Weld, D. S. (2007). When is temporal planning really temporal? In IJCAI (pp. 1852–1859). Dakin, R. J. (1965). A tree-search algorithm for mixed integer programming problems. The Computer Journal, 8, 250–255. Dantsin, E., Goerdt, A., Hirsch, E. A., & Sch¨oning, U. (2000). Deterministic k-SAT algorithms based on covering codes and local search. In ICALP (pp. 236–247). Davidson, A. (2001). A fast pruning algorithm for optimal sequence alignment. In Symposium on Bioinformatics and Bioengineering (pp. 49–56). Davis, H. W. (1990). Cost-error relationship in A*. Journal of the ACM, 37(2), 195–199. Dayhoff, M. O., Schwartz, R. M., & Orcutt, B. C. (1978). A model of evolutionary change in proteins. Atlas of Protein Sequences and Structures, 5. Dean, T. L., & Boddy, M. (1988). An analysis of time-dependent planning. In AAAI. Dean, T. L., Kaelbling, L., Kirman, J., & Nicholson, A. (1995). Planning under time constraints in stochastic domains. Artificial Intelligence, 76(1–2), 35–74. Dearden, R. (2001). Structured prioritised sweeping. In ICML (pp. 82–89). DeChampeaux, D., & Sint, H. J. (1977). An improved bi-directional heuristic search algorithm. Journal of the ACM, 24(2), 177–191. Dechter, R. (1999). Bucket elimination: A unifying framework for reasoning. Artificial Intelligence, 41–85. Dechter, R. (2004). Constraint Processing. Morgan Kaufmann. Dechter, R., & Pearl, J. (1983). The optimality of A* revisited. In AAAI (pp. 59–99). DeGiacomo, G., & Vardi, M. Y. (1999). Automata-theoretic approach to planning for temporally extended goals. In ECP (pp. 226–238). Delort, C., & Spanjaard, O. (2010). Using bound sets in multiobjective optimization: Application to the biobjective binary knapsack problem. In SEA (pp. 253–265). Demaine, E. D., Demaine, M. L., & O’Rourke, J. (2000). PushPush and Push-1 are NP-hard in 2D. In Canadian Conference on Computational Geometry (pp. 211–219). Dementiev, R., Kettner, L., Mehnert, J., & Sanders, P. (2004). Engineering a sorted list data structure for 32-bit key. In ALENEX/ANALC (pp. 142–151). Dementiev, R., Kettner, L., & Sanders, P. (2005). STXXL: Standard template library for XXL data sets. In ESA (pp. 640–651). Demmer, M. J., & Herlihy, M. (1998). The arrow distributed directory protocol. In DISC (pp. 119–133). Deng, X., Kameda, T., & Papadimitriou, C. (1998). How to learn an unknown environment I: The rectilinear case. Journal of the ACM, 45(2), 215–245. Deng, X., & Papadimitriou, C. (1990). Exploring an unknown graph. In FOCS (pp. 355–361). Deo, N., & Pang, C. (1984). Shortest path algorithms: Taxonomy and annotations. IEEE Transactions on Systems Science and Cybernetics, 14, 257–323. Dial, R. B. (1969). Shortest-path forest with topological ordering. Communications of the ACM, 12(11), 632–633. Dietterich, T. G. (2000). Hierarchical reinforcement learning with the maxq value function decomposition. Journal of Artificial Intelligence Research, 13, 227–303. Dietzfelbinger, M., Karlin, A., Mehlhorn, K., Meyer auf der Heide, F., Rohnert, H., & Tarjan, R. E. (1994). Dynamic perfect hashing: Upper and lower bounds. SIAM Journal of Computing, 23, 738–761. Dijkstra, E. W. (1959). A note on two problems in connexion with graphs. Numerische Mathematik, 1, 269–271. Dijkstra, E. W., & Scholten, C. S. (1979). Termination detection for diffusing computations. Information Processing Letters, 11(1), 1–4. Diligenty, M., Coetzee, F., Lawrence, S., Giles, C. M., & Gori, M. (2000). Focused crawling using context graphs. In International Conference on Very Large Databases (pp. 527–534).
800
Bibliography
Dillenburg, J. F. (1993). Techniques for improving the efficiency of heuristic search. PhD thesis, University of Illinois at Chicago. Dillenburg, J. F., & Nelson, P. C. (1994). Perimeter search. Artificial Intelligence, 65(1), 165–178. Dinh, H. T., Russell, A., & Su, Y. (2007). On the value of good advice: The complexity of A* search with accurate heuristics. In AAAI (pp. 1140–1145). Do, M. B., & Kambhampati, S. (2003). Sapa: A multi-objective metric temporal planner. 20, 155–194. Doran, J., & Michie, D. (1966). Experiments with the graph traverser program. In Proceedings of the Royal Society of London (Vol. 294, pp. 235–259). Dorigo, M., Gambardella, L. M., Middendorf, M., & Stu¨ tzle, T. (Eds.). (2002). IEEE Transactions on Evolutionary Computation: Special Issue on Ant Algorithms and Swarm Intelligence. Dorigo, M., Maniezzo, V., & Colorni, A. (1996). The ant system: Optimization by a colony of cooperating agents. IEEE Transactions on Systems, Man and Cybernetics, 26(1), 29–41. Dorigo, M., & Stu¨ tzle, T. (Eds.). (2004). Ant Colony Optimization. MIT Press. Dow, P. A., & Korf, R. E. (2007). Best-first search for treewidth. In AAAI (pp. 1146–1151). Dr¨ager, K., Finkbeiner, B., & Podelski, A. (2009). Directed model checking with distance-preserving abstractions. International Journal on Software Tools for Technology Transfer, 11(1), 27–37. Driscoll, J. R., Gabow, H. N., Shrairman, R., & Tarjan, R. E. (1988). Relaxed heaps: An alternative to fibonacci heaps with applications to parallel computation. Communications of the ACM, 31(11). Droste, S., Jansen, T., & Wegener, I. (1999). Possibly not a free lunch but at least a free appetizer. In GECCO (pp. 833–839). Droste, S., Jansen, T., & Wegener, I. (2002). Optimization with randomized search heuristics—The (A)NFL theorem, realistic scenarios, and difficult functions. Theoretical Computer Science, 287, 131–144. Dudek, G., Romanik, K., & Whitesides, S. (1995). Localizing a robot with minimum travel. In SODA (pp. 437– 446). Dudek, G., Romanik, K., & Whitesides, S. (1998). Localizing a robot with minimum travel. Journal on Computing, 27(2), 583–604. Duran, M. A., & Grossmann, I. E. (1986). An outer approximation algorithm for a class of mixed-integer nonlinear programs. Mathematical Programming, 36, 306–307. Dutt, S., & Mahapatra, N. R. (1994). Scalable load balancing strategies for parallel A* algorithms. Journal of Parallel and Distributed Computing, 22(3), 488–505. Dutt, S., & Mahapatra, N. R. (1997). Scalable global and local hashing strategies for duplicate pruning in parallel A* graph search. IEEE Transactions on Parallel and Distributed Systems, 8(7), 738–756. Dutton, R. D. (1993). Weak-heap sort. BIT, 33, 372–381. Eckerle, J. (1998). Heuristische Suche unter Speicherbeschr¨ankungen. PhD thesis, University of Freiburg. Eckerle, J., & Lais, T. (1998). Limits and possibilities of sequential hashing with supertrace. In FORTE/PSTV. Kluwer. Eckerle, J., & Ottmann, T. A. (1994). An efficient data structure for the bidirectional search. In ECAI (pp. 600– 604). Eckerle, J., & Schuierer, S. (1995). Efficient memory-limited graph search. In KI (pp. 101–112). Edelkamp, S. (1997). Suffix tree automata in state space search. In KI (pp. 381–385). Edelkamp, S. (1998a). Updating shortest paths. In ECAI (pp. 655–659). Edelkamp, S. (1998b). Datenstrukturen and lernverfahren in der zustandsraumsuche. PhD thesis, University of Freiburg. Edelkamp, S. (2001a). Planning with pattern databases. In ECP (pp. 13–24). Edelkamp, S. (2001b). Prediction of regular search tree growth by spectral analysis. In KI (pp. 154–168). Edelkamp, S. (2002). Symbolic pattern databases in heuristic search planning. In AIPS (pp. 274–293).
Bibliography
801
Edelkamp, S. (2003a). Memory limitation in artificial intelligence. In P. Sanders, U. Meyer, & J. F. Sibeyn (Eds.), Memory Hierarchies (pp. 233–250). Edelkamp, S. (2003b). Promela planning. In SPIN (pp. 197–212). Edelkamp, S. (2003c). Taming numbers and durations in the model checking integrated planning system. Journal of Artificial Research, 20, 195–238. Edelkamp, S. (2004). Generalizing the relaxed planning heuristic to non-linear tasks. In KI (pp. 198–212). Edelkamp, S. (2005). External symbolic heuristic search with pattern databases. In ICAPS (pp. 51–60). Edelkamp, S. (2006). On the compilation of plan constraints and preferences. In ICAPS (pp. 374–377). Edelkamp, S. (2007). Automated creation of pattern database search heuristics. In MOCHART (pp. 35–50). Edelkamp, S., & Eckerle, J. (1997). New strategies in real-time heuristic search. In S. Koenig, A. Blum, T. Ishida, & R. E. Korf (Eds.), AAAI Workshop on Online Search (pp. 30–35). Edelkamp, S., & Helmert, M. (2001). The model checking integrated planning system MIPS. AI-Magazine (pp. 67–71). Edelkamp, S., & Jabbar, S. (2005). Action planning for graph transition systems. In ICAPS, Workshop on Verification and Validation of Model-Based Planning and Scheduling Systems (pp. 58–66). Edelkamp, S., & Jabbar, S. (2006a). Action planning for directed model checking of Petri nets. ENTCS, 149(2), 3–18. Edelkamp, S., & Jabbar, S. (2006b). Externalizing real-time model checking. In MOCHART (pp. 67–83). Edelkamp, S., & Jabbar, S. (2006c). Large-scale directed model checking LTL. In SPIN (pp. 1–18). Edelkamp, S., Jabbar, S., & Bonet, B. (2007). External memory value iteration. In ICAPS (pp. 414–429). Edelkamp, S., Jabbar, S., & Lluch-Lafuente, A. (2005). Cost-algebraic heuristic search. In AAAI (pp. 1362–1367). Edelkamp, S., Jabbar, S., & Lluch-Lafuente, A. (2006). Heuristic search for the analysis of graph transition systems. In ICGT (pp. 414–429). Edelkamp, S., Jabbar, S., & Schr¨odl, S. (2004a). External A*. In KI (pp. 233–250). Edelkamp, S., Jabbar, S., & Sulewski, D. (2008a). Distributed verification of multi-threaded C++ programs. ENTCS, 198(1), 33–46. Edelkamp, S., Jabbar, S., & Willhalm, T. (2003). Geometric travel planning. In ITSC (Vol. 2, pp. 964–969). Edelkamp, S., & Kissmann, P. (2007). Externalizing the multiple sequence alignment problem with affine gap costs. In KI (pp. 444–447). Edelkamp, S., & Kissmann, P. (2008a). Symbolic classification of general multi-player games. In ECAI (pp. 905– 906). Edelkamp, S., & Kissmann, P. (2008b). Symbolic classification of general two-player games. In KI (pp. 185–192). Edelkamp, S., & Kissmann, P. (2008c). Limits and possibilities of BDDs in state space search. In AAAI (pp. 1452– 1453). Edelkamp, S., Kissmann, P., & Jabbar, S. (2008b). Scaling search with symbolic pattern databases. In MOCHART (pp. 49–64). Edelkamp, S., & Korf, R. E. (1998). The branching factor of regular search spaces. In AAAI (pp. 299–304). Edelkamp, S., Leue, S., & Lluch-Lafuente, A. (2004b). Directed explicit-state model checking in the validation of communication protocols. International Journal on Software Tools for Technology Transfer, 5(2–3), 247–267. Edelkamp, S., Leue, S., & Lluch-Lafuente, A. (2004c). Partial order reduction and trail improvement in directed model checking. International Journal on Software Tools for Technology Transfer, 6(4), 277–301. Edelkamp, S., & Leven, P. (2002). Directed automated theorem proving. In LPAR (pp. 145–159). Edelkamp, S., & Lluch-Lafuente, A. (2004). Abstraction in directed model checking. In ICAPS, Workshop on Connecting Planning Theory with Practice. Edelkamp, S., & Meyer, U. (2001). Theory and practice of time-space trade-offs in memory limited search. In KI (pp. 169–184).
802
Bibliography
Edelkamp, S., & Reffel, F. (1998). OBDDs in heuristic search. In KI (pp. 81–92). Edelkamp, S., Sanders, P., & Simecek, P. (2008c). Semi-external LTL model checking. In CAV (pp. 530–542). Edelkamp, S., & Schr¨odl, S. (2000). Localizing A*. In AAAI (pp. 885–890). Edelkamp, S., & Stiegeler, P. (2002). Implementing HEAPSORT with n lg n − 0.9n and QUICKSORT with n lg n + 0.2n comparisons. ACM Journal of Experimental Algorithmics, 7(5). Edelkamp, S., & Sulewski, D. (2008). Flash-efficient LTL model checking with minimal counterexamples. In SEFM (pp. 73–82). Edelkamp, S., & Sulewski, D. (2010). Efficient probabilistic model checking on general purpose graphics processors. In SPIN (pp. 106–123). Edelkamp, S., Sulewski, D., & Yu¨ cel, C. (2010a). GPU exploration of two-player games with perfect hash functions. In SOCS (pp. 23–30). Edelkamp, S., Sulewski, D., & Yu¨ cel, C. (2010b). Perfect hashing for state space exploration on the GPU. In ICAPS (pp. 57–64). Edelkamp, S., Sulewski, D., Barnat, J., Brim, L., & Simecek, P. (2011). Flash memory efficient LTL model checking. Science of Computer Programming, 76(2), 136–157. Edelkamp, S., & Wegener, I. (2000). On the performance of WEAK-HEAPSORT. In STACS (pp. 254–266). Elmasry, A. (2010). The violation heap: A relaxed fibonacci-like heap. In COCOON (pp. 479–488). Elmasry, A., Jensen, C., & Katajainen, J. (2005). Relaxed weak queues: An alternative to run-relaxed heaps. Technical Report CPH STL 2005-2, Department of Computing, University of Copenhagen. Elmasry, A., Jensen, C., & Katajainen, J. (2008a). Two new methods for constructing double-ended priority queues from priority queues. Computing, 83(4), 193–204. Elmasry, J., Jensen, C., & Katajainen, J. (2008b). Multipartite priority queues. ACM Transactions on Algorithms, 5(1), 1–19. Elmasry, A., Jensen, C., & Katajainen, J. (2008c). Two-tier relaxed heaps. Acta Informatica, 45(3), 193–210. Engels, A., Feijs, L. M. G., & Mauw, S. (1997). Test generation for intelligent networks using model checking. In TACAS (pp. 384–398). Eppstein, D. (1987). On the NP-completeness of cryptarithms. SIGACT News, 18(3), 38–40. Eppstein, D., & Galil, Z. (1988). Parallel algorithmic techniques for compinatorial computation. Annual Review of Computer Science, 3, 233–283. Ertico. (2002). Nextmap for transport telematics systems. Final Report, 06-2002. Even, S., & Gazit, H. (1985). Updating distances in dynamic graphs. Methods of Operations Research, 49, 371– 387. Even, S., & Shiloach, Y. (1981). An on-line edge deletion problem. Journal of the ACM, 28(1), 1–4. Evett, M., Hendler, J., Mahanti, A., & Nau, D. S. (1990). PRA*: A memory-limited heuristic search procedure for the connection machine. In Frontiers in Massive Parallel Computation (pp. 145–149). Eyerich, P., Keller, T., & Helmert, M. (2010). High-quality policies for the Canadian traveler’s problem. In AAAI (pp. 51–58). Eyerich, P., Mattmu¨ ller, R., & R¨oger, G. (2009). Using the context-enhanced additive heuristic for temporal and numeric planning. In ICAPS (pp. 130–137). Fabiani, P., & Meiller, Y. (2000). Planning with tokens: An approach between satisfaction and optimisation. In PUK. Fadel, R., Jakobsen, K. V., Katajainen, J., & Teuhola, J. (1997). External heaps combined with effective buffering. In Australasian Theory Symposium (pp. 72–78). Faigle, U., & Kern, W. (1992). Some convergence results for probabilistic tabu search. Journal of Computing, 4, 32–37. Feige, U. (1996). A fast randomized LOGSPACE algorithm for graph connectivity. Theoretical Computer Science, 169(2), 147–160.
Bibliography
803
Feige, U. (1997). A spectrum of time-space tradeoffs for undirected s − t connectivity. Journal of Computer and System Sciences, 54(2), 305–316. Felner, A. (2001). Improving search techniques and using them in different environments. PhD thesis, Bar-Ilan University. Felner, A., & Alder, A. (2005). Solving the 24 puzzle with instance dependent pattern databases. In SARA (pp. 248– 260). Felner, N. R., Korf, R. E., & Hanan, S. (2004a). Additive pattern database heuristics. Journal of Artificial Intelligence Research, 22, 279–318. Felner, A., Meshulam, R., Holte, R. C., & Korf, R. E. (2004b). Compressing pattern databases. In AAAI (pp. 638– 643). Felner, A., Moldenhauer, C., Sturtevant, N. R., & Schaeffer, J. (2010). Single-frontier bidirectional search. In AAAI. Felner, A., & Ofek, N. (2007). Combining perimeter search and pattern database abstractions. In SARA (pp. 414– 429). Felner, A., & Sturtevant, N. R. (2009). Abstraction-based heuristics with true distance computations. In SARA. Felner, A., Shoshani, Y., Altshuler, Y., & Bruckstein, A. (2006). Multi-agent physical A* with large pheromones. Autonomous Agents and Multi-Agent Systems, 12(1), 3–34. Felner, A., Zahavi, U., Schaeffer, J., & Holte, R. C. (2005). Dual lookups in pattern databases. In IJCAI (pp. 103– 108). Feng, Z., & Hansen, E. A. (2002). Symbolic heuristic search for factored Markov decision processes. In AAAI (pp. 714–719). Feuerstein, E., & Marchetti-Spaccamela, A. (1993). Dynamic algorithms for shortest paths in planar graphs. Theoretical Computer Science, 116(2), 359–371. Fikes, R. E., & Nilsson, N. J. (1971). Strips: A new approach to the application of theorem proving to problem solving. Artificial Intelligence, 2, 189–208. Finnsson, H., & Bj¨ornsson, Y. (2008). Simulation-based approach to general game playing. In AAAI (pp. 1134– 1139). Fleischer, R., Romanik, K., Schuierer, S., & Trippen, G. (2001). Optimal robot localization in trees. Information and Computation, 171, 224–247. Flinsenberg, I. C. M. (2004). Route planning algorithms for car navigation. PhD thesis, Technische Universiteit Eindhoven, Eindhoven, The Netherlands. Forbus, K. D., & de Kleer, J. (1993). Building Problem Solvers. MIT Press. Ford, L. R., & Fulkerson, D. R. (1962). Flows in Networks. Princeton University Press. Forgy, C. L. (1982). Rete: A fast algorithm for the many pattern/many object pattern match problem. Artificial Intelligence, 19, 17–37. Fotakis, D., Pagh, R., & Sanders, P. (2003). Space efficient hash tables with worst case constant access time. In STACS (pp. 271–282). Foux, G., Heymann, M., & Bruckstein, A. (1993). Two-dimensional robot navigation among unknown stationary polygonal obstacles. IEEE Transactions on Robotics and Automation, 9(1), 96–102. Fox, D., Burgard, W., & Thrun, S. (1998). Active Markov localization for mobile robots. Robotics and Autonomous Systems, 25, 195–207. Fox, M., & Long, D. (1999). The detection and exploration of symmetry in planning problems. In IJCAI (pp. 956– 961). Fox, M., & Long, D. (2003). PDDL2.1: An extension to PDDL for expressing temporal planning domains. Journal of Artificial Intelligence Research, 20, 61–124. Fox, M., Long, D., & Halsey, K. (2004). An investigation on the expressive power of PDDL2.1. In ECAI (pp. 586– 590).
804
Bibliography
Franceschini, G., & Geffert, V. (2003). An in-place sorting with o(n lg n) comparisons and o(n) moves. In FOCS (pp. 242–250). Franciosa, P., Frigioni, D., & Giaccio, R. (2001). Semi-dynamic breadth-first search in digraphs. Theoretical Computer Science, 250(1–2), 201–217. Frank, I., & Basin, D. (1998). Search in games with incomplete information: A case study using bridge card play. Artificial Intelligence, 100, 87–123. Fredman, M. L., & Tarjan, R. E. (1987). Fibonacci heaps and their uses in improved network optimization algorithm. Journal of the ACM, 34(3), 596–615. Fredman, M. L., Koml´os, J., & Szemer´edi, E. (1984). Storing a sparse table with o(1) worst case access time. Journal of the ACM, 3, 538–544. Fredman, M. L., Sedgewick, R., Sleator, D. D., & Tarjan, R. E. (1986). The pairing heap: A new form of selfadjusting heap. Algorithmica, 1(1), 111–129. Fredriksson, K., Navarro, G., & Ukkonen, E. (2005). Sequential and indexed two-dimensional combinatorial template matching allowing rotations. Theoretical Computer Science, 347(1–2), 239–275. Frigioni, D., Marchetti-Spaccamela, A., & Nanni, U. (1996). Fully dynamic output bounded single source shortest path problem. In SODA (pp. 212–221). Frigioni, D., Marchetti-Spaccamela, A., & Nanni, U. (1998). Semidynamic algorithms for maintaining single source shortest path trees. Algorithmica, 22(3), 250–274. Frigioni, D., Marchetti-Spaccamela, A., & Nanni, U. (2000). Fully dynamic algorithms for maintaining shortest paths trees. Journal of Algorithms, 34(2), 251–281. Fuentetaja, R., Borrajo, D., & Linares L´opez, C. (2008). A new approach to heuristic estimations for cost-based planning. In FLAIRS (pp. 543–548). Furcy, D. (2004). Speeding up the convergence of online heuristic search and scaling up offline heuristic search. PhD thesis, Georgia Institute of Technology. Furcy, D., Felner, A., Holte, R. C., Meshulam, R., & Newton, J. (2004). Multiple pattern databases. In ICAPS (pp. 122–131). Furcy, D., & Koenig, S. (2000). Speeding up the convergence of real-time search. In AAAI (pp. 891–897). Furtak, T., Kiyomi, M., Uno, T., & Buro, M. (2005). Generalized Amazons is PSPACE-complete. In IJCAI (pp. 132–137). Gabow, H. N., & Tarjan, R. E. (1989). Faster scaling algorithms for network problems. SIAM Society for Industrial and Applied Mathematics, 18(5), 1013–1036. Galand, L., Perny, P., & Spanjaard, O. (2010). Choquet-based optimisation in multiobjective shortest path and spanning tree problems. European Journal of Operational Research, 204(2), 303–315. Gambardella, L. M., & Dorigo, M. (1996). Solving symmetric and asymmetric tsps by ant colonies. In Conference on Evolutionary Computation (IEEE-EC) (pp. 20–22). Garavel, H., Mateescu, R., & Smarandache, I. (2001). Parallel state space construction for model-checking. In SPIN (pp. 216–234). Gardner, M. (1966). The problems of Mrs. Perkin’s quilt and other square packing problems. Scientific American, 215(3), 59–70. Garey, M. R., & Johnson, D. S. (1979). Computers and Intractibility: A Guide to the Theory of NP-Completeness. Freeman & Company. Garey, M. R., Johnson, D. S., & Stockmeyer, L. (1974). Some simplified NP-complete problems. In STOC (pp. 47–63). Gaschnig, J. (1979a). Performance measurement and analysis of certain search Algorithms. PhD thesis, CarnegieMellon University. Gaschnig, J. (1979b). A problem similarity approach to devising heuristics: First results. In IJCAI (pp. 434–441).
Bibliography
805
Gaschnig, J. (1979c). Performance Measurement and Analysis of Certain Search Algorithms. PhD thesis, Department of Computer Science, Carnegie-Mellon University. Gasser, R. (1995). Harnessing computational resources for efficient exhaustive search. PhD thesis, ETH Zu¨ rich. Gates, W. H., & Papadimitriou, C. H. (1976). Bounds for sorting by prefix reversal. Discrete Math., 27, 47–57. Geffner, H. (2000). Functional Strips: A More Flexible Language for Planning and Problem Solving (pp. 188– 209). Kluver. Geisberger, R., & Schieferdecker, D. (2010). Heuristic contraction hierarchies with approximation guarantee. In SOCS (pp. 31–38). Geldenhuys, J., & Valmari, A. (2003). A nearly memory optimal data structure for sets and mappings. In SPIN (pp. 236–150). Gelly, S., & Silver, D. (2007). Combining online and offline knowledge in UCT. In ICML (Vol. 227, pp. 273–280). Genesereth, M., & Nourbakhsh, I. (1993). Time-saving tips for problem solving with incomplete information. In AAAI (pp. 724–730). Geoffrion, A. M. (1972). Generalized Benders decomposition. Journal of Optimization Theory and Applications, 10(4), 237–241. Gerevini, A., & Long, D. (2005). Plan constraints and preferences in PDDL3. Technical Report, Department of Electronics for Automation, University of Brescia. Gerevini, A., Saetti, A., & Serina, I. (2006). An approach to temporal planning and scheduling in domains with predictable exogenous events. Journal of Artificial Intelligence Research, 25, 187–231. Ghiani, G., Guerriero, F., Laporte, G., & Musmanno, R. (2003). Real-time vehicle routing: Solution concepts, algorithms and parallel computing strategies. European Journal of Operational Research, 151, 1–11. Ghosh, S., Mahanti, A., & Nau, D. S. (1994). ITS: An efficient limited-memory heuristic tree search algorithm. In AAAI (pp. 1353–1358). Ginsberg, M. L. (1988). Knowledge-base reduction: A new approach to checking knowledge bases for inconsistency and redundancy. In AAAI (pp. 585–589). Ginsberg, M. L. (1993). Dynamic backtracking. Journal of Artificial Intelligence Research, 1, 25–46. Ginsberg, M. L. (1996). Partition search. In AAAI (pp. 228–233). Ginsberg, M. L. (1999). Step toward an expert-level bridge-playing program. In IJCAI (pp. 584–589). Ginsberg, M. L., & Harvey, W. (1992). Iterative broadening. Artificial Intelligence, 55, 367–383. Godefroid, P. (1991). Using partial orders to improve automatic verification methods. In CAV (pp. 176–185). Godefroid, P., & Khurshid, S. (2004). Exploring very large state spaces using genetic algorithms. International Journal on Software Tools for Technology Transfer, 6(2), 117–127. Goetsch, G., & Campbell, M. S. (1990). Experiments with the null-move heuristic. In Computers, Chess, and Cognition (pp. 159–181). Gooley, M. M., & Wah, B. W. (1990). Speculative search: An efficient search algorithm for limited memory. In IEEE International Workshop on Tools with Artificial Intelligence (pp. 194–200). Gordon, M. (1987). HOL: A proof generating system for higher-order logic. In G. Birtwistle & P. A. Subrahmanyam (Eds.), VLSI Specification, Verification, and Synthesis. Kluwer. Goto, S., & Sangiovanni-Vincentelli, A. (1978). A new shortest path updating algorithm. Networks, 8(4), 341– 372. Govindaraju, N. K., Gray, J., Kumar, R., & Manocha, D. (2006). GPUTeraSort: High performance graphics coprocessor sorting for large database management. In SIGMOD (pp. 325–336). Graf, S., & Saidi, H. (1997). Construction of abstract state graphs with PVS. In CAV (pp. 72–83). Groce, A., & Visser, W. (2002). Model checking Java programs using structural heuristics. In ISSTA (pp. 12–21). Grumberg, O., Heyman, T., & Schuster, A. (2006). A work-efficient distributed algorithm for reachability analysis. Formal Methods in System Design, 29(2), 157–175.
806
Bibliography
Guibas, L., Motwani, R., & Raghavan, P. (1992). The robot localization problem in two dimensions. In SODA (pp. 259–268). Guida, G., & Somalvico, M. (1979). A method for computing heuristics in problem solving. Information and Computation, 19, 251–259. Gu¨ nther, M., & Nissen, V. (2010). Particle swarm optimization and an agent-based algorithm for a problem of staff scheduling. In EvoApplications (2) (pp. 451–461). Gupta, S., Kececioglu, J., & Schaffer, A. (1996). Improving the practical space and time efficiency of the shortestpaths approach to sum-of-pairs multiple sequence alignment. Journal of Computational Biology. Gusfield, D. (1993). Efficient methods for multiple sequence alignment with guaranteed error bounds. Bulletin of Mathematical Biology, 55(1), 141–154. Gusfield, D. (1997). Algorithms on Strings, Trees, and Sequences: Computer Science and Computational Biology. Cambridge University Press. Gutmann, J., Fukuchi, M., & Fujita, M. (2005). Real-time path planning for humanoid robot navigation. In IJCAI (pp. 1232–1237). Hachtel, G. D., & Somenzi, F. (1992). A symbolic algorithm for maximum network flow. Methods in System Design, 10, 207–219. Hajek, J. (1978). Automatically verified data transfer protocols. In International Computer Communications Conference (pp. 749–756). Han, C., & Lee, C. (1988). Comments on Mohr and Henderson’s path consistency algorithm. Artificial Intelligence, 36, 125–130. Hansen, E. A., Zhou, R., & Feng, Z. (2002). Symbolic heuristic search using decision diagrams. In SARA (pp. 83– 98). Hansen, E. A., & Zilberstein, S. (1998). Heuristic search in cyclic AND/OR graphs. In AAAI (pp. 412–418). Hansen, E. A., & Zilberstein, S. (2001). LAO*: A heuristic search algorithm that finds solutions with loops. Artificial Intelligence, 129, 35–62. Hansson, O., Mayer, A., & Valtorta, M. (1992). A new result on the complexity of heuristic estimates for the A* algorithm (research note). Artificial Intelligence, 55, 129–143. Haralick, R. M., & Elliot, G. L. (1980). Increasing tree search efficiency for constraint satisfaction problems. Artificial Intelligence, 14, 263–314. Harris, M., Sengupta, S., & Owens, J. D. (2007). Parallel prefix sum (scan) with CUDA. In H. Nguyen (Ed.), GPU Gems 3 (pp. 851–876). Addison-Wesley. Hart, P. E., Nilsson, N. J., & Raphael, B. (1968). A formal basis for heuristic determination of minimum path cost. IEEE Transactions on on Systems Science and Cybernetics, 4, 100–107. Harvey, W. D. (1995). Nonsystematic backtracking search. PhD thesis, Stanford University. Harvey, W. D., & Ginsberg, M. L. (1995). Limited discrepancy search. In IJCAI (pp. 607–613). Haslum, P. (2006). Improving heuristics through relaxed search—An analysis of TP4 and HSP* a in the 2004 planning competition. Journal of Artificial Intelligence Research, 25, 233–267. Haslum, P. (2009). hm(p) = h1(pm): Alternative characterisations of the generalisation from hmax to hm. In ICAPS. Haslum, P., Bonet, B., & Geffner, H. (2005). New admissible heuristics for domain-independent planning. In AAAI (pp. 1163–1168). Haslum, P., Botea, A., Helmert, M., Bonet, B., & Koenig, S. (2007). Domain-independent construction of pattern database heuristics for cost-optimal planning. In AAAI (pp. 1007–1012). Haslum, P., & Geffner, H. (2000). Admissible heuristics for optimal planning. In AIPS (pp. 140–149). Haslum, P., & Jonsson, P. (2000). Planning with reduced operator sets. In AIPS (pp. 150–158). Haverkort, B. R., Bell, A., & Bohnenkamp, H. C. (1999). On the efficient sequential and distributed generation of very large Markov chains from stochastic Petri nets. In Workshop on Petri Net and Performance Models (pp. 12–21). IEEE Computer Society Press.
Bibliography
807
Hawes, N. (2002). An anytime planning agent for computer game worlds. In CG, Workshop on Agents in Computer Games. Hebert, M., McLachlan, R., & Chang, P. (1999). Experiments with driving modes for urban robots. In Proceedings of the SPIE Mobile Robots. Heinz, E. A. (2000). Scalable Search in Computer Chess. Vierweg. Heinz, A., & Hense, C. (1993). Bootstrap learning of alpha-beta-evaluation functions. In ICCI (pp. 365–369). Helmert, M. (2002). Decidability and undecidability results for planning with numerical state variables. In AIPS (pp. 303–312). Helmert, M. (2003). Complexity results for standard benchmark domains in planning. Artificial Intelligence, 143(2), 219–262. Helmert, M. (2006a). New complexity results for classical planning benchmarks. In ICAPS (pp. 52–62). Helmert, M. (2006b). The Fast Downward planning system. Journal of Artificial Intelligence Research, 26, 191–246. Helmert, M., & Domshlak, C. (2009). Landmarks, critical paths and abstractions: What’s the difference anyway? In ICAPS (pp. 162–169). Helmert, M., & Geffner, H. (2008). Unifying the causal graph and additive heuristics. In ICAPS (pp. 140– 147). Helmert, M., Haslum, P., & Hoffmann, J. (2007). Flexible abstraction heuristics for optimal sequential planning. In ICAPS (pp. 176–183). Helmert, M., Mattmu¨ ller, R., & R¨oger, G. (2006). Approximation properties of planning benchmarks. In ECAI (pp. 585–589). Helmert, M., & R¨oger, G. (2008). How good is almost perfect? In AAAI (pp. 944–949). Helmert, M., & R¨oger, G. (2010). Relative-order abstractions for the pancake problem. In ECAI (pp. 745–750). Henrich, D., Wurll, Ch., & W¨orn, H. (1998). Multi-directional search with goal switching for robot path planning. In IEA/AIE (pp. 75–84). Henzinger, T. A., Kopke, P. W., Puri, A., & Varaiya, P. (1995). What’s decidable about hybrid automata? In STOC (pp. 373–381). Hern´adv¨olgyi, I. T. (2000). Using pattern databases to find macro operators. In AAAI (p. 1075). Hern´adv¨olgyi, I. T. (2003). Automatically generated lower bounds for search. PhD thesis, University of Ottawa. Hern´adv¨ogyi, I. T., & Holte, R. C. (1999). PSVN: A vector representation for production systems. Technical Report 99-04, University of Ottawa. Hern´andez, C., & Meseguer, P. (2005). LRTA*(k). In IJCAI (pp. 1238–1243). Hern´andez, C., & Meseguer, P. (2007a). Improving HLRTA*(k). In CAEPIA (pp. 110–119). Hern´andez, C., & Meseguer, P. (2007b). Improving LRTA*(k). In IJCAI (pp. 2312–2317). Hickmott, S., Rintanen, J., Thiebaux, S., & White, L. (2006). Planning via Petri net unfolding. In IJCAI (pp. 1904– 1911). Hirschberg, D. S. (1975). A linear space algorithm for computing common subsequences. Communications of the ACM, 18(6), 341–343. Hoey, J., St-Aubin, R., Hu, A., & Boutilier, C. (1999). SPUDD: Stochastic planning using decision diagrams. In UAI (pp. 279–288). Hoffman, F., Icking, C., Klein, R., & Kriegel, K. (1997). A competitive strategy for learning a polygon. In SODA (pp. 166–174). Hoffmann, J. (2001). Local search topology in planning benchmarks: An empirical analysis. In IJCAI (pp. 453– 458). Hoffmann, J. (2003). The Metric FF planning system: Translating “ignoring the delete list” to numerical state variables. Journal of Artificial Intelligence Research, 20, 291–341. Hoffmann, J., & Edelkamp, S. (2005). The deterministic part of IPC-4: An overview. Journal of Artificial Intelligence Research, 24, 519–579.
808
Bibliography
Hoffmann, J., Edelkamp, S., Thiebaux, S., Englert, R., Liporace, F., & Tru¨ g, S. (2006). Engineering realistic benchmarks for planning: The domains used in the deterministic part of IPC-4. Journal of Artificial Intelligence Research, Submitted. Hoffmann, J., & Koehler, J. (1999). A new method to query and index sets. In IJCAI (pp. 462–467). Hoffmann, J., & Nebel, B. (2001). Fast plan generation through heuristic search. Journal of Artificial Intelligence Research, 14, 253–302. Hoffmann, J., Porteous, J., & Sebastia, L. (2004). Ordered landmarks in planning. Journal of Artificial Intelligence Research, 22, 215–278. Hofmeister, T. (2003). An approximation algorithm MAX2SAT with cardinality constraints. In ESA (pp. 301– 312). Hofmeister, T., Sch¨oning, U., Schuler, R., & Watanabe, O. (2002). A probabilistic 3-SAT algorithm further improved. In STACS (pp. 192–202). Holland, J. (1975). Adaption in natural and artificial systems. PhD thesis, University of Michigan. Holmberg, K. (1990). On the convergence of the cross decomposition. Mathematical Programming, 47, 269–316. Holte, R. C. (2009). Common misconceptions concerning heuristic search. In SOCS (pp. 46–51). Holte, R. C., & Hern´adv¨olgyi, I. T. (1999). A space-time tradeoff for memory-based heuristics. In AAAI (pp. 704–709). Holte, R. C., Grajkowski, J., & Tanner, B. (2005). Hierarchical heuristic search revisited. In SARA (pp. 121–133). Holte, R. C., Perez, M. B., Zimmer, R. M., & Donald, A. J. (1996). Hierarchical A*: Searching abstraction hierarchies. In AAAI (pp. 530–535). Holzer, M., & Schwoon, S. (2001). Assembling molecules in Atomix is hard. Technical Report 0101, Institut fu¨ r Informatik, Technische Universit¨at Mu¨ nchen. Holzmann, G. J. (1997). State compression in SPIN. In 3rd Workshop on Software Model Checking. Holzmann, G. J. (1998). An analysis of bitstate hashing. Formal Methods in System Design, 13(3), 287–305. Holzmann, G. J. (2004). The Spin Model Checker: Primer and Reference Manual. Addison-Wesley. Holzmann, G. J., & Bosnacki, D. (2007). The design of a multicore extension of the SPIN model checker. IEEE Transactions on Software Engineering, 33(10), 659–674. Holzmann, G. J., & Puri, A. (1999). A minimized automaton representation of reachable states. International Journal on Software Tools for Technology Transfer, 2(3), 270–278. Hoos, H., & Stu¨ tzle, T. (1999). Towards a characterisation of the behaviour of stochastic local search algorithms for SAT. Artificial Intelligence, 112, 213–232. Hoos, H. H., & Stu¨ tzle, T. (2004). Stochastic Local Search: Foundations & Applications. Morgan Kaufmann. Hopcroft, J. E., & Ullman, J. D. (1979). Introduction to Automata Theory, Languages and Computation. AddisonWesley. Horowitz, E., & Sahni, S. (1974). Computing partitions with applications to the knapsack problem. Journal of the ACM, 21(2), 277–292. Hsu, E., & McIlraith, S. (2010). Computing equivalent transformations for applying branch-and-bound search to MAX-SAT. In SOCS (pp. 111–118). Hu¨ ffner, F., Edelkamp, S., Fernau, H., & Niedermeier, R. (2001). Finding optimal solutions to Atomix. In KI (pp. 229–243). Huyn, N., Dechter, R., & Pearl, J. (1980). Probabilistic analysis of the complexity of A*. Artificial Intelligence, 15, 241–254. Ibaraki, T. (1978). m-depth serach in branch-and-bound algorithms. Computer and Information Sciences, 7(4), 315–373. Ibaraki, T. (1986). Generalization of alpha-beta and SSS∗ search procedures. Artificial Intelligence, 29, 73–117. Icking, C., Klein, R., & Langetepe, E. (1999). An optimal competitive strategy for walking in streets. In STACS (pp. 110–120).
Bibliography
809
Ikeda, T., & Imai, T. (1994). A fast A* algorithm for multiple sequence alignment. Genome Informatics Workshop (pp. 90–99). Inggs, C., & Barringer, H. (2006). CTL* model checking on a shared memory architecture. Formal Methods in System Design, 29(2), 135–155. Ishida, T. (1992). Moving target search with intelligence. In AAAI (pp. 525–532). Ishida, T. (1997). Real-Time Search for Learning Autonomous Agents. Kluwer Academic Publishers. Italiano, G. (1988). Finding paths and deleting edges in directed acyclic graphs. Information Processing Letters, 28(1), 5–11. Jabbar, S. (2003). GPS-based navigation in static and dynamic environments. Master’s thesis, University of Freiburg. Jabbar, S. (2008). External memory algorithms for state space exploration in model checking and action planning. PhD thesis, Technical University of Dortmund. Jabbar, S., & Edelkamp, S. (2005). I/O efficient directed model checking. In VMCAI. (pp. 313–329). Jabbar, S., & Edelkamp, S. (2006). Parallel external directed model checking with linear I/O. In VMCAI (pp. 237– 251). Jabbari, S., Zilles, S., & Holte, R. C. (2010). Bootstrap learning of heuristic functions. In SOCS (pp. 52–60). J´aj´a, J. (1992). An Introduction to Parallel Algorithms. Addision Wesley. Jaychandran, G., Vishal, V., & Pande, V. S. (2006). Using massively parallel simulations and Markovian models to study protein folding: Examining the Villin head-piece. Journal of Chemical Physics, 124(6), 164903–14. Jensen, R. M. (2003). Efficient BDD-based planning for non-deterministic, fault-tolerant, and adversarial domains. PhD thesis, Carnegie-Mellon University. Jensen, R. M., Bryant, R. E., & Veloso, M. M. (2002). Set A*: An efficient BDD-based heuristic search algorithm. In AAAI (pp. 668–673). Jensen, R. M., Hansen, E. A., Richards, S., & Zhou, R. (2006). Memory-efficient symbolic heuristic search. In ICAPS (pp. 304–313). Johnson, D. S. (1977). Efficient algorithms for shortest paths in sparse networks. Journal of the ACM, 24(1), 1–13. Jones, D. T., Taylor, W. R., & Thornton, J. M. (1992). The rapid generation of mutation data matrices from protein sequences. CABIOS, 3, 275–282. Junghanns, A. (1999). Pushing the limits: New developments in single-agent search. PhD thesis, University of Alberta. Junghanns, A., & Schaeffer, J. (1998). Single agent search in the presence of deadlocks. In AAAI (pp. 419–424). Junghanns, A., & Schaeffer, J. (2001). Sokoban: Improving the search with relevance cuts. Theoretical Computing Science, 252(1–2), 151–175. Kabanza, F., & Thiebaux, S. (2005). Search control in planing for termporally extended goals. In ICAPS (pp. 130– 139). Kaindl, H., & Kainz, G. (1997). Bidirectional heuristic search reconsidered. Journal of Artificial Intelligence Research, 7, 283–317. Kaindl, H., & Khorsand, A. (1994). Memory-bounded bidirectional search. In AAAI (pp. 1359–1364). Kale, L., & Saletore, V. A. (1990). Parallel state-space search for a first solution with consistent linear speedups. International Journal of Parallel Programming, 19(4), 251–293. Kaplan, H., Shafrir, N., & Tarjan, R. E. (2002). Meldable heaps and boolean union-find. In STOC (pp. 573–582). Karmarkar, N., & Karp, R. M. (1982). The differencing method of set partitioning. Technical Report UCB/CSD 82/113, Computer Science Division, University of California, Berkeley. Karp, R. M., & Rabin, M. O. (1987). Efficient randomized pattern-matching algorithms. IBM Journal of Research and Development, 31(2), 249–260. Kask, K., & Dechter, R. (1999). Branch and bound with mini-bucket heuristics. In IJCAI (pp. 426–435).
810
Bibliography
Katajainen, J., & Vitale, F. (2003). Navigation piles with applications to sorting, priority queues, and priority deques. Nordic Journal of Computing, 10(3), 238–262. Katz, M., & Domshlak, C. (2009). Structural-pattern databases. In ICAPS (pp. 186–193). Kautz, H., & Selman, B. (1996). Pushing the envelope: Planning propositional logic, and stochastic search. In ECAI (pp. 1194–1201). Kavraki, L., Svestka, P., Latombe, J.-C., & Overmars, M. (1996). Probabilistic roadmaps for path planning in high-dimensional configuration spaces. IEEE Transactions on Robotics and Automation, 12(4), 566–580. Keller, T., & Kupferschmid, S. (2008). Automatic bidding for the game of Skat. In KI (pp. 95–102). Kennedy, J., & Eberhart, R. C. Particle swarm optimization. In IEEE International Conference on Neural Networks (Vol. IV, pp. 1942–1948). Kennedy, J., Eberhart, R. C., & Shi, Y. (2001). Swarm Intelligence. Morgan Kaufmann. Kerjean, S., Kabanza, F., St-Denis, R., & Thiebaux, S. (2005). Analyzing LTL model checking techniques for plan synthesis and controller synthesis. In MOCHART. Kilby, P., Slaney, J., Thiebaux, S., & Walsh, T. (2005). Backbones and backdoors in satisfiability. In AAAI (pp. 1368–1373). Kirkpatrick, S., Gelatt Jr., C. D., & Vecchi, M. P. (1983). Optimization by simulated annealing. Science, 220, 671–680. Kishimoto, A. (1999). Transposition table driven scheduling for two-player games. Master’s thesis, University of Alberta. Kishimoto, A., Fukunaga, A., & Botea, A. On the scaling behavior of HDA*. In SOCS (pp. 61–62). Kishimoto, A., Fukunaga, A. S., & Botea, A. (2009). Scalable, parallel best-first search for optimal sequential planning. In ICAPS (pp. 201–208). Kissmann, P., & Edelkamp, S. (2010a). Instantiating general games using Prolog or dependency graphs. In KI (pp. 255–262). Kissmann, P., & Edelkamp, S. (2010b). Layer-abstraction for symbolically solving general two-player games. In SOCS. Kleer, J., & Williams, B. C. (1987). Diagnosing multiple faults. Artificial Intelligence (pp. 1340–1330). Klein, D., & Manning, C. (2003). A* parsing: Fast exact Viterbi parse selection. In North American chapter of the association for computational linguistics (pp. 40–47). Klein, P., & Subramanian, S. (1993). Fully dynamic approximation schemes for shortest path problems in planar graphs. In WADS (pp. 443–451). Kleinberg, J. (1994). The localization problem for mobile robots. In Proceedings of the Symposium on Foundations of Computer Science (pp. 521–533). Knight, K. (1993). Are many reactive agents better than a few deliberative ones? In IJCAI (pp. 432–437). Knoblock, C. A. (1994). Automatically generating abstractions for planning. Artificial Intelligence, 68(2), 243–302. Knuth, D. E., Morris, J. H., & Prat, V. R. (1977). Fast pattern matching in strings. Journal of Computing, 6(1), 323–350. Knuth, D. E., & Plass, M. F. (1981). Breaking paragraphs into lines. Software—Practice and Experience, 11, 1119–1184. Kobayashi, H., & Imai, H. (1998). Improvement of the A* algorithm for multiple sequence alignment. Genome Informatics (pp. 120–130). Kocsis, L., & Szepesv´ari, C. (2006). Bandit based Monte-Carlo planning. In ICML (pp. 282–293). Koenig, S. (2001a). Minimax real-time heuristic search. Artificial Intelligence, 129(1–2), 165–197. Koenig, S. (2001b). Agent-centered search. AI Magazine, 22(4), 109–131. Koenig, S. (2004). A comparison of fast search methods for real-time situated agents. In AAMAS (pp. 864–871). Koenig, S., & Likhachev, M. (2003). D* lite. In AAAI (pp. 476–483). Koenig, S., & Likhachev, M. (2005). Fast replanning for navigation in unknown terrain. Transactions on Robotics. Koenig, S., & Likhachev, M. (2006). Real-time adaptive A*. In AAMAS (pp. 281–288).
Bibliography
811
Koenig, S., Likhachev, M., Liu, Y., & Furcy, D. (2004). Incremental heuristic search in artificial intelligence. AI Magazine, 24(2), 99–112. Koenig, S., Mitchell, J., Mudgal, A., & Tovey, C. (2009). A near-tight approximation algorithm for the robot localization problem. Journal on Computing, 39(2), 461–490. Koenig, S., & Simmons, R.G. (1993). Complexity analysis of real-time reinforcement learning. In AAAI (pp. 99– 105). Koenig, S., & Simmons, R. G. (1995). Real-time search in non-deterministic domains. In IJCAI (pp. 1660– 1667). Koenig, S., & Simmons, R. G. (1996a). The effect of representation and knowledge on goal-directed exploration with reinforcement-learning algorithms. Machine Learning, 22(1/3), 227–250. Koenig, S., & Simmons, R. G. (1996b). Easy and hard testbeds for real-time search algorithms. In AAAI (pp. 279– 285). Koenig, S., & Simmons, R. (1998a). Xavier: A robot navigation architecture based on partially observable Markov decision process models. In R. Bonasso, D. Kortenkamp, & R. Murphy (Eds.), Artificial Intelligence Based Mobile Robotics: Case Studies of Successful Robot Systems (pp. 91–122). MIT Press. Koenig, S., & Simmons, R. G. (1998b). Solving robot navigation problems with initial pose uncertainty using real-time heuristic search. In AIPS (pp. 145–153). Koenig, S., Smirnov, Y., & Tovey, C. (2003). Performance bounds for planning in unknown terrain. Artificial Intelligence, 147(1–2), 253–279. Koenig, S., & Szymanski, B. (1999). Value-update rules for real-time search. In AAAI (pp. 718–724). Koenig, S., Szymanski, B., & Liu, Y. (2001). Efficient and inefficient ant coverage methods. Annals of Mathematics and Artificial Intelligence, 31, 41–76. Koenig, S., Tovey, C., & Halliburton, W. (2001). Greedy mapping of terrain. In ICRA (pp. 3594–3599). Kohavi, Z. (1978). Switching and Finite Automata Theory (2nd ed.). McGraw-Hill. Kohn, K. (1999). Molecular interaction map of the mammalian cell cycle control and DNA repair systems. Molecular Biology of the Cell, 10(8), 2703–2734. Korf, R. E. (1985a). Depth-first iterative-deepening: An optimal admissible tree search. Artificial Intelligence, 27 (1), 97–109. Korf, R. E. (1985b). Macro-operators: A weak method for learning. Artificial Intelligence, 26, 35–77. Korf, R. E. (1990). Real-time heuristic search. Artificial Intelligence, 42(2–3), 189–211. Korf, R. E. (1991). Multiplayer alpha-beta pruning. Artificial Intelligence, 48(1), 99–111. Korf, R. E. (1993). Linear-space best-first search. Artificial Intelligence, 62, 41–78. Korf, R. E. (1996). Improved limited discrepancy search. In IJCAI (pp. 286–291). Korf, R. E. (1997). Finding optimal solutions to Rubik’s Cube using pattern databases. In AAAI (pp. 700–705). Korf, R. E. (1998). A complete anytime algorithm for number partitioning. Artificial Intelligence, 106, 181–203. Korf, R. E. (1999). Divide-and-conquer bidirectional search: First results. In IJCAI (pp. 1184–1191). Korf, R. E. (2002). A new algorithm for optimal bin packing. In AAAI (pp. 731–736). Korf, R. E. (2003a). Breadth-first frontier search with delayed duplicate detection. In MOCHART (pp. 87–92). Korf, R. E. (2003b). An improved algorithm for optimal bin packing. In IJCAI (pp. 1252–1258). Korf, R. E. (2003c). Optimal rectangle packing: Initial results. In ICAPS (pp. 287–295). Korf, R. E. (2004a). Best-first frontier search with delayed duplicate detection. In AAAI (pp. 650–657). Korf, R. E. (2004b). Optimal rectangle packing: New results. In ICAPS (pp. 142–149). Korf, R. E. (2008). Minimizing disk I/O in two-bit breadth-first search. In AAAI (pp. 317–324). Korf, R. E. (2009). Multi-way number partitioning. In IJCAI (pp. 538–543). Korf, R. E. (2010). Objective functions multi-way number partitioning. In SOCS (pp. 71–72). Korf, R. E., & Chickering, D. M. (1994). Best-first minimax search: Othello results. In AAAI (Vol. 2, pp. 1365– 1370). Korf, R. E., & Felner, A. (2002). Disjoint pattern database heuristics. In Chips Challenging Champions: Games, Computers and Artificial Intelligence (pp. 13–26). Elsevier Sience.
812
Bibliography
Korf, R. E., & Felner, A. (2007). Recent progress in heuristic search: A case study of the four-peg towers of hanoi problem. In IJCAI (pp. 2324–2329). Korf, R. E., & Reid, M. (1998). Complexity analysis of admissible heuristic search. In AAAI (pp. 305–310). Korf, R. E., Reid, M., & Edelkamp, S. (2001). Time complexity of Iterative-Deepening-A*. Artificial Intelligence, 129(1–2), 199–218. Korf, R. E., & Schultze, T. (2005). Large-scale parallel breadth-first search. In AAAI (pp. 1380–1385). Korf, R. E., & Taylor, L. A. (1996). Finding optimal solutions to the twenty-four puzzle. In AAAI (pp. 1202–1207). Korf, R. E., & Zhang, W. (2000). Divide-and-conquer frontier search applied to optimal sequence alignment. In AAAI (pp. 910–916). Korf, R. E., Zhang, W., Thayer, I., & Hohwald, H. (2005). Frontier search. Journal of the ACM, 52(5), 715–748. Koza, J. R. (1992). Genetic Programming: On the Programming of Computers by Means of Natural Selection. MIT Press. Koza, J. R. (1994). Genetic Programming II: Automatic Discovery of Reusable Programs. MIT Press. Koza, J. R., Bennett, H. B., Andre, D., & Keane, M. A. (1999). Genetic Programming III: Darvinian Invention and Problem Solving. Morgan Kaufmann. Kristensen, L., & Mailund, T. (2003). Path finding with the sweep-line method using external storage. In ICFEM (pp. 319–337). Krueger, J., & Westermann, R. (2003). Linear algebra operators for GPU implementation of numerical algorithms. ACM Transactions on Graphics, 22(3), 908–916. Kumar, V. (1992). Branch-and-bound search. In S. C. Shapiro (Ed.), Encyclopedia of Artificial Intelligence (pp. 1468–1472). New York: Wiley-Interscience. Kumar, V., Ramesh, V., & Rao, V. N. (1987). Parallel best-first search of state-space graphs: A summary of results. In AAAI (pp. 122–127). Kumar, V., & Schwabe, E. J. (1996). Improved algorithms and data structures for solving graph problems in external memory. In IEEE-Symposium on Parallel and Distributed Processing (pp. 169–177). Kunkle, D., & Cooperman, D. (2008). Solving Rubik’s Cube: Disk is the new RAM. Communications of the ACM, 51(4), 31–33. Kupferschmid, S., Dr¨ager, K., Hoffmann, J., Finkbeiner, B., Dierks, H., Podelski, A., et al. (2007). Uppaal/DMC—Abstraction-based heuristics for directed model checking. In TACAS, (pp. 679–682). Kupferschmid, S., & Helmert, M. (2006). A Skat player based on Monte-Carlo simulation. In CG (pp. 135–147). Kupferschmid, S., Hoffmann, J., Dierks, H., & Behrmann, G. (2006). Adapting an AI planning heuristic for directed model checking. In SPIN, (pp. 35–52). Kvarnstr¨om, J., Doherty, P., & Haslum, P. (2000). Extending TALplanner with concurrency and resources. In ECAI (pp. 501–505). Kwa, J. (1994). BS*: An admissible bidirectional staged heuristic search algorithm. Artificial Intelligence, 38(2), 95–109. Laarman, A., van de Pol, J., & Weber, M. (2010). Boosting multi-core reachability performance with shared hash tables. In FMCAD. Lago, U. D., Pistore, M., & Traverso, P. (2002). Planning with a language for extended goals. In AAAI (pp. 447– 454). Land, A. H., & Doig, A. G. (1960). A tree-search algorithm for mixed integer programming problems. Econometria, 28, 497–520. Langley, P. (1996). Elements of Machine Learning. Morgan Kaufmann. Larsen, B. J., Burns, E., Ruml, W., & Holte, R. C. (2010). Searching without a heuristic: Efficient use of abstraction. In AAAI. Larsen, K. G., Larsson, F., Petterson, P., & Yi, W. (1997). Efficient verification of real-time systems: Compact data structures and state-space reduction. In IEEE Real Time Systems Symposium (pp. 14–24).
Bibliography
813
Larsen, K. G., Behrmann, G., Brinksma, E., Fehnker, A., Hune, T. S., Petterson, P., et al. (2001). As cheap as possible: Efficient cost-optimal reachability for priced timed automata. In CAV (pp. 493–505). Latombe, J.-C. (1991). Robot Motion Planning. Kluwer Academic Publishers. LaValle, S. (2006). Planning Algorithms. Cambridge University Press. LaValle, S., & Kuffner, J. (2000). Rapidly-exploring random trees: Progress and prospects. In Workshop on the Algorithmic Foundations of Robotics. Lawler, E. L. (1976). Combinatorial Optimization: Networks and Matroids. Holt, Rinehart, and Winston. Lee, C. Y. (1959). Representation of switching circuits by binary-decision programs. Bell Systems Technical Journal, 38, 985–999. Lehmer, H. D. (1949). Mathematical methods in large-scale computing units. In Symposium on Large-Scale Digital Calculating Machinery (pp. 141–146). Harvard University Press. Leiserson, C. E., & Saxe, J. B. (1983). A mixed integer linear programming problem which is efficiently solvable. In CCCC (pp. 204–213). Lerda, F., & Sisto, R. (1999). Distributed-memory model checking with SPIN. In SPIN (pp. 22–39). Lerda, F., & Visser, W. (2001). Addressing dynamic issues of program model checking. In SPIN (pp. 80–102). Leven, P., Mehler, T., & Edelkamp, S. (2004). Directed error detection in C++ with the assembly-level model checker StEAM. In SPIN (pp. 39–56). Li, Y., Harms, J., & Holte, R. C. (2005). IDA* MCSP: A fast exact MCSP algorithm. In International conference on communications (pp. 93–99). Li, Y., Harms, J. J., & Holte, R. C. (2007). Fast exact multiconstraint shortest path algorithms. In International Conference on Communications. Likhachevm, M. (2005). Search-based planning for large dynamic environments. PhD thesis, Carnegie Mellon University. Likhachev, M., & Koenig, S. (2002). Incremental replanning for mapping. In IROS (pp. 667–672). Likhachev, M., & Koenig, S. (2005). A generalized framework for Lifelong Planning A*. In ICAPS (pp. 99–108). Lin, C., & Chang, R. (1990). On the dynamic shortest path problem. Journal of Information Processing, 13(4), 470–476. Littman, M. (1994). Memoryless policies: Theoretical limitations and practical results. In From Animals to Animats 3: International Conference on Simulation of Adaptive Behavior. Linares L´opez, C. (2008). Multi-valued pattern databases. In ECAI (pp. 540–544). Linares L´opez, C. (2010). Vectorial pattern databases. In ECAI (pp. 1059–1060). Linares L´opez, C., & Borrajo, D. (2010). Adding diversity to classical heuristic planning. In SOCS (pp. 73–80). Linares L´opez, C., & Junghanns, A. (2003). Perimeter search performance. In CG (pp. 345–359). Lluch-Lafuente, A. (2003a). Directed search for the verification of communication protocols. PhD thesis, University of Freiburg. Lluch-Lafuente, A. (2003b). Symmetry reduction and heuristic search for error detection in model checking. In MOCHART (pp. 77–86). Love, N. C., Hinrichs, T. L., & Genesereth, M. R. (2006). General game playing: Game description language specification. Technical Report LG-2006-01, Stanford Logic Group. Luckhardt, C. A., & Irani, K. B. (1986). An algorithmic solution of n-person games. In AAAI (pp. 158–162). Lumelsky, V. (1987). Algorithmic and complexity issues of robot motion in an uncertain environment. Journal of Complexity, 3, 146–182. Lumelsky, V., & Stepanov, A. (1987). Path-planning strategies for a point mobile automaton moving amidst unknown obstacles of arbitrary shape. Algorithmica, 2, 403–430. Mackworth, A. K. (1977). Consistency in networks of relations. Artificial Intelligence, 8(1), 99–118. Madani, O., Hanks, S., & Condon, A. (1999). On the undecidability of probabilistic planning and infinite-horizon partially observable Markov decision problems. In AAAI (pp. 541–548).
814
Bibliography
Madras, N., & Slade, G. (1993). The Self-Avoiding Walk. Birkenhauser. Mahapatra, N. R., & Dutt, S. (1999). Sequential and parallel branch-and-bound search under limited memory constraints. The IMA Volumes in Mathematics and Its Applications—Parallel Processing of Discrete Problems, 106, 139–158. Mandow, L., & P´erez de-la Cruz, J.-L. (2010a). A note on the complexity of some multiobjective A* search algorithms. In ECAI (pp. 727–731). Mandow, L., & P´erez de-la Cruz, J.-L. (2010b). Multiobjective A* search with consistent heuristics. Journal of the ACM, 57(5). Manzini, G. (1995). BIDA*. Artificial Intelligence, 75(2), 347–360. Marais, H., & Bharat, K. (1997). Supporting cooperative and personal surfing with a desktop assistant. In ACM Symposium on User Interface, Software and Technology (pp. 129–138). Mares, M., & Straka, M. (2007). Linear-time ranking of permutations. In ESA (pp. 187–193). Marinari, E., & Parisi, G. (1992). Simulated tempering: A new Monte Carlo scheme. Europhysics Letters, 21, 451–458. Mariott, K., & Stuckey, P. (1998). Programming with Constraints. MIT Press. Marsland, T. A., & Reinefeld, A. (1993). Heuristic search in one and two player games. Technical Report TR 93-02, University of Alberta, Edmonton, Canada. Martelli, A. (1977). On the complexity of admissible search algorithms. Artificial Intelligence, 8, 1–13. Martello, S., & Toth, P. (1990). Lower bounds and reduction procedures for the bin packing problem. Discrete Applied Mathematics, 28, 59–70. Matthies, L., Xiong, Y., Hogg, R., Zhu, D., Rankin, A., Kennedy, B., et al. (2002). A portable, autonomous, urban reconnaissance robot. Robotics and Autonomous Systems, 40, 163–172. Mattmu¨ ller, R., Ortlieb, M., Helmert, M., & Bercher, P. (2010). Pattern database heuristics for fully observable nondeterministic planning. In ICAPS (pp. 105–112). McAllester, D. A. (1988). Conspiricy-number-search for min-max searching. Artificial Intelligence, 35, 287–310. McAllester, D., & Yuret, D. (2002). Alpha-beta-conspiracy search. ICGA Journal, 25(2), 16–35. McCreight, E. M. (1976). A space-economical suffix tree construction algorithm. Journal of the ACM, 23(2), 262–272. McCreight, E. M. (1985). Priority search trees. SIAM Journal of Computing, 14(2), 257–276. McMillan, K. L. (1993). Symbolic Model Checking. Kluwer Academic Press. McNaughton, M., Lu, P., Schaeffer, J., & Szafron, D. (2002). Memory-efficient A* heuristics for multiple sequence alignment. In AAAI (pp. 737–743). Mehler, T. (2005). Challenges and applications of assembly-level software model checking. PhD thesis, Technical University of Dortmund. Mehler, T., & Edelkamp, S. (2005). Incremental hashing with pattern databases. In ICAPS Poster Proceedings. Mehler, T., & Edelkamp, S. (2006). Dynamic incremental hashing in program model checking. ENTCS, 149(2). Mehlhorn, K. (1984). Data Structures and Algorithms (2): NP Completeness and Graph Algorithms. Springer. Mehlhorn, K., & Meyer, U. (2002). External-memory breadth-first search with sublinear I/O. In ESA (pp. 723– 735). Mehlhorn, K., & N¨aher, S. (1999). The LEDA Platform of Combinatorial and Geometric Computing. Cambridge University Press. Mercer, E., & Jones, M. (2005). Model checking machine code with the GNU debugger. In SPIN (pp. 251– 265). Merino, P., del Mar Gallardo, M., Martinez, J., & Pimentel, E. (2004). aSPIN: A tool for abstract model checking. International Journal on Software Tools for Technology Transfer, 5(2–3), 165–184. Meriott, K., & Stuckey, P. (1998). Programming with Constraints. MIT Press. Mero, L. (1984). A heuristic search algorithm with modifiable estimate. Artificial Intelligence, 23, 13–27.
Bibliography
815
Meseguer, P. (1997). Interleaved depth-first search. In IJCAI (pp. 1382–1387). Metropolis, N., Rosenbluth, A. W., Rosenbluth, M. N., Teller, A. H., & Teller, E. (1953). Equation of state calculations by fast computing machines. Journal of Chemical Physics, 21, 1087–1092. Milner, R. (1989). Communication and Concurrency. Prentice-Hall. Milner, R. (1995). An algebraic definition of simulation between programs. In IJCAI (pp. 481–489). Miltersen, P. B., Radhakrishnan, J., & Wegener, I. (2005). On converting CNF to DNF. Theoretical Computer Science, 347(1–2), 325–335. Minato, S., Ishiura, N., & Yajima, S. (1990). Shared binary decision diagram with attributed edges for efficient boolean function manipuation. In DAC (pp. 52–57). Miura, T., & Ishida, T. (1998). Statistical node caching for memory bounded search. In AAAI (pp. 450–456). Moffitt, M. D., & Pollack, M. E. (2006). Optimal rectangle packing: A Meta-CSP approach. In ICAPS (pp. 93– 102). Mohr, R., & Henderson, T. C. (1986). Arc and path consistency revisited. Artificial Intelligence, 28(1), 225–233. Monien, B., & Speckenmeyer, E. (1985). Solving satisfiability in less than 2n steps. Discrete Applied Mathematics, 10, 287–294. Moore, A., & Atkeson, C. (1993). Prioritized sweeping: Reinforcement learning with less data and less time. Machine Learning, 13(1), 103–130. Moore, A., & Atkeson, C. (1995). The parti-game algorithm for variable resolution reinforcement learning in multi-dimensional state spaces. Machine Learning, 21(3), 199–233. Moskewicz, M., Madigan, C., Zhao, Y., Zhang, L., & Malik, S. (2001). Chaff: Engineering an efficient SAT solver. In DAC (pp. 236–247). Mostow, J., & Prieditis, A. E. (1989). Discovering admissible heuristics by abstracting and optimizing. In IJCAI (pp. 701–707). Mudgal, A., Tovey, C., Greenberg, S., & Koenig, S. (2005). Bounds on the travel cost of a Mars rover prototype search heuristic. SIAM Journal on Discrete Mathematics 19(2): 431-447. Mudgal, A., Tovey, C., & Koenig, S. (2004). Analysis of greedy robot-navigation methods. In Proceedings of the International Symposium on Artificial Intelligence and Mathematics. Mues, C., & Vanthienen, J. (2004). Improving the scalability of rule base verification. In KI (pp. 381–395). Mu¨ ller, M. (1995). Computer go as a sum of local games. PhD thesis, ETH Zu¨ rich. Mu¨ ller, M. (2001). Partial order bounding: A new approach to evaluation in game tree search. Artificial Intelligence, 129(1–2), 279–311. Mu¨ ller, M. (2002). Proof set search. CG (pp. 88–107). Munagala, K., & Ranade, A. (1999). I/O-complexity of graph algorithms. In SODA (pp. 687–694). Munro, J. I., & Raman, V. (1996). Selection from read-only memory and sorting with minimum data movement. Theoretical Computer Science, 165, 311–323. Myrvold, W., & Ruskey, F. (2001). Ranking and unranking permutations in linear time. Information Processing Letters, 79(6), 281–284. Nau, D. S. (1983). Pathology on game trees revisited, and an alternative to minimaxing. Artificial Intelligence, 21, 221–244. Nau, D. S., Kumar, V., & Kanal, L. (1984). General branch and bound, and its relation to A* and AO*. Artificial Intelligence, 23, 29–58. Needleman, S., & Wunsch, C. (1981). A general method applicable to the search for similarities in the amino acid sequences of two proteins. Journal of Molecular Biology, 48, 443–453. Nguyen, V. Y., & Ruys, T. C. Incremental hashing for SPIN. In SPIN (pp. 232–249). Niewiadomski, R., Amaral, J. N., & Holte, R. C. (2006). Sequential and parallel algorithms for frontier A* with delayed duplicate detection. In AAAI. Nilsson, N. J. (1980). Principles of Artificial Intelligence. Tioga Publishing Company.
816
Bibliography
Nipkow, T., Paulson, L. C., & Wenzel, M. (2002). Isabelle/HOL—A Proof Assistant for Higher-Order Logic, Vol. 2283 of LNCS. Springer. Nourbakhsh, I. (1996). Robot Information Packet. AAAI Spring Symposium on Planning with Incomplete Information for Robot Problems. Nourbakhsh, I. (1997). Interleaving Planning and Execution for Autonomous Robots. Kluwer Academic Publishers. Nourbakhsh, I., & Genesereth, M. (1996). Assumptive planning and execution: A simple, working robot architecture. Autonomous Robots Journal, 3(1), 49–67. Okasaki, C. (1998). Purely Functional Data Structures (chap. 3). Cambridge University Press. Osborne, M. J., & Rubinstein, A. (1994). A Course in Game Theory. MIT Press. Ostlin, A., & Pagh, R. (2003). Uniform hashing in constant time and linear space. In ACM Symposium on Theory of Computing (pp. 622–628). Owen, G. (1982). Game Theory. Academic Press. Owens, J. D., Houston, M., Luebke, D., Green, S., Stone, J. E., & Phillips, J. C. (2008). GPU computing. Proceedings of the IEEE, 96(5), 879–899. Owre, S., Rajan, S., Rushby, J. M., Shankar, N., & Srivas, M. K. (1996). PVS: Combining specification, proof checking, and model checking. In CAV (pp. 411–414). Pagh, R., & Rodler, F. F. (2001). Cuckoo hashing. In ESA (pp. 121–133). Pai, D. K., & Reissell, L.-M. (1998). Multiresolution rough terrain motion planning. IEEE Transactions on Robotics and Automation, 14 (1), 19–33. Papadimitriou, C., & Tsitsiklis, J. (1987). The complexity of Markov decision processes. Mathematics of Operations Research, 12(3), 441–450. Papadimitriou, C., & Yannakakis, M. (1991). Shortest paths without a map. Theoretical Computer Science, 84(1), 127–150. Parberry, I. (1995). A real-time algorithm for the (n2 − 1)-puzzle. Information Processing Letters, 56, 23–28. Park, S. K., & Miller, K. W. (1988). Random number generators: Good ones are hard to find. Communications of the ACM, 31, 1192–1201. Paturi, R., Pudl´ak, P., & Zane, F. (1977). Satisfiability coding lemma. In FOCS (pp. 566–574). Pearl, J. (1985). Heuristics. Addison-Wesley. Pednault, E. P. D. (1991). Generalizing nonlinear planning to handle complex goals and actions with contextdependent effects. In IJCAI (pp. 240–245). Peled, D. A. (1996). Combining partial order reductions with on-the-fly model-checking. Formal Methods in Systems Design, 8, 39–64. Peled, D. A. (1998). Ten years of partial order reduction. In CAV (pp. 17–28). Pemberton, J., & Korf, R. E. (1992). Incremental path planning on graphs with cycles. In ICAPS (pp. 179–188). Pemberton, J., & Korf, R. E. (1994). Incremental search algorithms for real-time decision making. In ICAPS (pp. 140–145). Petri, C. A. (1962). Kommunikation mit automaten. PhD thesis, Universit¨at Bonn. Phillips, J. C., Braun, R., Wang, W., Gumbart, J., Tajkhorshid, E., Villa, E., Chipot C., Skeel, R. D., Kal´e, L, & Schulten K. (2005). Scalable molecular dynamics with NAMD. Journal of Computational Chemistry, 26(16), 1781–1802. Pijls, W., & Kolen, A. (1992). A general framework for shortest path algorithms. Technical Report 92-08, Erasmus Universiteit Rotterdam. Pinter, R. Y., Rokhlenko, O., Yeger-Lotem, E., & Ziv-Ukelson, M. (2005). Alignment of metabolic pathways. BioInformatics, 21(16), 3401–3408. Pirzadeh, A., & Snyder, W. (1990). A unified solution to coverage and search in explored and unexplored terrains using indirect control. In ICRA (pp. 2113–2119).
Bibliography
817
Pistore, M., & Traverso, P. (2001). Planning as model checking for extended goals in non-deterministic domains. In IJCAI (pp. 479–486). Plaat, A., Schaeffer, J., Pijls, W., & de Bruin, A. (1996). Best-first fixed-depth minimax algorithms. Artificial Intelligence, 87(1–2), 255–293. Pohl, I. (1969). Bi-directional and heursitic search in path problems. Technical Report, Stanford Linear Accelerator Center. Pohl, I. (1971). Bi-directional search. Machine Intelligence, 6, 127–140. Pohl, I. (1977a). Heuristic search viewed as a path problem. Artificial Intelligence, 1, 193–204. Pohl, I. (1977b). Practical and theoretical considerations in heuristic search algorithms. Machine Intelligence, 8, 55–72. Politowski, G., & Pohl, I. (1984). D-node retargeting in bidirectional heuristic search. In AAAI (pp. 274–277). Powley, C., & Korf, R. E. (1991). Single-agent parallel window search. IEEE Transaction on Pattern Analysis and Machine Intelligence, 4(5), 466–477. Preditis, A. (1993). Machine discovery of admissible heurisitics. Machine Learning, 12, 117–142. Preece, A., & Shinghal, R. (1994). Foundations and application of knowledge base verification. International Journal on Intelligent Systems Intelligence, 9(8), 683–701. Prendinger, H., & Ishizuka, M. (1998). APS, a prolog-based anytime planning system. In Proceedings 11th International Conference on Applications of Prolog (INAP). Provost, F. (1993). Iterative weakening: Optimal and near-optimal policies for the selection of search bias. In AAAI (pp. 769–775). Qian, K. (2006). Formal verification using heursitic search and abstraction techniques. PhD thesis, University of New South Wales. Qian, K., & Nymeyer, A. (2003). Heuristic search algorithms based on symbolic data structures. In ACAI (pp. 966– 979). Qian, K., & Nymeyer, A. (2004). Guided invariant model checking based on abstraction and symbolic pattern databases. In TACAS (pp. 497–511). Ramalingam, G., & Reps, T. (1996). An incremental algorithm for a generalization of the shortest-path problem. Journal of Algorithms, 21, 267–305. Rao, C., & Arkin, A. (2001). Control motifs for intracellular regulatory networks. Annual Review of Biomedical Engineering, 3, 391–419. Rao, N., Hareti, S., Shi, W., & Iyengar, S. (1993). Robot navigation in unknown terrains: Introductory survey of non-heuristic algorithms. Technical Report ORNL/TM–12410, Oak Ridge National Laboratory, TN. Rao, V. N., Kumar, V., & Korf, R. E. (1991). Depth-first vs. best-first search. In AAAI (pp. 434–440). Rapoport, A. (1966). Two-Person Game Theory. Dover. Rasmussen, J. I., Larsen, K. G., & Subramani, K. (2004). Resource-optimal scheduling using priced timed automata. In TACAS (pp. 220–235). Ratner, D., & Warmuth, M. K. (1990). The (n2 − 1)-puzzle and related relocation problems. Journal of Symbolic Computation, 10(2), 111–137. Reffel, F., & Edelkamp, S. (1999). Error detection with directed symbolic model checking. In FM (pp. 195–211). Regin, J.-C. (1994). A filtering algorithm for constraints of difference in CSPS. In AAAI (pp. 362–367). Reinefeld, A., & Marsland, T. A. (1994). Enhanced iterative-deepening search. IEEE Transactions on Pattern Analysis and Machine Intelligence, 16(7), 701–710. Reingold, O. (2005). Undirected st-connectivity in log-space. In STOC (pp. 376–385). Reisch, S. (1981). Hex ist PSPACE-vollst¨andig. Acta Informatica, 15, 167–191. Rensink, A. (2003). Towards model checking graph grammars. In Workshop on Automated Verification of Critical Systems, Technical Report DSSE-TR-2003 (pp. 150–160). Rich, E., & Knight, K. (1991). Artificial Intelligence. McGraw-Hill.
818
Bibliography
Richter, S., Helmert, M., & Gretton, C. (2007). A stochastic local search approach to vertex cover. In KI (pp. 412– 426). Richter, S., Helmert, M., & Westphal, M. (2008). Landmarks revisited. In AAAI (pp. 975–982). Rintanen, J. (2000). Incorporation of temporal logic control into plan operators. In ECAI (pp. 526–530). Rintanen, J. (2003). Symmetry reduction for SAT representations of transition systems. In ICAPS (pp. 32–41). Rintanen, J. (2006). Unified definition of heuristics for classical planning. In ECAI (pp. 600–604). Rivest, R. L. (1976). Partial-match retrieval algorithms. SIAM Journal of Computing, 5(1), 19–50. Robby, Dwyer, M. B., & Hatcliff, J. (2003). Bogor: An extensible and highly-modular software model checking framework. In ESEC (pp. 267–276). Rohnert, H. (1985). A dynamization of the all pairs least cost path problem. In STACS (pp. 279–286). Romein, J. W., & Bal, H. E. (2003). Solving Awari with parallel retrograde analysis. Computer, 36(10), 26–33. Romein, J. W., Plaat, A., Bal, H. E., & Schaeffer, J. (1999). Transposition table driven work scheduling in distributed search. In AAAI (pp. 725–731). Romero, L., Morales, E., & Sucar, E. (2001). An exploration and navigation approach for indoor mobile robots considering sensor’s perceptual limitations. In ICRA (pp. 3092–3097). Rossi, F., van Beek, P., & Walsh, T. (2006). Handbook of Constraint Programming (Foundations of Artificial Intelligence). New York: Elsevier Science. Rousset, P. (1988). On the consistency of knowledge bases, the COVADIS system. Computational Intelligence, 4, 166–170. Rozenberg, G. (Ed.). (1997). Handbook of Graph Grammars and Computing by Graph Transformations. World Scientific. Ruan, Y., Kautz, H., & Horvitz, E. (2004). The backdoor key: A path to understanding problem hardness. In AAAI. Russell, S. (1992). Efficient memory-bounded search methods. In ECAI (pp. 1–5). Wiley. Russell, S., & Norvig, P. (2003). Artificial Intelligence: A Modern Approach. Prentice-Hall. Russell, S., & Wefald, E. (1991). Do the Right Thing–Studies in Limited Rationality. MIT Press. Ryoo, H. S., & Sahinidis, N. V. (1996). A branch-and-reduce approach to global optimization. Journal of Global Optimization, 8(2), 107–139. Sacerdoti, E. (1997). Planning in a hierarchy of abstraction spaces. Artificial Intelligence, 5, 115–135. Samadi, M., Felner, A., & Schaeffer, J. (2008a). Learning from multiple heuristics. In AAAI (pp. 357–362). Samadi, M., Siabani, M., Holte, R. C., & Felner, A. (2008b). Compressing pattern databases with learning. In ECAI (pp. 495–499). Samuel, A. L. (1959). Some studies in machine learning using the game of checkers. IBM Journal on Research and Development, 3, 210–229. Sanders, P., Meyer, U., & Sibeyn, J. F. (2002). Algorithms for Memory Hierarchies. Springer. Savitch, W. J. (1970). Relationships between nondeterministic and deterministic tape complexities. Journal of Computer and System Sciences, 4(2), 177–192. Sawatzki, D. (2004a). A symbolic approach to the all-pairs shortest-paths problem. In WG (pp. 154–167). Sawatzki, D. (2004b). Implicit flow maximization by iterative squaring. In SOFSEM (pp. 301–313). Schaeffer, J. (1986). Experiments in search and knowledge. PhD thesis, University of Waterloo. Schaeffer, J. (1989). The history heuristic and alpha-beta search enhancements in practice. IEEE Transactions on Pattern Analysis and Machine Intelligence, 11, 1203–1212. Schaeffer, J. (1997). One Jump Ahead: Challenging Human Supremacy in Checkers. Springer. Schaeffer, J., Bj¨ornsson, Y., Burch, N., Kishimoto, A., & Mu¨ ller, M. (2005). Solving checkers. In IJCAI (pp. 292– 297). Schaeffer, J., Burch, N., Bj¨ornsson, Y., Kishimoto, A., Mu¨ ller, M., Lake, R., et al. (2007). Checkers is solved. Science, 317(5844), 1518–1522. Schapire, R. (1992). The Design and Analysis of Efficient Learning Algorithms. MIT Press.
Bibliography
819
Schiffel, S., & Thielscher, M. (2007). Fluxplayer: A successful general game player. In AAAI (pp. 1191–1196). Schlott, S. (1997). Vehicle Navigation: Route Planning, Positioning and Route Guidance. Landsberg/Lech, Germany: Verlag Moderne Industrie. Schofield, P. D. A. (1967). Complete solution of the eight puzzle. In Machine Intelligence 2 (pp. 125–133). Elsevier. Sch¨oning, U. (2002). A probabilistic algorithm for k-SAT based on limited local search and restart. Algorithmica, 32(4), 615–623. Schrage, L. (1979). A more portable Fortran random number generator. ACM Transactions on Mathematical Software, 5(2), 132–138. Schr¨odl, S. (1998). Explanation-based generalization in game playing: Quantitative results. In ECML (pp. 256– 267). Schr¨odl, S. (2005). An improved search algorithm for optimal multiple sequence alignment. Journal of Artificial Intelligence Research, 23, 587–623. Schr¨odl, S., Wagstaff, K., Rogers, S., Langley, P., & Wilson, C. (2004). Mining GPS traces for map refinement. Data Mining Knowledge Discovery, 9(1), 59–87. Schroeppel, R., & Shamir, A. (1981). A t = o(2n/2 ), s = o(2n/4 ) algorithm for certain NP-complete problems. SIAM Journal of Computing, 10(3), 456–464. Schulz, F., Wagner, D., & Weihe, K. (2000). Dijkstra’s algorithm on-line: An empirical case study from public railroad transport. Journal of Experimental Algorithmics, 5(12), 110–114. Schuppan, V., & Biere, A. (2004). Efficient reduction of finite state model checking to reachability analysis. International Journal on Software Tools for Technology Transfer, 5(2–3), 185–204. Schwefel, H.-P. (1995). Evolution and Optimum Seeking. Wiley. Sen, A. K., & Bagchi, A. (1988). Average-case analysis of heuristic search in tree-like networks. In Search in Artificial Intelligence (pp. 131–165). Sen, A. K., & Bagchi, A. (1989). Fast recursive formulations for best-first search that allow controlled use of memory. In IJCAI (pp. 297–302). Shannon, C. E. (1950). Programming a computer to play chess. Philosophical Magazine, 41(7), 256–275. Shostak, R. (1981). Deciding linear inequalities by computing loop residues. Journal of the ACM, 28, 769– 779. Shue, L., Li, S., & Zamani, R. (2001). An intelligent heuristic algorithm for project scheduling problems. In Annual Meeting of the Decision Sciences Institute. Shue, L., & Zamani, R. (1993). An admissible heuristic search algorithm. In International Symposium on Methodologies for Intelligent Systems (pp. 69–75). Sieling, D. (1994). Algorithmen und untere Schranken f¨ur verallgemeinerte OBDDs. PhD thesis, Technical University of Dortmund. Silver, D. (20050. Cooperative pathfinding. In Conference on Artificial Intelligence and Interactive Digital Entertainment (pp. 117–122). Simmons, R., Apfelbaum, D., Burgard, W., Fox, D., Moors, M., Thrun, S., & Younes, H (1997). Coordination for multi-robot exploration and mapping. In AAAI (pp. 852–858). Simmons, R., Goodwin, R., Koenig, S., O’Sullivan, J., & Armstrong, G. (2001). Xavier: An autonomous mobile robot on the web. In R. Goldberg & R. Siegwart (Eds.), Beyond Webcams: An Introduction to Online Robots. MIT Press. Singh, M. (1995). Path consistency revised. In IEEE International Conference on Tools with Artificial Intelligence (pp. 318–325). Singh, K., & Fujimura, K. (1993). Map making by cooperating mobile robots. In ICRA (pp. 254–259). Slaney, J., & Thi´ebaux, S. (2001). Blocks world revisited. Artificial Intelligence (pp. 119–153). Slaney, J., & Walsh, T. (2001). Backbones in optimization and approximation. In IJCAI (pp. 254–259).
820
Bibliography
Sleator, D., & Tarjan, R. (1985). Amortized efficiency of list update and paging rules. Communications of the ACM, 28(2), 202–208. Smith, D. E. (2004). Choosing objectives in over-subscription planning. In ICAPS (pp. 393–401). Smith, S. J. J., Nau, D. S., & Throop, T. A. (1998). Computer bridge—A big win for AI planning. AI Magazine, 19(2), 93–106. Smith, D. E., & Weld, D. S. (1999). Temporal planning with mutual exclusion reasoning. In IJCAI (pp. 326–337). Sobel, D. (1996). Longitude: The True Story of a Lone Genius Who Solved the Greatest Scientific Problem of His Time. Penguin Books. Sobrinho, J. L. (2002). Algebra and algorithms for QoS path computation and hop-by-hop routing in the internet. IEEE/ACM Transactions on Networking, 10(4), 541–550. Spira, P., & Pan, A. (1975). On finding and updating spanning trees and shortest paths. SIAM Journal on Computing, 4, 375–380. Spouge, J. L. (1989). Speeding up dynamic programming algorithms for finding optimal lattice paths. SIAM Journal of Applied Mathematics, 49(5), 1552–1566. Stasko, J. T., & Vitter, J. S. (1987). Pairing heaps: Experiments and analysis. Communications of the ACM, 30(3), 234–249. Stentz, A. (1995a). Optimal and efficient path planning for unknown and dynamic environments. International Journal of Robotics and Automation, 10(3), 89–100. Stentz, A. (1995b). The focussed D* algorithm for real-time replanning. In Proceedings of the International Joint Conference on Artficial Intelligence (pp. 1652–1659). Stentz, A. (1997). Best information planning for unknown, uncertain, and changing domains. In AAAI Workshop on Online Search (pp. 110–113). Stentz, A., & Hebert, M. (1995). A complete navigation system for goal acquisition in unknown environments. Autonomous Robots, 2(2), 127–145. Stephen, G. A. (1994). String Searching Algorithms. World Scientific Publishing. Stern, U., & Dill, D. L. (1996). Combining state space caching and hash compaction. In Methoden des Entwurfs und der verifikation digitaler systeme, 4. GI/ITG/GME Workshop (pp. 81–90). Shaker Verlag. Stern, U., & Dill, D. L. (1997). Parallelizing the Murφ Verifier. In CAV (pp. 256–267). Stern, R., Kalech, M., & Felner, A. (2010a). Searching for a k-clique in unknown graphs. In SOCS (pp. 83–89). Stern, R., Puzis, R., & Felner, A. (2010b). Potential search: A greedy anytime heuristic search. In SOCS (pp. 119– 120). Stockman, G. C. (1997). A minimax algorithm better than alpha-beta. Artificial Intelligence, 12(2), 179–196. Sturtevant, N. (2008). An analysis of UCT in multi-player games. In CG (pp. 37–49). Sturtevant, N., & Bowling, M. (2006). Robust game play against unknown opponents. In AAAI (pp. 96–109). Sturtevant, N., & Korf, R. E. (2000). On pruning techniques for multi-player games. In AAAI (pp. 201–207). Sturtevant, N., Zhang, Z., Holte, R. C., & Schaeffer, J. (2008). Using inconsistent heuristics on A* search. In AAAI, Workshop on Search Techniques in Artificial Intelligence and Robotics. Sulewski, D., Edelkamp, S., & Kissmann, P. (2011). Exploiting the computational power of the graphics cards: Optimal state space planning on the GPU. In ICAPS (pp. 242–249). Submitted. Sutherland, I. (1969). A method for solving arbitrary-wall mazes by computer. IEEE Transactions on Computers, C–18(12), 1092–1097. Sutton, R. (1991). DYNA, an integrated architecture for learning, planning, and reacting. SIGART Bulletin, 2(4), 160–163. Sutton, R. S. (1988). Learning to predict by the methods of temporal differences. Machine Learning, 3, 9–44. Sutton, A. M., Howe, A. E., & Whitley, L. D. (2010). Directed plateau search for MAX-k-SAT. In SOCS (pp. 90–97). Svennebring, J., & Koenig, S. (2004). Building terrain-covering ant robots. Autonomous Robots, 16(3), 313–332.
Bibliography
821
Tarjan, R. E. (1983). Data Structures and Network Algorithms. SIAM. Taylor, L. A. (1997). Pruning duplicate nodes in depth-first search. PhD thesis, Computer Science Department, University of California, Los Angeles. Tesauro, G. (1995). Temporal difference learning and TD-Gammon. Communication of the ACM, 38(3), 58–68. Thagard, P. (2003). Pathways to biomedical discovery. Philosophy of Science, 70, 2003. Thayer, S., Digney, B., Diaz, M., Stentz, A., Nabbe, B., & Hebert, M. (2000). Distributed robotic mapping of extreme environments. In SPIE: Mobile Robots XV and Telemanipulator and Telepresence Technologies VII (Vol. 4195). Thayer, J., & Ruml, W. Finding acceptable solutions faster using inadmissible information. In SOCS (pp. 98–99). Thayer, J., & Ruml, W. (2010). Anytime heuristic search: Frameworks and algorithms. In SOCS. Thorpe, P. (1994). A hybrid learning real-time search algorithm. Master’s thesis, Computer Science Department, University of California, Los Angeles. Thorup, M. (1999). Undirected single-source shortest paths with positive integer weights in linear time. Journal of the ACM, 46, 362–394. Thorup, M. (2000). On RAM priority queues. SIAM Journal of Computing, 30, 86–109. Thrun, S. (1992). The role of exploration in learning control. In Handbook for Intelligent Control: Neural, Fuzzy and Adaptive Approaches. Van Nostrand Reinhold. Thrun, S. (2000). Probabilistic algorithms in robotics. AI Magazine, 21(4), 93–109. Thrun, S., Bu¨ cken, A., Burgard, W., Fox, D., Fr¨ohlinghaus, T., Hennig, D., et al. (1998). Map learning and highspeed navigation in RHINO. In D. Kortenkamp, R. Bonasso, & R. Murphy (Eds.), Artificial Intelligence Based Mobile Robotics: Case Studies of Successful Robot Systems (pp. 21–52). MIT Press. Thrun, S., Burgard, W., & Fox, D. (2005). Probabilistic Robotics. MIT Press. Torasso, P., & Torta, G. (2003). Computing minimal-cardinality diagnoses using BDDs. In KI (pp. 224–238). Tovey, C., & Koenig, S. (2000). Gridworlds as testbeds for planning with incomplete information. In AAAI (pp. 819–824). Tovey, C., & Koenig, S. (2003). Improved analysis of greedy mapping. In Proceedings of the International Conference on Intelligent Robots and Systems (pp. 3251–3257). Tovey, C., & Koenig, S. (2010). Localization: Approximation and performance bounds for minimizing travel distance. IEEE Transactions on Robotics, 26(2), 320–330. Tromp, J. (2008). Solving connect-4 on medium board sizes. ICGA Journal, 31(2), 110–112. Tsang, T. (1993). Foundations of Constraint Satisfaction. Academic Press. Turing, A. M., Strachey, C., Bates, M. A., & Bowden, B. V. (1953). Digital computers applied to games. In B. V. Bowden (Ed.), Faster Than Thought (pp. 286–310). Putnam. Ukkonen, E. (1985). Algorithms for approximate string matching. Information and Control, 64, 110–118. Valmari, A. (1991). A stubborn attack on state explosion. In CAV (pp. 156–165). Valtorta, M. (1984). A result on the computational complexity of heuristic estimates for the A* algorithm. Information Sciences, 34, 48–59. van den Herik, H. J., & Herschberg, I. S. (1986). A data base on data bases. ICCA Journal (pp. 29–34). van Emde Boas, P., Kaas, R., & Zijlstra, E. (1977). Design and implementation of an efficient priority queue. Mathematical Systems Theory, 10, 99–127. Van Hentenryck, P. (1989). Constraint Satisfaction in Logic Programming. MIT Press. Van Hentenryck, P., Deville, Y., & Teng, C.-M. (1992). A generic arc-consistency algorithm and its specializations. Artificial Intelligence, 57, 291–321. van Leeuwen, J., & Wood, D. (1993). Interval heaps. The Computer Journal, 36, 209–216. Visser, W., Havelund, K., Brat, G., & Park, S. (2000). Model Checking Programs. In ICSE (pp. 3–12). Wagner, I. A., Lindenbaum, M., & Bruckstein, A. M. (1996). Smell as a computational resource—A lesson we can learn from the ant. In Israeli Symposium on Theory of Computing and Systems (ISTCS), (Vol. 24, pp. 219–230).
822
Bibliography
Wagner, I. A., Lindenbaum, M., & Bruckstein, A. M. (1998). Efficiently searching a graph by a smell-oriented vertex process. Annals of Mathematics and Artificial Intelligence, 24, 211–223. Wagner, I., Lindenbaum, M., & Bruckstein, A. (1999). Distributed covering by ant robots using evaporating traces. IEEE Transactions on Robotics and Automation, 15(5), 918–933. Wagner, D., & Willhalm, T. (2003). Geometric speed-up techniques for finding shortest paths in large sparse graphs. In ESA (pp. 776–787). Wagner, D., Willhalm, T., & Zaroliagis, C. (2004). Dynamic shortest path containers. ENTCS, 92, 65–84. Wah, B. (1991). MIDA*: An IDA* search with dynamic control. Technical Report 91-09, Center for Reliable and High Performance Computing, Coordinated Science Laboratory, University of Illinois. Wah, B., & Shang, Y. (1994). Comparative study of IDA*-style searches. In IJCAI (pp. 290–296). Walsh, T. (1997). Depth-bounded discrepancy search. In IJCAI (pp. 1388–1393). Wang, C. (1991). Location estimation and uncertainty analysis for mobile robots. In I. Cox & G. Wilfong (Eds.), Autonomous Robot Vehicles. Springer. Waterman, M. S. (1995). Introduction to Computational Biology: Maps, Sequences, and Genomes. Chapman and Hall. Wegener, I. (2000). Branching Programs and Binary Decision Diagrams—Theory and Applications. SIAM. Wehrle, M., Kupferschmid, S., & Podelski, A. (2008). Useless actions are useful. In ICAPS (pp. 388–395). Wickelgren, W. A. (1995). How to Solve Mathematical Problems. Dover. Wijs, A. (1999). What to do next? Analysing and optimising system behaviour in time. PhD thesis, Vrije Universiteit Amsterdam. Winter, S. (2002). Modeling costs of turns in route planning. GeoInformatica (pp. 345–361). Woelfel, P. (2006). Symbolic topological sorting with OBDDs. Journal of Discrete Algorithms, 4(1), 51–71. Wolper, P. (1983). Temporal logic can be more expressive. Information and Control, 56, 72–99. Wolpert, D. H., & Macready, W. G. (1996). No free lunch theorems for search. Technical Report, The Santa Fe Institute, NM. Yang, B., Bryant, R. E., O’Hallaron, D. R., Biere, A., Coudert, O., Janssen, G., et al. (1998). A performance study of BDD based model checking. In FMCAD (pp. 255–289). Yang, F., Culberson, J. C., Holte, R. C., Zahavi, U., & Felner, A. (2008). A general theory of additive state space abstractions. Journal of Artificial Intelligence Research, 32, 631–662. Yang, C. H., & Dill, D. L. (1998). Validation with guided search of the state space. In DAC (pp. 599–604). Yanovski, V., Wagner, I., & Bruckstein, A. (2003). A distributed ant algorithm for efficiently patrolling a network. Algorithmica, 37, 165–186. Yoshizumi, T., Miura, T., & Ishida, T. (2000). A* with partial expansion for large branching factor problems. In AAAI (pp. 923–929). Younger, D. H. (1967). Recognition and parsing of context-free languages in time n3 . Information and Control, 10(2), 189–208. Zahavi, U., Felner, A., Burch, N., & Holte, R. C. (2008a). Predicting the performance of IDA* with conditional distributions. In AAAI (pp. 381–386). Zahavi, U., Felner, A., Holte, R. C., & Schaeffer, J. (2008b). Duality in permutation state spaces and the dual search algorithm. Artificial Intelligence, 172(4–5), 514–540. Zahavi, U., Felner, A., Schaeffer, J., & Sturtevant, N. R. (2007). Inconsistent heuristics. In AAAI (pp. 1211–1216). Zelinsky, A. (1992). A mobile robot exploration algorithm. IEEE Transactions on Robotics and Automation, 8(6), 707–717. Zhang, W. (1998). Complete anytime beam search. In AAAI (pp. 425–430). Zhang, W. (2004a). Configuration landscape analysis and backbone guided local search for satisfiability and maximum satisfiability. Artificial Intelligence, 158(1), 1–26.
Bibliography
823
Zhang, W. (2004b). Phase transition and backbones of 3-SAT and Maximum 3-SAT. In Principles and Practice of Constraint Programming (CP). Zhang, W., Sen, A. K., & Bagchi, A. (1999). An average-case analysis of graph search. In AAAI (pp. 757–762). Zhang, Z., Sturtevant, N. R., Holte, R. C., Schaeffer, J., & Felner, A. (2009). A* search with inconsistent heuristics. In IJCAI (pp. 634–639). Zhang, Y., & Yap, R. H. C. (2001). Making AC-3 an optimal algorithm. In IJCAI (pp. 316–321). Zhao, Y. (1997). Vehicle Location and Navigation Systems. Artech House Inc. Zheng, Z. (1999). Analysis of swapping and tempering monte carlo Algorithms. PhD thesis, York University. Zhou, R., & Hansen, E. A. (2002a). Memory-bounded A* graph search. In Conference of the Florida Artificial Intelligence Research Society (FLAIRS). Zhou, R., & Hansen, E. A. (2002b). Multiple sequence alignment using A*. In AAAI. Student abstract. Zhou, R., & Hansen, E. A. (2003a). Sparse-memory graph search. In IJCAI (pp. 1259–1268). Zhou, R., & Hansen, E. A. (2003b). Sweep A*: Space-efficient heuristic search in partially-ordered graphs. In ICTAI (pp. 688–695). Zhou, R., & Hansen, E. A. (2004a). Breadth-first heuristic search. In ICAPS (pp. 92–100). Zhou, R., & Hansen, E. A. (2004b). Space-efficient memory-based heuristics. In AAAI (pp. 677–682). Zhou, R., & Hansen, E. A. (2004c). Structured duplicate detection in external-memory graph search. In AAAI (pp. 683–689). Zhou, R., & Hansen, E. A. (2005a). External-memory pattern databases using structured duplicate detection. In AAAI. Zhou, R., & Hansenm, E. A. (2005b). Beam-stack search: Integrating backtracking with beam search. In ICAPS (pp. 90–98). Zhou, R., & Hansen, E. A. (2006a). A breadth-first approach to memory-efficient graph search. In AAAI (pp. 1695– 1698). Zhou, R., & Hansen, E. A. (2006b). Domain-independent structured duplicate detection. In AAAI (pp. 1082– 1087). Zhou, R., & Hansen, E. A. (2007a). Edge partitioning in external-memory graph search. In IJCAI (pp. 2410– 2417). Zhou, R., & Hansen, E. A. (2007b). Parallel structured duplicate detection. In AAAI (pp. 1217–1222). Zhou, R., & Hansen, E. A. (2008). Combining breadth-first and depth-first strategies in searching for treewidth. In AAAI, Workshop on Search Techniques in Artificial Intelligence and Robotics. Zhou, R., Schmidt, T., Hansen, E. A., Do, M., & Uckun, S. (2010). Edge partitioning in parallel structured duplicate detection. In SOCS (pp. 137–138). Zilberstein, S., & Russell, S. (1993). Anytime sensing, planning and action: A practical model for robot control. In IJCAI (pp. 1402–1407). Zilles, S., & Holte, R. C. (2010). The computational complexity of avoiding spurious states in state space abstraction. Artificial Intelligence, 174(14), 1072–1092. Zobrist, A. (1970). A new hashing method with application for game playing. Technical Report, School of Electronic Engineering Science, University of Wisconsin, Madison. Reprinted in ICCA Journal 13(2), 69–73. Zomaya, A. (1996). The Parallel and Distributed Computing Handbook. McGraw-Hill.
This page intentionally left blank
Index (1+1) EA, 639–641 αβ-algorithm, 527 αβ-branch-and-bound, 550 αβ-pruning, 525–529 ∫-LRTA∗ , 488 ∫-optimality, 243 λ-reduction, 108 c-approximation, 646 h-value surface, 468, 481, 482, 499 k-beam search, 251 k-best first search, 250–251, 274 k-SAT, 593, 620, 646–651 k-satisfiability, 593 (pseudo) Boolean function, 640 Closed list, 48, 81, 89, 110, 111, 151–153, 167, 227, 251, 254–265, 280, 385, 768 DecreaseKey operation, 53, 90, 104, 108, 753 DeleteMin operation, 90, 92, 157, 324 Graphplan, 675–677, 679, 697 Insert operation, 51, 96, 128, 325, 356, 358 Open list, 48, 49, 50, 59, 60, 81, 89, 90, 110, 151–152, 167, 227, 236, 247, 254, 257, 262, 752, 766 Satplan, 317, 677–678, 697 (n2 − 1)-PUZZLE, 3, 10, 11, 19, 20, 29, 89, 116, 170, 177, 179, 211, 228, 283, 335, 407, 420 n-QUEENS, 624 1-Level Bucket, 90, 157, 265, 299, 306 2-Level Bucket, 92 2-SAT, 593, 596, 630, 665 2-SAT backdoor, 596 Airport, 674 Algebraic Decision Diagram, 312 All Pairs Shortest Paths, 47, 62, 86, 450, 579, 706, 719 Amazons, 523, 568 And Inverter Graph, 312 Arrow Distributed Directory Protocol, 724, 735 Arrow Puzzle, 187, 447 Atomic Heap, 157 Atomix, 42–43, 46 Awari, 568 Backgammon, 11, 45, 562
Bin Packing, 178, 572, 598, 599, 602, 620, 630 Binary Decision Diagram, 283, 286 Binary Search Tree, 97, 98 Binomial Tree, 104, 105 Biological Pathway, 759 Bipartite Matching, 624 Bitonic Sort, 404, 405 Blocksworld, 11, 29, 30, 296, 615, 616, 677, 681, 695, 699 Bloom Filter, 134, 158 Bridge, 10, 45, 536, 538, 568 Bucket Sort, 342, 343 Buffered Repository tree, 324, 325 Burned Pancake, 363, 364 Canadian Traveler’s Problem, 630 Century Puzzle, 21 Cheap Necklace, 41 Checkers, 10, 423, 522, 534, 560, 568 Chess, 10, 465, 520, 522, 530, 535, 537, 543, 560 Circuit Value problem, 374 Clique, 604, 620, 630 Component Tree, 157 Connect, 4, 10, 45, 521, 568 Cryptarithm, 574, 579 Dad’s Puzzle, 20, 21 Decision Tree, 286 Decomposable Negational Normal Form, 312 Dictionary, 111 Dining Philosophers, 158, 460, 711, 717, 735 Donkey Puzzle, 20 Eight Queens, 573, 586 Eight-Puzzle, 19, 20, 45, 118, 163, 172, 208, 432, 450, 458, 477, 773 External Mergesort, 323, 343 External Quicksort, 323, 324 Fibonacci Heap, 104–106, 157 Fifteen-Puzzle, 10, 19, 45, 115, 168, 191, 205, 208, 284, 309, 340, 343, 370, 389, 412, 414, 425, 440, 446 Frogs and Toads, 42 Gambler’s Ruin, 650 General Sliding Tile Puzzle, 20, 45
Generalized Suffix Tree, 89, 146, 151 Go, 521, 562, 567–568 Graph Coloring, 577, 624 Gridworld, 50, 52, 165, 255, 257, 435, 440, 512 Gripper, 300, 301 Heap, 98, 152, 752 Hex, 523, 568 Hobbits and Orcs, 82 Independent Set, 604, 620 Inverted Trie, 147, 148, 150 Knapsack, 84, 87, 598, 626 Knight’s Tour, 83, 84 Ladder, 667 Logistics, 11, 30, 685 Lonely Eight, 574, 575 Metric TSP, 25, 45 Minimum Spanning Tree, 26, 200 Missionary and Cannibals, 82 Morpion Solitaire, 538, 565, 568 Multiple Sequence Alignment, 3, 26–29, 62, 84, 255, 270, 325, 329, 365, 760, 770, 772 Nim, 521, 564 Nine-Men-Morris, 521, 522, 568 Number Partition, 572, 588, 596, 597, 620, 630 Openstack, 675 Pairing Heap, 100 Pancake, 363, 364 Patricia Trie, 143 Pattern Packing, 178, 684 Peg, 551 Perfect Weak Heap, 107 Pipesworld, 674 Power Supply Restoration, 674 Promela, 674 Quantified Boolean Formula, 628 Quick-Heapsort, 157 Quicksort, 157, 321, 404 Racetrack, 44 Radix Heap, 93–96, 157 Radix Sort, 343 Railroad Switching, 12–14, 23 Rank-Relaxed Weak Queue, 158 Rectangle Packing, 572, 601–604, 620, 630
825
826
Index
Relaxed Weak Queue, 106–108, 110, 157–158 River Crossing, 83 Route Planning, 24–25 Rovers, 674 Rubik’s Cube, 10, 22 Run-Relaxed Weak Queue, 157 Same Game, 565 Satellite, 674 Sequential Ordering, 189, 192 Set covering, 577 Settlers, 675 Single Source Shortest Paths, 47, 62, 196, 298, 311, 319, 324, 325 Skat, 566, 568 Smallest Enclosing Square, 627 Sokoban, 3, 9, 10, 22, 23, 45, 89, 116, 138, 284, 301, 305, 317, 441, 442, 445, 450, 453, 459, 463 STAR abstraction, 163 Stochastic Shortest Path, 553 Storage, 674 Strips, 29, 30, 38, 42, 163, 186, 365, 453, 463, 673, 696 Strips Abstraction, 163 Strips Planning, 29, 453 Strongly Connected Component, 311 Subset Sum, 642 Sudoku, 574, 579 Suffix List, 131, 133, 134, 137, 152, 158 Suffix Tree, 142, 143, 147, 150, 153, 159 Suffix Trie, 143 TSP, 25–26, 646 Thirty-Five-Puzzle, 45, 187, 295, 335, 348, 398 Three-Puzzle, 35 Tic-Tac-Toe, 521, 544, 545, 563, 566 Topological Sorting, 311, 318 Tournament Tree, 324 Towers-of-Hanoi, 10, 179, 370, 418, 424, 427 Traveling Purchase Problem, 675 Trie, 139, 141, 143, 147 Trucks, 675 Twenty-Four-Puzzle, 19, 45, 172, 174, 191, 208, 223 Two Ladder, 667 Umts, 675 Vertex Cover, 572, 604, 620
Weak Queue, 107, 152 Weak-Heapsort, 157 Wusel, 43, 46 64-bit compression, 406
A A∗ , 69–75 ABC procedure, 537 abstract description language, 673 abstract planning problem, 680 abstract problem graph, 343, 392 abstraction, 161, 185, 191, 703 abstraction database heuristic, 735 abstraction refinement, 161 abstraction transformation, 161, 162, 165 abstraction-directed model checking, 704 AC load balancing strategy, 387 AC-3, 576–577, 581, 629 AC-8, 576–577, 581, 629 acceptor processor, 388 Ackermann function, 41 action, 3, 12, 30, 35, 285, 694 action cost partitioning, 312 action execution time window, 696 action graph, 699 action planning, 3, 11, 29–32, 192, 280, 296, 673–699 action-execution step, 469–470 action-selection step, 469 action-value function, 540 active process heuristic, 707 activeness heuristic, 707–709, 719–720 adaptive sort, 356 ADD, 312, 569 adding finite-domain variables (with BDDs), 289 additional context, 698 additive penalty, 446 adjacency list, 15, 326, 328 adjacency matrix, 14, 47, 62, 210 ADL, 673, 697 admissible compression, 184 admissible heuristic, 18, 162, 171, 174, 697 admissible macro, 450 admissible pruning, 429, 430, 458–459 admissible weight function, 198, 204, 205 affine gap cost, 28, 65, 66 agent-centered search, 465–466, 514 Aho-Corasick algorithm, 435–438
algebraic decision diagram, 569 algorithm A, 58 algorithm flood, 634, 654 alive procedure, 444 all-different constraint, 571, 575, 579, 580 alphametic, 574 amino acid, 26, 27, 46 amortized complexity, 7, 92 ample set, 453–455, 464 ample set construction, 454 ancestor (of a node), 15 AND/OR graph, 552–559 anomaly (in a knowledge-based system), 701 ant algorithm, 652–657 antidiagonal, 63, 255, 767, 768 anytime A∗ , 277 anytime repairing A∗ , 246–250 API, 401 approximation, 26, 28, 34 approximation algorithm, 45, 599, 630, 645, 647, 687, 744 ARA∗ , 247–249 arc consistency, 571, 575–579 arc consistent (CSP), 575 arc consistent (variable pair), 575 arithmetic CSP, 578 arity, 8 array compaction, 406–407 arrow path, 724 articulation, 24 aspiration criterion, 638 aspiration search, 530–531 assembly language level program model checking, 714, 716 assertion, 706 assertion violation, 717 assignment costs, 686 assignment graph, 580 assumption based truth maintenance system, 729 asymptotic branching factor, 206–211 asynchronous distribution, 379 asynchronous IDA∗ , 382–385 asynchronous parallel search, 420 asynchronous search, 375, 380, 384 asynchronous setting, 369, 379, 420 ATMS, 729 atom, 8, 42–43 auto tactic, 733 automata-based model checking, 703
Index
automated theorem proving, 730–734 automatically inferred pruning knowledge, 429 average macro solution length, 450
B back leak, 259, 260, 763, 767, 772 back-propagation, 443 backbone, 595–596 backdoor, 595–596 backjumping, 583–584 backmarking, 585–587 backtracking, 581–582 backup induction, 554 backward edge, 455 backward proof, 733 backward search, 679 ball, 22 base model, 777 BDD, 283, 286–290 beam search, 251 beam width, 251, 266 beam-stack, 267 beam-stack search, 266–270 belief state, 504–506, 703 Bellman equation, 36, 37, 67, 747 Bellman-Ford algorithm, 47, 81, 86, 311 best-first minimax search, 567 best-first search (for two-player games), 533–534 best-fit, 599 BFS, 51–53 BFS level, 177, 272–273, 292, 294, 298, 326, 348, 402 BFS number, 362 BFS tree, 331 BHFFA, 410, 411, 427 bibliographic search problem, 433 bidirectional heuristic front-to-front algorithm, 410, 411, 427 bidirectional heuristic search, 370 bidirectional search, 408–419 big-oh notation, 7 bin completion, 599–600 binary constraint, 573 binary constraint network, 609 binary CSP, 573 binary search tree, 98, 385 bioinformatics, 759 bionic algorithm, 652 bipartite graph, 24, 579 birthday problem, 406
bit-state hashing, 134–136 black-box semantic, 674, 693, 694 blank, 19 BLAST, 771 blast tactic, 733 blind search, 16, 291–299 block, 4, 401 block (in a rank sequence), 107 block size, 321 BnB, 198–201 Boltzman constant, 636 Boolean constraint, 571 bootstrap method, 540 bootstrapping, 442, 458, 524 bound variable, 8 bounded model checking, 317, 736 bounding, 198 bounding box, 742 bounds consistency, 577–578 box, 22 branch-and-bound, 198–201 branch-and-bound search tree, 199, 201 branching, 198, 571 branching factor, 15, 206–211 branching partitioning, 310, 312 branching rule, 379, 581 breadth-first duplicate detection search, 431 breadth-first heuristic search, 261–264 breadth-first search, 47, 51–53 brute-force algorithm, 647 brute-force branching factor, 216, 217 brute-force search tree, 206, 211, 215, 216 B¨uchi automaton, 615–617, 631 bug hunting estimate, 704 business work-flow analysis, 702
C cache anomalies, 321 cache-oblivious algorithm, 361 canonicalize, 447 Carrillo-Lipman bound, 769, 770, 772 CAS, 378 cascading cut, 105, 107 causal graph, 685–687 causal graph analysis, 685 central processing unit (CPU), 370 chairman, 108 character, 113 characteristic equation, 209 characteristic function, 283–285
827
children layer, 389 Christofides’ algorithm, 646 chronological backtracking, 629 Church-Turing thesis, 5 circularity anomaly, 727 CKKA, 598 clause, 592 clause form, 731 cleaning transformation, 108, 109 client, 378, 398, 399 clique pattern database compression, 184 CLM, 657 clock valuation function, 721 clock variable, 721 closed under entailment, 723 closed world assumption, 29 clustering, 388 CNLP, 657, 669 coalescing, 401 collapse compression, 137 combinatorial game theory, 521, 568 communication protocol, 705–713 commutative action, 453 compare-and-swap, 378, 425 complete binary tree, 98 complete deductive system, 9 complete greedy algorithm, 598 complete Karmakar-Karp algorithm, 598 complete search process, 633 completeness (of a search algorithm), 456 complexity theory, 5–6 compound statement, 4 computability theory, 4–5 computable function, 5 computational biology, 9, 27, 757 computer ant, 634, 652 concise hash function, 403 configuration, 12 configuration space, 773–777 conflict analysis, 288 conflict anomaly, 727 congruence relation, 447 conjunctive normal form, 8, 620 consistency, 575–580 consistency (in a knowledge-based system), 701 consistent formula, 8 consistent heuristic, 3, 18 consolidate, 105 consolidation, 104–106 conspiracy number search, 567
828
Index
conspiracy search, 537 constant, 8 constrain operator, 309 constraint, 572 constraint function, 618 constraint graph, 583, 609 constraint local minimum, 657 constraint modeling, 571 constraint optimization, 618–619 constraint optimization problem, 572, 618 constraint partitioning, 699 constraint propagation, 571 constraint satisfaction problem, 572, 581 constraint search, 571 continuous nonlinear programming, 657 contracted locus, 143 control knowledge, 612, 631 control knowledge in LRTA∗ , 479 convex hull, 43 convex set, 750 Cook’s theorem, 286 cooling scheme, 637 correct deductive system, 9 cost, 14 cost (of an action), 35 cost consistency, 747 cost function, 53, 618 cost structure, 77, 78 cost-to-go function, 66 counterexample, 703 counterexample guided error refinement, 704, 705, 735 credit search, 629 critical node, 528 critical path, 611 critical role (of correct software), 701 critical tree, 528, 529, 534 cross-over operator, 642 crypto-arithmetic puzzle, 574 CSP, 572 cubie, 22 cuckoo hashing, 128–130 cuckoo process, 128, 129 cut, 105 cycle argument, 474, 483 cycle detection search, 426, 710
D DAG, 325 dangerous state, 708
data abstraction, 161 data partitioning, 384 data stream, 344 Datalog, 550 Davis-Putnam Logmann-Loveland algorithm, 594 dead reckoning, 739 dead-end detection, 430 dead-end pruning, 458–459 deadlock, 705, 707, 708 deadlock formula, 708 debugger, 713 decidable logic, 9 decidable problem, 5 decision problem, 5 decision tree, 529 decomposed state, 444 deductive system, 9 Deep Blue, 10 deep cut-off, 526 Deep Fritz, 10, 520 deep pruning, 547 Deep Thought, 521 deficiency anomaly, 727 delay transition, 721 delayed duplicate detection, 319, 359 delayed expansion strategy, 309 dependency network, 728 dependent actions, 693 depth-bounded discrepancy search, 591 depth-first branch-and-bound, 195, 199 depth-first iterative-deepening, 195, 201 depth-first search, 47, 50–51 depth-slicing, 375 derived predicate, 674, 695–696 descendant (of a node), 15 deterministic planning, 673 deterministic search model, 36 deterministic Turing machine, 591 DFBnB, 195, 199 DFID, 195, 201 DFS, 50 diagnosis, 727–730 diagnosis system, 730 diagnostic variable, 730 diagonizable matrix, 209 diamond property, 454 difference bound matrix, 312 difference constraint, 721 digital (binary) sum, 564 digital map, 737 Dijkstra’s algorithm, 47
diminishing pebble, 668 direct conflict, 694 direct numerical conflict, 694 directed acyclic graph, 325 directed automated theorem proving, 701 directed model checking, 701 directed state space problem, 23 discount, 65 disjoint hash function, 403 disjoint pattern database, 173–177 disjoint state abstraction, 175 disjunctive normal form, 8 disjunctive partitioning, 312 disk striping, 321 distance, 13 distance move, 452 distant move pair, 452 distributed algorithm, 369 distributed memory model, 397 distributed response strategy, 376 distributed search, 369–427 divide-and-conquer, 62 divide-and-conquer algorithm, 196–197 divide-and-conquer beam search, 266 divide-and-conquer beam stack search, 267 divide-and-conquer bidirectional search, 257 divide-and-conquer decomposition search, 568 divide-and-conquer forward frontier search, 257–259 divide-and-conquer solution reconstruction, 262 DNA, 26 domain abstraction, 163 domain expert pruning knowledge, 429 domain metric, 673 domain range, 577 domain splitting, 581 domain transition graph, 685 domain-independent planning, 673 dominance condition, 604 dominance condition on feasible bin completions, 599 don’t care (proposition), 680 donor processor, 388 double bit-state hashing, 251 double hashing, 124 DPLL, 594 dual encoding, 573
Index
dual pattern database, 179–180 duality, 180 duplicate (node), 49 duplicate (string), 432 duplicate detection scope, 265 duration, 695 dynamic backtracking, 584–585 dynamic incremental hashing, 155 dynamic load balancing, 384 dynamic perfect hashing, 127 dynamic programming, 62–68, 255, 543, 678–679 dynamic pruning, 458 dynamic substring pruning, 438 dynamic variable reordering, 288
E early duplicate detection, 328, 391 early merging, 359, 390 edge, 12 edge ant walk, 493, 501, 657 edge counting, 493 edge partitioning, 364 edge transition, 721 edit distance, 28 effective branching factor, 23 efficiency, 372 eigenvalue problem, 209 ELF, 713 eligibility trace, 567 embarrassing parallel, 398 embedded system verification, 702 embedding, 162 enabledness preserving action, 453 encapsulated variable, 573 endgame database, 522 enforced hill climbing, 240–242 equilibrium distribution, 212 equilibrium fraction (of nodes), 206, 207 equivalence class, 447 error, 539 error trail, 715 essential language extension, 673 Euclidean distance, 25, 745 Euler tour, 328, 374 evaluation, 634 evaluation function, 633, 641 evaluation function parameter, 542 eventually (operator), 613 evolutionary algorithm, 639–645 evolutionary distance, 28 executed action, 35
existential elimination, 9 existential introduction, 9 exit distance, 276 expand queue, 394 expansion (of a node), 15, 49 expected cost, 520 expected return, 36 expected reward, 520 explanation-based learning, 543 explanatory phase, 702 explicit graph, 14 explicit state space graph, 15 explicit-state model checking, 702 explicit-state pattern database, 683 explicit-state search, 283 exploitation (of the search space), 274 exploration (of a node), 15 exploration (of the search space), 274 exploration-exploitation dilemma, 542 Extended IDA∗ , 276 extended locus, 143 extended successor relation, 634 extended weight function, 198 external A∗ , 320 external A∗ search, 334 external B-tree, 362 external BFS, 326, 328, 360 external binary search tree, 362 external breadth-first branch-and-bound, 320, 330–332 external breadth-first heuristic search, 331, 332, 347 external breadth-first search, 319 external depth-first search, 319, 325 external Dijkstra search, 324 external Dijkstra’s algorithm, 47, 53–57 external enforced hill climbing, 320, 332–334 external explicit-graph DFS, 325–326 external explicit graph search algorithm, 324–328 external explicit-graph BFS, 326–328 external linked list, 361 external memory data structure, 323 external pattern database, 346–347 external queue, 361 external scanning, 323 external sorting, 323, 341 external stack, 361 external symbolic pattern database, 348 external value iteration, 349–353
829
F fact, 29 fact space exploration, 681 factorial base, 118 factorial base (of a permutation), 118 fail-safe variant, 526 failure function, 435 FALCONS, 489 fast learning and converging search, 489 FASTA, 763, 771 fault-finding phase, 702 feasibility problem, 635 feasible object set, 599 features, 542 fellow, 108 Fibonacci number, 40 FIFO, 51 finite state controller, 559 finite state machine pruning, 435–438 firing sequence, 717 first fail, 581 first order logic, 730 first-fit, 621 first-fit decreasing, 599 first-in first-out, 51 first-in-first-out (paging strategy), 320 first-order predicate logic, 8 fitness, 639 fitness function, 641 fixpoint, 31 fixpoint (computation), 289 FKS hashing, 128 FKS hashing scheme, 126–127 Floyd-Warshall algorithm, 47, 62 fluent, 673 folding, 388 forbidden word, 431 formula progression, 614–615 formula-based heuristic, 705–707 forward checking, 581 forward expansion, 554 forward proof, 733 forward pruning, 537 forward search, 679 forward set simplification, 293, 309 forward-chaining search, 449 free ball, 441 free variable, 8 freespace, 773 frequency (of pattern searches), 445 fringe search, 231–233 front-to-front, 410
830
Index
frontier search, 257–259, 319, 346, 389 frontier set simplification, 293 FSM distance heuristic, 709 full state hashing, 375 fully expanded, 453 function, 8 functional A∗ , 733–735
G GA, 634, 641–643 Galileo, 740 game description language, 550 game theory, 550, 567, 568 game tree, 524–525 gap, 28, 63, 273 gap opening, 27 GDE, 728–729 GDL, 550 general cost structure, 76, 78 general diagnostic engine, 728–729 general game playing, 11, 45, 550–552 general purpose GPU programming, 400 generalization of dead-end pattern, 441 generalized suffix tree, 89, 146–151, 438 generation (of a node), 61, 173, 224 generic search model, 29, 36–37 genetic operator, 642 geocoding, 744 global hashing, 388 global positioning system, 737, 739 global sequence alignment, 762 global variable, 199, 201, 709, 714 globally (operator), 613 goal constraint, 571, 613 goal preference, 617 goal state, 26, 37, 291, 298, 457, 474, 491, 561, 634, 725 golden ratio, 113 GPGPU, 400 GPS, 11, 739 GPU, 370, 400–408 GPU-based search, 370, 405 gradient decent, 668 gradient descent, 539, 542, 635 graph leveling, 388 graph morphism, 723, 725 graph transition system, 723–726 graphics processing unit (GPU), 370, 400 greedy best-first search, 73, 87, 243, 307–308, 497, 733 greedy heuristic, 597
greedy plan extraction, 31, 690 greedy policy, 37 grounded planning domain, 30 GSAT algorithm, 595
H Hamming distance heuristic, 718–719, 725 Hamming sphere algorithm, 649, 650 hand-off, 377 hard constraint, 571, 619, 697 hard problem, 591–609 hardware verification, 9, 318 harmless dead-end, 276 harmonic number, 136 harmonic sum, 136 hash compaction, 136–137, 158 hash table folding, 183 hash-based distribution, 375 hash-based duplicate detection, 342–343, 359, 388 hash-based partitioning, 404–406 head (of a string), 143 heap, 97–110 heap property, 98 heap store, 107 heap-ordered multiway tree, 100 heuristic, 15–19, 26, 47, 75, 161, 302–309, 465, 477–479, 597–598, 607–608, 690–691, 703–704, 707–713, 715–720 heuristic function, 69, 75, 212, 304, 608 heuristic knowledge in LRTA∗ , 479–480 heuristic search, 47, 68, 121, 261–264, 302–309, 418–419, 572 heuristic search algorithm, 16, 68, 263, 347, 752, 762 hierachical A∗ , 165–167 high-level variable, 687 hill-climbing, 240–242, 280, 332–334, 635–636, 668 Hirschberg’s algorithm, 256, 257, 762 history heuristic, 530, 567 Hoare calculus, 690 holy grail, 759 homomorphism, 162 horizon effect, 537, 562 Horn backdoor, 596 Horn clause, 732 Horner’s rule (for evaluating polynimials), 114
Huffman compression, 185 hyper-arc consistency, 577 hyperarcs, 553 hypercube, 27 hypergraph, 552, 553
I I/O efficiency, 319, 324, 354, 364, 388, 723 IDA∗ , 195, 203–218, 233, 236, 251–254, 276, 346, 382–385 IDDP, 764, 770, 772 IDLA∗ , 439 IE, 219 ILP, 618 image, 283, 290, 310 immediate duplicate detection, 353, 361, 365 immediate reward, 540 implicit graph, 15, 47, 48, 328–342 implicit state space graph, 15 improved limit discrepancy search, 589, 591 in-order traversal, 385 in-place locking, 378 inadmissible macro, 450 inadmissible pruning, 266 inclusion check, 722 inconsistent node, 244 incremental duplicate learning A∗ , 438–440 incremental hashing, 111, 113, 116, 158, 375 incremental pruning, 459 incremental state space generation, 15 indel, 27, 28 independence ratio, 375, 377 independent action, 453 inductive logic programming, 542 inference rule, 9, 32, 674, 697 infinite path, 56, 65, 613, 615, 690 influence, 452–453 informed search, 68, 81 inherently sequential, 694, 695 initial population, 641 initial state, 12, 31, 33, 41, 166, 183, 284, 304, 346, 429, 449, 697, 720 initial state set, 286 input resolution, 732 instruction-level paralellelism, 369 integer linear program, 618, 661
Index
intelligent authoring, 727 intelligent debugging, 728 intelligent tutoring, 727 interleaved variable ordering, 288 interleaving heuristic, 716 internal node heuristic, 732, 733 international planning competition, 45, 674, 735, 771 interpretation, 8 invariant analysis, 717 invariant constraint, 721 inverse, 119, 161, 167, 431, 703 inverse macro, 452 inversible action, 170, 180, 433 inversion, 20, 120 inverted index, 118 invisible action, 454 Isabelle, 736 isolated field procedure, 441 isomorphism heuristic, 725 iterative broadening, 251, 252, 280, 629 iterative deepening (in two-player search), 525 iterative deepening A∗ , 195, 204–218, 233, 236, 251, 254, 276, 345, 382, 385 iterative expansion, 219 iterative threshold search, 233–235, 279 iterative-deepening dynamic programming, 763–764 ITS, 233–235, 279
K Kalman filter, 741 Karmakar-Karp heuristic, 597–598 kernel, 259, 401 knowledge-based system, 701, 726–727 Kripke structure, 702, 703
L labeling, 524, 571, 581, 681, 727 Lagrange multiplier, 634, 657–660 language (induced by the model), 703 language (induced by the specification), 703 Las Vegas algorithm, 633, 647 lasso, 703, 710 last-in first-out, 50, 320 last-in-first-out (paging strategy), 320 lattice, 27, 255 layered plan graph construction, 677 lazy state space generation, 15
lcp, 440 LDFS, 569 LDS, 588–591, 619–620 leader (of a run), 108 learning DFS, 569 learning real-time A∗ , 466–473 least-recently-used (paging strategy), 320 leftmost tip node, 234 Lehmer generator, 116 Lempel-Ziv compression, 185 lexicographic rank, 118, 159 LIFO, 50, 320 lifted search space, 710 lifted state space, 634 limit discrepancy search, 588–591, 619–620 linear conflict heuristic, 21 linear probing, 123, 354, 358 linear program, 618, 661 linear speedup, 372 linear temporal logic, 613, 621, 697, 703 linearly priced timed automaton, 722 list ranking, 374 literal, 8, 592 little-oh notation, 7 live transition, 717 liveness as safety model checking, 710, 735 liveness property, 703 LM load balancing strategy, 387 load balancing, 375, 378, 385, 387 local hashing, 388, 425 local pattern, 23 local search, 465, 633, 638, 663 local search space, 468, 472, 479, 482, 487, 498, 499, 561 local sequence alignment, 762 local variable, 661, 711 locality, 116, 264–265, 343, 347 locality (for delayed duplicate detection), 343 locality (for structured duplicate detection), 343 locality (of abstract state space graph), 347 locality (of state vector), 116 locally consistent, 581 lock heuristic, 716 lock-free hash table, 378, 426 lock-free hashing, 378–379 locking, 387
831
logistics, 571, 622, 675 lollipop state space, 511 long run minimization (of solution costs), 480 longest common prefix, 146, 440 loosely called action, 471 loss backup, 543 low-level variable, 685, 686 lower bound, 7, 10, 18, 28, 45, 86, 130, 199, 299, 302, 340–342, 397, 477, 479, 606 LP, 618 LRTA∗ , 466–496 LRTA∗ improvement (for fast-acting agents), 480 LRTA∗ improvement (for slowly-acting agents), 480 LRTA∗ with lookahead, 473–474 LTL, 613, 621, 697, 703
M machine learning, 191–192, 463, 539, 561, 636, 759 macro, 450 macro action, 22, 191, 430, 450 macro learning, 450, 459 macro operator, 450 macro problem solving, 449–452, 459 macro table, 450–452 makespan, 630, 674 mammalian cell cycle control, 760, 771 Manhattan distance heuristic, 21, 115, 334, 374, 414, 446 map matching, 737, 741–744 marked node, 107–108 marking (in a Petri net), 717 Markov chain, 35, 741 Markov decision process, 35–36, 495, 519 Markov decision process problem, 35, 65–68, 495 master, 378, 380, 391, 394, 395, 398, 400 matching, 579 matrix multiplication, 374, 579 MAX-k-SAT, 630, 646–647, 648 max-atom heuristic, 678–679 max-atom-pair heuristic, 679 maximal pattern size, 445 maximum flow, 24, 580 maximum matching, 580, 606, 607 maximum weighted bipartite matching, 174
832
Index
maxMem, 187, 235, 266 MDP, 35–36, 65–68, 495 member (of a run), 107 membership problem, 111 memorizing, 441 memory aware recursive best-first search, 219 memory hierarchy, 319, 322 memory leak, 237 memory locality, 320, 755 memory-enhanced test framework, 532–533, 562 merge (weak-heap), 102 merging strategy, 356 merit function, 69 message-passing, 711 metric planning, 673, 687–691 Metropolis algorithm, 634, 637 Min-LRTA∗ , 482–483, 493 min-max LRTA∗ , 494–495, 504–506 min-max-learning real-time A∗ , 494–495, 504–506 minimal constraint network, 609 minimal matching (heuristic), 24 minimal temporal constraint network, 610 minimax, 519, 525 misplaced-tile heuristic, 21 mistake-bounded error model, 480, 495 modal operator, 613 model automaton, 615, 703 model checking, 701, 702, 704, 710, 713–717, 721 model checking object code, 713 model checking problem, 703–704, 710 model checking software, 713 model counting, 287 model relaxation, 704 model-based diagnosis, 727 molecule, 42 Monien-Speckenmeyer algorithm, 647–648 monotone heuristic, 18, 718 Monte Carlo algorithm, 633, 647 Monte Carlo policy evaluation, 68 Monte Carlo randomized search, 634 Monte Carlo sampling, 538, 552 Monte Carlo search, 537, 562 Moore’s Law, 319 most general unifier, 730 most-blocked heuristic, 716 motion-planning problem, 773, 776
move, 12 move ordering, 529–530 move-alternation property, 272 MRBFS, 219 MST, 26, 646 MTD(f), 532, 534 multiobjective search, 48, 79–80 multiplayer game, 10, 538, 547–549 multiple pattern database, 172–173, 681–683 multiple-goal heuristic search, 370, 418–419 multiplicative hashing, 113 multiplying finite-domain variables (with BDDs), 289 multivalued pattern database, 191 multivalued variable encoding, 681, 682, 685 multiway tree, 100 mutation operator, 640, 642, 684 mutex action, 676 mutex proposition, 676 mutually exclusive lock, 385 mutually substring free, 439
N NAND-flash, 353 navigation, 737 navigationpile, 155–156 negmax, 519, 524, 525, 530 neighborhood, 633, 634 next time (operator), 613 no-free-lunch theorem, 662, 663 no-good, 600, 729 node, 12 node counting, 491–492, 500–501, 502, 512 node expansion efficiency, 116 node ordering, 234, 255, 382, 695 node store, 107, 108 nondeterministic environment, 519 nondeterministic search model, 29, 36 nondeterministic Turing machine, 5, 6, 591, 593 noop, 31 noop action, 676, 680 normal form, 731 NP, 6 NP-complete, 25, 175, 178, 593 NP-complete problem, 6, 591 NP-containment, 591 NP-hardness, 591
nucleotide base, 26 null move, 537 null-window search, 531, 532
O objective function, 25, 79, 572, 617, 618, 633, 635, 638, 642, 643 observed action, 35 obstacle, 42 oct-tree data structure, 769 off-chip global memory, 401 off-chip local memory, 401 off-line heuristic, 703 on-chip register, 401 on-chip shared memory, 401 on-demand pattern database, 183 on-line heuristic, 703 on-the-fly state space generation, 15 open addressing, 121, 123, 131, 133, 134, 136, 153 open subgoal heuristic, 733 operations research, 198 operator, 12 optical storage media, 195 optimal alignment, 11, 27, 28, 255 optimal parallel plan, 695 optimal plan, 37, 300, 301, 675 optimal policy, 36, 65, 349, 539, 540, 560 optimal solution, 14, 25, 28 optimal value function, 36, 37, 68, 540, 541 optimality (of a search algorithm), 53, 78, 81, 198, 251, 440, 450 optimization problem, 79, 199, 331, 598, 634, 635, 662 oracle, 6 order preserving (hash function), 347 ordered hashing, 124, 125, 136, 406 ordered search tree algorithm, 198 original maze, 445 orthogonal hash function, 342 othello, 567 out-degree (of a node), 15 outer fragment (of a proof tree), 732 overall distribution, 212–213 overapproximation, 704 overconsistent A∗ , 244–246 overconsistent node, 245 overconstraint SAT problem, 595 oversubscribed problem, 571
Index
P PAC, 669 page, 320 page fault, 320, 752, 755, 756 page frame, 320 paging strategy, 320 pair transformation, 108, 109 pairing, 100 parallel A∗ , 388 parallel algorithm, 6, 369, 371–374 parallel branch-and-bound, 379–380 parallel depth-first branch-and-bound, 379 parallel depth-first search, 369, 379 parallel external A∗ , 388, 392–398 parallel external breadth-first search, 370, 388–391 parallel external search, 370, 388 parallel global A∗ , 385–387 parallel IDA∗ , 379, 382 parallel local A∗ , 385, 387–388 parallel memory model, 388 parallel merging, 374 parallel plan, 31, 675, 677, 695 parallel random access machine, 370–372, 374, 388 parallel search, 369, 370, 385, 397, 418, 420, 421, 522 parallel sorting, 374, 406 parallel state space search, 369, 374 parallel structured duplicate detection, 391–392, 393 parameter-free genetic algorithm, 634 parametric planning domain, 30, 448 paranoid assumption, 547 parent (of a node), 15 parent layer, 262, 389 parent transformation, 108, 109 parity, 20, 119 parity (of permutation), 119, 294 partial A∗ , 251–254 partial assignment, 573, 594, 605, 619, 620, 681, 721 partial expansion A∗ , 270–271 partial IDA∗ , 251–254 partial order reduction, 430, 453–458 partial path, 26, 143, 153 partial position, 442, 444, 446 partial solution, 26, 554, 558, 602, 604 partial state hashing, 375 partial state storage, 251, 253 partial sum, 373
partially expanded, 453 partially expanded node, 236 partially observable Markov decision process, 35, 507 particle swarm optimization, 669 partition function, 375 partition search, 535–536 partitionable (mixed) neighborhood, 661 partitioned transition relation, 315 path consistency, 571, 578, 580, 581 path consistent CSP, 579 path constraint, 571, 612–617, 621 path-max heuristic, 237 pattern database, 161, 167–168, 172–177, 177–185, 294–296, 346–348, 398–400, 680 pattern database partitioning, 312 pattern gene, 684 pattern mutation, 684 pattern search, 445–446 pattern selection problem, 178 pattern store, 445 pattern trie compaction, 185 Paturi-Pudl´ak-Zane algorithm, 648 PDDL, 30, 32, 33, 674, 688, 692–693, 696–697, 710–712, 720, 726, 761 PDDL semantic, 673–674 PDISK, 388 penalty, 446 penalty table, 445–446 pending queue, 690, 691 perfect hash function, 118–121, 126, 271, 284 perfect hash table, 139, 168, 295 perfect hashing, 111, 118, 126, 152, 153, 169 perfect heuristic, 16, 17 perfect information game, 524 persistent set, 464 PERT, 611–612, 621, 696 Petri net, 701, 717–720 phase transition, 595, 620 pipelined instruction fetching, 369 pipelining, 344–345 place (in a Petri net), 717 plan constraint, 616, 617, 696–697 planar graph, 325 planning heuristic, 710–713, 720, 726 planning pattern, 680 planning pattern database, 680–685 planning process, 674, 698 ply, 524, 525, 538
833
policy, 36, 519 policy iteration, 65–67, 558 polynomial reduction, 6, 593, 599, 606 polynomial-time transformation, 591 POMDP, 35, 507 portal heuristic, 192 positioning, 737 possible planning state, 681 postorder, 287 potential violating node, 107 PRAM, 370–372, 374, 388 PRAM architecture, 370 precedence ordering, 695 predecessor link, 50 predecessor pruning, 433 predicate logic, 8, 9, 730 preference constraint, 617, 697 prefix sum, 373 prefix-optimal, 78 preimage, 283, 295 Presburger automaton, 312 priced zone, 722 primary search, 710 primary state, 710 principal-variation, 524 principal-variation search, 532 principle of optimality, 53, 62, 66, 78 principle variation tree, 529 priority queue, 53, 89 priority search tree, 385 probabilistic environment, 519, 520, 560 probabilistic LRTA∗ , 495–496 probabilistic search model, 36 probabilitstic approximate completeness, 669 probing, 728 problem domain description language, 30, 673 problem graph, 13 process, 369 processor, 369 processor core, 369 production system, 3, 32 program model checking, 713–717 progression search, 679 project evaluation and review technique, 611–612, 695 proof number search, 567, 568 proof set search, 567 property automaton, 703 propositional conflict, 694 propositional formula, 8, 620
834
Index
propositional logic, 8 propositional planning, 673 protein, 26 protocol validation, 702 pruning, 429 pruning pair, 432 pruning set, 449 pseudo code, 3 pseudo random number, 117, 158 PSO, 669 PSPACE, 6 PSPACE complete, 23, 30, 46 PSVN, 35 pure backtracking, 581, 586 push-button automation, 702
Q Q-learning, 540, 542, 543, 560 Q-value, 37 quantifier, 8 quantitative dependency network, 728 queue, 51 quotient space, 112 quotient state space, 447
R Rabin and Karp hashing, 113–115 RAID, 321 RAM, 358 random access memory, 358 random communication, 387 random walk algorithm, 651 randomization, 633, 634, 647, 663 randomized hashing, 126 randomized local search, 639–641 randomized quicksort, 647 randomized search, 633, 634 randomized tabu search, 638–639, 663 rank hashing (of a permutation), 272 rank sequence, 107 rapid restart, 595 RBFS, 219–220 reopening (of nodes), 73 reweighted problem graph, 47 reweighting transformation, 69 reachability analysis, 545–546 reachability set, 717 reachable marking, 717 reachable planning state, 681 reachable state, 228, 568, 702 reached (node), 48 read-only media, 195
real-time A∗ , 491 real-time adaptive A∗ , 484 real-time dynamic programming, 569 real-time heuristic search, 465, 514 real-time model checking, 721, 723 real-time search, 465, 654 reasonable state space, 475, 483, 492, 493 recognized dead-end, 276, 334 recombination, 639 recovering solution quality, 255 recursive best-first search, 195, 219–220 recursively enumerable set, 5 reduced and ordered BDD, 286 reducibility of a heuristic, 446 redundancy anomaly, 727 redundant array of independent disks, 321 redundant array of inexpensive disks, 321 refine queue, 395 refined threshold determination, 195 refuted node, 526 region automaton, 721 regression search, 679 regular rank sequence, 107 regular search space, 195 reinforcement learning, 483, 540 relational product, 288, 290 relaxation, 54 relaxation (of a planning problem), 30 relaxation (of an action), 30 relaxed planning heuristic, 30, 34, 685, 686, 690, 691, 698 relaxed problem, 31, 162 relay search, 348–349 relay solution, 348 relevance analysis, 461, 462 relevance cut, 452–453 relevant flag, 443 remaining area, 604 removable item heuristic, 725 reset search space, 492 residual, 67 resolution refutation procedure, 731 resource-optimal scheduling, 721 restart, 594, 633 restrict operator, 309–310 Rete algorithm, 142, 159 retrograde analysis, 167, 519, 543–544 reversible state space problem, 23 revise procedure, 576
revolving search method, 465 reward (for an action), 35 RIDA∗ , 219, 280 right-most tip node, 234 robotics, 9, 11 roll-out, 11 rote learning, 539 round-and-robin, 387 RTA∗ , 491 RTAA∗ , 484 rule, 695 run transformation, 108 run-length compression, 185
S safely explorable state space, 475, 477, 491–493, 495 safety property, 702 SAS+ planning problem, 681, 685, 686 SAT, 593 satisfiability, 593 satisfiability problem, 620 satisfiable formula, 8 satisficing search strategy, 633 scanning (a file), 319 schema theorem, 644 scope, 8 search, 9 search algorithm, 3, 10, 11, 47, 197, 243, 256, 269, 274, 313, 385–388, 562, 582, 584, 587, 622, 664, 751 search constraint, 571 search discrepancy, 588 search frontier, 48 search heuristic, 16 search skeleton, 219 search tree, 48, 195 search tree problem space, 198 secondary state, 710 selection, 639, 640 selection function, 641 selective search, 633 semi-decidable set, 5 semi-external search, 365 semi-virtual connection, 523 semiring, 579 sentence, 8 sequential plan, 674 serialization (of a problem), 462 set (of individuals), 641 set-of-support approach, 732 shallow cut-off, 526, 548
Index
shallow pruning, 547–549 shared variable, 705, 711, 714 shared variable heuristic, 716 shortcut (string), 432 shortest firing sequence, 718 sibling transformation, 108 sifting algorithm, 288 signaling pathway, 759, 760 signature (of permutation), 119 simple ant system, 634, 652–653 simple GA, 641–643 simple genetic algorithm, 641–643 simple temporal constraint network, 610 simple temporal network, 609–611 simplemaxcut, 606 simulated annealing, 634, 663, 664 single instruction multiply data, 401 single-agent puzzle, 3 singleton, 108 singleton transformation, 108 singular extension, 537 Skolem constant, 732 Skolem function, 732 SLA∗ , 488 SLA∗ T, 488 SMGS, 259–261 soft constraint, 617 software checking, 713 software paging, 320, 752 software verification, 9 solid state disk, 353 solution, 13 solution (of a CSP), 572 solution certificate, 6 solution depth, 206 solution path, 14 solution preserving abstraction, 163 solution preserving pruning, 429 solution preserving restriction, 680 solution reconstruction, 227 solved node, 554 sorting (a file), 319 space explosion problem, 283 sparse graph, 14–15 sparse memory-graph search, 259–261 spatial logic, 724 specialized consistency, 571, 575, 579–580 speedup, 369, 372 splay operation (for treaps), 386 split value, 346 splittability of a heuristic, 446
splitter, 324 spurious solution path, 161 spurious state, 188 SRAM, 401 SSD, 353 stack, 50 stack splitting, 380–382 stage algorithm, 636 standard variable ordering, 288 state, 12 state (of a node), 108 state caching algorithm, 274 state explosion problem, 283, 663 state reconstruction, 253–254 state space, 3 state space of solutions, 634 state space partitioning function, 375 state space problem, 12–14 state space problem graph, 13 state trajectory constraint, 696–697 state-action pair, 471 state-caching algorithm, 227 static evaluation function, 524 static load balancing, 375 static penalty approach, 669 static pruning, 429 step counter, 550 sterile node, 215 stochastic node caching, 231 stone, 22 strategy (in two-player games), 529 streaming data, 344 streaming multiprocessor, 401 streaming processor, 401 string length heuristic, 732 string matching, 115, 374 strong backdoor, 596 strong preimage, 546 strong solution, 568 structured duplicate detection, 343–344, 359 stubborn set, 464 stuck procedure, 441 substring query, 142 subgraph pattern database compression, 184 subject model, 728 subnet distance heuristic, 719 subset dictionary, 443 substitution matrix, 27 substring acceptor, 433 substring matching, 438
835
substring pruning, 430–433, 458 substring pruning automaton, 437 subtree rotation (for treaps), 386 succeed-first principle, 581 successor (of a node), 15 sufficient saddle point condition, 658 suffix link, 143 sum-of-pairs alignment cost function, 27 super-goal, 370 super-linear speedup, 372 super-string query, 142 supervised learning, 540 surjective transformation, 164 swapping, 320 symbolic A∗ , 302–305 symbolic Bellman-Ford algorithm, 47, 57, 60, 62, 311 symbolic breadth-first search, 284 symbolic breadth-first tree search, 291–292 symbolic model checking, 317, 702 symbolic pattern database, 294–296 symbolic planning pattern database, 683 symbolic reachability analysis, 545 symbolic retrograde analysis, 544–547 symbolic search, 283 symbolic shortest path algorithm, 311 symbolic shortest-path search, 298–299 symmetric action, 459 symmetry, 179–180, 447 symmetry pattern database lookup, 179, 180 symmetry reduction, 430, 447–449, 459 synchronous distribution, 379 synchronous parallel search, 420 synchronous pruning automaton, 433 synchronous search, 380 synchronous setting, 369, 379 system invariant violation, 705 systematic state space enumeration, 633 systematic tie breaking, 489
T taboo, 638 tabu list, 638 tabu neighbor, 638 tabu search, 638–639 tail (of a string), 143 Taylor series expansion, 659 temporal constraint, 572 temporal constraint network, 609–612, 621
836
Index
temporal control knowledge, 696 temporal credit assignment problem, 540 temporal difference learning, 540, 541 temporal graph logic, 724 temporal logic, 571, 702–703 temporal plan, 674 temporal planning, 673–674, 691–695 temporally extended goal, 612, 622, 696 terminal node, 143, 524, 528, 554, 724 termination-checking step, 471, 489 test maze, 445 theorem proving, 9, 730–732 thickness of search frontier, 265 thread, 401 time consistency, 747, 748 time tabling, 571, 622 timed automaton, 722 timed initial fact, 674 timed initial literal, 696 tip edge, 234 tip node, 234 token (in a Petri net), 717 tool-specific heuristic, 716 top-down proof, 732 topological order, 63, 75, 255 total duplicate identification, 49 trail-directed heuristic, 709, 716 trail-directed search, 704, 716 trajectory, 721 transformed Lagrangian, 658 transition, 12 transition (in a Petri net), 717 transition guard, 721 transition relation, 285, 288–290, 310 transposed matrix, 209 transposition table, 228–231, 530 transposition-driven scheduling, 375, 376 transputer, 385 treap, 385–387 tree partial locking protocol, 387 tree width, 631 trial-based real-time dynamic programming, 512, 514 triangle inequality, 26, 746 triangle inequality (of Euclidean plane), 25, 746 trie, 139, 185, 435 trivial heuristic, 73, 235
true distance heuristic, 192 truth table, 8 TSP, 25–26, 200, 201, 646, 652 Turing machine, 4–6, 32–33, 591, 593 Turing machine configuration, 33, 592 Turing test, 567 two-bit breadth-first search, 271–273 two-person game theory, 567
U UCT, 11, 538 unblocked state, 775 undecidability, 32 undecidability (of metric planning), 690 undecidable, 3, 30, 32, 690 underconstraint SAT problem, 595 underconsistent node, 245 unification, 443, 730, 731 uninformed search, 16, 47, 81, 165, 169, 284, 723 uninteruptable power supply, 321 union-find data structure, 154 unique table, 313 unit, 369 unit clause, 732 unit cost problem graph, 14, 306–308 unit propagation, 594, 596 unit resolution, 732 universal hashing, 111, 116 unrecognized dead-end, 276, 334 unsupervised learning, 540 until (operator), 613 unweighted problem graph, 14, 242, 338, 347, 450 UPS, 321 used operator, 262 user interaction, 737 user view serialization, 387
variable transposition, 448, 449 vector notation (of productions system), 35 vectorial pattern database, 191 verification of a solution, 6 vertex ant walk, 654–657, 666 video RAM, 401–407 virtual connection, 523 virtual machine, 713 virtual memory, 319, 320, 752 virtual search tree, 274 VLOCK, 715 von Neumann architecture, 321 VRAM, 401–407 VUNLOCK, 715
W wait-free hash table, 425 wasted space, 602–604 wave-shaping, 409, 410 weak backdoor, 596 weak preimage, 546 weakest precondition, 690, 691 weight, 13–14 weight function, 53 weighted A∗ , 243–244 weighted problem graph, 14, 69, 73 weighted search space, 14, 432 weighted state space problem, 14, 16, 18 weighted transition relation, 286, 299 well-formed formula, 8 win backup, 543, 544 work queue, 375, 390, 394 workspace, 773, 774 worst macro solution length, 450 worst-fit, 599 worst-fit decreasing, 599
V
Z
valid end state, 441 valleys in h-value surface, 482 value function, 36, 37, 67, 68, 349, 519 value iteration, 65–68, 349 value selection, 581 value-update step, 469–473 variable ordering (in a BDD), 287, 288 variable ordering (of a CSP), 581 variable permutation, 448
zero-initialized edge counting, 493 zero-initialized LRTA∗ , 477, 479, 492, 514 zero-initialized node counting, 492 zero-sum game, 524, 547, 560–561 Zobrist hashing, 564 zone, 721 zone union, 723 zugzwang, 537
This page intentionally left blank
This page intentionally left blank
This page intentionally left blank
This page intentionally left blank