130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It...

62
Christian Schulte KTH Royal Institute of Technology Sweden [email protected] Peter J. Stuckey NICTA, Victoria Lab, U Melbourne Australia [email protected]

Transcript of 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It...

Page 1: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Christian Schulte

KTH – Royal Institute of Technology

Sweden

[email protected]

Peter J. Stuckey

NICTA, Victoria Lab, U Melbourne

Australia

[email protected]

Page 2: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Variable Domain

Maps variables to sets of possible values

5/31/2011 PPDP 2008, Christian Schulte 2

x{3,4,5} y{3,4,5}

Finite domains (integers)

Page 3: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Propagators Implement constraints (relations)

alldifferent(x1, …, xn)

x + 2y = z

x y = z

5/31/2011 PPDP 2008, Christian Schulte 3

Page 4: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Constraint Propagation

Computes stronger domains propagators remove impossible values

licensed by constraint propagator implements

5/31/2011 PPDP 2008, Christian Schulte 4

x{3,4,5} y{3,4,5}

x y y>3

Page 5: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Constraint Propagation

Computes stronger domains propagators remove impossible values

5/31/2011 PPDP 2008, Christian Schulte 5

x{3,4,5} y{4,5}

x y y>3

Page 6: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Constraint Propagation

Computes stronger domains propagators remove impossible values

5/31/2011 PPDP 2008, Christian Schulte 6

x{4,5} y{4,5}

x y y>3

Page 7: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Propagators

Compute stronger domains remove impossible values

Deleted when redundant

5/31/2011 PPDP 2008, Christian Schulte 7

x{4,5} y{4,5}

x y

Page 8: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

The Beauty… Simple model: propagators

are independent

communicate via variables as monotonic channels

Advantages compositional setup

propagators can incorporate variety of inference techniques

5/31/2011 PPDP 2008, Christian Schulte 8

Page 9: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

The Curse… Simple model: propagators

are independent

communicate via variables as monotonic channels

Disadvantages how to reason about and take advantage from global

properties

5/31/2011 PPDP 2008, Christian Schulte 9

Page 10: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Delete Them… So far (local beauty):

delete propagator when itself decides to be redundant…

Our goal here (global curse):

propagators can be redundant even though they cannot decide themselves…

find out and delete them…

5/31/2011 PPDP 2008, Christian Schulte 10

Page 11: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Placing Rectangles

Two rectangles of dimensions w1 h1 and w2 h2 and left corners (x1,y1) and (x2,y2) do not overlap, iff

left right

below above

5/31/2011 PPDP 2008, Christian Schulte 11

(x1,y1)

(x2,y2)

h1h2

w1 w2

Page 12: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Placing Rectangles

Two rectangles of dimensions w1 h1 and w2 h2 and left corners (x1,y1) and (x2,y2) do not overlap, iff

x1 + w1 x2 x2 + w2 x1

y1 + h1 h2 y2 + h2 y1

5/31/2011 PPDP 2008, Christian Schulte 12

(x1,y1)

(x2,y2)

h1h2

w1 w2

Page 13: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Placing Rectangles

Model with reification asb1. b2. b3. b4.

b1 x1 + w1 x2 b2 x2 + w2 x1

b3 y1 + h1 h2 b4 y2 + h2 y1

b1 b2 b3 b4

5/31/2011 PPDP 2008, Christian Schulte 13

(x1,y1)

(x2,y2)

h1h2

w1 w2

Page 14: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Placing Rectangles

After some search h1=3, h2=5, y1[0 … 4], y2[8 … 10]. Then b3 y1 + h1 y2 sets b3=1 and disappears

b4 y2 + h2 y1 sets b4=0 and disappears

b1 b2 b3 b4 detects redundancy and disappears

But: b1 x1 + w1 x2 and b2 x2 + w2 x1 continue never change anything yet waste time and memory

5/31/2011 PPDP 2008, Christian Schulte 14

(x1,y1)

(x2,y2)

h1h2

w1 w2

Page 15: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Placing Rectangles

After some search h1=3, h2=5, y1[0 … 4], y2[8 … 10]. Then b3 y1 + h1 h2 sets b3=1 and disappears

b4 y2 + h2 y1 sets b4=0 and disappears

b1 b2 b3 b4 detects redundancy and disappears

But: b1 x1 + w1 x2 and b2 x2 + w2 x1 continue never change anything yet waste time and memory

5/31/2011 PPDP 2008, Christian Schulte 15

(x1,y1)

(x2,y2)

h1h2

w1 w2

typical problem for disjunction and reification

Page 16: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Euclidian Distance

Two points (x1,y1) and (x2,y2) at least distance d apart(x1 - x2)

2 + (y1 - y2)2 d2

As not directly available, decompose into (d constant)dxx. dx. dyy. dy.

dx = x1 – x2 dxx = dx dx dy = y1 – y2 dyy = dy dy

dxx + dyy d2

Assume dxx + dyy d2 becomes redundant…

... the other propagators might stay on!

5/31/2011 PPDP 2008, Christian Schulte 16

(x1,y1)

(x2,y2)d

Page 17: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Euclidian Distance

Two points (x1,y1) and (x2,y2) at least distance d apart(x1 - x2)

2 + (y1 - y2)2 d2

As not directly available, decompose into (d constant)dxx. dx. dyy. dy.

dx = x1 – x2 dxx = dx dx dy = y1 – y2 dyy = dy dy

dxx + dyy d2

Assume dxx + dyy d2 becomes redundant…

... the other propagators might stay on!

5/31/2011 PPDP 2008, Christian Schulte 17

(x1,y1)

(x2,y2)d

typical problem for decomposition

Page 18: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Lexicographic Order

Model as (n i 1)oi = (xi < yi) ((xi = yi) oi-1)

on = 1 o0 = 0

5/31/2011 PPDP 2008, Christian Schulte 18

(x1, …, xn) < (y1, …, yn)

Page 19: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Lexicographic Order

Decompose into individual propagators (n i 1)oi = li ri ri = ei oi-1

li xi < yi ei xi = yi

on = 1 o0 = 0

If l1 becomes true, most propagators might remain up to 4(n – 1) propagators

worst case: search branches in order x1, …, xn or y1, …, yn

5/31/2011 PPDP 2008, Christian Schulte 19

(x1, …, xn) < (y1, …, yn)

Page 20: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Lexicographic Order

Decompose into individual propagators (n i 1)oi = li ri ri = ei oi-1

li xi < yi ei xi = yi

on = 1 o0 = 0

If l1 becomes true, most propagators might remain up to 4(n – 1) propagators

worst case: search branches in order x1, …, xn or y1, …, yn

5/31/2011 PPDP 2008, Christian Schulte 20

(x1, …, xn) < (y1, …, yn)

typical problem for decomposition

Page 21: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Recurring Theme Situation

variable occurs in one propagator only

propagator does not modify other variables

variable and propagator should be eliminated

Eliminating one propagator might make more variables eliminable…

…and hence more propagators … and more variables … … …

5/31/2011 PPDP 2008, Christian Schulte 23

Page 22: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Overview Dynamic, linear time analysis to find variables that can

be eliminated and hence, propagators that can be eliminated

Content constraint propagation [gentle reminder]

variable elimination

dynamic analysis for variable elimination

implementation [paper]

short evaluation [paper]

summary

5/31/2011 PPDP 2008, Christian Schulte 24

Page 23: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

5/31/2011 25PPDP 2008, Christian Schulte

Page 24: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Variables and Domains Domain D complete mapping from variables V to

finite sets of integers

Domain D1 stronger than D2, D1 D2, if

D1 obtained by value removal from D2

D1(x) D2(x) for all xV

5/31/2011 PPDP 2008, Christian Schulte 26

Page 25: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Valuations and Constraints Integer valuation maps variables to integer values

{x1 d1, …, xn dn}

Constraint c over variables vars(c)={x1, …, xn} set of valuations

for all c, vars()={x1, …, xn}

is an element of domain D, D, if

(x)D(x) for all xV

5/31/2011 PPDP 2008, Christian Schulte 28

Page 26: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Propagators Propagator f monotonically decreasing function from

domains to domains decreasing: only value removal (f(D) D)

monotonic: stronger input, stronger output (D1 D2 f(D1) f(D2))

Variables vars(f) of a propagator f output: variables that can change by application of f

input: variables that can modify result of f

Dependent propagators props(x) for variable x all propagators f with xvars(f)

5/31/2011 PPDP 2008, Christian Schulte 29

Page 27: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Propagators Constraints Propagator f correct for constraint c, if

no solution of c is ever removed by f { | D } c = { | f(D) } c

Set of propagators F checking for constraint c, if

solution domains can be identified c iff domain() fixpoint of all f F

Set of propagators F implements constraint c, if

all f F are correct for c and F is checking for c

5/31/2011 PPDP 2008, Christian Schulte 30

Page 28: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Propagators Correct propagators for constraint c x y + 1

f(D)(x) = { dD(x) | d max D(y) + 1 }

f(D)(z) = D(z) z x

var(f)={x,y} (y input, x output)

g(D)(y) = { dD(y) | d min D(x) - 1 }

g(D)(z) = D(z) z y

var(g)={x,y} (x input, y output)

{f,g} implements c

{f,g} checking for c

props(x) {f,g} and props(y) {f,g} and

5/31/2011 PPDP 2008, Christian Schulte 31

Page 29: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Propagation Solving Propagation solver solv(F,D) for propagators F and

domain D computes greatest (weakest) simultaneous fixpoint D' of all fF

for all fF f(D') = D'

if f(D'')=D'' for all fF with D'' D, then D'' D'

Implementation and interleaving with search [paper] repeat application of propagators until simultaneous fixpoint

create new propagators corresponding to choice during search

5/31/2011 PPDP 2008, Christian Schulte 32

Page 30: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

5/31/2011 37PPDP 2008, Christian Schulte

Page 31: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Key Idea Assume

variable y occurs in single propagator f

f never changes any variable but y

then: eliminate f (as it is redundant) and hence y

Road map when are constraints and propagators redundant

correctness of elimination

how to detect redundancy (common cases)

5/31/2011 38PPDP 2008, Christian Schulte

Page 32: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Existential Redundancy Constraint c existentially redundant for y at D, if

D implies y. c for valuations D of variables vars(c) – {y}, exists dD(y)

where {yd}c

Propagator f existentially redundant for y at D, if

any future propagation of f can only change y solv({f}, D') =-{y} D'

where D' D and D'(y)=D(y)

5/31/2011 39PPDP 2008, Christian Schulte

Page 33: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Existential Redundancy If propagator f correct for constraint c and c is

existentially redundant for y at D, then

f existentially redundant for y at D proof: just use definitions

Significance: reason about semantics (constraint c) and not about implementation (propagator f)

5/31/2011 PPDP 2008, Christian Schulte 40

Page 34: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Yes, It Works! (Key Lemma) Let f be existentially redundant for y at D, F be set of

propagators where yvars(g) for all gF

solv(F{f}, D') =-{y} solv(F, D') deleting f and y does not change propagation

Proof: take execution sequence of propagators including f

reorder: move occurrences of f to end

due to existential redundancy: domains the same wrt –{y}

as result is fixpoint for all propagators in F: same result

5/31/2011 PPDP 2008, Christian Schulte 41

Page 35: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Elimination Opportunities Initial model

not likely unless very poor

maybe, if model has been generated automatically

More likely, due to (as in motivating examples) elimination of redundant propagators

removal of independent variables, leading to variables occurring once

We can detect propagator to be existentially redundant…

…but how frequent is it and how costly?

5/31/2011 PPDP 2008, Christian Schulte 42

Page 36: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Binary Domain Propagators For constraint c domain propagator dom(c)

dom(c)(D)(x) = {(x) | D c } xvars(c)

dom(c)(D)(x) = D(x) otherwise keep only values occurring in possible solutions

strongest possible propagator

A domain propagator f with vars(f)={x,y} is existentially redundant for x and y at D with f(D)=D

that is, existentially redundant at fixpoint

no check required

5/31/2011 PPDP 2008, Christian Schulte 43

Page 37: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Boolean Functional Constraints A propagator f for the total functional constraint

y=e(x) with y Boolean and

D(y)={0,1}

is existentially redundant for y at D some expression e over variables x

examples: conjunction, disjunction, reification, etc…

check: y not yet fixed

5/31/2011 PPDP 2008, Christian Schulte 44

Page 38: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Integer Functional Constraints A bounds(Z) or bounds(R) propagator f for the total

functional constraint y=e(x) with

D(y) [infD e(x) … supD e(x)]

is existentially redundant for y at D some expression e over variables x

examples: linear constraints, etc…

check: D(y) [infD e(x) … supD e(x)] (typically available in f)

5/31/2011 PPDP 2008, Christian Schulte 45

Page 39: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

5/31/2011 46PPDP 2008, Christian Schulte

Page 40: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Key Idea Linear time analysis

find variables to eliminate

delete existentially redundant propagators

Traverse variables through propagators from x through fprops(x) to yvars(f)

start from output variables OV and search variables SV

mark whether a variable is interesting: if not, eliminate

delete propagators existentially redundant for non-interesting variable

5/31/2011 PPDP 2008, Christian Schulte 47

Page 41: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Search and Output Variables Output variables: contain solution

Search variables: will be assigned during search search creates propagators on search variables

Of course, we are interested in both!

5/31/2011 PPDP 2008, Christian Schulte 48

Page 42: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Interesting Visits… A variable x can be interesting or not: interesting[x]

= yes cannot not be eliminated

= no can be eliminated

= maybe traversal determines whether x is interesting

encountered again = yes

A variable x is visited at most once: visited[x] if visited again, previously computed value of interesting[x]

All search and output variables are interestingfor (x OVSV)

interesting[x] := yes;

5/31/2011 PPDP 2008, Christian Schulte 49

Page 43: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Traverse: Visit and Interesttraverse(x, g)

if (visited[x])return interesting[x];

visited[x] := true;if (interesting[x] = no)

interesting[x] = maybe;for (f props(x) – {g})

…if (interesting[x] = maybe)

interesting[x] := no;return interesting[x];

5/31/2011 PPDP 2008, Christian Schulte 50

Page 44: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Traverse: Visit and Interesttraverse(x, g)

if (visited[x])return interesting[x];

visited[x] := true;if (interesting[x] = no)

interesting[x] = maybe;for (f props(x) – {g})

…if (interesting[x] = maybe)

interesting[x] := no;return interesting[x];

5/31/2011 PPDP 2008, Christian Schulte 51

avoid self cycles though g

Page 45: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Traverse: Not Redundant…

for (f props(x) – {g})

if (f existentially redundant for y x at D)

else

interesting[x] := yes;

for (z vars(f) – {x})

traverse(z, f);

5/31/2011 PPDP 2008, Christian Schulte 52

Page 46: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Traverse: Not Redundant…

for (f props(x) – {g})

if (f existentially redundant for y x at D)

else

interesting[x] := true;

for (z vars(f) – {x})

traverse(z, f);

5/31/2011 PPDP 2008, Christian Schulte 53

avoid self cycles though f

Page 47: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Traverse: Redundant?…for (f props(x) – {g})

if (f existentially redundant for y x at D)if (traverse(y, f) = no)

delete f;else

interesting[x] := yes;for (z vars(f) – {x,y})

traverse(z, f);else

……

5/31/2011 PPDP 2008, Christian Schulte 54

Page 48: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Traverse: Redundant?…for (f props(x) – {g})

if (f existentially redundant for y x at D)if (traverse(y, f) = no)

delete f;else

interesting[x] := yes;for (z vars(f) – {x,y})

traverse(z, f);else

……

5/31/2011 PPDP 2008, Christian Schulte 55

y could be interesting (yes or maybe)

Page 49: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Analyseanalyse(D, OV, SV)

for (x V)

interesting[x] := no;

visited[x] := false;

for (x OVSV)

interesting[x] := yes;

for (x SV)

traverse(x, );

5/31/2011 PPDP 2008, Christian Schulte 56

Page 50: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Analyseanalyse(D, OV, SV)

for (x V)

interesting[x] := no;

visited[x] := false;

for (x OVSV)

interesting[x] := yes;

for (x SV)

traverse(x, );

5/31/2011 PPDP 2008, Christian Schulte 57

new propagators by search on SV

Page 51: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Yes, It Works! Let F be propagator set, D domain, and SV and OV sets

of variables. Suppose after analyse(D, OV, SV) propagators G remain. Then

solv(F, D') =OV solv(G, D')

for all D' D where D' =-OVSV D

Important: efficient to find some y for which f is existentially redundant

typically, only one y is a candidate

otherwise, only very few [paper]

5/31/2011 PPDP 2008, Christian Schulte 58

Page 52: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Catching Modeling Errors Suppose analysis finds that x is never traversed even

though propagator f with x in vars(f)… f will never be executed

after search terminates: possibly not a solution

Why not check after search terminates whether propagators are left?

search might not terminate (propagation missing)

use analysis to find error as soon as possible

5/31/2011 PPDP 2008, Christian Schulte 59

Page 53: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

5/31/2011 60PPDP 2008, Christian Schulte

Page 54: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Experiments Problems

bibd-v-k-l: balanced incomplete block design

lexicographic order and Boolean sums

circle-n-s: circle packing

decomposition for Euclidian distance

s-p-n-s: simple square packing

reification and Boolean constraints for no-overlap

p-s-p-n-s: square packing with capacity reasoning

many additional small constraints

Setup implemented using Gecode 2.1.1 as starting point

ambitious: Gecode (one of) the most efficient system(s)

5/31/2011 PPDP 2008, Christian Schulte 61

Page 55: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Overhead Accuracy Infeasible to run analysis every computation of solv

can increase runtime by up to 70%

run only every n-th computation

Accuracy: percentage of saved propagator executions 100% every computation of solv (all possible useless

propagator executions avoided)

Run analysis directly before search [paper] beneficial for Gecode

5/31/2011 PPDP 2008, Christian Schulte 62

Page 56: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Average Accuracy

5/31/2011 PPDP 2008, Christian Schulte 63

Page 57: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Best Performance: Gains

5/31/2011 PPDP 2008, Christian Schulte 64

Page 58: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Best Performance: Accuracy

5/31/2011 PPDP 2008, Christian Schulte 65

Page 59: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

How Often To Run The Analysis User can make safe bet by choosing the analysis

frequency between 10 and 15 still substantial improvements possible

feasible compromise between accuracy and overhead

Analysis has naïve implementation uses C++ recursion (mutual, very deep)

More detailed evaluation [paper]

5/31/2011 PPDP 2008, Christian Schulte 66

Page 60: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

5/31/2011 67PPDP 2008, Christian Schulte

Page 61: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Related Work Unique: general and dynamic method for finite domain

propagators

Well known: detection and removal of redundant propagators

Earlier work on variable elimination: CLP over reals Gauss-Jordan elimination[Macdonald et al. 1993]beneficial at compile

time

Fourier elimination [Fordan & Yap 1998] beneficial only in certain circumstances

eliminate variables in linear real constraints

"don't care" propagation in non-clausal SAT solvers exploit "don't care" propagation for disjunctive nodes, avoiding

propagation in some sub-nodes [Thiffault et al. 2004]

also generalization by propagation control [Brand & Yap 2006]

restricted to Boolean variables

5/31/2011 68PPDP 2008, Christian Schulte

Page 62: 130.243.105.49130.243.105.49/.../presentations/SchulteSweConsNet11.pdf · 2011. 6. 9. · Yes, It Works! (Key Lemma) Let . f. be existentially redundant for . y. at . D, F. be set

Conclusion Useful optimization

automatic modeling, modeling errors, optimizing propagation

Simple and efficient linear time analysis, can be beneficial

Future work automatically finding out when to run the analysis

how to integrate into production quality system

5/31/2011 PPDP 2008, Christian Schulte 69