Presentation is loading. Please wait.

Presentation is loading. Please wait.

CGRASS A System for Transforming Constraint Satisfaction Problems Alan Frisch, Ian Miguel (York) Toby Walsh (Cork)

Similar presentations


Presentation on theme: "CGRASS A System for Transforming Constraint Satisfaction Problems Alan Frisch, Ian Miguel (York) Toby Walsh (Cork)"— Presentation transcript:

1 CGRASS A System for Transforming Constraint Satisfaction Problems Alan Frisch, Ian Miguel (York) Toby Walsh (Cork)

2 Motivation Modelling experts carefully transform problems to reduce greatly the effort required to solve them. The challenge: Automate these transformations. Identify useful transformations.

3 Types of Transformation 1.Add constraints to eliminate symmetrical solutions. Given: Add: 2.Add implied constraints. Given: and Infer:

4 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

5 Overview of Rest of Talk Case Study: The Golomb Ruler. Transformation at 3 Levels of Abstraction. Conclusions/Future Work

6 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].

7 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.

8 Approach 1: Instance Level Transformation Minimise: max i (x i ) Constraints of the form: (x i – x j  x k – x l ) Subject to: i  j, k  l, i  k  j  l Domains: [0 – n 2 ] Poor Model: Quaternary Constraints. Symmetry.

9 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.

10 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.

11 The Introduce Method Preconditions 1. Exp has arity greater than 1, occurs more than once in the constraint set. 2. someVariable = Exp not already present. Post-conditions 1.Generate new var, x, domain defined by Exp. 2.Add constraint: x = Exp.

12 An Instance of Eliminate Preconditions: 1. Lhs = CommonExp s.t. CommonExp also present in another constraint c. 2. c new obtained by replacing all occurrences of CommonExp by Lhs in c. 3.Size of c new less than that of c. 4. c new not obviously redundant. Post-conditions 1.Add c new, remove c.

13 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).

14 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. x 1 – x 2  x 1 – x 3

15 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 x 1, x 2 throughout, re-normalised constraint set returns to original state. Symmetry-testing on the 3-tick instance: x 1, x 2, x 3 are symmetrical. Hence we add: x 1  x 2, x 2  x 3

16 Variable Introduction/Elimination After symmetry breaking, strengthening inequalities. x 1 < x 2 x 2 < x 3 x1  x3x1  x3 x 1 - x 2  x 2 – x 1 x 1 - x 2  x 2 – x 3 x 1 - x 2  x 3 – x 1 x 1 - x 3  x 2 – x 1 x 1 - x 3  x 3 – x 1 x 1 - x 3  x 3 – x 2 x 2 - x 1  x 3 – x 2 x 2 - x 3  x 3 – x 1 x 2 - x 3  x 3 – x 2 Still 9 quaternary constraints. Reduce arity by introducing new variables: E.g. z 0 = x 1 – x 2 Eliminate substitutes new variables into quaternary constraints, reducing arity.

17 Final Problem State Combination of Introduce and Eliminate GenAllDiff greedily checks for cliques of inequations. x 1 < x 2 x 2 < x 3 x1  x3x1  x3 z 0 = x 2 – x 1 z 1 = x 3 – x 2 z 2 = x 3 – x 1 All-different(z 0, z 1, z 2 )

18 Results Model3-tick4-tick5-tick6-tick BasicFails111413651131438 Nodes131443655131444 Time0.06s 0.5s28.8s TransformedFails351764 Nodes582170 Solve0.05s 0.06s CGRASS 0.4s5.1s74s782s

19 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.

20 Approach 2: Transformation of Quantified Constraint Expressions Minimise: max i (x i ) 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.

21 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: n 2 ). distance({x, y}) = |x – y| {distance({x, y})  distance({x’, y’}) | {x, y}  T, {x’,y’}  T, {x, y}  {x’,y’}}

22 Initial Transformations Given recurrence of distance, natural to introduce distance variables. {d xy = distance({x, y}) | {x, y}  T} Substituting: {d xy  d x’y’ | {x, y}  T, {x’, y’}  T, {x, y}  {x’, y’}} This defines a clique. Lifted GenAllDiff : All-diff({d xy | {x, y}  T})

23 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, {s 1, …, s 2 }. Domain of each s i is A. Assignments to elements of S form a set totally ordered by , i.e. s 1 < s 2 < … < s n

24 Application of refine(subset) Assign S = {s 1, s 2, …, s n } Each s i has domain {0, …, m} s 1 < s 2 < … < s n {d ij = distance({s i, s j }) | {s i, s j }  S} All-diff({d ij | {s i, s j }  S}) Starting to look more like a CSP

25 Final Transformations Domain of each s i bounded above by m, which is to be minimised. Refine {s i, s j } from a set to an ordered pair. Assign S = {s 1, s 2, …, s n } Each s i has domain {0, …, m} s 1 < s 2 < … < s n Minimise(s n ) {d ij = s j – s i |  S x S, i < j} All-diff({d xy |  S x S, i < j})

26 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 Refine 1 2 3 4+


Download ppt "CGRASS A System for Transforming Constraint Satisfaction Problems Alan Frisch, Ian Miguel (York) Toby Walsh (Cork)"

Similar presentations


Ads by Google