Title: Additive pattern database heuristics
1Additive pattern database heuristics
- Ariel Felner
- Bar-Ilan University.
- felner_at_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
2A 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.
3How 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
4Pattern 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
5Non-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
- Rubiks Cube. (Korf 1997)
- The best way to combine different non-additive
pattern databases is to take their maximum!! - These databases dont scale up to large problems.
6Additive pattern databases
- We want to add values from different pattern
databases. - There are two ways to build additive databases
- -gt Statically-partitioned additive databases
- -gt 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.
7Statically-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
8Dynamically-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
9Mutual 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
10Weighted vertex-cover (WVC)
- For the special case of the tile puzzle we can do
better. - An edge x, y2 means (xygt2)
- For each edge, one tile should move at least two
more moves than its MD, yielding a constraint - (xgt2 or ygt2)
- 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
11Weighted vertex-cover (cont.)
- A hyperedge of three tiles (x,y,z) with a cost
of 4 means that (xyzgt4) but also that - (xgt4) or (ygt4) or (zgt4) or (xgt2 and ygt2) or
(xgt2 and zgt2) or (ygt2 and zgt2) - 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!!
12Summary 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,
13Experimental Results15 puzzle
Fives
Sixes
SevenEight
14Results 24 puzzle.
- For the 24 puzzle we compared the SDB of sixes
with the DDB of pairs triples on 10 random
instances.
- The relative advantage of the SDB decreases when
the problem scales up - What will happen for the 6x6 35 puzzle???
1535 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)
16Tile 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!!
174-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.
18Heuristics 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 4n states and 2n
bits suffice to store each state.
19Pattern 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 mltn by simply assigning
the n-m larger disks to the goal peg. - The largest databases that we stored was of size
14 - 414256MB 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 (141312)/6364 different 12-3 splits.
20TOH results15-disks
21Vertex-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.
0
1
2
3
R
X0 V1,2,3
V0
V0,2 X1
V0,1
22Heuristics for VC
- The included edges form the g part of fgh.
- 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
23Additive 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.
24VCadditive 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.
25VC 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.
26VC results
- 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.
27Conclusions 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.
28Theory 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
29Condition 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. - Rubiks cube and a disjoint version of pattern
databases of Culberson and Schaeffer (96) are
counter examples.
30Algorithm 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
31Algorithm 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.
32Discussion
- 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.
33Summary
- 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.