Global Constraints Toby Walsh National ICT Australia and University of New South Wales www.cse.unsw.edu.au/~tw.

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

Solving Systems of Equations by Substitution Objectives: Solve Systems of Equations using substitution. Solve Real World problems involving systems of.
Slide 1 Insert your own content. Slide 2 Insert your own content.
Introduction to Algorithms 6.046J/18.401J/SMA5503
Tuesday, March 5 Duality – The art of obtaining bounds – weak and strong duality Handouts: Lecture Notes.
2 pt 3 pt 4 pt 5pt 1 pt 2 pt 3 pt 4 pt 5 pt 1 pt 2pt 3 pt 4pt 5 pt 1pt 2pt 3 pt 4 pt 5 pt 1 pt 2 pt 3 pt 4pt 5 pt 1pt Two-step linear equations Variables.
Höchstleistungsrechenzentrum Stuttgart SEGL Parameter Study Slide 1 Science Experimental Grid Laboratory (SEGL) Dynamical Parameter Study in Distributed.
0 - 0.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
Addition Facts
Constraints and Search Toby Walsh Cork Constraint Computation Centre (4C) Logic & AR Summer School, 2002.
Case study 5: all interval series Results due to Simonis, Puget & Regin.
Case study 7: Langfords problem Model due to Barbara Smith.
Non-Binary Constraint Satisfaction Toby Walsh Cork Constraint Computation Center.
Non-binary Constraints Toby Walsh
Maximal Independent Sets of a Hypergraph IJCAI01.
BALANCING 2 AIM: To solve equations with variables on both sides.
BALANCING EQUATIONS AIM: Solve equations with variables on both sides.
ZMQS ZMQS
Mathematics for Economics Beatrice Venturi 1 Economics Faculty CONTINUOUS TIME: LINEAR DIFFERENTIAL EQUATIONS Economic Applications LESSON 2 prof. Beatrice.
CSED101 INTRODUCTION TO COMPUTING GREEDY APPROACH, DIVIDE AND CONQUER Hwanjo Yu.
Greedy Technique Constructs a solution to an optimization problem piece by piece through a sequence of choices that are: feasible, i.e. satisfying the.
Machine scheduling Job 1Job 3 Job 4 Job 5Machine 1 Machine 2 time 0C max Job 2.
Detection Chia-Hsin Cheng. Wireless Access Tech. Lab. CCU Wireless Access Tech. Lab. 2 Outlines Detection Theory Simple Binary Hypothesis Tests Bayes.
1 Symbol Tables. 2 Contents Introduction Introduction A Simple Compiler A Simple Compiler Scanning – Theory and Practice Scanning – Theory and Practice.
Hash Tables.
Chapter 15 Complex Numbers
4.6 Perform Operations with Complex Numbers
Complex Numbers 3.3 Perform arithmetic operations on complex numbers
LIAL HORNSBY SCHNEIDER
演 算 法 實 驗 室演 算 法 實 驗 室 On the Minimum Node and Edge Searching Spanning Tree Problems Sheng-Lung Peng Department of Computer Science and Information Engineering.
5.9 + = 10 a)3.6 b)4.1 c)5.3 Question 1: Good Answer!! Well Done!! = 10 Question 1:
Logarithmic Equations
Artificial Variables, 2-Phase and Big M Methods
Squares and Square Root WALK. Solve each problem REVIEW:
30S Applied Math Mr. Knight – Killarney School Slide 1 Unit: Linear Programming Lesson 5: Problem Solving Problem Solving with Linear Programming Learning.
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
© 2012 National Heart Foundation of Australia. Slide 2.
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
Addition 1’s to 20.
25 seconds left…...
Part 1 Overview, introduction, examples What is Operations Research? What is Optimization What is Sequential Decision Making? What is Dynamic Programming?
To Kill A Mockingbird Mrs. Barnett English 3. Gothic Fiction Gothic fiction PPT.
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Constraint Programming Toby Walsh UNSW and NICTA.
Test B, 100 Subtraction Facts
11.2 Solving Quadratic Equations by Completing the Square
Week 1.
DTU Informatics Introduction to Medical Image Analysis Rasmus R. Paulsen DTU Informatics TexPoint fonts.
Dantzig-Wolfe Decomposition
Local Search Jim Little UBC CS 322 – CSP October 3, 2014 Textbook §4.8
CPSC 322, Lecture 14Slide 1 Local Search Computer Science cpsc322, Lecture 14 (Textbook Chpt 4.8) Oct, 5, 2012.
10.3 Simplifying Radical Expressions
1 State-Space representation and Production Systems Introduction: what is State-space representation? What are the important trade-offs? (E.Rich, Chapt.2)
13-Optimization Assoc.Prof.Dr. Ahmet Zafer Şenalp Mechanical Engineering Department Gebze Technical.
Computational Facility Layout
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
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.
Global Grammar Constraints Toby Walsh National ICT Australia and University of New South Wales Joint work with Claude-Guy Quimper.
CP Summer School Modelling for Constraint Programming Barbara Smith 4. Combining Viewpoints, Modelling Advice.
Eliminating non- binary constraints Toby Walsh Cork Constraint Computation Center.
Presentation transcript:

Global Constraints Toby Walsh National ICT Australia and University of New South Wales

Course outline ● Introduction ● All Different ● Lex ordering ● Value precedence ● Complexity ● GAC-Schema ● Soft Global Constraints ● Global Grammar Constraints ● Roots Constraint ● Range Constraint ● Slide Constraint ● Global Constraints on Sets

Conclusions ● Constraint programming is a powerful paradigm for solving many combinatorial optimization problems ● Global constraints are integral to this success ● As we shall see, there are many different types of global constraints – However, a few are central like AllDifferent, Roots, Range, Slide,...

All Different Example application

Golomb rulers ● Mark ticks on a rule – Distance between any two ticks (not just neighbouring) is distinct ● Applications – Radio-astronomy – Crystallorgraphy –... – Prob006 in CSPLib,

Golomb rulers ● Simple solution – Exponentially long ruler – Ticks at 0, 1, 3, 7, 15, 31,... ● Goal is to find minimal length ruler – Sequence of optimization 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 larger – 0,1 – 0,1,3 – 0,1,4,6 – 0,1,4,9,11 – 0,1,4,10,12,17 ● Solutions grow as approximately O(n^2)

Golomb rulers as CSP ● Variable Xi for each tick – Value is position ● Auxiliary variable Dij for each inter-tick distance – Dij=|Xi-Xj| ● Two (global) constraints – X1<X2<..Xn – AllDifferent(D11,D12,D13,...)

Golomb ruler as CSP ● Not yet achieved “dream” of declarative programming – Need to break symmetry of inverting ruler ● D12< Dn-1n – Add implied constraints ● D12<D13... – Pure declarative specifications not quite enough!

AllDifferent ● AllDifferent([X1,..Xn]) iff Xi=/=Xj for i<j ● Useful in wide range of applications – Timetabling (exams with common student must occur at different times) – Production (each product must be produced at a different time) –... ● Can propagate just using binary inequalities ● But this decomposition hurts propagation

AllDifferent ● AllDifferent([X1,..Xn]) iff Xi=/=Xj for i<j ● Can propagate just using binary inequalities ● But this decomposition hurts propagation – X1 in {1,2}, X2 in {1,2}, X3 in {1,2,3} – X1 and X2 consume between them 2 values – X3 cannot therefore use either of these values – Therefore we can prune X3=1 and X3=2 leaving just X3=3 – How can we automate such reasoning? – How can we do this efficiently (< O(n^2))

AllDifferent ● One of the oldest global constraints – In ALICE language [Lauriere 78] ● Found in every constraint solver today – GAC algorithm based on matching theory due to Regin [AAAI 94], runs in O(dn^3/2) – BC algorithm using combinatorics due to Puget [AAAI98], runs in O(nlogn)

BC on AllDifferent ● Application of Hall's Theorem – Sometimes called the “marriage” theorem – Given k sets – Then there is an unique and distinct element in each set iff any union of j of the sets has at least j elements for 0<j<=k – E.g. S1={1,2}, S2={1,2} but not S1={1,2},S2={1,2} and S3={1,2}

Hall's theorem ● You wish to marry n men and women – Each woman declares who they are willing to marry (some set of men) – Each man will be “happy” with whoever is willing to marry them – Clearly any subset of j women, the number of men they are willing to marry must be j or more (thus this condition is necessary) – What is surprising is that it is also sufficient!

BC on AllDifferent ● Hall Interval – Interval of values in which as many variables as domain values – E.g. X1 in {1,2,3}, X2 in {1,2}, X3 in {1,2,3} – 3 variables in the interval [1..3] ● AllDifferent([X1,..Xn]) is BC iff – Each interval, the number of vars it covers is less than the width of the interval – No variable outside a Hall Interval has a value within it

BC on AllDifferent ● Consider X1 in {1,2}, X2 in {1,2}, X3 in {1,2,3}

BC on AllDifferent ● Consider X1 in {1,2}, X2 in {1,2}, X3 in {1,2,3} ● Then [1..2] is a Hall Interval covered by X1 and X2 ● X3 has values inside this Hall Interval ● We can prune these and make AllDifferent BC

BC on AllDifferent ● Naïve algorithm considers O(n^2) intervals ● Puget orders intervals – Ordering has O(nlogn) cost – Then can go through them in order

GAC on AllDifferent ● GAC algorithm based on matching theory due to Regin [AAAI 94] – runs in O(dn^3/2) ● Matching = set of edges with no two edges having a node in common ● Maximal matching = largest possible matching ● Value graph = bipartite graph between variables and their possible values

GAC on AllDifferent ● Consider X1 in {1,3}, X2 in {1,3} and X3 in {1,2}

GAC on AllDifferent ● Consider X1 in {1,3}, X2 in {1,3} and X3 in {1,2} X1 X2 X

GAC on AllDifferent ● Consider X1 in {1,3}, X2 in {1,3} and X3 in {1,2} X1 X2 X

GAC on AllDifferent ● Consider X1 in {1,3}, X2 in {1,3} and X3 in {1,2} X1 X2 X

GAC on AllDifferent ● Consider X1 in {1,3}, X2 in {1,3} and X3 in {1,2} X1 X2 X

GAC on AllDifferent ● Consider X1 in {1,3}, X2 in {1,3} and X3 in {2} X1 X2 X

GAC on AllDifferent ● How do we find edges that don't belong to any maximum matching? ● Find one maximum matching ● Identify strongly connected components ● Prune other edges ● Dominate cost is that of finding maximum matching – Augmenting path algorithm of Hopcroft and Karp

Beyond AllDifferent ● Symmetric AllDifferent – Xi=j iff Xj=i ● Useful in sports scheduling – Team1 plays 2 iff Team2 plays 1 ● GAC can be enforced in O(nm) time ● Again based on maximum matching but now in non-bipartite graph

Beyond AllDifferent ● Soft AllDifferent – Relax constraint that all values are different – Introduce “cost” variable ● Number of variables that need to change value to make it all different ● Number of binary inequalities not satisfied

Beyond AllDifferent ● NValues([X1,...,Xn],M) iff |{j | Xi=j}|=M ● AllDifferent is special case when M=n ● Useful when values represent a resource – Minimize the number of resources used

Beyond AllDifferent ● Global cardinality constraint – GCC([X1,..Xn],[a1,..am],[b1,...bm]) iff aj <= |{i | Xi=j }| <= bj for all j – In other words, j occurs between aj and bj times ● Again useful when values represent a resource – You have at least one night shift but no more than four each week

Propagating GCC ● Regin gives O(n^2d) flow based algorithm for achieving GAC [AAAI 96] ● Improved recently to O(n^3/2 d) using matching theory ● We'll come back to a similar flow based propagator for the RANGE constraint

Conclusions ● AllDifferent is one of the oldest (and most useful) global constraints ● Efficient propagators exist for achieving GAC and BC ● When to choose BC over GAC? – Heuristic choice: BC often best when many more values than variables, GAC when we are close to a permutation (number of vars=number of values)