Global Constraints for Lexicographic Orderings Alan Frisch, Ian Miguel (University of York) Brahim Hnich, Toby Walsh (4C) Zeynep Kiziltan (Uppsala University)

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.
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Global Constraints Toby Walsh NICTA and University of New South Wales
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)
ICS-271:Notes 5: 1 Lecture 5: Constraint Satisfaction Problems ICS 271 Fall 2008.
Reducing Symmetry in Matrix Models Alan Frisch, Ian Miguel, Toby Walsh (York) Pierre Flener, Brahim Hnich, Zeynep Kiziltan, Justin Pearson (Uppsala)
Case study 5: balanced academic curriculum problem Joint work with Brahim Hnich and Zeynep Kiziltan (CPAIOR 2002)
EE 553 Integer Programming
Leeds: 6 June 02Constraint Technology for the Masses Alan M. Frisch Artificial Intelligence Group Department of Computer Science University of York Collaborators:
Introduction to Finite Elements
Transforming and Refining Abstract Constraint Specifications Alan Frisch, Brahim Hnich*, Ian Miguel, Barbara Smith, and Toby Walsh *Cork Constraint Computation.
Maths for Computer Graphics
Constraint Models for the Covering Test Problems Authors: Brahim Hnich, Steven D. Prestwich, Evgeny Selensky, Barbara M. Smith Speaker: Pingyu Zhang CSE.
Symmetry as a Prelude to Implied Constraints Alan Frisch, Ian Miguel, Toby Walsh University of York.
4 Feb 2004CS Constraint Satisfaction1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
Alan M. Frisch Artificial Intelligence Group Department of Computer Science University of York Extending the Reach of Constraint Technology through Reformulation.
1 Optimisation Although Constraint Logic Programming is somehow focussed in constraint satisfaction (closer to a “logical” view), constraint optimisation.
Matrix Modelling Alan M. Frisch and Ian Miguel (York) Brahim Hnich, Zeynep Kiziltan (Uppsala) Toby Walsh (Cork)
Matrix Modelling Pierre Flener (Uppsala) Alan M. Frisch (York) Brahim Hnich, Zeynep Kiziltan (Uppsala) Ian Miguel, and Toby Walsh (York)
Constraint Systems Laboratory March 26, 2007Reeson–Undergraduate Thesis1 Using Constraint Processing to Model, Solve, and Support Interactive Solving of.
A game of logic where the player must assign the numbers 1..9 to cells on a 9x9 grid. The placement of the numbers must be such that every number must.
Reducing Symmetry in Matrix Models Alan Frisch, Ian Miguel, Toby Walsh (York) Pierre Flener, Brahim Hnich, Zeynep Kiziltan, Justin Pearson (Uppsala)
Modeling the Covering Test Problem Brahim Hnich, Steven Prestwich, and Evgeny Selensky Cork Constraint Computation Center UCC Supported by SFI.
Alan M. Frisch Artificial Intelligence Group Department of Computer Science University of York Co-authors Ian Miguel, Toby Walsh, Pierre Flener, Brahim.
Constraint Systems Laboratory 11/22/2005Zheng – Comprehensive1 Survey of Techniques for Detecting and Exploiting Symmetry in Constraint Satisfaction Problems.
Matrix Modelling: Déjà Vu Pierre Flener (Uppsala) Alan M. Frisch (York) Brahim Hnich, Zeynep Kiziltan (Uppsala) Ian Miguel, and Toby Walsh (York)
Modelling a Steel Mill Slab Design Problem Alan Frisch, Ian Miguel, Toby Walsh AI Group University of York.
From Constraints to Finite Automata to Filtering Algorithms Mats Carlsson, SICS Nicolas Beldiceanu, EMN
1 Constraint Satisfaction Problems Slides by Prof WELLING.
CS32310 MATRICES 1. Vector vs Matrix transformation formulae Geometric reasoning allowed us to derive vector expressions for the various transformation.
Chapter 3: The Fundamentals: Algorithms, the Integers, and Matrices
CP Summer School Modelling for Constraint Programming Barbara Smith 1.Definitions, Viewpoints, Constraints 2.Implied Constraints, Optimization,
Building “ Problem Solving Engines ” for Combinatorial Optimization Toshi Ibaraki Kwansei Gakuin University (+ M. Yagiura, K. Nonobe and students, Kyoto.
Relaxation and Hybrid constraint processing Different relaxation techniques Some popular hybrid techniques.
Symmetry Breaking Ordering Constraints Zeynep Kiziltan Department of Information Science Uppsala University, Sweden A progress.
4.1 Matrix Operations What you should learn: Goal1 Goal2 Add and subtract matrices, multiply a matrix by a scalar, and solve the matrix equations. Use.
CSCE350 Algorithms and Data Structure Lecture 17 Jianjun Hu Department of Computer Science and Engineering University of South Carolina
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Euler paths and tours.
On Algorithms for Decomposable Constraints Kostas Stergiou Ian Gent, Patrick Prosser, Toby Walsh A.P.E.S. Research Group.
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.
The AllDifferent Constraint: Efficiency Measures Ian P. Gent, Ian Miguel, Peter Nightingale.
Sports Scheduling Written by Kelly Easton, George Nemhauser, Michael Trick Presented by Matthew Lai.
Chapter 5: Constraint Satisfaction ICS 171 Fall 2006.
CSC 423 ARTIFICIAL INTELLIGENCE Constraint Satisfaction Problems.
CP Summer School Modelling for Constraint Programming Barbara Smith 3. Symmetry, Viewpoints.
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.
Constraint Satisfaction Problems University of Berkeley, USA
Greatest Common Divisors & Least Common Multiples  Definition 4 Let a and b be integers, not both zero. The largest integer d such that d|a and d|b is.
1. 2 Outline of Ch 4 Best-first search Greedy best-first search A * search Heuristics Functions Local search algorithms Hill-climbing search Simulated.
Eliminating non- binary constraints Toby Walsh Cork Constraint Computation Center.
Chapter 5 Team Teaching AI (created by Dewi Liliana) PTIIK Constraint Satisfaction Problems.
10.3 Reformulation The Lex-Leader Method Shant Karakashian 1.
1 Constraint Satisfaction Problems (CSP). Announcements Second Test Wednesday, April 27.
Data Structures I (CPCS-204)
CSC5240 Combinatorial Search and Optimization with Constraints
Constraint Satisfaction
Constraint Satisfaction Problems
Arrays Week 2.
Constraints and Search
Minimax strategies, alpha beta pruning
Constraint satisfaction problems
Generic SBDD using Computational Group Theory
Constraint Satisfaction Problems
Minimax strategies, alpha beta pruning
Constraint satisfaction problems
Presentation transcript:

Global Constraints for Lexicographic Orderings Alan Frisch, Ian Miguel (University of York) Brahim Hnich, Toby Walsh (4C) Zeynep Kiziltan (Uppsala University)

GACLex A new family of global constraints.

GACLex A new family of global constraints. Non-binary constraint. Specialised propagator.

GACLex A new family of global constraints. Non-binary constraint. Specialised propagator. GACLex maintains Generalised Arc Consistency: Given an assignment to any constrained variable, we can find consistent assignments for the remainder.

GACLex A new family of global constraints. Linear time complexity.

GACLex A new family of global constraints. Linear time complexity. Ensures that a pair of vectors of variables are lexicographically ordered.

GACLex A new family of global constraint. Linear time complexity. Ensures that a pair of vectors of variables are lexicographically ordered  lex

Motivation Many problems can be modelled by matrices of decision variables.

Motivation Many problems can be modelled by matrices of decision variables. E.g. Combinatorial Problems –Balanced Incomplete Block Design.

Motivation Many problems can be modelled by matrices of decision variables. E.g. Configuration Problems: –Rack Configuration.

Motivation Many problems can be modelled by matrices of decision variables. E.g. Scheduling Problems: –Social Golfers.

Motivation Many problems can be modelled by matrices of decision variables. E.g. Design Problems: –Steel Mill Slab Design.

Motivation Many problems can be modelled by matrices of decision variables. Frequently these matrices exhibit row and/or column symmetry.

Motivation Many problems can be modelled by matrices of decision variables. Frequently these matrices exhibit row and/or column symmetry. We can permute the rows/columns in any (non)solution to obtain another (non)solution.

Motivation Many problems can be modelled by matrices of decision variables. Frequently these matrices exhibit row and/or column symmetry. We can permute the rows/columns in any (non)solution to obtain another (non)solution. It can be very expensive to search fruitless symmetric branches of the search tree.

Motivation Many problems can be modelled by matrices of decision variables. Frequently these matrices exhibit row and/or column symmetry. Lexicographic ordering is an effective way to break a lot of this symmetry.

Example Consider 2 identical bins: BA

Example Consider 2 identical bins: We must pack 6 items: BA

Example Here is one solution: BA

Example Here is another: BA

Example Is there any fundamental difference? a) b) AB BA

Example Consider a matrix model: A B A B a) b) AB BA

Example Consider a matrix model: NB: ‘1’ means place this item in this bin: A B A B a) b) AB BA

Example Consider a matrix model: If we insist that row A  lex row B, we remove a) from the solution set A B A B b) BA

Example Notice that items 3 and 4 are identical A B b) BA A B c) BA

Example Notice that items 3 and 4 are identical A B b) BA A B If we insist that col 3  lex col 4, we remove c) from the solution set.

How GACLex Works Consider the following example. We have two vectors of decision variables:

How GACLex Works Consider the following example. We have two vectors of decision variables: x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2}

How GACLex Works Consider the following example. We have two vectors of decision variables: x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} We want to enforce GAC on: x  lex y.

A Tale of Two Pointers We use two pointers, α and β, to avoid repeatedly traversing the vectors.

A Tale of Two Pointers We use two pointers, α and β, to avoid repeatedly traversing the vectors. We index the vectors as follows: x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2}

A Tale of Two Pointers We use two pointers, α and β, to avoid repeatedly traversing the vectors. We index the vectors as follows: x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} Most Significant Index

A Tale of Two Pointers We use two pointers, α and β, to avoid repeatedly traversing the vectors x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} α: index such that all variables at more significant indices are ground and equal.

A Tale of Two Pointers We use two pointers, α and β, to avoid repeatedly traversing the vectors x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint.

A Tale of Two Pointers We use two pointers, α and β, to avoid repeatedly traversing the vectors x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} α: index such that all variables at more significant indices are ground and equal. β: If tails never violate the constraint: 

Pointer Initialisation Needs one traversal of the vectors (linear). Details in the paper. α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint.

Pointer Initialisation Needs one traversal of the vectors (linear) x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint. α

Pointer Initialisation Needs one traversal of the vectors (linear) x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} α β α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint.

Failure Inconsistent if β  α. α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint.

How GACLex Works We maintain α and β as assignments made. α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint.

How GACLex Works We maintain α and β as assignments made. When β = α + 1 we enforce bounds consistency on: x α < y α α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint.

How GACLex Works We maintain α and β as assignments made. When β = α + 1 we enforce bounds consistency on: x α < y α The variable at the αth element of each vector. α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint.

How GACLex Works We maintain α and β as assignments made. When β = α + 1 we enforce bounds consistency on: x α < y α When β > α + 1 we enforce bounds consistency on: x α  y α α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint.

How GACLex Works We maintain α and β as assignments made. Key: we reduce GAC on vectors to BC on binary constraints. α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint.

How GACLex Works x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} α β α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint. 0, 1 removed from y α.

How GACLex Works x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} α β α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint. 0, 1 removed from y α.

How GACLex Works x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} α β α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint. Update α.

How GACLex Works x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} α β α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint. Update α.

How GACLex Works x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} α β α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint. 3, 4 removed from x α.

How GACLex Works x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} α β α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint. 3, 4 removed from x α.

How GACLex Works x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} α β α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint. Update α.

How GACLex Works x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} α β α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint. Update α.

How GACLex Works x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} α β α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint. 4, 5 removed from x α, 0, 1 removed from y α.

How GACLex Works x{2}{1,3,4}{1,2,3,4,5}{1,2}{3,4,5} y{0,1,2}{1}{0,1,2,3,4}{0,1}{0,1,2} α β α: index such that all variables at more significant indices are ground and equal. β: most significant index from which the two vectors’ tails necessarily violate the constraint. 4, 5 removed from x α, 0, 1 removed from y α.

Complexity Initialisation: O(n)

Complexity Initialisation: O(n) Propagation: We enforce bounds consistency between at most n pairs of variables: x α < y α or x α  y α.

Complexity Initialisation: O(n) Propagation: We enforce bounds consistency between at most n pairs of variables: x α < y α or x α  y α. Cost: b.

Complexity Initialisation: O(n) Propagation: We enforce bounds consistency between at most n pairs of variables: x α < y α or x α  y α. Cost: b. Overall cost: O(nb).

Alternative 1: Decomposition x  lex y can be decomposed into n non- binary constraints: x 0  y 0

Alternative 1: Decomposition x  lex y can be decomposed into n non- binary constraints: x 0  y 0 x 0 = y 0  x 1  y 1

Alternative 1: Decomposition x  lex y can be decomposed into n non- binary constraints: x 0  y 0 x 0 = y 0  x 1  y 1 x 0 = y 0  x 1 = y 1  x 2  y 2

Alternative 1: Decomposition x  lex y can be decomposed into n non- binary constraints: x 0  y 0 x 0 = y 0  x 1  y 1 x 0 = y 0  x 1 = y 1  x 2  y 2 … x 0 = y 0  x 1 = y 1 …  x n-2 = y n-2  x n-1  y n-1

Alternative 1: Decomposition x  lex y can be decomposed into n non- binary constraints: Usually, only forward checking is performed on such non-binary constraints.

Alternative 1: Decomposition x  lex y can be decomposed into n non- binary constraints: Usually, only forward checking is performed on such non-binary constraints. They are also cumbersome.

Alternative 2: Arithmetic Constraints To ensure that x  lex y with domain size d: d n-1  x 0 + d n-2  x 1 + … + d 0  x n-1  d n-1  y 0 + d n-2  y 1 + … + d 0  y n-1

Alternative 2: Arithmetic Constraints To ensure that x  lex y with domain size d: d n-1  x 0 + d n-2  x 1 + … + d 0  x n-1  d n-1  y 0 + d n-2  y 1 + … + d 0  y n-1 Bounds consistency on this expression is equivalent to GAC on x  lex y.

Alternative 2: Arithmetic Constraints To ensure that x  lex y with domain size d: d n-1  x 0 + d n-2  x 1 + … + d 0  x n-1  d n-1  y 0 + d n-2  y 1 + … + d 0  y n-1 Bounds consistency on this expression is equivalent to GAC on x  lex y. When n and d are large, d n-1 is greater than the word size of the computer.

Alternative 2: Arithmetic Constraints To ensure that x  lex y with domain size d: d n-1  x 0 + d n-2  x 1 + … + d 0  x n-1  d n-1  y 0 + d n-2  y 1 + … + d 0  y n-1 Bounds consistency on this expression is equivalent to GAC on x  lex y. When n and d are large, d n-1 is greater than the word size of the computer. This method is only feasible for small vectors/domain size.

Multiple Lex Constraints All rows/columns of a matrix might be lex ordered.

Multiple Lex Constraints All rows/columns of a matrix might be lex ordered. Can treat as a single global constraint.

Multiple Lex Constraints All rows/columns of a matrix might be lex ordered. Can treat as a single global constraint. GAC on such a constraint is future work. Can approximate with GACLex between all pairs, or adjacent pairs. GACLex on all pairs = GAC on whole set for 0/1 vectors.

Experimental Results: BIBD Standard combinatorial problem v rows. b columns. r 1s per row. k 1s per column. λ is scalar product between every pair of rows. Symmetrical rows and columns

Results: BIBD Decomposition takes About 9 times longer on each of these instances.

Results: BIBD Fails, Choice-points very similar: GACLex  Decomposition. Why? We are using a good static variable ordering. So substantially decreased run-times due to efficiency gains in this case.

Results: Social Golfers Schedule a golf tournament of w weeks. In each week, divide golfers into g groups, size s. Every golfer plays once per week. Every pair of golfers can meet at most once.

Results: Social Golfers Schedule a golf tournament of w weeks. In each week, divide golfers into g groups, size s. Every golfer plays once per week. Every pair of golfers can meet at most once. 3d 0/1 model: Groups Weeks Players

Results: Social Golfers Schedule a golf tournament of w weeks. In each week, divide golfers into g groups, size s. Every golfer plays once per week. Every pair of golfers can meet at most once. 3d 0/1 model: Groups Weeks Players Players, groups and weeks all symmetrical

Results: Social Golfers Decomposition takes between 10 and 56 times longer (at least) on these instances.

Results: Social Golfers More complex interactions in 3d model result in greater pruning with GACLex. This explains the even greater run- time improvements.

Results: Tournament Scheduling n teams play over n-1 weeks. Each week divided into n/2 periods. Each period divided into 2 slots (home/away). Every team: Plays once a week. Plays at most twice in the same period. Plays every other team. Periods Slots(2) Weeks Periods Weeks Channel Slots, Periods, Weeks are symmetrical

Results: Tournament Scheduling Search tree similar. Variable/value ordering compatible with lex. Speed increase around 3x. Vectors much smaller.

Results: Adjacent v All-pairs In theory, enforcing lex between all pairs of vectors gives more propagation. We have seen no evidence of this. Perhaps conditions appear infrequently.

Conclusion Global constraints for lexicographic orderings. Linear time complexity. Decompositions carry a penalty in the amount or cost of propagation.

Future Work GACLex for multiple vectors. Other types of ordering, e.g. multisets. Compare with other decompositions: x 0  y 0  (x 0 = y 0  (x 1  y 1  (x 1 = y 1  …

Resources Solver code coming soon at: