Top Banner
1 Dual lookups in Pattern Databases Ariel Felner, Ben- Gurion Univ. Israel Uzi Zahavi, Bar-Ilan Univ. Israel Jonathan Schaeffer, Univ. of Alberta, Canada Robert C. Holte, Univ. of Alberta, Canada
29

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

Mar 29, 2015

Download

Documents

Macey Nottage
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Dual lookups in Pattern Databases Ariel Felner, Ben-Gurion Univ. Israel Uzi Zahavi, Bar-Ilan Univ. Israel Jonathan Schaeffer, Univ. of Alberta, Canada.

1

Dual lookups in Pattern Databases

Ariel Felner, Ben-Gurion Univ. Israel

Uzi Zahavi, Bar-Ilan Univ. Israel

Jonathan Schaeffer, Univ. of Alberta, Canada

Robert C. Holte, Univ. of Alberta, Canada

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

2

Overview

• Heuristic search and A*

• Test domains

• Pattern databases

• Dual lookups in pattern databases

• Experimental results

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

3

A*• Best-first search with a cost function of

f(n)=g(n)+h(n)

• g(n): actual distance from the initial state to n

• h(n): estimated remained distance from n to the goal state.

• h(n) is admissible if it is always underestimating

• Examples of h:

Air distance,

Manhattan Distance

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

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

4

Attributes of A*

• If h(n) is admissible then A* is guaranteed to return an optimal (shortest) solution

• A* is admissible, complete and optimally effective. [Pearl & Dechter 84]

• IDA* is a linear space version of A* [Korf 85] which uses DFS iterations.

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

5

Domains

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

15 puzzle

• 10^13 states

• First solved by [Korf 85] with IDA* and Manhattan distance

• Takes 53 seconds

24 puzzle

• 10^24 states

• First solved by [Korf 96]

• Takes 2 days

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

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

6

• Rubik’s cube

• 10^19 states

• First solved by [Korf 97]

• Takes 2 days to solve

Domains

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

7

)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 10^13 states• The (20,4) version has 10^18 states

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

8

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

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

9

Subproblems-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: Rubik’s cube [Korf 97]• Problem: 3x3x3 Rubik’s cube

Subproblem: 2x2x2 Corner cubies.

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

10

Pattern 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: Rubik’s cube. • Has 10^19 States.• The corner cubies subproblem has 88 Million states • A table with 88 Million entries fits in memory [Korf 97].

Patternspace

Search space

Mapping/Projection

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

11

Example - 15 puzzle

2 3 6 7

2 3 6 7

• 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

PDB[8][12][13][14]=18

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

12

Disjoint Additive PDBs (DADB)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

• Values of disjoint databases can be added and are still admissible [Korf & Felner: AIJ-02,

Felner, Korf & Hanan: JAIR-04]

7-8

•If you have many PDBS, take their maximum

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

13

DADB:Tile puzzles

PuzzleHeuristicValueNodes TimeMemory

15Breadth-FS10^1328 days3-tera-bytes

15Manhattan36.942401,189,63053.4240

155-5-541.5623,090,4050.5413,145

156-6-342.924617,5550.16333,554

157-845.63236,7100.034576,575

246-6-6-6360,892,479,6712 days242,000

5-5-5 6-6-3 7-8 6-6-6-6

[Korf, AAAI 2005]

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

14

Symmetries 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.– Rubik’s 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!!

8

8

7

7

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

15

Regular and dual representation

• Regular representation of a problem:

• Variables – objects (tiles, cubies etc,)

• Values – locations

• Dual representation:

• Variables – locations

• Values – objects

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

16

Regular vs. Dual lookups in PDBs

2 3 6 7

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

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

17

Regular and dual lookups

• Regular lookup: PDB[8,12,13,14]

• Dual lookup: PDB[9,5,12,15]

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

18

Regular and dual in TopSpin

• Regular lookup for C : PDB[1,2,3,7,6]

• Dual lookup for C: PDB[1,2,3,8,9]

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

19

Dual 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, Rubik’s cube

• Bad example: Towers of Hanoi

• Problematic example: Tile Puzzles

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

20

Inconsistency of Dual lookups

Example: Top-Spin

c(b,c)=1

Consistency of heuristics: |h(a)-h(b)| <= c(a,b)

Regular Dual

b00

c12

• Both lookups for B

PDB[1,2,3,4,5]=0• Regular lookup for C

PDB[1,2,3,7,6]=1• Dual lookup for C

PDB[1,2,3,8,9]=2

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

21

Traditional Pathmax

• children inherit f-value from their parents if it makes them larger

g=1h=4f=5

g=2h=2f=4

g=2h=3f=5

Inconsistency

Pathmax

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

22

Bidirectional pathmax (BPMX)

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

h-values

2

5 1

4

5 3

h-values

BPMX

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

23

Results: (17,4) TopSpin puzzleregulardualBPMXnodestime

10----40,019,42967.76

01no7,618,80515.72

01yes1,397,6142.93

44yes82,6060.94

1717yes27,5751.34

• Nodes improvement (17r+17d) : 1451

• Time improvement (4r+4d) : 72

• We also solved the (20,4) TopSpin version.

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

24

Results: Rubik’s cube

regulardualBPMXnodestime

10----90,930,66228.18

01no19,653,3867.38

01yes8,315,1163.24

44yes615,5630.51

2424yes362,9270.90

• Nodes improvement (24r+24d) : 250

• Time improvement (4r+4d) : 55

• Data on 1000 states with 14 random moves• PDB of 7-edges cubies

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

25

Results: Rubik’s cube

• With duals we improved Korf’s results on random instances by a factor of 1.5 using exactly the same PDBs.

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

26

Results: tile puzzles

HeuristicBPMXValuenodestime

Manhattan----36.94401,189,63053.424

R----44.75136,2890.081

R+R*----45.6336,7100.034

R+R*+D+D*yes46.1218,6010.022

• With duals, the time for the 24 puzzle drops from 2 days to 1 day.

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

27

Discussion• Results for the TopSpin and Rubik’s 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

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

28

Summary

• Dual PDB lookups

• BPMX cutoffs for inconsistent heuristics

• State of the art solvers.

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

29

Future work

• Duality in search spaces

• Which and how many symmetries to use

• Other sources of inconsistencies

• Better ways for propagating inconsistencies