Additive pattern database heuristics

Slides:



Advertisements
Similar presentations
1 Dual lookups in Pattern Databases Ariel Felner, Ben-Gurion Univ. Israel Uzi Zahavi, Bar-Ilan Univ. Israel Jonathan Schaeffer, Univ. of Alberta, Canada.
Advertisements

Review: Search problem formulation
An Introduction to Artificial Intelligence
Finding Search Heuristics Henry Kautz. if State[node] is not in closed OR g[node] < g[LookUp(State[node],closed)] then A* Graph Search for Any Admissible.
Types of Algorithms.
Solving Problem by Searching
Lecture 24 Coping with NPC and Unsolvable problems. When a problem is unsolvable, that's generally very bad news: it means there is no general algorithm.
Algorithms + L. Grewe.
1 Heuristic Search Chapter 4. 2 Outline Heuristic function Greedy Best-first search Admissible heuristic and A* Properties of A* Algorithm IDA*
Recent Progress in the Design and Analysis of Admissible Heuristic Functions Richard E. Korf Computer Science Department University of California, Los.
5-1 Chapter 5 Tree Searching Strategies. 5-2 Satisfiability problem Tree representation of 8 assignments. If there are n variables x 1, x 2, …,x n, then.
Experiments We measured the times(s) and number of expanded nodes to previous heuristic using BFBnB. Dynamic Programming Intuition. All DAGs must have.
Five Problems CSE 421 Richard Anderson Winter 2009, Lecture 3.
The number of edge-disjoint transitive triples in a tournament.
CPSC 322, Lecture 9Slide 1 Search: Advanced Topics Computer Science cpsc322, Lecture 9 (Textbook Chpt 3.6) January, 23, 2009.
CPSC 322 Introduction to Artificial Intelligence October 27, 2004.
2-dimensional indexing structure
Computational problems, algorithms, runtime, hardness
CPSC 322, Lecture 9Slide 1 Search: Advanced Topics Computer Science cpsc322, Lecture 9 (Textbook Chpt 3.6) January, 22, 2010.
Review: Search problem formulation
1 Advances in Pattern Databases Ariel Felner, Ben-Gurion University Israel
1 PHA*:Performing A* in Unknown Physical Environments Ariel Felner Bar-Ilan University. Joint work with Roni Stern and Sarit Kraus.
Cooperating Intelligent Systems Informed search Chapter 4, AIMA.
Research Related to Real-Time Strategy Games Robert Holte November 8, 2002.
Cooperating Intelligent Systems Informed search Chapter 4, AIMA 2 nd ed Chapter 3, AIMA 3 rd ed.
Origin of Heuristic Functions
1 Branch and Bound Searching Strategies 2 Branch-and-bound strategy 2 mechanisms: A mechanism to generate branches A mechanism to generate a bound so.
Pattern Databases Robert Holte University of Alberta November 6, 2002.
R-Trees 2-dimensional indexing structure. R-trees 2-dimensional version of the B-tree: B-tree of maximum degree 8; degree between 3 and 8 Internal nodes.
Cooperating Intelligent Systems Informed search Chapter 4, AIMA 2 nd ed Chapter 3, AIMA 3 rd ed.
Heuristics CSE 473 University of Washington. © Daniel S. Weld Topics Agency Problem Spaces SearchKnowledge Representation Planning PerceptionNLPMulti-agentRobotics.
State-Space Searches. 2 State spaces A state space consists of –A (possibly infinite) set of states The start state represents the initial problem Each.
State-Space Searches.
Using Abstraction to Speed Up Search Robert Holte University of Ottawa.
 Optimal Packing of High- Precision Rectangles By Eric Huang & Richard E. Korf 25 th AAAI Conference, 2011 Florida Institute of Technology CSE 5694 Robotics.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
Vilalta&Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
Li Wang Haorui Wu University of South Carolina 04/02/2015 A* with Pattern Databases.
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
Informed search strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
Informed searching. Informed search Blind search algorithms do not consider any information about the states and the goals Often there is extra knowledge.
Informed Search Methods. Informed Search  Uninformed searches  easy  but very inefficient in most cases of huge search tree  Informed searches  uses.
Data Structures & Algorithms Graphs
Graph Colouring L09: Oct 10. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including the famous.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
Heuristic Search Andrea Danyluk September 16, 2013.
CPS Computational problems, algorithms, runtime, hardness (a ridiculously brief introduction to theoretical computer science) Vincent Conitzer.
A* optimality proof, cycle checking CPSC 322 – Search 5 Textbook § 3.6 and January 21, 2011 Taught by Mike Chiang.
Heuristic Functions.
Branch and Bound Searching Strategies
Artificial Intelligence Lecture No. 8 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Introduction to NP Instructor: Neelima Gupta 1.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
Reading Material Sections 3.3 – 3.5 Sections 4.1 – 4.2 “Optimal Rectangle Packing: New Results” By R. Korf (optional) “Optimal Rectangle Packing: A Meta-CSP.
Review: Tree search Initialize the frontier using the starting state
Finding Optimal Solutions to Rubik's Cube Using Pattern Databases
Graph Theory and Algorithm 02
Abstraction Transformation & Heuristics
Artificial Intelligence Problem solving by searching CSC 361
Finding Heuristics Using Abstraction
Types of Algorithms.
Heuristics Local Search
Informed search algorithms
Heuristics Local Search
Types of Algorithms.
State-Space Searches.
State-Space Searches.
State-Space Searches.
Presentation transcript:

Additive pattern database heuristics Ariel Felner Bar-Ilan University. felner@cs.biu.ac.il September 2003 Joint work with Richard E. Korf Journal version submitted to JAIR. Available at: http://www.cs.biu.ac.il/~felner

A* and its variants A* is a best-first search algorithm that uses f(n)=g(n)+h(n) as its cost function. Nodes are sorted in an open-list according to their f-value. g(n) is the shortest known path between the initial node and the current node n. h(n) is an admissible (lower bound) heuristic estimation from n to the goal node A* is admissible, complete and optimally effective. [Pearl 84] A* is memory limited. IDA* is the linear-space version of A*.

How to improve search? Enhanced algorithms: Perimeter-search, RBFS, Frontier-search etc, They all try to better explore the search tree. Better heuristics: more parts of the search tree will be pruned. In the 3rd Millennium we have very large memories. We can build large tables. For enhanced algorithms: large open-lists or transposition tables. They store nodes explicitly. A more intelligent way is to store general knowledge. We can do this with heuristics

Pattern databases Many problems can be decomposed into subproblems that must be also solved. The cost of a solution to a subproblem is a lower-bound on the cost of the complete solution. Instead of calculating the solution on the fly, expand the whole state-space of the subproblem and store the solution to each state in a database. These are called pattern databases

Non-additive pattern databases Fringe database for the 15 puzzle by (Culberson and Schaeffer 1996). Stores the number of moves including tiles not in the pattern Rubik’s Cube. (Korf 1997) The best way to combine different non-additive pattern databases is to take their maximum!! These databases don’t scale up to large problems.

Additive pattern databases We want to add values from different pattern databases. There are two ways to build additive databases: -> Statically-partitioned additive databases -> Dynamically-partitioned additive databases. We will present additive pattern databases for: Tile puzzles 4-peg towers of Hanoi problem Multiple sequence-alignment problem Vertex-cover We will then present a general theory that discusses the conditions for additive pattern databases.

Statically-partitioned additive databases These were created for the 15 and 24 puzzles (Korf & Felner 2002) We statically partition the tiles into disjoint patterns and compute the cost of moving only these tiles into their goal states. For the 15 puzzle: 36,710 nodes. 0.027 seconds. 575 MB For the 24 puzzle: 360,892,479,671 2 days 242 MB

Dynamically-partitioned additive databases Statically-partition databases do not capture conflicts of tiles from different patterns. We want to store as many pattern databases as possible and partition them to disjoint subproblems on the fly such the chosen partition will yield the best heuristic. Suppose we take all possible pairs and build a graph such that tiles are nodes and edges are the pairwise cost of the two nodes (tiles) incident with that edge. 2 1 2 1 1 2 1 3 4 1

Mutual cost graph Maximum matching to the above pairwise-graph will yield the best dynamic partitioning. With larger groups (triples, quadruples) this graph can be called the mutual-cost graph. Maximum-matching on the mutual-cost graph is an admissible heuristic. In practice we can use only the addition above the Manhattan-distance. In that case many edges disappear. This graph is called the conflict-graph

Weighted vertex-cover (WVC) For the special case of the tile puzzle we can do better. An edge {x, y}=2 means (x+y>=2) For each edge, one tile should move at least two more moves than its MD, yielding a constraint: (x>=2 or y>=2) Divide the costs by two then this is actually a vertex-cover of the conflict graph. Will produce a heuristic of 4 for the shown graph. With hyperedges and larger costs we get weighted vertex-cover. 2 2 2 3 2 1

Weighted vertex-cover (cont.) A hyperedge of three tiles (x,y,z) with a cost of 4 means that (x+y+z>=4) but also that: (x>=4) or (y>=4) or (z>=4) or (x>=2 and y>=2) or (x>=2 and z>=2) or (y>=2 and z>=2) WVC is NP-complete. Why? Because simple VC is NPC and is a special case of WVC. Our graph for the tile puzzles is very sparse. We only had few edges with costs above MD!!

Summary: DDB for the tile puzzle Before the search: Store all pairwise, triple, quadruple conflict in a pattern database. During the search: for each node of the search tree: 1) build the conflict-graph 2) Calculate WVC of the conflict-graph as an admissible heuristic. Many domain dependent enhancements are applicable. e.g. only incremental changes etc,

Experimental Results:15 puzzle Fives Sixes Seven+Eight Memory Nodes/Sec Seconds Nodes Value Heuristic 7,509,527 53.424 401,189,630 36.942 Manhattan 3,891,701 10.336 40,224,625 38.788 Linear conflict 1,000 959,896 10.401 9,983,886 40.432 pairs 2,300 139,376 5.076 707,476 42.792 Pairs+triples 78,800 11,901 9.276 110,394 43.992 Pairs+triples+4 3,145 5,722,922 0.541 3,090,405 41.562 fives 33,554 3,788,680 0.163 617,555 42.924 sixes 576,575 1,377,630 0.027 36,710 45.632 seven+eight

Results: 24 puzzle. For the 24 puzzle we compared the SDB of sixes with the DDB of pairs + triples on 10 random instances. Memory Nodes/Sec Seconds Nodes Value Heuristic 5,000 185,000 1,757 306,958,148 82,814 2+3 242,000 1,306,000 1,446 2,031,102,635 81,246 sixes The relative advantage of the SDB decreases when the problem scales up What will happen for the 6x6 35 puzzle???

35 puzzle We sampled 10 Billion random states and calculated their heuristic. The table was created by the method presented by Korf, Reid and Edelkamp. (AIJ 129, 2001) Memory Nodes/sec Rel. Time Relative Nodes Value Heuristic 20,500,000 987.5 31,000 135.02 Manhattan 404,000 4,138,000 1.8 11.5 139.82 Static: fives 5,000 635,000 1.0 1 142.66 2+3

Tile puzzles: Summary The relative advantage of the SDB over DDB decreases over time. For the 15 puzzle 1/2 of the domain is stored. For the 24 puzzle 1/4 of the domain is stored. For the 35 puzzle 1/7 of the domain is stored. The memory needed by the DDB was 100 times smaller than that of the SDB!!

4-peg Towers of Hanoi (TOH) There is a conjecture about the length of optimal path but it was not proven. Systematic search is the only way to solve this problem or to verify the conjecture. There are too many cycles. IDA* as a DFS will not prune these cycle. Therefore, A* (actually frontier A* [Korf 2000]) was used.

Heuristics for the TOH Infinite peg heuristic (INP): Each disk moves to its own temporary peg. Additive pattern databases: Partition the disks into disjoint sets. 8 and 7 for example in the 15-disk problem. Store the cost of the complete state space of each set in a pattern database table. The n-disk problem contains 4^n states and 2n bits suffice to store each state.

Pattern databases for TOH There is only one database for a pattern of size n. A pattern database of size n also contains a pattern database of size m<n by simply assigning the n-m larger disks to the goal peg. The largest databases that we stored was of size 14 4^14=256MB if each state needs a byte. To solve the 15 disks problem we can split the disks into 14-1, 13-2 or 12-3 disks. The SDB will use the same partition at all times. The DDB looks on all possible partitions and chooses the partition with the best heuristic. There are (14*13*12)/6=364 different 12-3 splits.

TOH: results 15-disks seconds Nodes Avg h h(s) solution Heuristic 1,198 371,556,049 26.37 29 129 Infinite peg 32 9,212,163 62.63 86 Static 12-3 7 2,205,206 74.23 100 Static 13-2 2 158,639 87.79 114 Static 14-1 122,128 95.52 Dynamic 14-1 16 disks 221 65,472,582 75.78 102 161 Static 13-3 65 17,737,145 89.10 Static 14-2 6,242,949 Dynamic 14-2 17 disks 7,200 101,052,900 --------- 116 183 Dynamic 14-3

Vertex-Cover (VC) Given a graph we want the minimal set of vertices such that they cover all the edges. VC was one of the first problems that was proved to be NP-complete. Search tree: At each level, either include or exclude a vertex. Improvements: If a node is excluded, all its neighbors bust be included. Dealing with degree-0 and degree-1 vertices. 1 2 3 R X:0 V:1,2,3 V:0 V:0,2 X:1 V:0,1

Heuristics for VC The included edges form the g part of: f=g+h. We want an admissible heuristic of the free vertices. Pairwise heuristic: A maximum-matching of the free-graph. For a triangle we can add two to the heuristic. In general, a clique of size k contributes k-1 to h. So: partition the free-graph into disjoint cliques and sum up their heuristics. VC EX 1 3 2 4 Free vertices

Additive pattern databases Clique is NP-complete. However, in random graphs, cliques of size 5 and larger are rare. Thus, it is easy to finds small cliques Pattern databases: Instead of finding the cliques on the fly we identify them before the search and store them in a pattern database. We stored cliques of size 4 or smaller. During the search we need to retrieve disjoint cliques from the pattern database.

VC:additive heuristics 1) We match the free graph against the database and form a hyper-graph (conflict-graph) such that each hyper-edges corresponds to a clique in the free-graph. 2) A maximum-matching (MM) of this graph is an admissible heuristic of the free graph. Since maximum-matching is NP-complete, we can settle for maximal-matching. Dynamic partitioning: do the above process for each new node of the search tree.

VC: heuristics (cont.) Static partitioning: Do the above process only once and use these cliques for al the nodes of the search tree. A clique of size k contributes k-m-1 to the heuristic given that m vertices were already included in the partial vertex-cover. Once again, the static partitioning is faster but is less accurate since we are forced to use the same partitioning.

VC: results Nodes/sec Seconds Nodes Cliques Database 174,306 4,134 720,582,454 --- No database 128,139 1,463 187,467,358 2 Static: 124,464 849 105,669,961 3 Static 123,252 844 103,655,233 4 82,982 231 19,159,780 Dynamic 60,451 70 4,261,831 57,136 73 4,170,981 The results are on random graphs of size 150 and an average degree of 16. When we added our dynamic database to the best proven tree search algorithm we further improved the running time by a fact or more than 10.

Conclusions and Summary In general: Additivity can be applied whenever a problem can be decomposed into disjoint subproblems such that the sum of the costs is a lower bound on cost of the complete problem. Additive databases is a special case of additive heuristic where we save the heuristics in a table.

Theory: definitions A problem consists a set of objects. A pattern is a subset of objects of the problem A subproblem is associated with a pattern. The cost of solving the subproblem is a lower bound on the cost of the complete problem. Patterns are disjoint if they have no objects in common The costs of subproblems are additive if their sum is a lower bound on the cost of solving them together

Condition for additivity Additivity can be applied if the cost of a subproblem is composed from costs of objects from corresponding pattern only Permutation puzzles The domain includes permutations of objects and operators that map one permutation to another. For the tile puzzles and TOH, every operator moves only one tile and the above claim is valid. Rubik’s cube and a disjoint version of pattern databases of Culberson and Schaeffer (96) are counter examples.

Algorithm schema: static database In the precomputation phase do: Partition the objects into disjoint patterns Solve the corresponding subproblems and store the costs in a database. In the search phase do: For each node retrieve the values of the costs of the subproblems and sum them up for an admissible heuristic

Algorithm schema: dynamic database In the precomputation phase do: For each pattern to be used, solve the corresponding subproblem and store the costs in a database. In the search phase do: For each node retrieve the values of the costs of the all subproblems from the database. Find a set of disjoint subproblems such that the sum of the costs is maximized. There are of course many domain dependent enhancements.

Discussion The dynamic partitioned database is more accurate at a cost of larger constant time per node. Adding more patterns to a system is beneficial up to a certain point. That point can be currently found by a trial and error process. Memory is also an issue. Different techniques have different memory requirements.

Summary Static databases were better for the tile puzzles and multiple sequence alignment. Dynamic databases were better for the vertex-cover problem and for the towers of Hanoi. Future work: Automatically find the best static partition. Better ways of finding the best dynamic partition. Other problems. Given a certain amount of memory how to make the best use of it.