From Constraints to Finite Automata to Filtering Algorithms Mats Carlsson, SICS Nicolas Beldiceanu, EMN

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems
Advertisements

CICLOPS 2001 Finite Domain Constraints in SICStus Prolog Mats Carlsson Swedish Institute of Computer Science
Constraint Satisfaction Problems Russell and Norvig: Chapter
CSCI 115 Chapter 6 Order Relations and Structures.
10 October 2006 Foundations of Logic and Constraint Programming 1 Unification ­An overview Need for Unification Ranked alfabeths and terms. Substitutions.
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.
Artificial Intelligence Constraint satisfaction problems Fall 2008 professor: Luigi Ceccaroni.
Parallel Scheduling of Complex DAGs under Uncertainty Grzegorz Malewicz.
Best-First Search: Agendas
CS21 Decidability and Tractability
Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala.
Formal Software Testing and Model Checking Generating Test Cases For a Timed I/O Automaton Model Leonid Mokrushin.
A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines Andreas Glausch and Wolfgang Reisig 1.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Basic abstract interpretation theory. 2 The general idea §a semantics l any definition style, from a denotational definition to a detailed interpreter.
19 April 2013Lecture 4: Associating Narrowing Functions to Constraints1 Associating Narrowing Functions to Constraints Jorge Cruz DI/FCT/UNL April 2013.
4 Feb 2004CS Constraint Satisfaction1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
CPSC 668Set 16: Distributed Shared Memory1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
Discrete Mathematics Lecture 4 Harper Langston New York University.
Jean-Charles REGIN Michel RUEHER ILOG Sophia Antipolis Université de Nice – Sophia Antipolis A global constraint combining.
Abstract Interpretation Part I Mooly Sagiv Textbook: Chapter 4.
8-1 Problem-Solving Examples (Preemptive Case). 8-2 Outline Preemptive job-shop scheduling problem (P-JSSP) –Problem definition –Basic search procedure.
26 April 2013Lecture 5: Constraint Propagation and Consistency Enforcement1 Constraint Propagation and Consistency Enforcement Jorge Cruz DI/FCT/UNL April.
Programming Language Semantics Denotational Semantics Chapter 5 Part III Based on a lecture by Martin Abadi.
Global Constraints for Lexicographic Orderings Alan Frisch, Ian Miguel (University of York) Brahim Hnich, Toby Walsh (4C) Zeynep Kiziltan (Uppsala University)
Great Theoretical Ideas in Computer Science.
Leonardo de Moura Microsoft Research. Many approaches Graph-based for difference logic: a – b  3 Fourier-Motzkin elimination: Standard Simplex General.
Relations Chapter 9.
Chapter 9 1. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing.
Constraint Satisfaction Problems
1 Constraint Programming: An Introduction Adapted by Cristian OLIVA from Peter Stuckey (1998) Ho Chi Minh City.
Solving fixpoint equations
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.
DECIDABILITY OF PRESBURGER ARITHMETIC USING FINITE AUTOMATA Presented by : Shubha Jain Reference : Paper by Alexandre Boudet and Hubert Comon.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
Algorithms and their Applications CS2004 ( ) Dr Stephen Swift 3.1 Mathematical Foundation.
The Integers. The Division Algorithms A high-school question: Compute 58/17. We can write 58 as 58 = 3 (17) + 7 This forms illustrates the answer: “3.
Chapter 9. Section 9.1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and.
Steffen Staab Advanced Data Modeling 1 of 32 WeST Häufungspunkte Bifurkation: x n+1 = r x n (1-x n ) Startwert x 0 = 0,25.
Chapter 5 Section 1 – 3 1.  Constraint Satisfaction Problems (CSP)  Backtracking search for CSPs  Local search for CSPs 2.
CP Summer School Modelling for Constraint Programming Barbara Smith 2. Implied Constraints, Optimization, Dominance Rules.
Chapter 5: Constraint Satisfaction ICS 171 Fall 2006.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 8 Relations 歐亞書局.
Outline Introduction Minimizing the makespan Minimizing total flowtime
Simultaneously Learning and Filtering Juan F. Mancilla-Caceres CS498EA - Fall 2011 Some slides from Connecting Learning and Logic, Eyal Amir 2006.
A Logic of Partially Satisfied Constraints Nic Wilson Cork Constraint Computation Centre Computer Science, UCC.
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Problem Statement How do we represent relationship between two related elements ?
1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3 Grand Challenge:
CHAPTER 5 SECTION 1 – 3 4 Feb 2004 CS Constraint Satisfaction 1 Constraint Satisfaction Problems.
LDK R Logics for Data and Knowledge Representation ClassL (part 2): Reasoning with a TBox 1.
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,
1. 2 Outline of Ch 4 Best-first search Greedy best-first search A * search Heuristics Functions Local search algorithms Hill-climbing search Simulated.
A Semantic Caching Method Based on Linear Constraints Yoshiharu Ishikawa and Hiroyuki Kitagawa University of Tsukuba
Chapter 5 Team Teaching AI (created by Dewi Liliana) PTIIK Constraint Satisfaction Problems.
1 Chapter 5 Branch-and-bound Framework and Its Applications.
1 Partial Orderings Epp, section Introduction An equivalence relation is a relation that is reflexive, symmetric, and transitive A partial ordering.
Constraint Programming
Equivalence Relations
Jaya Krishna, M.Tech, Assistant Professor
Logics for Data and Knowledge Representation
Constraints and Search
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
CS 8520: Artificial Intelligence
Constraint Satisfaction Problems
Presentation transcript:

From Constraints to Finite Automata to Filtering Algorithms Mats Carlsson, SICS Nicolas Beldiceanu, EMN

ESOP, March 29, 2004 Outline Constraint Propagation: Example & Model Constraints and Key Notions Case Study: X  lex Y Definition and signature Finite automaton Filtering algorithm Case Study: lex_chain(X 0,…,X m-1 ) Definition and signature Finite automaton Filtering algorithm Conclusion

ESOP, March 29, 2004 Example x + y = 92x + 4y = 24 x y

ESOP, March 29, 2004 Example x + y = 92x + 4y = 24 x y

ESOP, March 29, 2004 Example x + y = 92x + 4y = 24 x y

ESOP, March 29, 2004 Example x + y = 92x + 4y = 24 x y

ESOP, March 29, 2004 Example x + y = 92x + 4y = 24 x y

ESOP, March 29, 2004 Example x + y = 92x + 4y = 24 x y

ESOP, March 29, 2004 Example x + y = 92x + 4y = 24 x y

ESOP, March 29, 2004 Constraint Propagation Variables feature variable domain (finite set of integers) Propagators implement constraints Propagation loop execute propagators until simultaneous fixpoint

ESOP, March 29, 2004 Propagator Propagator p is a procedure (coroutine) implements constraintcon(p) its semantics (set of tuples) computes on set of variablesvar(p) Execution of propagator p filters domains of variables in var(p) signals failure signals entailment

ESOP, March 29, 2004 Propagators Are Intensional Propagators implement filtering aka: narrowing, domain reduction, value removal No extensional representation of con(p) impractical in most cases (space) Extensional representation of constraint can be provided by special propagator often: “element” constraint, “relation” constraint, …

ESOP, March 29, 2004 Propagation Events Normally, a propagator p is resumed whenever some value in a domain of var(p) has been removed. In some cases, some events (e.g. removing internal values) are irrelevant whilst other (bounds adjustments) are relevant.

ESOP, March 29, 2004 Idempotent Propagators A propagator is idempotent if it always computes a fixpoint. Most constraint programming systems can accommodate both idempotent and non- idempotent propagators.

ESOP, March 29, 2004 Implementing Propagators Implementation uses operations on variables reading domain information filtering domains (removing values) Variables are the only communication channels between propagators Algorithms for Domain filtering Failure detection Entailment detection

ESOP, March 29, 2004 Outline Constraint Propagation: Example & Model Constraints and Key Notions Case Study: X  lex Y Definition and signature Finite automaton Filtering algorithm Case Study: lex_chain(X 0,…,X m-1 ) Definition and signature Finite automaton Filtering algorithm Conclusion

ESOP, March 29, 2004 Classes of Constraints Basic constraints Constraints for which the solver is complete x  D, x = v, x = y (variable aliasing) Primitive constraints (need propagators) Non-decomposable constraints x<y, x  y, x+y = z, x*y = z, … Global constraints (need propagators) Subsume a set of basic or primitive constraints, usually providing stronger consistency

ESOP, March 29, 2004 Support and Consistency Given: constraint C, variable x  var(C), its domain D(x), integer v. x=v has support for C iff v  D(x) C has a solution such that x=v C is hyperarc consistent iff  x  var(C)  v  D(x) x=v has support for C Maintaining hyperarc consistency may not be possible with polynomial algorithms (e.g. diophantine equations)

ESOP, March 29, 2004 Entailment A constraint con(p) is entailed if it holds for any combination of values in the current domains. Consequences for its propagator p: It has no more work to do It should not be resumed any more (up to backtracking) It is usually reponsible for detecting entailment

ESOP, March 29, 2004 Failure A constraint con(p) is false if it does not hold for any combination of values in the current domains. Consequences for its propagator p: It should signal inconsistency, e.g. by instigating backtracking It is reponsible for detecting failure

ESOP, March 29, 2004 Notation Vectors and subvectors X = (x 0,…,x n-1 ) X [0,r) = (x 0,…,x r-1 ), r  n Domain variables D(x), the domain of x (set of integers) min(x), lower bound of x, O(1) max(x), upper bound of x, O(1) prev(x,b) = max{y  D(x) | y<b}, O(d) next(x,b) = min{y  D(x) | y>b}, O(d)

ESOP, March 29, 2004 Constraint Signatures The constraint store is the set of all domains D(x) For alphabet A, constraint C, constraint store G, let S(C,G,A) be the signature of C wrt. G and A. The filtering algorithm is derived from a finite automaton for signatures.

ESOP, March 29, 2004 Outline Constraint Propagation: Example & Model Constraints and Key Notions Case Study: X  lex Y Definition and signature Finite automaton Filtering algorithm Case Study: lex_chain(X 0,…,X m-1 ) Definition and signature Finite automaton Filtering algorithm Conclusion

ESOP, March 29, 2004 Definition: X  lex Y Let: X = (x 0,…,x n-1 ) Y = (y 0,…,y n-1 ) x i, y i domain variables or integers X  lex Y holds iff n=0, or x 0 <y 0, or x 0 =y 0  (x 1,…,x n-1 )  lex (y 1,…,y n-1 ).

ESOP, March 29, 2004 Signature: X  lex Y LetterCondition <max(x i )<min(y i ) =x i = y i, integers >min(x i )>max(y i )  max(x i )=min(y i )  min(x i )<max(y i )  min(x i )=max(y i )  max(x i )>min(y i ) ?otherwise $End of string

ESOP, March 29, 2004 Signature example: X  lex Y X Y S=  ?<>$

ESOP, March 29, 2004 Poset of signature letters <=> ?  E.g., a  becomes a < or a = in a ground store.

ESOP, March 29, 2004 Outline Constraint Propagation: Example & Model Constraints and Key Notions Case Study: X  lex Y Definition and signature Finite automaton Filtering algorithm Case Study: lex_chain(X 0,…,X m-1 ) Definition and signature Finite automaton Filtering algorithm Conclusion

ESOP, March 29, 2004 Finite Automaton for X  lex Y 1234 T1T3T2 F1D1D3D2   $ $$ $$ $$     

ESOP, March 29, 2004 Success State T1 1 T1  $$ Enforce x i =y i in the leading prefix for C to hold. Afterwards, the leading prefix is ground and equal.

ESOP, March 29, 2004 Success State T2 124 T2      <  q Enforce x q <y q in order for there to be at least one < preceding the first >.

ESOP, March 29, 2004 Success State T3 123 T3  $$ $$     q Only enforce x q  y q, for < can appear in a later position.

ESOP, March 29, 2004 Delay States 1234 T3T2 D1D3D2   $ $$ $$      q Not yet enough information to know what to do at position q. T1 $$

ESOP, March 29, 2004 Outline Constraint Propagation: Example & Model Constraints and Key Notions Case Study: X  lex Y Definition and signature Finite automaton Filtering algorithm Case Study: lex_chain(X 0,…,X m-1 ) Definition and signature Finite automaton Filtering algorithm Conclusion

ESOP, March 29, 2004 Filtering Algorithms Non-incremental, O(n) Run finite automaton from scratch Consider all letters from scratch Incremental, amortized O(1) Deal with one letter change at a time Needs to know what letter has changed, in what state

ESOP, March 29, 2004 Incremental Restart T1T3T2 F1D1D3D2   $ $$ $$ $$      Resume in state 1.

ESOP, March 29, 2004 Incremental Restart T1T3T2 F1D1D3D2   $ $$ $$ $$      Resume in state 2.

ESOP, March 29, 2004 Incremental Restart T1T3T2 F1D1D3D2   $ $$ $$ $$      Resume in state 3 or 4, resp.

ESOP, March 29, 2004 Incremental Restart T1T3T2 F1D1D3D2   $ $$ $$ $$      If changed to =, no-op. Otherwise, resume in state 3 or 4, resp.

ESOP, March 29, 2004 Finite Automaton for X < lex Y 1234 T1T3T2 F1D1D3D2  $$ $$ $  $      

ESOP, March 29, 2004 Outline Constraint Propagation: Example & Model Constraints and Key Notions Case Study: X  lex Y Definition and signature Finite automaton Filtering algorithm Case Study: lex_chain(X 0,…,X m-1 ) Definition and signature Finite automaton Filtering algorithm Conclusion

ESOP, March 29, 2004 Definition: lex_chain(X 0,…,X m-1 ) Let: X i = (x i0,…,x in-1 ) x ij domain variables or integers lex_chain(X 0,…,X m-1 ) holds iff X 0  lex …  lex X m-1

ESOP, March 29, 2004 Internal constraint: between(A,X,B) Preconditions: A = (a 0,…,a n-1 ), B = (b 0,…,b n-1 ) X = (x 0,…,x n-1 ) a i,b i integers; x i domain variables  i  [0,n) : a i  D(x i ), b i  D(x i ) Holds iff: A  lex X  lex B

ESOP, March 29, 2004 Signature: between(A,X,B) LetterCondition < a i <b i  next(x i,a i )  b i « a i <b i  next(x i,a i )<b i =min(x i )=a i =b i =max(x i ) # min(x i )  a i =b i  max(x i )  a i =b i > a i >b i  b i  min(x i )  max(x i )  a i » a i >b i  (min(x i )<b i  a i <max(x i )) $End of string

ESOP, March 29, 2004 Signature example: between(A,X,B) A5466 X B5544 S#<>»$ X’ {4,6}{3,4,6,7}

ESOP, March 29, 2004 Outline Constraint Propagation: Example & Model Constraints and Key Notions Case Study: X  lex Y Definition and signature Finite automaton Filtering algorithm Case Study: lex_chain(X 0,…,X m-1 ) Definition and signature Finite automaton Filtering algorithm Conclusion

ESOP, March 29, 2004 Finite Automaton: between(A,X,B) 12 T1T2 F1 =#=# >»>» «$<«»#$ >= < State 1 denotes a prefix in which a i =b i. Hence we must enforce x i =a i =b i there.

ESOP, March 29, 2004 Success State T1: between(A,X,B) 1 T1 =#=# «$ Either q=n or x q =v has support for all a q  v  b q. Hence we enforce a q  x q  b q. q

ESOP, March 29, 2004 Success State T2: between(A,X,B) 12 T2 =#=# <«»#$ >= < We have: X [0,r) =A [0,r)  X [0,r) =B [0,r) Hence we enforce: a i  x i  b i for i  [0,r). Either r=n or x r =v has support for all v  b r  v  a r. Hence we enforce: x r  b r  x r  a r. r

ESOP, March 29, 2004 Outline Constraint Propagation: Example & Model Constraints and Key Notions Case Study: X  lex Y Definition and signature Finite automaton Filtering algorithm Case Study: lex_chain(X 0,…,X m-1 ) Definition and signature Finite automaton Filtering algorithm Conclusion

ESOP, March 29, 2004 Feasible Upper Bound: Problem Given X and B, compute the lexicographically largest U such that: U  lex B  i  [0,n) : u i  D(x i ) Similarly for feasible lowest bound

ESOP, March 29, 2004 Feasible Upper Bound: Algorithm Compute  as the smallest i such that U [0,i)  B [0,i) Compute: u i = b i, if i <  u i = prev(x i,b i ), if i =  u i = max(x i ), if i >  Similarly for feasible lowest bound

ESOP, March 29, 2004 Filtering: lex_chain(X 0,…,X m-1 ) 1. Compute feasible upper bound B i for X i from i=m-1 down to i=0. 2. Compute feasible lower bound A i for X i from i=0 to i=m Enforce A i  lex X i  lex B i for all i. Arc-consistency in O(nmd) time.

ESOP, March 29, 2004 Outline Constraint Propagation: Example & Model Constraints and Key Notions Case Study: X  lex Y Definition and signature Finite automaton Filtering algorithm Case Study: lex_chain(X 0,…,X m-1 ) Definition and signature Finite automaton Filtering algorithm Conclusion

ESOP, March 29, 2004 Results An approach to designing filtering algorithms by derivation from FAs on constraint signatures Case studies and hyperarc consistency algorithms for two constraints: X  lex Y, running in amortized O(1) time per propagation event lex_chain(X 0,…,X m-1 ), running in O(nmd) time per invocation

ESOP, March 29, 2004 Future Work What constraints are amenable to the approach? Where does the alphabet come from? Where does the automaton come from? Where do the pruning rules come from? How do we make the algorithms incremental?

ESOP, March 29, 2004 References and proofs SICS T : Revisiting the Lexicographic Ordering Constraint, Mats Carlsson, Nicolas Beldiceanu. SICS T : Arc-Consistency for a Chain of Lexicographic Ordering Constraints, Mats Carlsson, Nicolas Beldiceanu.

ESOP, March 29, 2004 Related Work Global constraints for lexicographic orderings. A. Frisch, B. Hnich, Z. Kızıltan, I. Miguel, T. Walsh. Proc. CP’2002. LNCS 2470, pp , Springer, 2002.