1 / 45

Non-binary constraints: modelling

Non-binary constraints: modelling. Toby Walsh Cork Constraint Computation Center. Modelling case studies. Golomb rulers Graceful graphs [Smith & Walsh AAAI2000] Permutation problems Channelling constraints [Walsh LPAR 2001]. Golomb rulers. Mark ticks on a ruler

emond
Download Presentation

Non-binary constraints: modelling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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, … • http://www.csplib.org/prob/prob006

  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

  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 • Exp occurs more than once in the constraint set. • someVariable = Exp not already present. Post-conditions • Generate new var, x, domain defined by Exp. • 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 A1 A2

  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 A1 A2 iff A1 A2 & not A2 A1 • equivalence A1 =A2 iff A1 A2 & A2 A1 • incomparable A1 @ A2 iff neither A1 A2 nor A2A1

  28. Further properties • Monotonicity • AC1u2AC1AC1n2 adding constraints can only tighten a model • Fixed point • AC1AC2impliesAC1u2 = AC1 combining a looser model with a tighter model doesn’t help!

  29. Extensions • Ordering extends to search algorithms • E.g. MAC1 MAC2 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. GAC1 AC2

  30. Permutation models • primal  model • xi xj 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 xi  xj x1 x2 x6 x3 x4 x5

  32. Primal all-different model • n primal variables • each with n values • one non-binary constraint all-different(x1,x2,..) x1 x2 x6 x3 x5 x4

  33. Primal/dual model x1 d1 • 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 xi=j iff dj=i • no other constraints needed! x2 d2 x3 d3 x4 d4 x5 d5

  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, Xij true iff xi=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  ACc  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 MACc on Langford’s problem • I studied 3 other permutation problems • all interval series • circular Golomb rulers • quasigroups (Latin squares) All 4 problems in www.csplib.org

  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

More Related