CP Summer School 2008 1 Modelling for Constraint Programming Barbara Smith 4. Combining Viewpoints, Modelling Advice.

Slides:



Advertisements
Similar presentations
Constraints and Search Toby Walsh Cork Constraint Computation Centre (4C) Logic & AR Summer School, 2002.
Advertisements

Case study 3: orthogonal Latin squares Modelled by Barbara Smith.
Solve Your Problem Faster - by changing the model
Non-Binary Constraint Satisfaction Toby Walsh Cork Constraint Computation Center.
Non-binary Constraints Toby Walsh
Maximal Independent Sets of a Hypergraph IJCAI01.
Symmetry Definitions for Constraint Satisfaction Problems Dave Cohen, Peter Jeavons, Chris Jefferson, Karen Petrie and Barbara Smith.
ISN Workshop September 2003 Constraint Programming in Practice: Scheduling a Rehearsal Barbara Smith.
Planning II: Partial Order Planning
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
EE 553 Integer Programming
Best-First Search: Agendas
Maths of Constraint Satisfaction, Oxford, March 2006 Constraint Programming Models for Graceful Graphs Barbara Smith.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
1 Boolean Satisfiability in Electronic Design Automation (EDA ) By Kunal P. Ganeshpure.
Constraint Satisfaction Problems
Dynamic lot sizing and tool management in automated manufacturing systems M. Selim Aktürk, Siraceddin Önen presented by Zümbül Bulut.
24-Jun-15 Pruning. 2 Exponential growth How many leaves are there in a complete binary tree of depth N? This is easy to demonstrate: Count “going left”
KNAPSACK PROBLEM A dynamic approach. Knapsack Problem  Given a sack, able to hold K kg  Given a list of objects  Each has a weight and a value  Try.
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)
Chapter 5 Outline Formal definition of CSP CSP Examples
Recursion Chapter 7. Chapter 7: Recursion2 Chapter Objectives To understand how to think recursively To learn how to trace a recursive method To learn.
Constraint Satisfaction Not all problems are solved by a sequential series of steps. How do we solve other types of problems?
1/25 Pointer Logic Changki PSWLAB Pointer Logic Daniel Kroening and Ofer Strichman Decision Procedure.
(c) University of Washingtonhashing-1 CSC 143 Java Hashing Set Implementation via Hashing.
Copyright R. Weber Search in Problem Solving Search in Problem Solving INFO 629 Dr. R. Weber.
Factoring Polynomials
Tractable Symmetry Breaking Using Restricted Search Trees Colva M. Roney-Dougal, Ian P. Gent, Tom Kelsey, Steve Linton Presented by: Shant Karakashian.
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.
Recursion Chapter 7. Chapter Objectives  To understand how to think recursively  To learn how to trace a recursive method  To learn how to write recursive.
1. Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Systems of Equations CHAPTER 1Solving Systems of Linear Equations Graphically.
Copyright © 2015, 2011, 2007 Pearson Education, Inc. 1 1 Chapter 4 Systems of Linear Equations and Inequalities.
Constraint Satisfaction Problems (CSPs) CPSC 322 – CSP 1 Poole & Mackworth textbook: Sections § Lecturer: Alan Mackworth September 28, 2012.
© J. Christopher Beck Lecture 13: Modeling in Constraint Programming.
Modelling for Constraint Programming Barbara Smith CP 2010 Doctoral Programme.
CP Summer School Modelling for Constraint Programming Barbara Smith 2. Implied Constraints, Optimization, Dominance Rules.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
Constraint Satisfaction CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
Chapter 5: Constraint Satisfaction ICS 171 Fall 2006.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Fall 2006 Jim Martin.
Problem Analysis September 18, 2015 CSE 232, Shane Carr.
Solving Problems by searching Well defined problems A probem is well defined if it is easy to automatically asses the validity (utility) of any proposed.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
NP-Complete problems.
Problem Reduction So far we have considered search strategies for OR graph. In OR graph, several arcs indicate a variety of ways in which the original.
CP Summer School Modelling for Constraint Programming Barbara Smith 3. Symmetry, Viewpoints.
Tommy Messelis * Stefaan Haspeslagh Patrick De Causmaecker *
Constraint Propagation influenced by Dr. Rina Dechter, “Constraint Processing”
Robust Planning using Constraint Satisfaction Techniques Daniel Buettner and Berthe Y. Choueiry Constraint Systems Laboratory Department of Computer Science.
1 CSC 384 Lecture Slides (c) , C. Boutilier and P. Poupart CSC384: Lecture 16  Last time Searching a Graphplan for a plan, and relaxed plan heuristics.
Genetic Algorithms. Underlying Concept  Charles Darwin outlined the principle of natural selection.  Natural Selection is the process by which evolution.
1 Constraint Satisfaction Problems (CSP). Announcements Second Test Wednesday, April 27.
1 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 CSC384: Intro to Artificial Intelligence Backtracking Search I ● Announcements.
Artificial Intelligence Chapter 11 Alternative Search Formulations and Applications.
Scheduling with Constraint Programming
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
EMGT 6412/MATH 6665 Mathematical Programming Spring 2016
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Artificial Intelligence
Constraints and Search
Constraint satisfaction problems
Artificial Intelligence
CS 8520: Artificial Intelligence
Constraint satisfaction problems
A handbook on validation methodology. Metrics.
Presentation transcript:

CP Summer School Modelling for Constraint Programming Barbara Smith 4. Combining Viewpoints, Modelling Advice

CP Summer School Which Viewpoint to Choose?  Sometimes one viewpoint is clearly better, e.g. if we can’t express the constraints easily in one  But different perspectives often allow different expression of the constraints and different implied constraints  can be hard to decide which is better  We don’t need to choose one viewpoint – we can use two (or more) at once  We need channelling constraints to link the variables

CP Summer School Combining Viewpoints: Permutation Problems  Dual viewpoints of a permutation problem with variables x 1, x 2, …, x n and d 1, d 2, …, d n  Combine them using the channelling constraints  (x i = j) ≡ (d j = i )  The channelling constraints are sufficient to ensure that x 1, x 2, …, x n are all different  but might be beneficial to have a specific allDifferent constraint as well and enforce GAC

CP Summer School Combining Viewpoints: Integer & Set Variables  In a nurse rostering problem, we can allocate shifts to nurses or nurses to shifts  First viewpoint:  an integer variable n ij for each nurse i and day j  its value is the shift that nurse i works on day j  Second viewpoint:  a set variable S kj for each shift k and day j  its value is the set of nurses that work shift k on day j  Channelling constraints: (n ij = k) ≡ (i  S kj )

CP Summer School The Golomb Ruler Problem  A Golomb ruler with m marks consists of  a set of m integers 0 = x 1 < x 2 <... < x m  the m (m − 1)/2 differences x j − x i are all different  Objective: find a ruler with minimum length x m  First viewpoint: variables x 1, x 2,…, x m  x j − x i ≠ x l − x k for all distinct pairs  x 1 < x 2 <... < x m  Second viewpoint: variables d ij, 1 ≤ i < j ≤ m  allDifferent( d 11, d 12, …, d m-1,m )  d ik = d ij + d jk for 1 ≤ i < j < k ≤ m  Channelling constraints: d ij = x j − x i

CP Summer School Constraints in Combined Viewpoints  It is safe to combine two complete models of a problem, with channelling constraints  But often unnecessary and inefficient  If some constraints are more easily expressed in one viewpoint, we don’t need them in both  e.g. nurse rostering  constraints on nurse availability are stated in the ‘nurse’ viewpoint  constraints on work requirements (e.g. no. of nurses required for each shift) are stated in the ‘shift’ viewpoint  or if they propagate better in one viewpoint  e.g. x j −x i ≠ x l −x k v. allDifferent( d 11, d 12,…, d m-1,m ) in the Golomb ruler problem

CP Summer School Choosing the Search Variables  We need to choose a set of variables such that an assignment to each one, satisfying the constraints, will give a complete solution to the problem  Assume we pass the search variables to the search algorithm in a list or array  the order defines a static variable ordering  though we can still use a dynamic ordering

CP Summer School Search Variables  When a model combines two (or more) viewpoints of a problem, which variables should drive the search?  Assigning values to either set of variables would be sufficient to solve the problem  even if we did not express the problem constraints on those variables  the channelling constraints ensure that we can assign values to one set of variables but define the constraints in the other viewpoint, if we want

CP Summer School Search Variables – Permutation Problems  We can use both sets of variables as search variables  e.g. use a dynamic variable order e.g. variable with smallest domain in either viewpoint  combines variable and value ordering: the dual variable with smallest domain corresponds (in the other viewpoint) to the value occurring in fewest domains

CP Summer School SONET Problem: Viewpoints  Whether a given node is on a given ring:  x ij = 1 if node i is on ring j  Which ring(s) each node is on:  N i = set of rings node i is on  Which nodes are on each ring  R j = set of nodes on ring j  In principle, any of these viewpoints could be the basis of a complete CSP model  channelling constraints (x ij = 1) ≡ (i  R j ) ≡ (j  N i )  There are also auxiliary variables  n i = the number of rings each node is on ( = | N i |)

CP Summer School Possible Choices  Use just one set of variables, e.g. x ij – the others are just for constraint propagation  Use two (or more) sets of variables (of the same type) e.g. R j,N i  interleave them in a sensible (static) order  or use a dynamic ordering applied to both sets of variables  Use an incomplete set of variables first, to reduce the search space before assigning a complete set  e.g. decide how many rings each node is on (search variables n i ) and then which rings each node is on ( x ij )  another strategy adds assigning the objective variable first – see earlier

CP Summer School Automating Modelling  There are lots of choices to make in modelling a problem as a CSP  difficult even with experience  Can it be automated?  some initial steps so far  e.g. systems that propose models given a high- level specification  descriptions of common patterns in modelling

CP Summer School Advice from the Folklore  Reduce the number of variables  if we only use one viewpoint:  a model which needs fewer variables to describe the solutions to the problem is likely to be a better model  e.g. an integer model is probably better than a Boolean model  But only if the variables allow the constraints to be expressed in a way that propagates well  artificially reducing the number of variables by inventing a single variable to replace a pair of variables will not give a better model

CP Summer School Advice from the Folklore 2  Reduce the number of constraints  One viewpoint in the magic squares problem has far more constraints than the other  rewriting a set of constraints in a more compact form is likely to be beneficial, if the resulting constraints can propagate efficiently  e.g. combine constraints with the same scope  use a global constraint to replace a set of constraints  But simply conjoining constraints for the sake of reducing their number will not give a better model if the new constraints cannot propagate efficiently

CP Summer School More Advice  Add more variables  auxiliary variables to allow constraints to be expressed  new viewpoints allowing a different perspective on the problem  Add more constraints  implied constraints  channelling constraints to link new variables  Check empirically  that a change does reduce run-time

CP Summer School Conclusion  Aim for a rich model  multiple viewpoints  auxiliary variables  implied constraints  Understand the problem as well as you can  build that insight into the model  the better you can understand a problem, the better you can solve it THE END