CGRASS

Post on 04-Jan-2016

18 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

CGRASS. A System for Transforming Constraint Satisfaction Problems. Alan Frisch, Ian Miguel (York) Toby Walsh (Cork). Motivation. Modelling experts carefully transform problems to reduce greatly the effort required to solve them. The challenge: Automate these transformations. - PowerPoint PPT Presentation

Transcript

CGRASSA System for Transforming

Constraint Satisfaction Problems

Alan Frisch, Ian Miguel (York)

Toby Walsh (Cork)

Motivation

• Modelling experts carefully transform problems to reduce greatly the effort required to solve them.

• The challenge:• Automate these transformations.• Identify useful transformations.

Types of Transformation

1. Add constraints to eliminate symmetrical solutions.

• Given: Add:

2. Add implied constraints.• Given: and • Infer:

1HI

G

EF

D

BC

A

HI

G

EF

D

BC

A

1HI

G

EF

D

BC

AHI

G

EF

D

BC

A

13

BC

A

Types of Transformation (2)

1. Replacing constraints with equivalents.• E.g. Introducing new variables as we will see

later.

2. Removing redundant constraints.• Given: and• is redundant

BA BA

BA

Overview of Rest of Talk

• Case Study: The Golomb Ruler.

• Transformation at 3 Levels of Abstraction.

• Conclusions/Future Work

The Golomb Ruler

• A set of n ticks at integer points on a ruler, length m.• All inter-tick distances must be unique.• Minimise m.

• Practical applications: astronomy, crystallography

• Previously, useful implied constraints found by hand [Smith et al 2000].

The Golomb Ruler –Characteristics of a Good Model

• Break Symmetry:• All n ticks are symmetrical.

• Introduce distance variables:• Allows us to use the all-different constraint.

Approach 1:Instance Level Transformation

• Minimise: maxi(xi)

• Constraints of the form:

(xi – xj xk – xl)

• Subject to:i j, k l, i k j l

• Domains: [0 – n2]

• Poor Model:• Quaternary Constraints.• Symmetry.

CGRASS

• Constraint GeneRation And Symmetry-breaking.• Based on, and extends, Bundy’s proof planning.• Patterns in proofs captured in methods.

• Strong preconditions limit applicability.• Prevent combinatorially explosive search.

• Easily adaptable to problem transformation.• Methods now encapsulate common patterns in hand-

transformation.

Proof Planning - Operation

• Given a goal to prove:– Select a method.– Check pre-conditions.– Execute post-conditions.– Construct output goal(s).

• Associated tactic constructs actual proof.• CGRASS makes transformations rather than

constructing sub-goals to prove.

The Introduce Method

• Preconditions1. Exp has arity greater than 1, occurs more

than once in the constraint set.2. someVariable = Exp not already present.• Post-conditions1.Generate new var, x, domain defined by

Exp.2.Add constraint: x = Exp.

An Instance of Eliminate

• Preconditions:1. Lhs = CommonExp s.t. CommonExp also present

in another constraint c.

2. cnew obtained by replacing all occurrences of CommonExp by Lhs in c.

3. Size of cnew less than that of c.

4. cnew not obviously redundant.• Post-conditions

1. Add cnew, remove c.

Normalisation

• Lexicographic ordering + Simplification.

• Inspired by HartMath: www.hartmath.org.

• Necessary to deal with associative/commutative operators (e.g. +, *).

• Replaces semantic equivalence test with simple syntactic comparison (to an extent).

3-tick Golomb Ruler

• Basic model produces 30 constraints.

• Initial normalisation of the constraint set reduces this to just 12.– Constraints with reflection symmetry across an

inequation identical following normalisation.– Some cancellation also possible E.g.

x1 – x2 x1 – x3

Symmetry-breaking

• Often useful implied constraints can be derived only when some/all symmetry broken.

• Symmetry breaking method as pre-processing.

• Symmetrical variables:• Have identical domains.

• If exchange x1, x2 throughout, re-normalised constraint set returns to original state.

• Symmetry-testing on the 3-tick instance:• x1, x2, x3 are symmetrical.

• Hence we add:• x1 x2, x2 x3

Variable Introduction/Elimination• After symmetry breaking, strengthening inequalities.

x1 < x2 x2 < x3 x1 x3

x1 - x2 x2 – x1 x1- x2 x2 – x3 x1- x2 x3 – x1

x1 - x3 x2 – x1 x1- x3 x3 – x1 x1- x3 x3 – x2

x2 - x1 x3 – x2 x2 - x3 x3 – x1 x2 - x3 x3 – x2

• Still 9 quaternary constraints.

• Reduce arity by introducing new variables:

• E.g. z0 = x1 – x2

•Eliminate substitutes new variables into quaternary constraints, reducing arity.

Final Problem State

• Combination of Introduce and Eliminate• GenAllDiff greedily checks for cliques of

inequations.

x1 < x2 x2 < x3 x1 x3

z0 = x2 – x1 z1 = x3 – x2 z2 = x3 – x1

All-different(z0, z1, z2)

Results

Model 3-tick 4-tick 5-tick 6-tick

Basic Fails 11 141 3651 131438

Nodes 13 144 3655 131444

Time 0.06s 0.06s 0.5s 28.8s

Transformed Fails 3 5 17 64

Nodes 5 8 21 70

Solve 0.05s 0.05s 0.05s 0.06sCGRASS 0.4s 5.1s 74s 782s

Analysis of Results

• Cost of making inferences far outweighs the benefit gained.• An instance of a bad model may have huge

numbers of constraints.• E.g. bad model of 6-tick ruler has 870 quaternary

constraints.

• Conclusion: Inference at instance level alone unlikely to be cost-effective in general.

Approach 2: Transformation of Quantified Constraint Expressions

• Minimise: maxi(xi)

• )}()()(|)(:],1[,,,{ ljkilkjixxxxnlkji lkji

• This model still in terms of CSP variables.

• Input small, represents whole class.

• Fairly straightforward to justify distance vars.

• Symmetry of ticks is difficult

• Swapping ticks, re-normalising doesn’t work.

Approach 3: High Level Transformation of the Golomb Ruler• Put n ticks on a ruler of size m such that all

inter-tick distances are unique. Minimise m.

• Find T {0, …, m}, |T|=n.

• Minimise m, (upper bound: n2).

• distance({x, y}) = |x – y|

• {distance({x, y}) distance({x’, y’}) | {x, y} T, {x’,y’} T, {x, y} {x’,y’}}

Initial Transformations

• Given recurrence of distance, natural to introduce distance variables.• {dxy = distance({x, y}) | {x, y} T}

• Substituting:• {dxy dx’y’ | {x, y} T, {x’, y’} T, {x, y} {x’, y’}}

• This defines a clique. Lifted GenAllDiff:• All-diff({dxy | {x, y} T})

Refinement

• We use refinement methods to move to lower levels of abstraction:

• E.g. To pick subset, size n, from set A, size m, totally ordered by :• Introduce set S of n variables, {s1, …, s2}.

• Domain of each si is A.

• Assignments to elements of S form a set totally ordered by , i.e. s1 < s2 < … < sn

Application of refine(subset)

• Assign S = {s1, s2, …, sn}

• Each si has domain {0, …, m}

• s1 < s2 < … < sn

• {dij = distance({si, sj}) | {si, sj} S}

• All-diff({dij | {si, sj} S})

• Starting to look more like a CSP

Final Transformations

• Domain of each si bounded above by m, which is to be minimised.

• Refine {si, sj} from a set to an ordered pair.

• Assign S = {s1, s2, …, sn}

• Each si has domain {0, …, m}

• s1 < s2 < … < sn

• Minimise(sn)

• {dij = sj – si | <si, sj> S x S, i < j}

• All-diff({dxy | <x, y> S x S, i < j})

Conclusions/Future Work• CGRASS: Automatic transformation of instances.

• Based on proof planning.

• Transformation at instance level alone not practical.• Transformation at the `right’ level is much easier.

Individual Instances

Quantified Constraints

Sets/Mappings

Higher Levels…

Abstract

Abstract

Abstract

Refine

Refine

Refine

1

2

3

4+