Title: Advances in Pattern Databases
1Advances in Pattern Databases
-
- Ariel Felner,
- Ben-Gurion University
- Israel
- email felner_at_bgu.ac.il
2Overview
- Heuristic search and pattern databases
- Disjoint pattern databases
- Compressed pattern databases
- Dual lookups in pattern databases
- Current and future work
3optimal path search algorithms
- For small graphs provided explicitly, algorithm
such as Dijkstras shortest path, Bellman-Ford or
Floyd-Warshal. Complexity O(n2). - For very large graphs , which are implicitly
defined, the A algorithm which is a best-first
search algorithm.
4Best-first search schema
- sorts all generated nodes in an OPEN-LIST and
chooses the node with the best cost value for
expansion. - generate(x) insert x into OPEN_LIST.
- expand(x) delete x from OPEN_LIST and generate
its children. - BFS depends on its cost (heuristic) function.
Different functions cause BFS to expand different
nodes..
20
25
30
35
30
35
35
40
Open-List
5Best-first search Cost functions
- g(x) Real distance from the initial state to x
- h(x) The estimated remained distance from x to
the goal state. - ExamplesAir distance
- Manhattan Dinstance
- Different cost combinations of g and h
- f(x)level(x) Breadth-First Search.
- f(x)g(x) Dijkstras algorithms.
- f(x)h(x) Pure Heuristic Search (PHS).
- f(x)g(x)h(x) The A algorithm (1968).
6A (and IDA)
- A is a best-first search algorithm that uses
f(n)g(n)h(n) as its cost function. - f(x) in A is an estimation of the shortest path
to the goal via x. - A is admissible, complete and optimally
effective. Pearl 84 - Result any other optimal search algorithm will
expand at least all the nodes expanded by A
Breadth First Search
A
7Domains
- 15 puzzle
- 1013 states
- First solved by Korf 85 with IDA and Manhattan
distance - Takes 53 seconds
- 24 puzzle
- 1024 states
- First solved by Korf 96
- Takes 2 days
8Domains
- Rubiks cube
- 1019 states
- First solved by Korf 97
- Takes 2 days to solve
9(n,k) Top Spin Puzzle
- n tokens arranged in a ring
- States any possible permutation of the tokens
- Operators Any k consecutive tokens can be
reversed - The (17,4) version has 1013 states
- The (20,4) version has 1018 states
104-peg Towers of Hanoi (TOH4)
- There is a conjecture about the length of optimal
path but it was not proven. - Size 4k
11How to improve search?
- Enhanced algorithms
- Perimeter-search Delinberg and Nilson 95
- RBFS Korf 93
- Frontier-search Korf and Zang 2003
- Breadth-first heuristic search Zhou and Hansen
04 - ? They all try to better explore the search tree.
- Better heuristics more parts of the search tree
will be pruned.
12Better heuristics
- 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
13Subproblems-Abstractions
- Many problems can be abstracted into subproblems
that must be also solved. - A solution to the subproblem is a lower bound on
the entire problem.
- Example Rubiks cube Korf 97
- Problem ? 3x3x3 Rubiks cube
- Subproblem ? 2x2x2 Corner cubies.
14Pattern Databases heuristics
- A pattern database Culbreson Schaeffer 96 is
a lookup table that stores solutions to all
configurations of the subproblem / abstraction /
pattern. - This table is used as a heuristic during the
search. - Example Rubiks cube.
- Has 1019 States.
- The corner cubies subproblem has 88 Million
states - A table with 88 Million entries fits in memory
Korf 97.
Search space
Pattern space
Mapping/Projection
15Non-additive pattern databases
- Fringe pattern database Culberson Schaeffer
1996. - Has only 259 Million states.
- Improvement of a factor of 100 over Manhattan
Distance
16Example - 15 puzzle
- How many moves do we need to move tiles 2,3,6,7
from locations 8,12,13,14 to their goal locations - The solution to this is located in
- PDB812131418
17Disjoint Additive PDBs (DADB)
- If you have many PDBS, take their maximum
- Values of disjoint databases can be added and are
still admissible Korf Felner AIJ-02, - Felner, Korf
Hanan JAIR-04 - Additivity can be applied if the cost of a
subproblem is composed from costs of objects from
corresponding pattern only
18DADBTile puzzles
5-5-5
6-6-3
7-8
6-6-6-6
Korf, AAAI 2005
19Heuristics for the TOH
- Infinite peg heuristic (INP) Each disk moves to
its own temporary peg. - Additive pattern databases
- Felner, Korf Hanan, JAIR-04
20Additive PDBS for TOH4
- Partition the disks into disjoint sets
- Store the cost of the complete pattern space of
each set in a pattern database. - Add values from these PDBs for the heuristic
value. - The n-disk problem contains 4n states
- The largest database that we stored was of 14
disks which needed 414256MB.
6
10
21TOH4 results
- The difference between static and dynamic is
covered in Felner, Korf Hanan JAIR-04
22Best Usage of Memory
- Given 1 giga byte of memory, how do we best use
it with pattern databases? - Holte, Newton, Felner, Meshulam and Furcy,
ICAPS-2004 showed that it is better to use many
small databases and take their maximum instead of
one large database. - We will present a different (orthogonal) method
Felner, Mushlam Holte AAAI-04.
23Compressing pattern database Felner et al
AAAI-04
- Traditionally, each configuration of the pattern
had a unique entry in the PDB. - Our main claim ?
- Nearby entries in PDBs are highly correlated
!! - We propose to compress nearby entries by storing
their minimum in one entry. - We show that ?
- most of the knowledge is preserved
- Consequences Memory is saved, larger patterns
can be used ? speedup in search is obtained.
24Cliques in the pattern space
- The values in a PDB for a clique are d or d1
- In permutation puzzles cliques exist when only
one object moves to another location.
d
G
d1
d
- Usually they have nearby entries in the PDB
- A44444
A clique in TOH4
25Compressing cliques
- Assume a clique of size K with values d or d1
- Store only one entry (instead of K) for the
clique with the minimum d. Lose at most 1. - A44444 A44441
- Instead of 4p we need only 4(p-1) entries.
- This can be generalized to a set of nodes with
diameter D. (for cliques D1) - A44444 A44411
- In general compressing by k disks reduces memory
requirements from 4p to 4(p-k)
26TOH4 results 16 disks (142)
- Memory was reduced by a factor of 1000!!! at a
cost of only a factor of 2 in the search effort.
27TOH4 larger versions
Memory was reduced by a factor of 1000!!! At a
cost of only a factor of 2 in the search
effort. Lossless compressing is noe efficient in
this domain.
- For the 17 disks problem a speed up of 3 orders
of magnitude is obtained!!! - The 18 disks problem can be solved in 5 minutes!!
28Tile Puzzles
Goal State
Clique
- Storing PDBs for the tile puzzle
- (Simple mapping) A multi dimensional array ?
- A1616161616 size1.04Mb
- (Packed mapping) One dimensional array ?
A1615141312 size 0.52Mb. - Time versus memory tradeoff !!
2915 puzzle results
- A clique in the tile puzzle is of size 2.
- We compressed the last index by two ?
- A161616168
30- Dual lookups in pattern databases Felner et al,
IJCAI-04
31Symmetries in PDBs
- Symmetric lookups were already performed by the
first PDB paper of Culberson Schaeffer 96 - examples
- Tile puzzles reflect the tiles
- about the main diagonal.
- Rubiks cube rotate the cube
- We can take the maximum among the different
lookups - These are all geometrical symmetries
- We suggest a new type of symmetry!!
7
8
8
7
32Regular and dual representation
- Regular representation of a problem
- Variables objects (tiles, cubies etc,)
- Values locations
- Dual representation
- Variables locations
- Values objects
33Regular vs. Dual lookups in PDBs
- Regular question
- Where are tiles 2,3,6,7 and how many moves
are needed to gather them to their goal
locations? - Dual question
- Who are the tiles in locations 2,3,6,7 and
how many moves - are needed to distribute them to their goal
locations?
34Regular and dual lookups
- Regular lookup PDB8,12,13,14
- Dual lookup PDB9,5,12,15
35Regular and dual in TopSpin
- Regular lookup for C PDB1,2,3,7,6
- Dual lookup for C PDB1,2,3,8,9
36Dual lookups
- Dual lookups are possible when there is a
symmetry between locations and objects - Each object is in only one location and each
location occupies only one object. - Good examples TopSpin, Rubiks cube
- Bad example Towers of Hanoi
- Problematic example Tile Puzzles
37Inconsistency of Dual lookups
Consistency of heuristics h(a)-h(b) lt
c(a,b)
- Both lookups for B
- PDB1,2,3,4,50
- Regular lookup for C PDB1,2,3,7,61
- Dual lookup for C PDB1,2,3,8,92
38Traditional Pathmax
- children inherit f-value from their parents if
it makes them larger
g1 h4 f5
Inconsistency
g2 h2 f4
g2 h3 f5
Pathmax
39Bidirectional pathmax (BPMX)
h-values
h-values
2
4
BPMX
5
1
5
3
- Bidirectional pathmax h-values are propagated in
both directions decreasing by 1 in each edge. - If the IDA threshold is 2 then with BPMX the
right child will not even be generated!!
40Results (17,4) TopSpin puzzle
- Nodes improvement (17r17d) 1451
- Time improvement (4r4d) 72
- We also solved the (20,4) TopSpin version.
41Results Rubiks cube
- Data on 1000 states with 14 random moves
- PDB of 7-edges cubies
- Nodes improvement (24r24d) 250
- Time improvement (4r4d) 55
42Results Rubiks cube
- With duals we improved Korfs results on random
instances by a factor of 1.5 using exactly the
same PDBs.
43Results tile puzzles
- With duals, the time for the 24 puzzle drops
from 2 days to 1 day.
44Discussion
- Results for the TopSpin and Rubiks cube are
better than those of the tile puzzles - Dual PDB lookups and BPMX cutoffs are more
effective if each operators changes larger part
of the states. - This is because the identity of the objects being
queried in consecutive states are dramatically
changed
45Summary
- Dual PDB lookups
- BPMX cutoffs for inconsistent heuristics
- State of the art solvers.
46Future work
- More compression
- Duality in search spaces
- Which and how many symmetries to use
- Other sources of inconsistencies
- Better ways for propagating inconsistencies
47Ongoing and future work compressing PDBs
- An item for the PDB of tiles (a,b,c,d) is in the
form ltLa, Lb, Lc, Ldgtd - Store the PDBs in a Trie
- A PDB of 5 tiles will have a level in the trie
for each tile. The values will be in the leaves
of the trie. - This data-structure will enable flexibility and
will save memory as subtrees of the trie can be
pruned
48Trie pruninig
Simple (lossless) pruning Fold leaves with
exactly the same values.
No data will be lost.
2
2
2
2
2
49Trie pruninig
- Intelligent (lossy)pruning
- Fold leaves/subtrees with are correlated to each
other (many option for this!!) - Some data will be lost.
- Admissibility is still kept.
2
2
2
2
4
50Trie Initial Results
A 5-5-5 partitioning stored in a trie with simple
folding
51Neural Networks (NN)
- We can feed a PDB into a neural network engine.
Especially, Addition above MD - For each tile we focus on its dx and dy from its
goal position. (i.e. MD) - Linear conflict
- dx1 dx2 0
- dy1 gt dy21
- A NN can learn
- these rules
2
1
dy1 2 dy20
52Neural network
- We train the NN by feeding the entire (or part of
the) pattern space. - For example for a pattern of 5 tiles we have 10
features, 2 for each tile. - During the search, given the locations of the
tiles we look them up in the NN.
53Neural network example
dx4
Layout for the pattern of the tiles 4, 5 and 6
dy4
dx5
4
dy5
dx6
dy6
54Neural Network problems
- We face the problem of overestimating and will
have to bias the results towards underestimating. - We keep the overestimating values in a separate
hash table - Results are encouraging!!
55Ongoing and Future Work on Duality
- Definition 1
- Let O be a sequence of operators such that s ? O
? G - We apply O to G and get sd
- G ? O ? sd
56Duality continued
- Definition 2 For a state S we flip the roles of
variables and objects
57Duality
The two definitions are equivalent!! Therefor
e Copt(S,G) Copt(Sd,G)
58Duality
- We can use heuristics from Sd for S
- We can search from both ways.
- Dual A (DA) An algorithm that searches and
jumps if the heuristic is better. Results in
progress.
59Workshop
- You are all welcome to the workshop on
- Heuristic Search, Memory-based Heuristics and
Their application - To be held in AAAI-06
- See www.ise.bgu.ac.il/faculty/felner