+ All Categories
Home > Documents > Abstraction Heuristics for Rubik’s Cube

Abstraction Heuristics for Rubik’s Cube

Date post: 13-Mar-2022
Category:
Upload: others
View: 12 times
Download: 0 times
Share this document with a friend
60
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
Transcript

Abstraction Heuristics for Rubik’s Cube

Bachelor Thesis

Abstraction Heuristics for Rubik’s Cube

Clemens Buchner

Departement of Mathematics and Computer ScienceUniversity of Basel

June 8, 2018

Abstraction Heuristics for Rubik’s Cube

Introduction

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

Abstraction Heuristics for Rubik’s Cube

Introduction

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

Abstraction Heuristics for Rubik’s Cube

Introduction

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

Abstraction Heuristics for Rubik’s Cube

Introduction

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

Abstraction Heuristics for Rubik’s Cube

Introduction

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

Abstraction Heuristics for Rubik’s Cube

Introduction

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

Abstraction Heuristics for Rubik’s Cube

Introduction

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

Abstraction Heuristics for Rubik’s Cube

Introduction

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

Abstraction Heuristics for Rubik’s Cube

Introduction

State Space

. . .

. . .

. . .

. . .

. . .

. . .

. . .

. . .

. . .

F

U

R

F

U

R

Abstraction Heuristics for Rubik’s Cube

Rubik’s Cube

Terminology

I Cubies: small pieces onRubik’s Cube

I corner cubiesI edge cubiesI center cubies

I Faces: sets of cubies

I F, B, L, R, U, D

Abstraction Heuristics for Rubik’s Cube

Rubik’s Cube

Terminology

I Cubies: small pieces onRubik’s Cube

I corner cubies

I edge cubiesI center cubies

I Faces: sets of cubies

I F, B, L, R, U, D

Abstraction Heuristics for Rubik’s Cube

Rubik’s Cube

Terminology

I Cubies: small pieces onRubik’s Cube

I corner cubiesI edge cubies

I center cubies

I Faces: sets of cubies

I F, B, L, R, U, D

Abstraction Heuristics for Rubik’s Cube

Rubik’s Cube

Terminology

I Cubies: small pieces onRubik’s Cube

I corner cubiesI edge cubiesI center cubies

I Faces: sets of cubies

I F, B, L, R, U, D

Abstraction Heuristics for Rubik’s Cube

Rubik’s Cube

Terminology

I Cubies: small pieces onRubik’s Cube

I corner cubiesI edge cubiesI center cubies

I Faces: sets of cubiesI F, B, L, R, U, D

Abstraction Heuristics for Rubik’s Cube

Rubik’s Cube

Model

I 20 variables, one for each relevantcubie

I center cubies and cubie insidenever change

I value describes location androtation

I size of domain =#locations · #rotations

I 18 operators, three per faceI turn 90◦ clockwise, turn 90◦

counterclockwise and turn 180◦

I no preconditions

I 43, 252 · 1018 reachable states

Abstraction Heuristics for Rubik’s Cube

Rubik’s Cube

Model

I 20 variables, one for each relevantcubie

I center cubies and cubie insidenever change

I value describes location androtation

I size of domain =#locations · #rotations

I 18 operators, three per faceI turn 90◦ clockwise, turn 90◦

counterclockwise and turn 180◦

I no preconditions

I 43, 252 · 1018 reachable states

Abstraction Heuristics for Rubik’s Cube

Rubik’s Cube

Model

I 20 variables, one for each relevantcubie

I center cubies and cubie insidenever change

I value describes location androtation

I size of domain =#locations · #rotations

I 18 operators, three per faceI turn 90◦ clockwise, turn 90◦

counterclockwise and turn 180◦

I no preconditions

I 43, 252 · 1018 reachable states

Abstraction Heuristics for Rubik’s Cube

Rubik’s Cube

Model

I 20 variables, one for each relevantcubie

I center cubies and cubie insidenever change

I value describes location androtation

I size of domain =#locations · #rotations

I 18 operators, three per faceI turn 90◦ clockwise, turn 90◦

counterclockwise and turn 180◦

I no preconditions

I 43, 252 · 1018 reachable states

Abstraction Heuristics for Rubik’s Cube

Rubik’s Cube

Model

I 20 variables, one for each relevantcubie

I center cubies and cubie insidenever change

I value describes location androtation

I size of domain =#locations · #rotations

I 18 operators, three per faceI turn 90◦ clockwise, turn 90◦

counterclockwise and turn 180◦

I no preconditions

I 43, 252 · 1018 reachable states

Abstraction Heuristics for Rubik’s Cube

Rubik’s Cube

Model

I 20 variables, one for each relevantcubie

I center cubies and cubie insidenever change

I value describes location androtation

I size of domain =#locations · #rotations

I 18 operators, three per faceI turn 90◦ clockwise, turn 90◦

counterclockwise and turn 180◦

I no preconditions

I 43, 252 · 1018 reachable states

Abstraction Heuristics for Rubik’s Cube

Rubik’s Cube

Model

I 20 variables, one for each relevantcubie

I center cubies and cubie insidenever change

I value describes location androtation

I size of domain =#locations · #rotations

I 18 operators, three per faceI turn 90◦ clockwise, turn 90◦

counterclockwise and turn 180◦

I no preconditions

I 43, 252 · 1018 reachable states

Abstraction Heuristics for Rubik’s Cube

Rubik’s Cube

Model

I 20 variables, one for each relevantcubie

I center cubies and cubie insidenever change

I value describes location androtation

I size of domain =#locations · #rotations

I 18 operators, three per faceI turn 90◦ clockwise, turn 90◦

counterclockwise and turn 180◦

I no preconditions

I 43, 252 · 1018 reachable states

Abstraction Heuristics for Rubik’s Cube

Abstraction Heuristics

Abstraction Heuristics

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

Abstraction Heuristics for Rubik’s Cube

Abstraction Heuristics

Example: Boat and Sluice

fill

empty

enterleave

fill

empty

leaveenter

fill

empty

Abstraction Heuristics for Rubik’s Cube

Abstraction Heuristics

Projection

fill, empty

enterleave

fill, empty

leaveenter

fill, empty

Abstraction Heuristics for Rubik’s Cube

Abstraction Heuristics

Cartesian Abstraction

fill, emptyenter, leave

Abstraction Heuristics for Rubik’s Cube

Abstraction Heuristics

Cartesian Abstraction

fill, emptyenter, leave

leaveenter

fill, empty

Abstraction Heuristics for Rubik’s Cube

Abstraction Heuristics

Cartesian Abstraction

fill, empty

enterleave

fill, empty

leaveenter

fill, empty

Abstraction Heuristics for Rubik’s Cube

Abstraction Heuristics

Cartesian Abstraction

fill, empty

enterleave

fill

empty

leaveenter

fill, empty

Abstraction Heuristics for Rubik’s Cube

Abstraction Heuristics

Merge-and-Shrink Abstraction

fill, empty

enterleave

fill

empty

leaveenter

fill, empty

Abstraction Heuristics for Rubik’s Cube

Cartesian Abstraction Refinement

Cartesian Abstraction Refinement

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

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 thefollowing form:

X 7→ x1 B X 7→ x2 ∧X 7→ x3 B X 7→ x4 ∧

. . . ∧Z 7→ z1 B Z 7→ z2

I factored effect tasks only have factored effect operators

Abstraction Heuristics for Rubik’s Cube

Cartesian Abstraction Refinement

Transition Check (before)

1: function CheckTransition(a, o, b)2: for all v ∈ V do3: if v ∈ vars (pre (o)) and pre (o) [v ] 6∈ dom (v , a) then4: return false5: if v ∈ vars (post(o)) and post(o)[v ] 6∈ dom (v , b) then6: return false7: if v 6∈ vars (post(o)) and dom (v , a) ∩ dom (v , b) = ∅ then8: return false9: return true

Abstraction Heuristics for Rubik’s Cube

Cartesian Abstraction Refinement

Transition Check (before)

1: function CheckTransition(a, o, b)2: for all v ∈ V do3: if v ∈ vars (pre (o)) and pre (o) [v ] 6∈ dom (v , a) then4: return false5: if v ∈ vars (post(o)) and post(o)[v ] 6∈ dom (v , b) then6: return false7: if v 6∈ vars (post(o)) and dom (v , a) ∩ dom (v , b) = ∅ then8: return false9: return true

Abstraction Heuristics for Rubik’s Cube

Cartesian Abstraction Refinement

Functions

possible (a, o,X ) =⋃

x∈dom(X ,a)

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

Abstraction Heuristics for Rubik’s Cube

Cartesian Abstraction Refinement

Transition Check (after)

1: function CheckTransition(a, o, b)2: for all v ∈ V do3: if v ∈ vars (pre (o)) and pre (o) [v ] 6∈ dom (v , a) then4: return false5: if v ∈ vars (o) and possible (a, o, v)∩ dom (v , b) = ∅ then6: return false7: if v 6∈ vars (o) and dom (v , a) ∩ dom (v , b) = ∅ then8: return false9: return true

Abstraction Heuristics for Rubik’s Cube

Evaluation

Evaluation

Abstraction Heuristics for Rubik’s Cube

Evaluation

Setup

I 200 problem instances of different difficultiesI seven heuristics

I Blind Search Heuristic as a baselineI different Pattern Database heuristicsI Cartesian Abstraction with conditional effectsI Merge-and-Shrink

Abstraction Heuristics for Rubik’s Cube

Evaluation

Coverage

Summary blind man syst corner edge cegar m&s

coverage 68 128 122 108 105 111 95out-of-memorya 132 72 0 92 95 89 105timeoutb 0 0 78 0 0 0 0total timec 0.32 16.98 141.36 2.64 2.21 0.61 19.94

amemory limit: 3.5 GiBbtime limit: 30 minutescgeometric mean of instances solved by all configurations

Abstraction Heuristics for Rubik’s Cube

Evaluation

Coverage

Summary blind man syst corner edge cegar m&s

coverage 68 128 122 108 105 111 95out-of-memorya 132 72 0 92 95 89 105timeoutb 0 0 78 0 0 0 0total timec 0.32 16.98 141.36 2.64 2.21 0.61 19.94

amemory limit: 3.5 GiBbtime limit: 30 minutescgeometric mean of instances solved by all configurations

Abstraction Heuristics for Rubik’s Cube

Evaluation

Coverage

Summary blind man syst corner edge cegar m&s

coverage 68 128 122 108 105 111 95out-of-memorya 132 72 0 92 95 89 105timeoutb 0 0 78 0 0 0 0total timec 0.32 16.98 141.36 2.64 2.21 0.61 19.94

amemory limit: 3.5 GiBbtime limit: 30 minutescgeometric mean of instances solved by all configurations

Abstraction Heuristics for Rubik’s Cube

Evaluation

Coverage

Summary blind man syst corner edge cegar m&s

coverage 68 128 122 108 105 111 95out-of-memorya 132 72 0 92 95 89 105timeoutb 0 0 78 0 0 0 0total timec 0.32 16.98 141.36 2.64 2.21 0.61 19.94

amemory limit: 3.5 GiBbtime limit: 30 minutescgeometric mean of instances solved by all configurations

Abstraction Heuristics for Rubik’s Cube

Evaluation

Expansions Until the Last f -layer

10−1 100 101 102 103 104 105 106

10−1

100

101

102

103

104

105

106

uns.

uns.

blind search

sin

gle

corn

erp

atte

rn

Abstraction Heuristics for Rubik’s Cube

Evaluation

Expansions Until the Last f -layer

10−1 100 101 102 103 104 105 106

10−1

100

101

102

103

104

105

106

uns.

uns.

single corner pattern

max

over

man

ual

PD

Bs

Abstraction Heuristics for Rubik’s Cube

Evaluation

Expansions Until the Last f -layer

10−1 100 101 102 103 104 105 106

10−1

100

101

102

103

104

105

106

uns.

uns.

max over manual PDBs

CE

GA

R

Abstraction Heuristics for Rubik’s Cube

Evaluation

Expansions Until the Last f -layer

10−1 100 101 102 103 104 105 106

10−1

100

101

102

103

104

105

106

uns.

uns.

CEGAR

mer

ge-a

nd

-sh

rin

k

Abstraction Heuristics for Rubik’s Cube

Evaluation

Initial h-values

0

2

4

6

8

10

12

problem instances

diff

eren

ceto

h?

blind searchmanual patternsCEGARmerge-and-shrink

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

Abstraction Heuristics for Rubik’s Cube

Conclusion

Thank you for your attention.

Abstraction Heuristics for Rubik’s Cube

Appendix

Planning Tasks

Definition

A planning task is a 4-tuple Π = 〈V, I ,O, γ〉 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), andcost cost(o)

Abstraction Heuristics for Rubik’s Cube

Appendix

Locations

I coordinate systemI distinguish categories

I corner cubies and edge cubies

0

1

2

3

4 6

70

1

2

3

4 6

7

9

11

Abstraction Heuristics for Rubik’s Cube

Appendix

Rotations

I number of facelets corresponds to possible rotationsI triple representation 〈x , y , z〉

I use blanks (#) where less than 3 faceletsI rotation is first non-blank triple element

x

y

z

Abstraction Heuristics for Rubik’s Cube

Appendix

Rotations

I number of facelets corresponds to possible rotationsI triple representation 〈x , y , z〉

I use blanks (#) where less than 3 faceletsI rotation is first non-blank triple element

x

y

z

Abstraction Heuristics for Rubik’s Cube

Appendix

Regression (1)

Definition

Let X 7→ x1 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→ x1, eff (o)) = pre (o) [X ] ∧ (effcond (X 7→ x1, eff (o))∨(X 7→ x1 ∧ ¬effcond (X 6= x1, eff (o))))

Abstraction Heuristics for Rubik’s Cube

Appendix

Regression (2)

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

∨〈X 7→x1,X 7→x2〉∈

effects(o)

X 7→ x1∨

X 7→ x2

if X 7→ x2 does notoccur as an effectcondition in o

⊥ otherwise

regr (X , o) =

⋃x∈X

regr (X 7→ x , o)

regr (a, o) = A1 × · · · × An where Ai = regr (dom(vi , a), o)

Abstraction Heuristics for Rubik’s Cube

Appendix

Expansions Until the Last f -layer

10−1 100 101 102 103 104 105

10−1

100

101

102

103

104

105

uns.

uns.

max over manual PDBs

max

over

syst

emat

icP

DB

s

Abstraction Heuristics for Rubik’s Cube

Appendix

Expansions Until the Last f -layer

10−1 100 101 102 103 104 105 106

10−1

100

101

102

103

104

105

106

uns.

uns.

single corner pattern

sin

gle

edge

pat

tern


Recommended