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

Slides:



Advertisements
Similar presentations
Constraints and Search Toby Walsh Cork Constraint Computation Centre (4C) Logic & AR Summer School, 2002.
Advertisements

Non-Binary Constraint Satisfaction Toby Walsh Cork Constraint Computation Center.
Non-binary Constraints Toby Walsh
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Global Constraints Toby Walsh NICTA and University of New South Wales
Constraint Satisfaction Problems
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
Traveling Salesperson Problem
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
Exploiting Symmetry in Planning Maria Fox Durham Planning Group University of Durham, UK.
ICS-271:Notes 5: 1 Lecture 5: Constraint Satisfaction Problems ICS 271 Fall 2008.
Generating Implied Constraints via Proof Planning Alan Frisch, Ian Miguel, Toby Walsh Dept of CS University of York EPSRC funded project GR/N16129.
Constraint Optimization Presentation by Nathan Stender Chapter 13 of Constraint Processing by Rina Dechter 3/25/20131Constraint Optimization.
Optimal Rectangle Packing: A Meta-CSP Approach Chris Reeson Advanced Constraint Processing Fall 2009 By Michael D. Moffitt and Martha E. Pollack, AAAI.
Foundations of Constraint Processing More on Constraint Consistency 1 Foundations of Constraint Processing CSCE421/821, Spring
Non-binary constraints Toby Walsh Dept of CS University of York England.
Best-First Search: Agendas
Transforming and Refining Abstract Constraint Specifications Alan Frisch, Brahim Hnich*, Ian Miguel, Barbara Smith, and Toby Walsh *Cork Constraint Computation.
Constraint Programming: modelling Toby Walsh NICTA and UNSW.
Maths of Constraint Satisfaction, Oxford, March 2006 Constraint Programming Models for Graceful Graphs Barbara Smith.
CGRASS A System for Transforming Constraint Satisfaction Problems Alan Frisch, Ian Miguel AI Group University of York Toby Walsh 4C.
1 Optimisation Although Constraint Logic Programming is somehow focussed in constraint satisfaction (closer to a “logical” view), constraint optimisation.
Computational Methods for Management and Economics Carla Gomes
Constraint Satisfaction Problems
Jean-Charles REGIN Michel RUEHER ILOG Sophia Antipolis Université de Nice – Sophia Antipolis A global constraint combining.
Modeling the Covering Test Problem Brahim Hnich, Steven Prestwich, and Evgeny Selensky Cork Constraint Computation Center UCC Supported by SFI.
CGRASS A System for Transforming Constraint Satisfaction Problems Alan Frisch, Ian Miguel (York) Toby Walsh (Cork)
26 April 2013Lecture 5: Constraint Propagation and Consistency Enforcement1 Constraint Propagation and Consistency Enforcement Jorge Cruz DI/FCT/UNL April.
Chapter 5 Outline Formal definition of CSP CSP Examples
CGRASS A System for Transforming Constraint Satisfaction Problems Alan Frisch, Ian Miguel AI Group University of York Toby Walsh 4C.
ECE669 L10: Graph Applications March 2, 2004 ECE 669 Parallel Computer Architecture Lecture 10 Graph Applications.
Ryan Kinworthy 2/26/20031 Chapter 7- Local Search part 2 Ryan Kinworthy CSCE Advanced Constraint Processing.
1.1 Chapter 1: Introduction What is the course all about? Problems, instances and algorithms Running time v.s. computational complexity General description.
1 Constraint Programming: An Introduction Adapted by Cristian OLIVA from Peter Stuckey (1998) Ho Chi Minh City.
CP Summer School Modelling for Constraint Programming Barbara Smith 1.Definitions, Viewpoints, Constraints 2.Implied Constraints, Optimization,
Symmetry Breaking Ordering Constraints Zeynep Kiziltan Department of Information Science Uppsala University, Sweden A progress.
Constrainedness Including slides from Toby Walsh.
Introduction to Job Shop Scheduling Problem Qianjun Xu Oct. 30, 2001.
Constraint Satisfaction Problems (CSPs) CPSC 322 – CSP 1 Poole & Mackworth textbook: Sections § Lecturer: Alan Mackworth September 28, 2012.
Modelling for Constraint Programming Barbara Smith CP 2010 Doctoral Programme.
On Algorithms for Decomposable Constraints Kostas Stergiou Ian Gent, Patrick Prosser, Toby Walsh A.P.E.S. Research Group.
CP Summer School Modelling for Constraint Programming Barbara Smith 2. Implied Constraints, Optimization, Dominance Rules.
The AllDifferent Constraint: Efficiency Measures Ian P. Gent, Ian Miguel, Peter Nightingale.
CP Summer School Modelling for Constraint Programming Barbara Smith 4. Combining Viewpoints, Modelling Advice.
On the Relation between SAT and BDDs for Equivalence Checking Sherief Reda Rolf Drechsler Alex Orailoglu Computer Science & Engineering Dept. University.
Constraints and Search Toby Walsh Cork Constraint Computation Centre (4C) Logic & AR Summer School, 2002.
Chapter 2) CSP solving-An overview Overview of CSP solving techniques: problem reduction, search and solution synthesis Analyses of the characteristics.
SAT 2009 Ashish Sabharwal Backdoors in the Context of Learning (short paper) Bistra Dilkina, Carla P. Gomes, Ashish Sabharwal Cornell University SAT-09.
CP Summer School Modelling for Constraint Programming Barbara Smith 3. Symmetry, Viewpoints.
Maximum Density Still Life Symmetries and Lazy Clause Generation Geoffrey Chu, Maria Garcia de la Banda, Chris Mears, Peter J. Stuckey.
Arc Consistency CPSC 322 – CSP 3 Textbook § 4.5 February 2, 2011.
Donghyun (David) Kim Department of Mathematics and Computer Science North Carolina Central University 1 Chapter 7 Time Complexity Some slides are in courtesy.
Heuristics for Efficient SAT Solving As implemented in GRASP, Chaff and GSAT.
Eliminating non- binary constraints Toby Walsh Cork Constraint Computation Center.
Lecture 6 – Integer Programming Models Topics General model Logic constraint Defining decision variables Continuous vs. integral solution Applications:
Honors Track: Competitive Programming & Problem Solving Seminar Topics Kevin Verbeek.
Hybrid BDD and All-SAT Method for Model Checking
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Inference and search for the propositional satisfiability problem
Consistency Methods for Temporal Reasoning
Constraint Satisfaction
Integer Programming (정수계획법)
Constraints and Search
More on Constraint Consistency
Chapter 11 Limitations of Algorithm Power
Constraints and Search
Integer Programming (정수계획법)
Complexity Theory: Foundations
Consistency algorithms
Presentation transcript:

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  Distance between any two ticks (not just neighbouring ticks) is distinct Applications in radio-astronomy, cystallography, … 

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

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)

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|

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

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

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

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!

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!

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

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!

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

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!

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

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

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

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!

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 ?

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

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

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

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

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

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

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

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!

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

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

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

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

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

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

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

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

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

Theoretical results

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

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

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!

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

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

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

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