CP Summer School 2008 1 Modelling for Constraint Programming Barbara Smith 2. Implied Constraints, Optimization, Dominance Rules.

Slides:



Advertisements
Similar presentations
Solve Your Problem Faster - by changing the model
Advertisements

Non-Binary Constraint Satisfaction Toby Walsh Cork Constraint Computation Center.
ISN Workshop September 2003 Constraint Programming in Practice: Scheduling a Rehearsal Barbara Smith.
Constraint Satisfaction Problems Russell and Norvig: Chapter
Local Search Jim Little UBC CS 322 – CSP October 3, 2014 Textbook §4.8
Lecture 11 Last Time: Local Search, Constraint Satisfaction Problems Today: More on CSPs.
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
Iterative Deepening A* & Constraint Satisfaction Problems Lecture Module 6.
Transportation Problem (TP) and Assignment Problem (AP)
Constraint Optimization Presentation by Nathan Stender Chapter 13 of Constraint Processing by Rina Dechter 3/25/20131Constraint Optimization.
Optimal Rectangle Packing: A Meta-CSP Approach Chris Reeson Advanced Constraint Processing Fall 2009 By Michael D. Moffitt and Martha E. Pollack, AAAI.
Review: Constraint Satisfaction Problems How is a CSP defined? How do we solve CSPs?
5-1 Chapter 5 Tree Searching Strategies. 5-2 Satisfiability problem Tree representation of 8 assignments. If there are n variables x 1, x 2, …,x n, then.
Branch & Bound Algorithms
EMIS 8373: Integer Programming Valid Inequalities updated 4April 2011.
Best-First Search: Agendas
Transforming and Refining Abstract Constraint Specifications Alan Frisch, Brahim Hnich*, Ian Miguel, Barbara Smith, and Toby Walsh *Cork Constraint Computation.
Branch and Bound Searching Strategies
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.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
Ryan Kinworthy 2/26/20031 Chapter 7- Local Search part 1 Ryan Kinworthy CSCE Advanced Constraint Processing.
Nov 14 th  Homework 4 due  Project 4 due 11/26.
Constraint Satisfaction Problems
ENEE 6441 On Quine-McCluskey Method > Goal: find a minimum SOP form > Why We Need to Find all PIs? f(w,x,y,z) = x’y’ +wxy+x’yz’+wy’z = x’y’+x’z’+wxy+wy’z.
MAE 552 – Heuristic Optimization Lecture 26 April 1, 2002 Topic:Branch and Bound.
2-Layer Crossing Minimisation Johan van Rooij. Overview Problem definitions NP-Hardness proof Heuristics & Performance Practical Computation One layer:
1 Branch and Bound Searching Strategies 2 Branch-and-bound strategy 2 mechanisms: A mechanism to generate branches A mechanism to generate a bound so.
CSE 550 Computer Network Design Dr. Mohammed H. Sqalli COE, KFUPM Spring 2007 (Term 062)
Iterative Flattening in Cumulative Scheduling. Cumulative Scheduling Problem Set of Jobs Each job consists of a sequence of activities Each activity has.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding ILPs with Branch & Bound ILP References: ‘Integer Programming’
Constraint Satisfaction Problems
Decision Procedures An Algorithmic Point of View
Fixed Parameter Complexity Algorithms and Networks.
CP Summer School Modelling for Constraint Programming Barbara Smith 1.Definitions, Viewpoints, Constraints 2.Implied Constraints, Optimization,
Solving the Concave Cost Supply Scheduling Problem Xia Wang, Univ. of Maryland Bruce Golden, Univ. of Maryland Edward Wasil, American Univ. Presented at.
Representing and Using Graphs
Local Search CPSC 322 – CSP 5 Textbook §4.8 February 7, 2011.
Modelling for Constraint Programming Barbara Smith CP 2010 Doctoral Programme.
Chapter 5 Section 1 – 3 1.  Constraint Satisfaction Problems (CSP)  Backtracking search for CSPs  Local search for CSPs 2.
Hande ÇAKIN IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS.
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.
Constraints and Search Toby Walsh Cork Constraint Computation Centre (4C) Logic & AR Summer School, 2002.
Chapter 2) CSP solving-An overview Overview of CSP solving techniques: problem reduction, search and solution synthesis Analyses of the characteristics.
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.
Arc Consistency CPSC 322 – CSP 3 Textbook § 4.5 February 2, 2011.
1. 2 Outline of Ch 4 Best-first search Greedy best-first search A * search Heuristics Functions Local search algorithms Hill-climbing search Simulated.
Chapter 5 Team Teaching AI (created by Dewi Liliana) PTIIK Constraint Satisfaction Problems.
EXAMPLE: MAP COLORING. Example: Map coloring Variables — WA, NT, Q, NSW, V, SA, T Domains — D i ={red,green,blue} Constraints — adjacent regions must.
Introduction to Integer Programming Integer programming models Thursday, April 4 Handouts: Lecture Notes.
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.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
1 Chapter 6 Reformulation-Linearization Technique and Applications.
1 Constraint Satisfaction Problems (CSP). Announcements Second Test Wednesday, April 27.
The NP class. NP-completeness
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
The minimum cost flow problem
Computer Science cpsc322, Lecture 14
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Branch and Bound.
Artificial Intelligence
Constraints and Search
Constraint satisfaction problems
Constraint satisfaction problems
Integer LP: Algorithms
Presentation transcript:

CP Summer School Modelling for Constraint Programming Barbara Smith 2. Implied Constraints, Optimization, Dominance Rules

CP Summer School Implied Constraints  Implied constraints are logical consequences of the set of existing constraints  So are logically redundant (sometimes called redundant constraints)  They do not change the set of solutions  Adding implied constraints can reduce the search effort and run-time

CP Summer School Example: Car Sequencing  Existing constraints only say that the option capacities cannot be exceeded  but we can’t go too far below capacity either  Suppose there are 30 cars, and 12 require option 1 (capacity 1 car in 2)  At least one car in slots 1 to 8 of the production sequence must have option 1  otherwise 12 of cars 9 to 30 will require option 1, i.e. too many  Cars 1 to 10 must include at least two option 1 cars,..., and cars 1 to 28 must include at least 11 option 1 cars  These are implied constraints

CP Summer School Useful Implied Constraints  An implied constraint reduces search if:  at some point during search, a partial assignment will fail because of the implied constraint  without the implied constraint, the search would continue  the partial assignment cannot lead to a solution  the implied constraint forbids it, but does not change the set of solutions  In car sequencing, partial assignments with option 1 under- used could be explored during search, without the implied constraints

CP Summer School Useless Implied Constraints  The assignments forbidden by an implied constraint may never actually arise  depends on the search order  e.g. in car sequencing,  at least one of cars 1 to 8 must require option 1  any 8 consecutive cars must have one option 1 car  but if the sequence is built up from slot 1, only the implied constraints on slots 1 to k can cause the search to backtrack  If we find a class of implied constraints, maybe only some are useful  adding a lot of constraints that don’t reduce search will increase the run-time

CP Summer School Implied Constraints v. Global Constraints  Régin and Puget (CP97) developed a global constraint for sequence problems, including the car sequencing problem  “our filtering algorithm subsumes all the implied constraints” used by Dincbas et al.  Implied constraints may only be useful because a suitable global constraint does not (yet) exist  But many implied constraints are simple and quick to propagate  Use a global constraint if there is one available and it is cost-effective  but look for useful implied constraints as well

CP Summer School Implied Constraints Example- Optimizing SONET Rings  Transmission over optical fibre networks  Known traffic demands between pairs of client nodes  A node is installed on a SONET ring using an ADM (add-drop multiplexer)  If there is traffic demand between 2 nodes, there must be a ring that they are both on  Rings have capacity limits (number of ADMs, i.e. nodes, & traffic)  Satisfy demands using the minimum number of ADMs

CP Summer School Simplified SONET Problem  Split the demand graph into subgraphs (SONET rings):  every edge is in at least one subgraph  a subgraph has at most 5 nodes  minimize total number of nodes in the subgraphs

CP Summer School Implied Constraints on Auxiliary Variables  The viewpoint variables are Boolean variables, x ij, such that x ij = 1 if node i is on ring j  Introduce an auxiliary variable for each node: n i = number of rings that node i is on  We can derive implied constraints on these variables from subproblems  a node and its neighbours  a pair of nodes and their neighbours

CP Summer School Implied Constraints: SONET  A node i with degree in the demand graph > 4 must be on more than 1 ring (i.e. n i > 1 )  If a pair of connected nodes k, l have more than 3 neighbours in total, at least one of the pair must be on more than 1 ring (i.e. n k +n l > 2 )

CP Summer School Implied Constraints & Consistency  Implied constraints can often be seen as partially enforcing some higher level of consistency:  during search, consistency is maintained only on single constraints  some forms of consistency checking take all the constraints on a subset of the variables and remove inconsistent tuples  Enforcing consistency on more than one constraint is computationally expensive, even if only done before search  often no inconsistent tuples would be found  any that are found may not reduce search  forbidden tuples are hard to handle in constraint solvers

CP Summer School Implied Constraints & Nogoods  A way to find implied constraints is to see that incorrect compound assignments are being explored  e.g. by examining the search in detail  Implied constraints express & generalize what is incorrect about these assignments  So implied constraints are like nogoods (inconsistent compound assignments)  whenever the search backtracks, a new nogood has been found  but the same compound assignment will not occur again  If we could learn implied constraints in this way, they would take account of the search heuristics

CP Summer School Finding Useful Implied Constraints  Identify obviously wrong partial assignments that may/do occur during search  Try to predict them by contemplation/intuition  Observe the search in progress  Having auxiliary variables in the model enables observing/thinking about many possible aspects of the search  Check empirically that new constraints do reduce both search and running time

CP Summer School Optimization  A Constraint Satisfaction Optimization Problem (CSOP) is:  a CSP  X,D,C   and an optimization function f mapping every solution to a numerical value  find the solution T such that the value of f(T) is maximized (or minimized, depending on the requirements)

CP Summer School Optimization: Branch and Bound  Include a variable, say t, for the objective f(T)  Include constraints (and maybe new variables) linking the existing variables and t  Find a solution with value (say) t 0  Add a constraint t < t 0 (if minimizing)  Find a new solution  Repeat last 2 steps  When there is no solution, the last solution found has been proved optimal  (Or if you know a good bound on the optimal value, maybe you can recognise an optimal solution when you find it)

CP Summer School Optimization as a Sequence of CSPs  Sometimes, optimization problems are solved as a sequence of decision problems  e.g find the matrix with the smallest number of rows that satisfies certain constraints  model with variables x ij to represent each entry in the matrix  the objective is a parameter of the model, not a variable  so solve a sequence of CSPs with increasing matrix size until a solution is found  the solution is optimal

CP Summer School Objective as a Search Variable  If the objective is a variable, it can be a search variable  e.g. in the SONET problem:  x ij = 1 if node i is on ring j  n i = number of rings that node i is on  t (objective) = sum of n i variables = total number of ADMs used  search strategy  assign the smallest available value to t  assign values to n i variables  assign values to x ij variables  backtrack to choose a larger value of t if search fails  the first solution found is optimal

CP Summer School Optimization: Dominance Rules  A compound assignment that satisfies the constraints can be forbidden if it is dominated:  for any solution that this assignment would lead to, there must be another solution that is equally good or better  Dominance rules are similar to implied constraints but  are not logical consequences of the constraints  do not necessarily preserve the set of optimal solutions

CP Summer School Finding Dominance Rules  Useful dominance rules are often very simple and obvious  in satisfaction problems, search heuristics should guide the search away from obviously wrong compound assignments  in optimization problems, to prove optimality we have to prove that there is no better solution  every possibility allowed by the constraints has to be explored  Examples from the SONET problem  no ring should have just one node on it  any two rings must have more than 5 nodes in total (otherwise we could merge them)

CP Summer School Summary  Implied constraints can be very useful in allowing infeasible subproblems to be detected earlier  Make sure they are useful  they do reduce search  they do reduce the run-time  there is no global constraint that could do the same job  Optimization requires new solving strategies  usually need to find a sequence of solutions  to prove optimality, we often have to prove a problem unsatisfiable  dominance rules can help