• Keine Ergebnisse gefunden

Abstraction Heuristics for Rubik’s Cube

N/A
N/A
Protected

Academic year: 2022

Aktie "Abstraction Heuristics for Rubik’s Cube"

Copied!
60
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Abstraction Heuristics for Rubik’s Cube

Bachelor Thesis

Abstraction Heuristics for Rubik’s Cube

Clemens B¨ uchner

Departement of Mathematics and Computer Science University of Basel

June 8, 2018

(2)

Abstraction Heuristics for Rubik’s Cube Introduction

Planning: Figure out a sequence of actions that leads to a goal.

(3)

Abstraction Heuristics for Rubik’s Cube Introduction

Planning: Figure out a sequence of actions that leads to a goal.

(4)

Abstraction Heuristics for Rubik’s Cube Introduction

Planning: Figure out a sequence of actions that leads to a goal.

(5)

Abstraction Heuristics for Rubik’s Cube Introduction

Planning: Figure out a sequence of actions that leads to a goal.

(6)

Abstraction Heuristics for Rubik’s Cube Introduction

Planning: Figure out a sequence of actions that leads to a goal.

(7)

Abstraction Heuristics for Rubik’s Cube Introduction

Planning: Figure out a sequence of actions that leads to a goal.

(8)

Abstraction Heuristics for Rubik’s Cube Introduction

Planning: Figure out a sequence of actions that leads to a goal.

(9)

Abstraction Heuristics for Rubik’s Cube Introduction

Planning: Figure out a sequence of actions that leads to a goal.

(10)

Abstraction Heuristics for Rubik’s Cube Introduction

State Space

. . .

. . . . . . . . . . . . . . . . . . . . .

. . . F

U

R

F U

R

(11)

Abstraction Heuristics for Rubik’s Cube Rubik’s Cube

Terminology

I Cubies: small pieces on Rubik’s Cube

I

corner cubies

I

edge cubies

I

center cubies

I Faces: sets of cubies

I

F, B, L, R, U, D

(12)

Abstraction Heuristics for Rubik’s Cube Rubik’s Cube

Terminology

I Cubies: small pieces on Rubik’s Cube

I

corner cubies

I

edge cubies

I

center cubies

I Faces: sets of cubies

I

F, B, L, R, U, D

(13)

Abstraction Heuristics for Rubik’s Cube Rubik’s Cube

Terminology

I Cubies: small pieces on Rubik’s Cube

I

corner cubies

I

edge cubies

I

center cubies

I Faces: sets of cubies

I

F, B, L, R, U, D

(14)

Abstraction Heuristics for Rubik’s Cube Rubik’s Cube

Terminology

I Cubies: small pieces on Rubik’s Cube

I

corner cubies

I

edge cubies

I

center cubies

I Faces: sets of cubies

I

F, B, L, R, U, D

(15)

Abstraction Heuristics for Rubik’s Cube Rubik’s Cube

Terminology

I Cubies: small pieces on Rubik’s Cube

I

corner cubies

I

edge cubies

I

center cubies

I Faces: sets of cubies

I

F, B, L, R, U, D

(16)

Abstraction Heuristics for Rubik’s Cube Rubik’s Cube

Model

I 20 variables, one for each relevant cubie

I

center cubies and cubie inside never change

I

value describes location and rotation

I size of domain =

#locations · #rotations

I 18 operators, three per face

I

turn 90

clockwise, turn 90

counterclockwise and turn 180

I

no preconditions

I 43, 252 · 10 18 reachable states

(17)

Abstraction Heuristics for Rubik’s Cube Rubik’s Cube

Model

I 20 variables, one for each relevant cubie

I

center cubies and cubie inside never change

I

value describes location and rotation

I size of domain =

#locations · #rotations

I 18 operators, three per face

I

turn 90

clockwise, turn 90

counterclockwise and turn 180

I

no preconditions

I 43, 252 · 10 18 reachable states

(18)

Abstraction Heuristics for Rubik’s Cube Rubik’s Cube

Model

I 20 variables, one for each relevant cubie

I

center cubies and cubie inside never change

I

value describes location and rotation

I size of domain =

#locations · #rotations

I 18 operators, three per face

I

turn 90

clockwise, turn 90

counterclockwise and turn 180

I

no preconditions

I 43, 252 · 10 18 reachable states

(19)

Abstraction Heuristics for Rubik’s Cube Rubik’s Cube

Model

I 20 variables, one for each relevant cubie

I

center cubies and cubie inside never change

I

value describes location and rotation

I size of domain =

#locations · #rotations

I 18 operators, three per face

I

turn 90

clockwise, turn 90

counterclockwise and turn 180

I

no preconditions

I 43, 252 · 10 18 reachable states

(20)

Abstraction Heuristics for Rubik’s Cube Rubik’s Cube

Model

I 20 variables, one for each relevant cubie

I

center cubies and cubie inside never change

I

value describes location and rotation

I size of domain =

#locations · #rotations

I 18 operators, three per face

I

turn 90

clockwise, turn 90

counterclockwise and turn 180

I

no preconditions

I 43, 252 · 10 18 reachable states

(21)

Abstraction Heuristics for Rubik’s Cube Rubik’s Cube

Model

I 20 variables, one for each relevant cubie

I

center cubies and cubie inside never change

I

value describes location and rotation

I size of domain =

#locations · #rotations

I 18 operators, three per face

I

turn 90

clockwise, turn 90

counterclockwise and turn 180

I

no preconditions

I 43, 252 · 10 18 reachable states

(22)

Abstraction Heuristics for Rubik’s Cube Rubik’s Cube

Model

I 20 variables, one for each relevant cubie

I

center cubies and cubie inside never change

I

value describes location and rotation

I size of domain =

#locations · #rotations

I 18 operators, three per face

I

turn 90

clockwise, turn 90

counterclockwise and turn 180

I

no preconditions

I 43, 252 · 10 18 reachable states

(23)

Abstraction Heuristics for Rubik’s Cube Rubik’s Cube

Model

I 20 variables, one for each relevant cubie

I

center cubies and cubie inside never change

I

value describes location and rotation

I size of domain =

#locations · #rotations

I 18 operators, three per face

I

turn 90

clockwise, turn 90

counterclockwise and turn 180

I

no preconditions

I 43, 252 · 10 18 reachable states

(24)

Abstraction Heuristics for Rubik’s Cube Abstraction Heuristics

Abstraction Heuristics

(25)

Abstraction Heuristics for Rubik’s Cube Abstraction Heuristics

Abstractions

I disregard information on purpose

I combine states with similarities to abstract states

I always admissible → A yields optimal plan

(26)

Abstraction Heuristics for Rubik’s Cube Abstraction Heuristics

Example: Boat and Sluice

fill empty enter

leave

fill empty

leave enter

fill

empty

(27)

Abstraction Heuristics for Rubik’s Cube Abstraction Heuristics

Projection

fill, empty

enter leave

fill, empty

leave enter

fill, empty

(28)

Abstraction Heuristics for Rubik’s Cube Abstraction Heuristics

Cartesian Abstraction

fill, empty

enter, leave

(29)

Abstraction Heuristics for Rubik’s Cube Abstraction Heuristics

Cartesian Abstraction

fill, empty enter, leave

leave enter

fill, empty

(30)

Abstraction Heuristics for Rubik’s Cube Abstraction Heuristics

Cartesian Abstraction

fill, empty

enter leave

fill, empty

leave enter

fill, empty

(31)

Abstraction Heuristics for Rubik’s Cube Abstraction Heuristics

Cartesian Abstraction

fill, empty

enter leave

fill empty

leave enter

fill, empty

(32)

Abstraction Heuristics for Rubik’s Cube Abstraction Heuristics

Merge-and-Shrink Abstraction

fill, empty

enter leave

fill empty

leave enter

fill, empty

(33)

Abstraction Heuristics for Rubik’s Cube Cartesian Abstraction Refinement

Cartesian Abstraction Refinement

(34)

Abstraction Heuristics for Rubik’s Cube Cartesian Abstraction Refinement

Regression

I regression of Cartesian Set not Cartesian

I no support for conditional effects

I Rubik’s Cube has only conditional effects

(35)

Abstraction Heuristics for Rubik’s Cube Cartesian Abstraction Refinement

Factored Effect Task

Definition

Operator o is called a factored effect operator if eff (o ) has the following form:

X 7→ x 1 B X 7→ x 2 ∧ X 7→ x 3 B X 7→ x 4 ∧

. . . ∧

Z 7→ z 1 B Z 7→ z 2

I factored effect tasks only have factored effect operators

(36)

Abstraction Heuristics for Rubik’s Cube Cartesian Abstraction Refinement

Transition Check (before)

1: function CheckTransition (a, o , b) 2: for all v ∈ V do

3: if v ∈ vars (pre (o )) and pre (o) [v ] 6∈ dom (v, a) then 4: return false

5: if v ∈ vars (post (o )) and post(o)[v ] 6∈ dom (v, b) then 6: return false

7: if v 6∈ vars (post (o )) and dom (v, a) ∩ dom (v , b) = ∅ then 8: return false

9: return true

(37)

Abstraction Heuristics for Rubik’s Cube Cartesian Abstraction Refinement

Transition Check (before)

1: function CheckTransition (a, o , b) 2: for all v ∈ V do

3: if v ∈ vars (pre (o )) and pre (o) [v ] 6∈ dom (v, a) then 4: return false

5: if v ∈ vars (post(o) ) and post (o)[v] 6∈ dom (v , b) then 6: return false

7: if v 6∈ vars (post(o) ) and dom (v , a) ∩ dom (v, b) = ∅ then 8: return false

9: return true

(38)

Abstraction Heuristics for Rubik’s Cube Cartesian Abstraction Refinement

Functions

possible (a, o, X ) = [

x∈dom(X ,a)

{resulting fact (X 7→ x, o )}

(39)

Abstraction Heuristics for Rubik’s Cube Cartesian Abstraction Refinement

Transition Check (after)

1: function CheckTransition (a, o , b) 2: for all v ∈ V do

3: if v ∈ vars (pre (o )) and pre (o) [v ] 6∈ dom (v, a) then 4: return false

5: if v ∈ vars (o ) and possible (a, o , v ) ∩ dom (v, b) = ∅ then 6: return false

7: if v 6∈ vars (o ) and dom (v, a) ∩ dom (v, b) = ∅ then 8: return false

9: return true

(40)

Abstraction Heuristics for Rubik’s Cube Evaluation

Evaluation

(41)

Abstraction Heuristics for Rubik’s Cube Evaluation

Setup

I 200 problem instances of different difficulties

I seven heuristics

I

Blind Search Heuristic as a baseline

I

different Pattern Database heuristics

I

Cartesian Abstraction with conditional effects

I

Merge-and-Shrink

(42)

Abstraction Heuristics for Rubik’s Cube Evaluation

Coverage

Summary blind man syst corner edge cegar m&s

coverage 68 128 122 108 105 111 95

out-of-memory

a

132 72 0 92 95 89 105

timeout

b

0 0 78 0 0 0 0

total time

c

0.32 16.98 141.36 2.64 2.21 0.61 19.94

a

memory limit: 3.5 GiB

b

time limit: 30 minutes

c

geometric mean of instances solved by all configurations

(43)

Abstraction Heuristics for Rubik’s Cube Evaluation

Coverage

Summary blind man syst corner edge cegar m&s

coverage 68 128 122 108 105 111 95

out-of-memory

a

132 72 0 92 95 89 105

timeout

b

0 0 78 0 0 0 0

total time

c

0.32 16.98 141.36 2.64 2.21 0.61 19.94

a

memory limit: 3.5 GiB

b

time limit: 30 minutes

c

geometric mean of instances solved by all configurations

(44)

Abstraction Heuristics for Rubik’s Cube Evaluation

Coverage

Summary blind man syst corner edge cegar m&s

coverage 68 128 122 108 105 111 95

out-of-memory

a

132 72 0 92 95 89 105

timeout

b

0 0 78 0 0 0 0

total time

c

0.32 16.98 141.36 2.64 2.21 0.61 19.94

a

memory limit: 3.5 GiB

b

time limit: 30 minutes

c

geometric mean of instances solved by all configurations

(45)

Abstraction Heuristics for Rubik’s Cube Evaluation

Coverage

Summary blind man syst corner edge cegar m&s

coverage 68 128 122 108 105 111 95

out-of-memory

a

132 72 0 92 95 89 105

timeout

b

0 0 78 0 0 0 0

total time

c

0.32 16.98 141.36 2.64 2.21 0.61 19.94

a

memory limit: 3.5 GiB

b

time limit: 30 minutes

c

geometric mean of instances solved by all configurations

(46)

Abstraction Heuristics for Rubik’s Cube Evaluation

Expansions Until the Last f -layer

10

−1

10

0

10

1

10

2

10

3

10

4

10

5

10

6

10

−1

10

0

10

1

10

2

10

3

10

4

10

5

10

6

uns.

uns.

blind search

single co rner pattern

(47)

Abstraction Heuristics for Rubik’s Cube Evaluation

Expansions Until the Last f -layer

10

−1

10

0

10

1

10

2

10

3

10

4

10

5

10

6

10

−1

10

0

10

1

10

2

10

3

10

4

10

5

10

6

uns.

uns.

single corner pattern

max over manual PDBs

(48)

Abstraction Heuristics for Rubik’s Cube Evaluation

Expansions Until the Last f -layer

10

−1

10

0

10

1

10

2

10

3

10

4

10

5

10

6

10

−1

10

0

10

1

10

2

10

3

10

4

10

5

10

6

uns.

uns.

max over manual PDBs

CEGAR

(49)

Abstraction Heuristics for Rubik’s Cube Evaluation

Expansions Until the Last f -layer

10

−1

10

0

10

1

10

2

10

3

10

4

10

5

10

6

10

−1

10

0

10

1

10

2

10

3

10

4

10

5

10

6

uns.

uns.

CEGAR

merge-and-shrink

(50)

Abstraction Heuristics for Rubik’s Cube Evaluation

Initial h-values

0 2 4 6 8 10 12

problem instances

differencetoh?

blind search manual patterns CEGAR merge-and-shrink

(51)

Abstraction Heuristics for Rubik’s Cube Conclusion

Summary

I factored effect tasks can be abstracted with CEGAR

I PDBs find most solutions with least expansions

I CEGAR is fast and yields perfect heuristic values

(52)

Abstraction Heuristics for Rubik’s Cube Conclusion

Thank you for your attention.

(53)

Abstraction Heuristics for Rubik’s Cube Appendix

Planning Tasks

Definition

A planning task is a 4-tuple Π = hV , I , O, γi where

I V is a finite set of finite-domain state variables,

I I is a state over V called the initial state,

I O is a finite set of finite-domain operators over V , and

I γ is a formula over V called the goal.

I operators o ∈ O with precondition pre(o), effect eff (o), and

cost cost(o)

(54)

Abstraction Heuristics for Rubik’s Cube Appendix

Locations

I coordinate system

I distinguish categories

I

corner cubies and edge cubies

0

1

2

3

4 6

0 7 1

2 3

4 6

7 9

11

(55)

Abstraction Heuristics for Rubik’s Cube Appendix

Rotations

I number of facelets corresponds to possible rotations

I triple representation hx, y, z i

I

use blanks (#) where less than 3 facelets

I

rotation is first non-blank triple element

x

y

z

(56)

Abstraction Heuristics for Rubik’s Cube Appendix

Rotations

I number of facelets corresponds to possible rotations

I triple representation hx, y, z i

I

use blanks (#) where less than 3 facelets

I

rotation is first non-blank triple element

x

y

z

(57)

Abstraction Heuristics for Rubik’s Cube Appendix

Regression (1)

Definition

Let X 7→ x

1

be an atomic effect and let o be an operator in a (general) planning task. Then the regression of X through o is defined as follows:

regr (X 7→ x

1

, eff (o )) = pre (o ) [X ] ∧ (effcond (X 7→ x

1

, eff (o)) ∨

(X 7→ x

1

∧ ¬effcond (X 6= x

1

, eff (o ))))

(58)

Abstraction Heuristics for Rubik’s Cube Appendix

Regression (2)

regr (X 7→ x 2 , o) = pre (o ) [X ] ∧

_

hX 7→x

1

,X 7→x

2

i∈

effects(o)

X 7→ x 1

 

 

X 7→ x 2

if X 7→ x 2 does not occur as an effect condition in o

⊥ otherwise

regr (X , o ) = [

x∈X

regr (X 7→ x, o)

regr (a, o ) = A 1 × · · · × A n where A i = regr (dom(v i , a), o)

(59)

Abstraction Heuristics for Rubik’s Cube Appendix

Expansions Until the Last f -layer

10

−1

10

0

10

1

10

2

10

3

10

4

10

5

10

−1

10

0

10

1

10

2

10

3

10

4

10

5

uns.

uns.

max over manual PDBs

max over systematic PDBs

(60)

Abstraction Heuristics for Rubik’s Cube Appendix

Expansions Until the Last f -layer

10

−1

10

0

10

1

10

2

10

3

10

4

10

5

10

6

10

−1

10

0

10

1

10

2

10

3

10

4

10

5

10

6

uns.

uns.

single corner pattern

single edge pattern

Referenzen

ÄHNLICHE DOKUMENTE

Cette identification semble plausible lorsqu'on la compare à des dessins où Moreau étudie l'effet d'ensemble de cette composition (ill. Dans ce cas l'esquisse aurait été peinte

Tue object gets its structure (attributes and values) by the change-command (see below). In the second case, additionally, the abstraction relationships of the

Part iii provides a theoretical and experimental comparison of saturated cost partitioning and other cost partitioning algorithms. Theoretically, we show that saturated

I basic idea of abstraction heuristics: estimate solution cost by considering a smaller planning task. I formally: abstraction function α maps states to abstract states and thus

As for the abstraction of the model, we distinguish between (1) state abstraction that only merge states as in single-model ab- straction, (2) feature abstraction that modifies only

According to the meta model in figure 1 we define this version of the ER-model to consist of the modelling notions entity type and value type and the ab- straction concepts

Finally, if the clustering algorithms are crisp, that is, every data object is assigned unambiguously to a cluster, then all methods from section 3 and 4 provide a single abstraction

Pragmatics: universal, rational principles Make exclusive use of on-the-spot reasoning Semantics: arbitrary