compressing pattern databases

28
1 Compressing Pattern Databases Ariel Felner Bar-Ilan University . [email protected] March 2004 Joint work with Ram Meshulam, Robert Holte and Richard E. Korf Submitted to AAAI04 . Available at: http://www.cs.biu.ac.il/~felner

Upload: alcina

Post on 13-Jan-2016

40 views

Category:

Documents


0 download

DESCRIPTION

Compressing Pattern Databases. Ariel Felner Bar-Ilan University. [email protected] March 2004 Joint work with Ram Meshulam, Robert Holte and Richard E. Korf Submitted to AAAI04. Available at: http://www.cs.biu.ac.il/~felner. A* and its variants. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Compressing Pattern Databases

1

Compressing Pattern Databases Ariel Felner

Bar-Ilan [email protected]

March 2004Joint work with Ram Meshulam, Robert Holte

and Richard E. KorfSubmitted to AAAI04.

Available at: http://www.cs.biu.ac.il/~felner

Page 2: Compressing Pattern Databases

2

A* and its variants• A* (and IDA*) 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

• Recently, the attention has shifted towards creating more accurate heuristic functions.

Page 3: Compressing Pattern Databases

3

Pattern databases• Many problems can be decomposed into subproblems

(patterns) that must be also solved.• The pattern space is a domain abstraction of the original

space• The cost of a solution to a subproblem is a lower-bound on

the cost of the complete solution • Instead of calculating the lower bounds on the fly, we

expand the whole pattern-space and store the solution to each pattern configuration in a pattern database

Patternspace

Search space

Mapping function

Page 4: Compressing Pattern Databases

4

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

B x x 3 x x x 7 x x x 11 12 13 14 15

• Rubik’s Cube. [Korf 1997]• The best way to combine different non-additive

pattern databases is to take their maximum!

Page 5: Compressing Pattern Databases

5

Additive pattern databases• We can add values from different pattern databases

if they are disjoint (and count their own moves)• There are two ways to build additive databases:• Statically-partitioned additive databases

(they were also called disjoint pattern databases)

• Dynamically-partitioned additive databases.• Applications of additive pattern databases

– Tile puzzles

– 4-peg Towers of Hanoi Puzzle (TOH4)

Page 6: Compressing Pattern Databases

6

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

7 8

6 6

6 6

Page 7: Compressing Pattern Databases

7

4-peg Towers of Hanoi (TOH4)

• 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 & Zhang 2000]) was used.

Page 8: Compressing Pattern Databases

8

Additive PDBS for TOH4• Partition the disks into disjoint sets

(patterns) . For example, 10 and 6 for the 16-disk problem.

• Store the cost of the complete pattern space of each set in a pattern database. (There are many enhancements)

• The n-disk problem contains 4^n states and 2n bits suffice to store each state.

• The largest databases that we stored was of size 14 which needed 4^14=256MB.

Page 9: Compressing Pattern Databases

9

TOH4: results

16 disks

Heuristicsolutionh(s)Avg hNodesseconds

Static 13-316110275.78134,653,23248

Static 14-216111489.1036,479,15114

Dynamic 14-216111495.5212,872,73221

17 disks

Dynamic 14-318311697.05238,561,5902,501

Page 10: Compressing Pattern Databases

10

How to best use the memory• The speed of the search is directly related to

the size of the pattern database.• We usually omit the computation time of

the PDBs but cannot ignore the memory requirements

• [Holte, Newton, Felner, Mushulam and Furcy 2004] showed that it is better to use many small databases and take their maximum instead of one large database.

• We limit the discussion to 1 Giga bytes.

Page 11: Compressing Pattern Databases

11

Compressing pattern databases• Traditionally, each configuration of the pattern

had a unique entry in the PDB.• Our main cliam

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

cab be used speedup in search is obtained.

Page 12: Compressing Pattern Databases

12

Cliques in the pattern space

• The values in a PDB for a clique are d or d+1

• In permutation puzzles cliques exist when only one object moves to another location.

• Usually they have

nearby entries

in the PDB

A B C D D

G d

dd+1

A B C D

Page 13: Compressing Pattern Databases

13

Storing cliques• Assume a clique of size K with values d or d+1

• Lossy compression Store only one entry for the clique with the minimum d. Loose at most 1.

• Lossless compression Store the minimum d. Also store K additional bits, one per entry.

A clique in TOH4

Page 14: Compressing Pattern Databases

14

Compressing PDBs in TOH4• If we compress the last index of smallest

disk then a PDB with P disks can now be stored in only 4^(P-1) entries instead of 4^P

• This can be generalized to a set of nodes with diameter D. (for cliques D=1)

• For TOH4, we fix the position of the largest P-2 disks and compress all the 4^2=16 entries of the smallest 2 disks.

• In general, compressing any block will work, not necessarily cliques.

Page 15: Compressing Pattern Databases

15

TOH4 results: 16 disks (14+2)PDBH(s)Avg HDNodesTimeMem MB

14/0 + 211687.03036,479,15114.34256

14/1 + 211586.48137,964,22714.6964

14/2 + 2 11385.67340,055,43615.4116

14/3 + 211184.44544,996,74316.944

14/4 + 210782.73945,808,32817.361

14/5 + 2 10380.841361,132,72623.780.256

14/1s +211687.03036,479,15115.8796

• Memory was reduced by a factor of 1000!!! at a cost of only a factor of 2 in the search effort.

• Lossless compressing is not efficient in this domain.

Page 16: Compressing Pattern Databases

16

TOH4: larger versionssizePDBTypeAvg HNodesTimeMem

1714/0 + 3static81.5>393,887,923>421256

1714/0 + 3dynamic87.0238,561,5902,501256

1715/1 + 2static103.7155,737,83283256

1716/2 + 1 static123.817,293,6037256

1816/2 + 2static123.8380,117,836463256

• 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!!

Page 17: Compressing Pattern Databases

17

Tile Puzzles0 0 3

0 0 6 7

0 0 10 11

0 0 2 2

• We can take advantage of the simple heuristics. We can store only the addition above the Manhattan distance heuristic

Storing PDBs for the tile puzzle

• (Simple mapping) A multi dimensional array

A[16][16][16][16][16] size=1.04Mb

• (Packed mapping) One dimensional array with

A[16*15*14*13*12 ] size = 0.52Mb.

• The time and memory tradeoff is straightforward!!

Page 18: Compressing Pattern Databases

18

15 puzzle results• A clique in the tile puzzle is of size 2. • We compressed the last index by two A[16][16][16][16][8]

PDBTypecompressNodesTimeMemAvg H

1 7-8packed----136,2880.081576,57544.75

1 +7-8packed----36,7100.034576,57545.63

1 7-7-1packed----464,9770.23257,65743.64

1 7-7-1simple----464,9770.058536,87043.64

1 7-7-1simplelossy565,8810.069268,43543.02

1 7-7-1simplelossless487,4300.070268,43543.59

2 7-7-1simplelossy147,3360.021536,87043.98

2 +7-7-1simplelossy66,6920.016536,87044.92

Page 19: Compressing Pattern Databases

19

24 puzzle• The same tendencies were obtained for the

24 puzzle.

• The 6-6-6-6 partitioning is so good that adding another set of 6-6-6-6 did not speedup the search.

• We have also tried a 7-7-5-5 partitioning but it did not speedup the search.

Page 20: Compressing Pattern Databases

20

Ongoing and future work

• An item for the PDB of tiles (a,b,c,d) is in the form: <La, Lb, Lc, Ld>=d

• 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

Page 21: Compressing Pattern Databases

21

Trie pruninig

2 2 22

2

Simple (lossless) pruning: Fold leaves with exactly the same values. No data will be lost.

Page 22: Compressing Pattern Databases

22

Trie pruninigIntelligent (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 24

2

Page 23: Compressing Pattern Databases

23

Trie: Initial Results

PDBMDH(s)NodesTimeNodes/secMem

Simple36.9441.563,090,40

50.65,150,6763,145,728

Packed36.94 41.563,090,40

53.126988,6131,572,480

Trie36.9441.563,090,40

52.593 1,191,826765,778

A 5-5-5 partitioning stored in a trie with simple folding

Page 24: Compressing Pattern Databases

24

Neural 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 > dy2+1• A NN can learn

these rules

2 1

dy1 =2

dy2=0

Page 25: Compressing Pattern Databases

25

Neural 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.

Page 26: Compressing Pattern Databases

26

Neural network exampledx4

dy4

dx5

dy5

dx6

dy6

4

Layout for the pattern of the tiles 4, 5 and 6

Page 27: Compressing Pattern Databases

27

Neural 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!!

PDBH(s)NodesTimeMem

Regular31.00243,2900.491,572,480

Neural Network29.67 454,26269.75 33,611d+472w

Page 28: Compressing Pattern Databases

28

Selective Pattern Database• Only part of the pattern space is queried for

a single problem instance.

• If we can identify that part we can only generate that part.