Swapping Evaluation: A Memory-Scalable Solution for Answer-On-Demand - - PowerPoint PPT Presentation

swapping evaluation a memory scalable solution for answer
SMART_READER_LITE
LIVE PREVIEW

Swapping Evaluation: A Memory-Scalable Solution for Answer-On-Demand - - PowerPoint PPT Presentation

Swapping Evaluation: A Memory-Scalable Solution for Answer-On-Demand Tabling an 1 Manuel Carro 1 David S. Warren 2 Pablo Chico de Guzm 1 School of Computer Science, Technical University of Madrid, Spain 2 State University of New York at Stony


slide-1
SLIDE 1

Swapping Evaluation: A Memory-Scalable Solution for Answer-On-Demand Tabling

Pablo Chico de Guzm´ an1 Manuel Carro1 David S. Warren2

1School of Computer Science, Technical University of Madrid, Spain 2State University of New York at Stony Brook, USA

ICLP 2010 — Edinburgh – July 16, 2010

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 1 / 15

slide-2
SLIDE 2

Introduction

Tabling Basics

Tabling: resolution strategy (alternative to SLD) aimed at improving both efficiency and declarativeness in Prolog.

◮ ≈ memoing: answers for already executed calls retrieved from table. ◮ Infinite recursions automatically avoided.

Example code

:- table p/1. p(A) :- q, p(B), A = 2. p(A) :- A = 1.

?− p(A). q, p(B), A = 2. A = 1. p(B), A = 2. Suspension p(1), A = 2. A = 2.

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 2 / 15

slide-3
SLIDE 3

Introduction

External and Internal Consumers

Internal: appears under its generator execution tree. External: appears out of the scope of its generator execution tree.

Example code

?- a, b, a. :- table a/0. a :- a. a. b.

a a true b a INTERNAL EXTERNAL

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 3 / 15

slide-4
SLIDE 4

Scheduling Strategy

Tabling: Scheduling Strategy

Local scheduling

Computes all the answers before returning any of them.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) comp1 t(1) p t(Y) fail

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 4 / 15

slide-5
SLIDE 5

Scheduling Strategy

Tabling: Scheduling Strategy

Local scheduling

Computes all the answers before returning any of them.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) comp1 t(1) p t(Y) fail fail

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 4 / 15

slide-6
SLIDE 6

Scheduling Strategy

Tabling: Scheduling Strategy

Local scheduling

Computes all the answers before returning any of them.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) comp2 t(2) p t(Y) fail

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 4 / 15

slide-7
SLIDE 7

Scheduling Strategy

Tabling: Scheduling Strategy

Local scheduling

Computes all the answers before returning any of them.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) comp2 t(2) p t(Y) fail fail

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 4 / 15

slide-8
SLIDE 8

Scheduling Strategy

Tabling: Scheduling Strategy

Local scheduling

Computes all the answers before returning any of them.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 4 / 15

slide-9
SLIDE 9

Scheduling Strategy

Tabling: Scheduling Strategy

Local scheduling

Computes all the answers before returning any of them.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) p t(Y) large1 fail t(1)

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 4 / 15

slide-10
SLIDE 10

Scheduling Strategy

Tabling: Scheduling Strategy

Local scheduling

Computes all the answers before returning any of them.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) p t(Y) large1 t(1) fail t(1)

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 4 / 15

slide-11
SLIDE 11

Scheduling Strategy

Tabling: Scheduling Strategy

Local scheduling

Computes all the answers before returning any of them.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) p t(Y) large1 fail t(1) t(2)

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 4 / 15

slide-12
SLIDE 12

Scheduling Strategy

Tabling: Scheduling Strategy

Local scheduling

Computes all the answers before returning any of them.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) p t(Y) large2 t(1) t(2) fail t(1)

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 4 / 15

slide-13
SLIDE 13

Scheduling Strategy

Tabling: Scheduling Strategy

Local scheduling

Computes all the answers before returning any of them.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) p t(Y) t(1) t(2) fail t(1) largeN

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 4 / 15

slide-14
SLIDE 14

Scheduling Strategy

Tabling: Scheduling Strategy

Local scheduling

Computes all the answers before returning any of them.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) p t(Y) large1 t(1) t(2) fail t(2)

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 4 / 15

slide-15
SLIDE 15

Scheduling Strategy

Tabling: Scheduling Strategy

Batched scheduling

Returns each of the answer as soon as they are computed.

◮ Cut-Once operators can prune when the desired answer is found. ◮ Bad memory behavior (live environments & external suspensions).

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) comp1 t(1) p t(Y) fail

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 5 / 15

slide-16
SLIDE 16

Scheduling Strategy

Tabling: Scheduling Strategy

Batched scheduling

Returns each of the answer as soon as they are computed.

◮ Cut-Once operators can prune when the desired answer is found. ◮ Bad memory behavior (live environments & external suspensions).

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) comp1 t(1) p t(Y) fail large1

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 5 / 15

slide-17
SLIDE 17

Scheduling Strategy

Tabling: Scheduling Strategy

Batched scheduling

Returns each of the answer as soon as they are computed.

◮ Cut-Once operators can prune when the desired answer is found. ◮ Bad memory behavior (live environments & external suspensions).

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) comp1 t(1) p t(Y) fail large1 t(1)

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 5 / 15

slide-18
SLIDE 18

Scheduling Strategy

Tabling: Scheduling Strategy

Batched scheduling

Returns each of the answer as soon as they are computed.

◮ Cut-Once operators can prune when the desired answer is found. ◮ Bad memory behavior (live environments & external suspensions).

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) comp1 t(1) p t(Y) fail large1 t(1) Susp.

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 5 / 15

slide-19
SLIDE 19

Scheduling Strategy

Tabling: Scheduling Strategy

Batched scheduling

Returns each of the answer as soon as they are computed.

◮ Cut-Once operators can prune when the desired answer is found. ◮ Bad memory behavior (live environments & external suspensions).

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) comp1 t(1) p t(Y) fail large1 large2 t(1) Susp.

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 5 / 15

slide-20
SLIDE 20

Scheduling Strategy

Tabling: Scheduling Strategy

Batched scheduling

Returns each of the answer as soon as they are computed.

◮ Cut-Once operators can prune when the desired answer is found. ◮ Bad memory behavior (live environments & external suspensions).

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) comp1 t(1) p t(Y) fail large1 large2 largeN ... t(1) Susp.

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 5 / 15

slide-21
SLIDE 21

Scheduling Strategy

Tabling: Scheduling Strategy

Batched scheduling

Returns each of the answer as soon as they are computed.

◮ Cut-Once operators can prune when the desired answer is found. ◮ Bad memory behavior (live environments & external suspensions).

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) comp2 t(2) p t(Y) fail large1 large2 largeN ... t(1) Susp. t(2)

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 5 / 15

slide-22
SLIDE 22

Swapping Evaluation

Motivation

Tabling has been successfully applied in many applications: deductive databases, program analysis, reasoning in the semantic Web, model checking, . . .

◮ They need to compute all answers (database-like computations). ◮ Local evaluation can be used, which is memory efficient.

However, some interesting, probably under-explored tabling applications, need only a subset of the answers (maybe only one):

◮ Example: planning. ◮ Local evaluation performs more work than needed. ◮ Batched memory behavior is unacceptable.

⇒ An efficient first-answer tabling is needed to successfully apply tabling in more kind of applications.

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 6 / 15

slide-23
SLIDE 23

Swapping Evaluation

Swapping Scheduling Strategy

External consumers do not suspend anymore.

◮ They continue the execution tree of their generator.

Memory behavior gets closer to local scheduling. Advantages from first-answer tabling are maintained.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) comp1 t(1) p t(Y) fail

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 7 / 15

slide-24
SLIDE 24

Swapping Evaluation

Swapping Scheduling Strategy

External consumers do not suspend anymore.

◮ They continue the execution tree of their generator.

Memory behavior gets closer to local scheduling. Advantages from first-answer tabling are maintained.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) comp1 t(1) p t(Y) large1 fail

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 7 / 15

slide-25
SLIDE 25

Swapping Evaluation

Swapping Scheduling Strategy

External consumers do not suspend anymore.

◮ They continue the execution tree of their generator.

Memory behavior gets closer to local scheduling. Advantages from first-answer tabling are maintained.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) comp1 t(1) p t(Y) large1 t(1) fail

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 7 / 15

slide-26
SLIDE 26

Swapping Evaluation

Swapping Scheduling Strategy

External consumers do not suspend anymore.

◮ They continue the execution tree of their generator.

Memory behavior gets closer to local scheduling. Advantages from first-answer tabling are maintained.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) p t(Y) large1 fail comp1 t(1) t(1)

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 7 / 15

slide-27
SLIDE 27

Swapping Evaluation

Swapping Scheduling Strategy

External consumers do not suspend anymore.

◮ They continue the execution tree of their generator.

Memory behavior gets closer to local scheduling. Advantages from first-answer tabling are maintained.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) p t(Y) large1 fail comp2 t(1) t(2)

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 7 / 15

slide-28
SLIDE 28

Swapping Evaluation

Swapping Scheduling Strategy

External consumers do not suspend anymore.

◮ They continue the execution tree of their generator.

Memory behavior gets closer to local scheduling. Advantages from first-answer tabling are maintained.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) p t(Y) large1 fail t(1) complete

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 7 / 15

slide-29
SLIDE 29

Swapping Evaluation

Swapping Scheduling Strategy

External consumers do not suspend anymore.

◮ They continue the execution tree of their generator.

Memory behavior gets closer to local scheduling. Advantages from first-answer tabling are maintained.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) p t(Y) large2 t(1) t(2) fail t(1)

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 7 / 15

slide-30
SLIDE 30

Swapping Evaluation

Swapping Scheduling Strategy

External consumers do not suspend anymore.

◮ They continue the execution tree of their generator.

Memory behavior gets closer to local scheduling. Advantages from first-answer tabling are maintained.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) p t(Y) t(1) t(2) fail t(1) largeN

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 7 / 15

slide-31
SLIDE 31

Swapping Evaluation

Swapping Scheduling Strategy

External consumers do not suspend anymore.

◮ They continue the execution tree of their generator.

Memory behavior gets closer to local scheduling. Advantages from first-answer tabling are maintained.

Example code

?- t(X), p, t(Y), fail. :- table t/1. t(X) :- computation1, X = 1. t(X) :- computation2, X = 2. p :- large1. p :- large2. ... p :- largeN.

t(X) p t(Y) large1 t(1) t(2) fail t(2)

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 7 / 15

slide-32
SLIDE 32

Swapping Evaluation

Live Environments

Inherent to first-answer tabling. Simulating local scheduling under first-answer tabling:

1

Renaming the header of the clause(s) defining t/1 to be t_aux/1.

2

Adding the following wrapper code: t(X) :- call_is_consumer(t aux(X)), !, t aux(X). t(X) :- ( t aux(X), fail ; t aux(X) ).

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 8 / 15

slide-33
SLIDE 33

Performance

Performance of First-Answer Queries

Local Swapping Query Time Stack Mem Table Mem Time Stack Mem Table Mem tcl(100, ) 2,320 1,828 3,276 212 tcr(100, ) 20 162,756 89,108 21,164 9,852 tcn(100, ) 20 190,660 90,640 2,228 212 sg(1, ) 392 147,420 191,128 2,228 212 atr2 ground 36 405,512 386,696 36 258,732 382,273 atr2 1var 1,048 522,844 3,864,540 744 296,244 3,374,687 atr2 2var 2,060 622,380 19,299,868 756 338,640 4,015,368 numbers 4 20 3,916 81,884 5,412 2,496 numbers 5 544 7,108 2,406,312 1 6,632 4,416 numbers 6 22,865 202,676 99,177,188 2 7,956 8,620

Note: In the above program set, batched and swapping have similar behavior since dependencies are not complex (see next slides for this case).

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 9 / 15

slide-34
SLIDE 34

Performance

Memory Performance of All-Answer Queries

Program Local Batched Swapping

Swapping Local

tcl 2,248 2,176 2,172 0.97 tcr 196,068 180,368 178,768 0.91 tcn 229,392 209,648 208,644 0.91 sg 764,960 813,276 790,068 1.03 atr2 478,112 476,736 475,592 0.99 pg 18,140 133,736 74,660 4.11 disj 7,096 32,900 11,124 1.57 kalah 11,700 61,060 23,324 1.99 gabriel 20,256 42,460 22,700 1.12 cs o 8,424 31,172 10,596 1.26 cs r 9,532 31,896 11,420 1.20 peep 22,700 354,612 78,572 3.46 pg deep 18,564 339,744 32,384 1.74 disj deep 23,852

  • 45,920

1.93 kalah deep 29,116

  • 132,232

4.54 gabriel deep 30,884

  • 69,444

2.25 cs o deep 8,356 63,420 32,988 3.95 cs r deep 21,424 12,961,540 78,772 3.68 peep deep 28,396

  • 106,228

3.74

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 10 / 15

slide-35
SLIDE 35

Performance

Time Performance of All-Answer Queries

Program Local Batched Swapping

Swapping Local

tcl 37.35 35.36 35.49 0.95 tcr 55.91 56.49 57.55 1.03 tcn 67.25 68.04 68.59 1.02 sg 263.27 272.57 293.37 1.11 atr2 872.64 876.29 884.65 1.01 pg 9.02 8.93 9.06 1.00 disj 10.66 10.46 10.88 1.02 kalah 12.05 11.91 12.31 1.02 gabriel 13.48 13.19 13.52 1.00 cs o 18.54 18.49 18.82 1.02 cs r 36.43 36.54 36.57 1.00 peep 38.34 38.07 38.60 1.01 pg deep 10.13 10.07 9.88 0.98 disj deep 165.58

  • 171.07

1.03 kalah deep 17,375.49

  • 17,147.00

0.99 gabriel deep 2,749.17

  • 2,808.98

1.02 cs o deep 1.88 1.81 1.94 1.03 cs r deep 70.27 79.51 69.36 0.99 peep deep 273.05

  • 272.07

0.99

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 11 / 15

slide-36
SLIDE 36

Conclusions

Conclusions

For applications not needing all the answers, there are clear advantages in first-answer tabling. However, batched memory behavior is unacceptable. Swapping evaluation has a much better memory behavior and then, tabling could be applied in under-explored applications. Local evaluation has still advantages ⇒ it can be easily simulated under first-answer tabling. Swapping will get more powerful when cut-once operator will be implemented (working on it).

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 12 / 15

slide-37
SLIDE 37

Conclusions

Swapping Evaluation: A Memory-Scalable Solution for Answer-On-Demand Tabling

Pablo Chico de Guzm´ an1 Manuel Carro1 David S. Warren2

1School of Computer Science, Technical University of Madrid, Spain 2State University of New York at Stony Brook, USA

ICLP 2010 — Edinburgh – July 16, 2010

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 13 / 15

slide-38
SLIDE 38

Conclusions

ASCC

?- a(X). :- table a/1, b/1. a(X) :- b(Y), a(X). a(X) :- ... b(1). b(X) :- large, b(X). Ga Gb Stacks Compl (1,1,0) Ca (2,1,0) Cb P

1 2 3 4 5 3 2 1 1 2

A B C

Ga Gb Stacks Compl (1,1,0) (2,2,0) Ga Gb Stacks Compl (1,1,0) Ca (2,1,0)

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 14 / 15

slide-39
SLIDE 39

Conclusions

SCC Memory Behavior

?- a(X). :- table a/1, b/1. a(X) :- b(Y), a(X). a(X) :- ... b(1). b(X) :- large, b(X). Ga Gb Stacks Compl (1,1,0) Ca (2,2,3) Cb P

1 2 3 4 5 3 2 1

Ga Gb Stacks Compl (1,1,0) Ca

A B C

3 2 1

Ga Gb Stacks Compl (1,1,0) Ca (2,2,3)

Pablo Chico de Guzm´ an et al (UPM) Swapping Evaluation. . . ICLP 2010, Edinburgh 15 / 15