Non-binary Constraints Toby Walsh

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems
Advertisements

February 21, 2002 Simplex Method Continued
Thursday, March 7 Duality 2 – The dual problem, in general – illustrating duality with 2-person 0-sum game theory Handouts: Lecture Notes.
DCS Lecture how to solve it Patrick Prosser. Put a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive numbers.
Constraints and Search Toby Walsh Cork Constraint Computation Centre (4C) Logic & AR Summer School, 2002.
Fast optimal instruction scheduling for single-issue processors with arbitrary latencies Peter van Beek, University of Waterloo Kent Wilken, University.
Non-Binary Constraint Satisfaction Toby Walsh Cork Constraint Computation Center.
Constraint Programming Peter van Beek University of Waterloo.
1-1 Constraint-based Scheduling Claude Le Pape. 1-2 Outline Introduction Scheduling constraints Non-preemptive scheduling –Temporal constraints –Resource.
Gate Sizing for Cell Library Based Designs Shiyan Hu*, Mahesh Ketkar**, Jiang Hu* *Dept of ECE, Texas A&M University **Intel Corporation.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Constraint Satisfaction Problems Russell and Norvig: Chapter
University of Toronto Mechanical & Industrial Engineering An Introduction to Constraint Programming J. Christopher Beck Dept. of Mechanical & Industrial.
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Modelling & Solving with Constraints Prof. Toby Walsh University College Cork/Uppsala University.
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Global Constraints Toby Walsh NICTA and University of New South Wales
Checking  -Calculus Structural Congruence is Graph Isomorphism Complete Victor Khomenko 1 and Roland Meyer 2 1 School of Computing Science, Newcastle.
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Constraint Programming Toby Walsh UNSW and NICTA.
Local Search Jim Little UBC CS 322 – CSP October 3, 2014 Textbook §4.8
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Distributed Constraint Satisfaction Problems M OHSEN A FSHARCHI.
13-Optimization Assoc.Prof.Dr. Ahmet Zafer Şenalp Mechanical Engineering Department Gebze Technical.
Constraint Satisfaction taking advantage of internal structure of states when paths don’t matter.
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
ICS-271:Notes 5: 1 Lecture 5: Constraint Satisfaction Problems ICS 271 Fall 2008.
Artificial Intelligence Constraint satisfaction problems Fall 2008 professor: Luigi Ceccaroni.
Non-binary constraints: modelling Toby Walsh Cork Constraint Computation Center.
Non-binary constraints Toby Walsh Dept of CS University of York England.
Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala.
Constraint Programming: modelling Toby Walsh NICTA and UNSW.
CGRASS A System for Transforming Constraint Satisfaction Problems Alan Frisch, Ian Miguel AI Group University of York Toby Walsh 4C.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
Constraint Satisfaction Problems
Jean-Charles REGIN Michel RUEHER ILOG Sophia Antipolis Université de Nice – Sophia Antipolis A global constraint combining.
© J. Christopher Beck Lecture 11: Constraint Programming 1.
26 April 2013Lecture 5: Constraint Propagation and Consistency Enforcement1 Constraint Propagation and Consistency Enforcement Jorge Cruz DI/FCT/UNL April.
Global Constraints for Lexicographic Orderings Alan Frisch, Ian Miguel (University of York) Brahim Hnich, Toby Walsh (4C) Zeynep Kiziltan (Uppsala University)
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.
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.
Jinsong Guo Jilin University, China Background  Filtering techniques are used to remove some local inconsistencies in the search algorithms solving.
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.
Constraints and Search Toby Walsh Cork Constraint Computation Centre (4C) Logic & AR Summer School, 2002.
Review Test1. Robotics & Future Technology Future of Intelligent Systems / Ray Kurzweil futurist Ray Kurzweil / A Long Bet A Long Bet / Robot Soccer.
Chapter 2) CSP solving-An overview Overview of CSP solving techniques: problem reduction, search and solution synthesis Analyses of the characteristics.
Maximum Density Still Life Symmetries and Lazy Clause Generation Geoffrey Chu, Maria Garcia de la Banda, Chris Mears, Peter J. Stuckey.
Arc consistency AC5, AC2001, MAC. AC5 A generic arc-consistency algorithm and its specializations AIJ 57 (2-3) October 1992 P. Van Hentenryck, Y. Deville,
Eliminating non- binary constraints Toby Walsh Cork Constraint Computation Center.
Chapter 5 Team Teaching AI (created by Dewi Liliana) PTIIK Constraint Satisfaction Problems.
Constraint Programming
St. Edward’s University
Computer Science cpsc322, Lecture 13
Constraint Satisfaction
Constraint Satisfaction
Constraints and Search
Constraints and Search
NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979.
Constraint Satisfaction Problems
Consistency algorithms
Presentation transcript:

Non-binary Constraints Toby Walsh

Outline Definition of non-binary constraints Modeling with non-binary constraints Constraint propagation with non-binary constraints Practical benefits: case study – Golomb rulers

Definitions Binary constraint – Relation on 2 variables identifying those pairs of values disallowed (nogoods) – E.g. not-equals constraint: X1 \= X2. Non-binary constraint – Relation on 3 or more variables identifying tuples of values disallowed – E.g. alldifferent(X1,X2,X3).

Some non-binary examples Timetabling – Variables: Lecture1. Lecture2, … – Values: time1, time2, … – Constraint that lectures do not conflict: alldifferent(Lecture1,Lecture2,…).

Some non-binary examples Scheduling – Variables: Job1. Job2, … – Values: machine1, machine2, … – Constraint on number of jobs on each machine: atmost(2,[Job1,Job2,…],machine1), atmost(1,[Job1,Job2,…],machine2).

Why use non-binary constraints? Binary constraints are NP-complete – Any non-binary constraint can be represented using binary constraints – E.g. alldifferent(X1,X2,X3) is equivalent to X1 \= X2, X1 \= X3, X2 \= X3 In theory therefore theyre not needed – But in practice, they are!

Modeling with non-binary constraints Benefits include: – Compact, declarative specifications (discussed next) – Efficient constraint propagation (discussed after next section)

Modeling with non-binary constraints Consider writing your own alldifferent constraint: alldifferent([]). alldifferent([Head|Tail]):- onedifferent(Head,Tail), alldifferent(Tail). onedifferent(El,[]). onedifferent(El,[Head|Tail]):- El \= Head, onedifferent(El,Tail).

Modeling with non-binary constraints Its possible but its not very pleasant! Nor is it very compact – alldifferent([X1,…Xn]) expands into n(n-1)/2 binary not-equals constraints, Xi \= Xj – one non-binary constraint or O(n^2) binary constraints?

Theoretical comparison Constraint algorithms: – Tree search (labeling) – Constraint propagation at each node Binary constraint propagation – Arc-consistency Non-binary constraint propagation – Generalized arc-consistency

Binary constraint propagation Arc-consistency (AC) is very popular – A binary constraint r(X1,X2) is AC iff for every value for X1, there is a consistent value (often called support) for X2 and vice versa – We can prune values that are not supported – A problem is AC iff every constraint is AC AC offers good tradeoff between amount of pruning and computational effort

Binary constraint propagation X2 \= X3 is AC X1 \= X2 is not AC – X2=1 has no support so can this value can be pruned X2 \= X3 is now not AC – No support for X3=2 – This value can also be pruned Problem is now AC {1} {1,2}{2,3} \= X1 X3X2

Non-binary constraint propagation generalized arc-consistency (GAC) for non- binary constraints – A non-binary constraint is GAC iff for every value for a variable there are consistent values for all other variables in the constraint – We can prune values that are not supported GAC = AC on binary constraints

GAC is stronger than AC Pigeonhole problem – 3 pigeons in 2 holes Non-binary model – alldifferent(X1,X2,X3) is not GAC Binary model – X1 \= X2, X1 \= X3, X2 \= X3 are all AC {2,3} X1 X3X2 \=

Using GAC within search Tree search – Instantiate chosen variable with value (label) – Maintain (incrementally enfoce) some level of consistency Maintaining GAC can be exponentially better than maintaining AC – Construct generalized pigeonhole example on which well explore exponentially fewer nodes

Achieving GAC By exploiting semantics of constraints, we can often enforce GAC efficiently – Consider alldifferent([X1,…Xn]) with each Xi having domain of size m – Generic GAC algorithm runs in O(m^n) – Specialized GAC algorithm for alldifferent runs in O(m^2 n^2) based on network flow

Practical benefits How do these (theoretical) differences affect you practically? Case study – Golomb rulers

Golomb rulers Mark ticks on a ruler – Distance between any two (not necessarily consecutive) ticks is distinct Applications in radio-astronomy –

Golomb rulers Simple solution – Exponentially long ruler – Ticks at 0,1,3,7,15,31,63,… Goal is to find miminal 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

Modeling 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 |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,…]). – Relatively tight!

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 modeling issues Additional (implied) constraints – Dont change set of solutions – But may reduce search significantly E.g. D12 < D13, D23 < D24, … 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

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

Something to try at home? Circular (or modular) Golomb rulers 2-d Golomb rulers

Conclusions Benefits of non-binary constraints – Compact, declarative models – Efficient and effective constraint propagation Supported by many constraint toolkits – alldifferent, atmost, cardinality, …

Conclusions Modeling decisions: – Auxiliary variables – Implied constraints – Symmetry breaking constraints More to constraints than just declarative problem specifications!