Eliminating non- binary constraints Toby Walsh Cork Constraint Computation Center.

Slides:



Advertisements
Similar presentations
Levels of Consistency Node Consistency (NC) Arc-consistency (AC) Path Consistency (PC) Generalised arc-consistency (GAC) Bounds consistency Inverse Path.
Advertisements

Non-Binary Constraint Satisfaction Toby Walsh Cork Constraint Computation Center.
Non-binary Constraints Toby Walsh
Maximal Independent Sets of a Hypergraph IJCAI01.
Global Constraints Toby Walsh NICTA and University of New South Wales
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
This lecture topic (two lectures) Chapter 6.1 – 6.4, except 6.3.3
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 Dual & Hidden Variable Encodings REFORMULATION.
Wednesday, January 29, 2003CSCE Spring 2003 B.Y. Choueiry Constraint Consistency Chapter 3.
Non-binary constraints: modelling Toby Walsh Cork Constraint Computation Center.
Foundations of Constraint Processing More on Constraint Consistency 1 Foundations of Constraint Processing CSCE421/821, Spring
1 Backdoor Sets in SAT Instances Ryan Williams Carnegie Mellon University Joint work in IJCAI03 with: Carla Gomes and Bart Selman Cornell University.
Review: Constraint Satisfaction Problems How is a CSP defined? How do we solve CSPs?
Non-binary constraints Toby Walsh Dept of CS University of York England.
Constraint Programming: modelling Toby Walsh NICTA and UNSW.
Statistical Regimes Across Constrainedness Regions Carla P. Gomes, Cesar Fernandez Bart Selman, and Christian Bessiere Cornell University Universitat de.
CP Formal Models of Heavy-Tailed Behavior in Combinatorial Search Hubie Chen, Carla P. Gomes, and Bart Selman
Computational Methods for Management and Economics Carla Gomes
Constraint Satisfaction Problems
Foundations of Constraint Processing, Fall 2005 Sep 20, 2005BT: A Theoretical Evaluation1 Foundations of Constraint Processing CSCE421/821, Fall 2005:
Hierarchical Constraint Satisfaction in Spatial Database Dimitris Papadias, Panos Kalnis And Nikos Mamoulis.
A Constraint Satisfaction Problem (CSP) is a combinatorial decision problem defined by a set of variables, a set of domain values for these variables,
1 Consistency algorithms Chapter 3. Spring 2007 ICS 275A - Constraint Networks 2 Consistency methods Approximation of inference: Arc, path and i-consistecy.
1 Backdoors To Typical Case Complexity Ryan Williams Carnegie Mellon University Joint work with: Carla Gomes and Bart Selman Cornell University.
Constraint Systems Laboratory March 26, 2007Reeson–Undergraduate Thesis1 Using Constraint Processing to Model, Solve, and Support Interactive Solving of.
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)
Consistency Methods for Temporal Reasoning Lin XU Constraint Systems Laboratory Advisor: Dr. B.Y. Choueiry April, 2003 Supported by a grant from NASA-Nebraska,
Ryan Kinworthy 2/26/20031 Chapter 7- Local Search part 2 Ryan Kinworthy CSCE Advanced Constraint Processing.
1 ΑΝΑΠΑΡΑΣΤΑΣΗ ΓΝΩΣΗΣ - Lecture 1 Constraint Satisfaction & Constraint Programming Advanced Issues My Thanks to Toby Walsh and Roman Bartak (for “stealing.
Distributions of Randomized Backtrack Search Key Properties: I Erratic behavior of mean II Distributions have “heavy tails”.
CP Summer School Modelling for Constraint Programming Barbara Smith 1.Definitions, Viewpoints, Constraints 2.Implied Constraints, Optimization,
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
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.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Fall 2006 Jim Martin.
CP Summer School Modelling for Constraint Programming Barbara Smith 4. Combining Viewpoints, Modelling Advice.
Variable and Value Ordering for MPE Search Sajjad Siddiqi and Jinbo Huang.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 6 Binary CSP.
Branch-and-Cut Valid inequality: an inequality satisfied by all feasible solutions Cut: a valid inequality that is not part of the current formulation.
Constraints and Search Toby Walsh Cork Constraint Computation Centre (4C) Logic & AR Summer School, 2002.
Quality of LP-based Approximations for Highly Combinatorial Problems Lucian Leahu and Carla Gomes Computer Science Department Cornell University.
Stochastic greedy local search Chapter 7 ICS-275 Spring 2009.
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.
Foundations of Constraint Processing, Fall 2004 October 3, 2004Interchangeability in CSPs1 Foundations of Constraint Processing CSCE421/821, Fall 2004:
Where are the hard problems?. Remember Graph Colouring? Remember 3Col?
Inference and search for the propositional satisfiability problem
Consistency Methods for Temporal Reasoning
Constraint Satisfaction
Empirical Comparison of Preprocessing and Lookahead Techniques for Binary Constraint Satisfaction Problems Zheying Jane Yang & Berthe Y. Choueiry Constraint.
Constraints and Search
More on Constraint Consistency
Intelligent Backtracking Algorithms: A Theoretical Evaluation
More on Constraint Consistency
Constraints and Search
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Constraint satisfaction problems
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Constraint satisfaction problems
Consistency algorithms
Presentation transcript:

Eliminating non- binary constraints Toby Walsh Cork Constraint Computation Center

Eliminating non-binary constraints Two methods Two methods Encodings: Encodings: Replace with binary constraints by introducing new vars Decompositions: Decompositions: (For restricted class of non-binary constraints) Replace with binary constraints on same variables

Meta-motivation Theoretical results informative Comparing non-binary constraint propagation with binary Suggests where non- binary constraints are valuable

Bibliography Lots of valuable results! Lots of valuable results! Bacchus & van Beek, AAAI-98 Chen, PhD thesis, UAlberta, 2000 Dechter, AAAI-90 Mohr & Masini, ECAI-88 Regin, AAAI-94 Stergiou & Walsh, AAAI-99 & IJCAI-99 Gent, Stergiou & Walsh, Artificial Intelligence 2000 Bacchus, Chen, van Beek, Walsh, Artificial Intelligence 2002 ….

Let’s start with the easy case! Decomposable constraints: Non-binary constraints that can be represented by binary constraints with introducing new variables It’s a special case that sometimes occurs about which we can be (theoretically) quite precise

Binary decompositions Certain non-binary constraints decompose into binary constraints on same vars Certain non-binary constraints decompose into binary constraints on same vars Sometimes called “network decomposable” Sometimes called “network decomposable”

Binary decompositions Two examples: Two examples: all-different(x1,x2,x3) is x1\=x2, x1\=x3, x2\=x3 all-different(x1,x2,x3) is x1\=x2, x1\=x3, x2\=x3 monotone(x1,x2,x3) is x1 < x2 < x3 monotone(x1,x2,x3) is x1 < x2 < x3 One non-example: One non-example: even(x1+x2+x3) even(x1+x2+x3) Can you see why not? Can you see why not?

Binary decompositions Theoretical comparison direct Theoretical comparison direct compare pruning of vars in binary decomposition with that in non-binary compare pruning of vars in binary decomposition with that in non-binary Empirical experiments reinforce theory Empirical experiments reinforce theory decomposing non-binary constraints can add orders of magnitude to solution cost decomposing non-binary constraints can add orders of magnitude to solution cost

Binary decompositions Upper and lower bound on FC Upper and lower bound on FC nFC1 on non-binary > FC on decomposition > nFC0 on non-binary Gaps can be exponential Gaps can be exponential Consider n-ary all-different with n-1 values nFC1 takes (n-1) branches FC on decomposition takes (n-1)! branches

Binary decompositions GAC lower bound GAC lower bound GAC on non-binary > AC on decomposition Gap again can be exponential But if we decompose too much, GAC=AC! GAC upper bound GAC upper bound In general, GAC ~ NIC, GAC ~ PIC.. BUT if decomposition to clique, NIC > GAC

Binary decompositions Tighter results provable for stricter classes Tighter results provable for stricter classes Tree decomposable constraints Tree decomposable constraints constraint graph is tree constraint graph is tree Triangle preserving constraints Triangle preserving constraints non-binary constraints on all triangles non-binary constraints on all triangles

Binary decompositions Tree decomposable constraints Tree decomposable constraints e.g. monotone(x1,x2,x3) e.g. monotone(x1,x2,x3) GAC=AC GAC=AC not surprising as AC enough to solve! not surprising as AC enough to solve! Decomposition here doesn’t lose us anything Decomposition here doesn’t lose us anything but even one cycle is enough for GAC>AC but even one cycle is enough for GAC>AC

Binary decompositions Triangle preserving decomposition Triangle preserving decomposition e.g. all-different(x1,x2,x3), quasigroups,... GAC > PIC, gap can again be exponential GAC ~ SAC, strongPC PIC is very strong consistency to be achieving at each node PIC is very strong consistency to be achieving at each node GAC can do even better than this! GAC can do even better than this! decomposition carries a very large price decomposition carries a very large price

Binary decompositions Experimental results Experimental results quasigroup completion quasigroup completion quasigroup existence quasigroup existence Quasigroup is a Latin square Quasigroup is a Latin square completion is completing partially filled square completion is completing partially filled square existence is finding one with additional properties existence is finding one with additional properties

Binary decompositions Modelling the quasigroup problem Modelling the quasigroup problem n^2 vars, each with domain of size n n^2 vars, each with domain of size n Non-binary model Non-binary model 2n all-different constraints (one for each row and column 2n all-different constraints (one for each row and column Binary decomposition Binary decomposition 2n cliques of not-equals constraints 2n cliques of not-equals constraints

Binary decompositions Quasigroup completion Quasigroup completion Gomes & Selman report “heavy-tailed” distributions Gomes & Selman report “heavy-tailed” distributions Maintaining AC on binary decomposition Maintaining AC on binary decomposition problems often take long time to solve problems often take long time to solve Maintaining GAC on all-different Maintaining GAC on all-different almost all problems trivial almost all problems trivial

Binary decompositions Quasigroup existence Quasigroup existence best paper at IJCAI-93 best paper at IJCAI-93 of interest to design theory of interest to design theory Open results first proved by computer Open results first proved by computer in some cases, only ever proved by computer in some cases, only ever proved by computer Maintaining GAC very competitive Maintaining GAC very competitive compared to specialized model finders like FINDER, SEM compared to specialized model finders like FINDER, SEM

Binary encodings Not all non-binary constraint decompose into binary constraints Not all non-binary constraint decompose into binary constraints on the same set of variables on the same set of variables Consider again Consider again even(x1+x2+x3) even(x1+x2+x3) But binary CSPs NP-complete But binary CSPs NP-complete

Binary encodings Every non-binary constraint can be encoded into binary constraints Every non-binary constraint can be encoded into binary constraints using polynomial number of additional (hidden) variables using polynomial number of additional (hidden) variables Two popular encodings Two popular encodings hidden variable encoding hidden variable encoding dual encoding dual encoding

Binary encodings Hidden variable encoding Hidden variable encoding add hidden var for each non-binary constraint add hidden var for each non-binary constraint Dual encoding Dual encoding add hidden var for each non-binary constraint add hidden var for each non-binary constraint throw away original variables throw away original variables

Binary encodings Dual encoding Dual encoding consider c1:even(x1+x2), c2:odd(x2+x3) consider c1:even(x1+x2), c2:odd(x2+x3) {00,11} {01,10} c1 c2 R21 R21= or

Binary encodings Hidden variable encoding Hidden variable encoding consider c1:even(x1+x2), c2:odd(x2+x3) consider c1:even(x1+x2), c2:odd(x2+x3) {0,1} {00,11} {01,10} {0,1} x1x2x3 c1 c2 r1 r2 r1= or r2= or

Binary encodings Hidden var encoding -> dual encoding Hidden var encoding -> dual encoding compose relations, discard original vars compose relations, discard original vars {0,1} {00,11} {01,10} {0,1} x1x3 c1 c2 R21 R21 = r2 + r1

Binary encodings Double encoding Double encoding dual + hidden var encoding dual + hidden var encoding original vars + hidden vars original vars + hidden vars all constraints of dual and of hidden all constraints of dual and of hidden Also called “combined encoding” Also called “combined encoding”

Binary encodings Theoretical analysis complicated by: Theoretical analysis complicated by: encoding “builds” in GAC for hidden vars encoding “builds” in GAC for hidden vars must translate between (original and hidden) vars must translate between (original and hidden) vars pruning in dual can infer large arity nogoods in original pruning in dual can infer large arity nogoods in original

Binary encodings Hidden var encoding Hidden var encoding FC on hidden ~ nFC0 on original each can be exponentially better than the other FC+ propogates through hidden vars FC+ propogates through hidden vars FC+ on hidden = nFC1 on original

Binary encodings Hidden var encoding Hidden var encoding AC on hidden = GAC on original Before looking for efficient (specialized) GAC algorithm Before looking for efficient (specialized) GAC algorithm try AC on hidden var encoding try AC on hidden var encoding

Binary encodings No point doing NIC on hidden var encoding No point doing NIC on hidden var encoding NIC on hidden = AC on hidden due to star shaped topology of constraint graph Higher consistencies remain distinct Higher consistencies remain distinct strongPC on hidden > SAC on hidden > NIC, AC on hidden

Binary encodings Dual encoding Dual encoding FC on dual ~ nFC0 on original each can be exponentially better than the other Dual better for tight constraints Dual better for tight constraints domains for hidden vars then small domains for hidden vars then small

Binary encodings Dual encoding Dual encoding AC on dual > GAC on original BUT domains of hidden vars very large when non-binary constraints loose BUT domains of hidden vars very large when non-binary constraints loose AC on dual prohibitively expensive AC on dual prohibitively expensive

Binary encodings Dual v hidden encoding Dual v hidden encoding BT on dual = FC on hidden AC on dual > AC on hidden SAC on dual > SAC on hidden strongPC on dual = strongPC on hidden Path consistency is enough to get through the hidden star! Path consistency is enough to get through the hidden star!

Binary encodings Experimental results Experimental results crossword puzzles crossword puzzles Golomb rulers Golomb rulers random CSPs random CSPs random 3-SAT random 3-SAT

Binary encodings Crossword puzzles Crossword puzzles “Original” model “Original” model vars for letters, domains {A-Z} vars for letters, domains {A-Z} Dual model Dual model vars for words, domains = dictionary vars for words, domains = dictionary Dual at least 1,000 times faster on larger problems Dual at least 1,000 times faster on larger problems

Binary encodings Golomb ruler Golomb ruler set of ticks, xi on a ruler set of ticks, xi on a ruler all inter-tick distances, dij different all inter-tick distances, dij different Ternary constraints, dij=xi-xj Ternary constraints, dij=xi-xj encoded using hidden var/double encoding encoded using hidden var/double encoding Competitive with non-binary model Competitive with non-binary model runs on any binary CSP solver! runs on any binary CSP solver!

Binary encodings Random CSPs and SAT Random CSPs and SAT Bacchus and van Beek plot contours to show constraint tightness where encoding pays Bacchus and van Beek plot contours to show constraint tightness where encoding pays gives good predictions for performance on structured problems like crosswords, … gives good predictions for performance on structured problems like crosswords, … number of satisfying tuples in constraint is most important factor in such predictions number of satisfying tuples in constraint is most important factor in such predictions

Conclusions Non-binary v binary decompositions Non-binary v binary decompositions GAC on non-binary can be stronger than PIC on decomposition GAC on non-binary can be stronger than PIC on decomposition Non-binary v binary encodings Non-binary v binary encodings GAC on non-binary = AC on hidden GAC on non-binary = AC on hidden AC on dual > GAC on non-binary AC on dual > GAC on non-binary

Conclusions Non-binary v binary decompositions Non-binary v binary decompositions decomposition can add significantly to search cost decomposition can add significantly to search cost Non-binary v binary encodings Non-binary v binary encodings encoding pays in practice on tight constraints encoding pays in practice on tight constraints

Future directions? Mixed models Mixed models e.g. dual encoding for only some of the (non- binary) constraints e.g. dual encoding for only some of the (non- binary) constraints Optimization Optimization objective function typically non-binary objective function typically non-binary