Presentation is loading. Please wait.

Presentation is loading. Please wait.

Non-binary constraints: modelling Toby Walsh Cork Constraint Computation Center.

Similar presentations


Presentation on theme: "Non-binary constraints: modelling Toby Walsh Cork Constraint Computation Center."— Presentation transcript:

1 Non-binary constraints: modelling Toby Walsh Cork Constraint Computation Center

2 Modelling case studies Golomb rulers  Graceful graphs  [Smith & Walsh AAAI2000] Permutation problems  Channelling constraints  [Walsh LPAR 2001]

3 Golomb rulers Mark ticks on a ruler  Distance between any two ticks (not just neighbouring ticks) is distinct Applications in radio-astronomy, cystallography, … 

4 Golomb rulers Simple solution  Exponentially long ruler  Ticks at 0,1,3,7,15,31,63,… Goal is to find minimal length rulers  turn optimization problem into sequence of satisfaction problems Is there a ruler of length m? Is there a ruler of length m-1? ….

5 Optimal Golomb rulers Known for up to 23 ticks Distributed internet project to find large rulers 0,1 0,1,3 0,1,4,6 0,1,4,9,11 0,1,4,10,12,17 0,1,4,10,18,23,25 Solutions grow as approximately O(n^2)

6 Modelling the Golomb ruler Variable, Xi for each tick Value is position on ruler Naïve model with quaternary constraints  For all i>j,k>l>j |Xi-Xj| \= |Xk-Xl|

7 Problems with naïve model Large number of quaternary constraints  O(n^4) constraints Looseness of quaternary constraints  Many values satisfy |Xi-Xj| \= |Xk-Xl|  Limited pruning

8 A better non-binary model Introduce auxiliary variables for inter-tick distances  Dij = |Xi-Xj|  O(n^2) ternary constraints Post single large non-binary constraint  alldifferent([D11,D12,…]).  Tighter constraints and denser constraint graph

9 Other modeling issues Symmetry  A ruler can always be reversed!  Break this symmetry by adding constraint: D12 < Dn-1,n  Also break symmetry on Xi X1 < X2 < … Xn  Such tricks important in many problems

10 Other modelling issues Additional (implied) constraints  Don’t change set of solutions  But may reduce search significantly E.g. D12 < D13, D23 < D24, … E.g. D1k at least sum of first k integers Pure declarative specifications are not enough!

11 Solving issues Labeling strategies often very important  Smallest domain often good idea  Focuses on “hardest” part of problem Best strategy for Golomb ruler is instantiate variables in strict order  Heuristics like fail-first (smallest domain) not effective on this problem!

12 Experimental results Runtime/secNaïve modelAlldifferent model 8-Find Prove Find Prove Find Prove> 10^568.3

13 Model (re)formulation Can we automate the process of refining and improving a model?  Identify and breaking symmetries  Inferring implied constraints  … CGRASS proof planner hopes to do this!

14 The `Introduce` Method Preconditions 1.Exp 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. Motivation: solver propagates through newly introduced variable

15 Other automatic methods Symmetry identification and removal  Order ticks Variable elimination  Generalization of Gaussian elimination Automatically turns naïve Golomb model into a reasonable one!

16 Something to try at home? Circular (or modular) Golomb rulers  Inter-tick distance variables more central, removing rotational symmetry? 2-d Golomb rulers All examples of “graceful” graphs

17 Summary Benefits of non-binary constraints  Compact, declarative models  Efficient and effective constraint propagation Supported by many constraint toolkits  alldifferent, atmost, cardinality, … Large space of models  Non-binary constraints only make this worse?  Automatic tools can help with model selection and reformulation

18 Summary (II) Modelling decisions:  Auxiliary variables  Implied constraints  Symmetry breaking constraints More to constraints than just declarative problem specifications!

19 Case study II: permutation problems Wide variety of scheduling, assignment and routing problems involve finding a permutation  Plus satisfying some additional constraints Illustrates some of the fundamental decisions that must be made when modelling!

20 Modelling choices Need to decide variables, domains and constraints Often difficult choice for something even as basic as the decision variables? E.g. consider scheduling the World Cup. Are vars=games, vals=times or vars=times, vals=games ?

21 Permutation problems |vars|=|vals|  each var has unique val many examples  scheduling  timetabling  routing  assignment problems permute vars for vals  which do we choose? TSP problem = find permutation of cities which makes a tour of minimum length

22 Meta-motivation Methodology for comparing models  based on definition of constraint tightness Other applications  comparing implied constraints  impact of reformulation

23 Comparing models Choice of model affects amount of constraint propagation  tighter model  more pruning and propagation Need dynamic tightness measure  domains shrink as we descend down search tree  other constraints may prune domains

24 Constraint tightness Pruning depends on local consistency enforced  higher consistencies will infer implied constraints missing from looser models Introduce tightness measure:  parameterized by level of consistency enforced  considers domains changing in size

25 Definition of tightness model 1 is as tight as model 2 wrt A-consistency iff given any domains model 1 is A-consistent -> model 2 is A-consistent written A 1  A 2

26 How does this compare to the previous definition? Tightness measure introduced by Debruyne & Bessiere [IJCAI- 97] A-consistency is tighter than B-consistency iff given any model the model is A-consistent -> the model is B-consistent We fix models but vary domains

27 Properties of new ordering Partial ordering  reflexive A1  A1  transitive A1  A2 & A2  A3 implies A1  A3 Defined relations  tighter A 1  A 2 iff A 1  A 2 & not A 2  A 1  equivalence A 1 = A 2 iff A 1  A 2 & A 2  A 1  incomparable A A 2 iff neither A 1  A 2 nor A 2  A 1

28 Further properties Monotonicity  AC 1u2  AC 1  AC 1n2 adding constraints can only tighten a model Fixed point  AC 1  AC 2 implies AC 1u2 = AC 1 combining a looser model with a tighter model doesn’t help!

29 Extensions Ordering extends to search algorithms  E.g. MAC 1  MAC 2 iff, given any domains, MAC on model 1 visits no more nodes than MAC on model 2  assume equivalent var and val ordering Similar monotonicity and fixed point properties Ordering extends to different consistencies applied to the different models  E.g. GAC 1  AC 2

30 Permutation models primal  model  x i  x j for all i,j primal alldiff model  alldifferent(x1,x2,…) primal/dual models  (dual) variables associated with each (primal) value “Modelling a Permutation Problem”, Barbara M Smith, ECAI'2000 Workshop on Modelling and Solving Problems with Constraints

31 Primal  model n primal variables  each with n values O(n^2) binary constraints x i  x j x5x5 x6x6 x1x1 x2x2 x3x3 x4x4

32 Primal all-different model n primal variables  each with n values one non-binary constraint all-different( x 1, x 2,..) x6x6 x5x5 x4x4 x3x3 x2x2 x1x1

33 Primal/dual model n primal variables  each with n values n dual variables  one for each primal value  each dual value associated with a primal variable n^2 channelling constraints x i= j iff d j =i no other constraints needed! x5x5 x1x1 x2x2 x3x3 x4x4 d5d5 d1d1 d2d2 d3d3 d4d4

34 Other reason to channel Channelling between models frequent modelling technique Some constraints easier to specify in one model Others easier to specify in a (dual) model Channelling maintains consistency between the 2 models

35 Multiple permutation problems Some problems consist of several permutations  order n quasigroup (or Latin square) has 2n intersecting permuations each of size n Following results extend to such cases

36 Some notation  BC bounds consistency  AC arc consistency  RPC restricted path consistency  PIC path inverse consistency  SAC singleton arc consistency  ACPC strong path consistency  GAC generalized arc consistency increasing pruning

37 Some notation   primal not equals   primal alldiff  c channelling constraints  c  channelling constraints & primal not equals  c  channelling constraints & primal alldiff   c  channelling constraints & primal/dual not equals...

38 Theoretical results

39 SAT models n Boolean vars, X ij true iff x i =j primal SAT model  O(n) clauses, each var takes at least one val  O(n^3) clauses, no primal var takes two vals  O(n^3) clauses, no two primal vars take same val channelling SAT model  no need for (dual) Boolean vars as Xij can be used again [Gomes et al 2001] and [Bejar & Manya 2000] report promising experimental results using SAT models of permutation problems with the Davis Putnam (DP) tree search algorithm

40 Theoretical results MAC tighter than DP, DP as tight as FC

41 Asymptotic results Tightness ordering reflects asymptotic cost  E.g. GAC   AC c  AC  O(n^4) O(n^3) O(n^2)  In each case, using best known algorithm Hence we need to run experiments to know if extra pruning is worth the cost!

42 Experimental results [Smith 2000] reports promising results for MAC c on Langford’s problem I studied 3 other permutation problems  all interval series  circular Golomb rulers  quasigroups (Latin squares) All 4 problems in

43 Experimental results using Sicstus FD constraint library  channelling is a standard non-binary constraint MACc best on “looser” problems  Langford’s problem, all interval series Maintaining GAC  better on “tighter” problems  circular Golomb rulers, mean (but not median) quasigroup performance

44 Extensions injective mappings  more vals than vars, each var takes unique val  can introduce dummy vars to make permutation channelling constraints  useful in many other problems  often (but not always) bijective  propagate pruning rapidly between models

45 Conclusions Many ways to model and solve even something as simple as a permutation problem  Hard even to decide what are the variables! Theory and experiment needed to compare models properly  Dominance/asymptotic results only take us so far Best model may not be a single model!  Channel between two (or more?) models


Download ppt "Non-binary constraints: modelling Toby Walsh Cork Constraint Computation Center."

Similar presentations


Ads by Google