of 56

• date post

06-Jan-2016
• Category

## Documents

• view

17

2

Embed Size (px)

description

Constraint Satisfaction 101. CSCE496/896, Fall 2011 www.cse.unl.edu/~choueiry/F11-496-896 Questions : cse496cp@cse.unl.edu Broadcast : cse496cp-ml@cse.unl.edu Berthe Y. Choueiry (Shu-we-ri) AVH 360. Outline. Motivating example, application areas CSP: Definition, representation - PowerPoint PPT Presentation

### Transcript of CSCE496/896, Fall 2011 cse.unl/~choueiry/F11-496-896 Questions : cse496cp@cse.unl

Foundations of Constraint Processing CSCE421/821, Fall 2003Overview 1
Overview 1
Basic solving techniques
(Implementing backtrack search)
Issues & research directions
Overview 1
Context: You are a senior in college
Problem: You need to register in 4 courses for the Spring semester
Possibilities: Many courses offered in Math, CSE, EE, CBA, etc.
Constraints: restrict the choices you can make
Unary: Courses have prerequisites you have/don't have Courses/instructors you like/dislike
Binary: Courses are scheduled at the same time
n-ary: In CE: 4 courses from 5 tracks such as at least 3 tracks are covered
You have choices, but are restricted by constraints
Make the right decisions!!
Overview 1
A set of variables: 4 courses at UNL
For each variable, a set of choices (values)
A set of constraints that restrict the combinations of values the variables can take at the same time
Questions
Does a solution exist? (classical decision problem)
How two or more solutions differ? How to change specific choices without perturbing the solution?
If there is no solution, what are the sources of conflicts? Which constraints should be retracted?
etc.
Overview 1
Temporal and spatial reasoning
Planning, scheduling, resource allocation
Molecular biology
Transportation
Overview 1
Solving a decision problem…
… While allowing the user to state arbitrary constraints in an expressive way and
Providing concise and high-level feedback about alternatives and conflicts
Related areas:
Overview 1
Overview 1
Overview 1
Basic solving techniques
Overview 1
Given:
Query/Question:
Example: Find x such that the condition y is satisfied
How about the Constraint Satisfaction Problem?
Overview 1
Overview 1
V is a set of variables,
D is a set of variable domains (domain values)
C is a set of constraints,
Query: can we find a value for each variable such that all constraints are satisfied?
Overview 1
Overview 1
Find number of/all solutions counting problem
Find a set of constraints that can be removed so that a solution exists optimization problem
Etc.
Overview 1
Domains:
Finite (discrete), enumeration works
Consistency techniques on domain bounds
Overview 1
Overview 1
Constraint Network (graph, hypergraph)
Overview 1
CSP Representation (II)
Constraint Definition
Overview 1
A constraint C is defined by
A scope, the set of variables on which the constraint applies
Notation: SCOPE(C), scope(C), scp(C)
A relation, a subset of the Cartesian product of the domains of the variables in the scope of the constraint
Notation: RELATION(C), rel(C)
Unary, binary, ternary,…, global
Relation Definition
Overview 1
As a list of allowed tuples (supports, positive table)
As a list of forbidden tuples (conflicts, no-goods)
Intension, given by a set builder
When it is not practical or possible to list all tuples
Define types/templates of common constraints to be used repeatedly
Examples: linear constraints, All-Diff (mutex), Atmost, TSP-constraint, cycle-constraint, etc.
Overview 1
Overview 1
Binary matrix (bit-matrix)
Overview 1
Basic solving techniques
Overview 1
Overview 1
Example III: Map coloring
Using 3 colors (R, G, & B), color the US map such that no two adjacent states have the same color
Variables?
Domains?
Constraints?
Overview 1
Example III: Map coloring (cont’d)
Using 3 colors (R, G, & B), color the US map such that no two adjacent states have the same color
Overview 1
Overview 1
{ a, b, c }
{ b, c, d }
Overview 1
{ R1, R3 }
{ b, c, d }
Overview 1
O+O = R+10X1
X3=F
Alldiff({F,D,U,V,R,O})
Overview 1
Overview 1
Domain covered by each characteristic (values)
Relations among the components (constraints)
A set of required functionalities (more constraints)
Find: a product configuration
that realizes the required functionalities
Overview 1
Overview 1
Given:
Four musicians: Fred, Ike, Mike, and Sal, play bass, drums, guitar and keyboard, not necessarily in that order.
They have 4 successful songs, ‘Blue Sky,’ ‘Happy Song,’ ‘Gentle Rhythm,’ and ‘Nice Melody.’
Ike and Mike are, in one order or the other, the composer of ‘Nice Melody’ and the keyboardist.
etc ...
Query: Who plays which instrument and who composed which song?
Overview 1
Overview 1
Formulation 1:
Gentle Rhythm and Nice Melody.
Domains: Fred, Ike, Mike, Sal
Constraints: …
Domains:
Constraints: …
Overview 1
Example V & VI: elements of C must be made explicit
{1, 2, 3, 4}
Overview 1
View materialization is a CSP
Example VIII: Interactive systems
Graphical user interfaces
Overview 1
Overview 1
Basic solving techniques
Overview 1
Overview 1
Overview 1
Overview 1
Show that 1 is in NP
Given a problem 1 in NP, show that an known NP-complete problem 2 can be efficiently reduced to 1
Select a known NP-complete problem 2 (e.g., SAT)
Construct a transformation f from 2 to 1
Prove that f is a polynomial transformation
(Check Chapter 3 of Garey & Johnson)
Overview 1
Overview 1
Term: Boolean variable
Question: Find an assignment of truth values to the Boolean variables such the sentence is satisfied.
Overview 1
Overview 1
Verifying that an assignment for all variables is a solution
Provided constraints can be checked in polynomial time
Reduction from 3SAT to CSP
Many such reductions exist in the literature (perhaps 7 of them)
Overview 1
Overview 1
Notation: variable-value pair = vvp
vvp term
V1 = {a, b, c, d} yields x1 = (V1, a), x2 = (V1, b), x3 = (V1, c), x4 = (V1, d),
V2 = {a, b, c} yields x5 = (V2, a), x6 = (V2, b), x7 = (V2,c).
The vvp’s of a variable disjunction of terms
V1 = {a, b, c, d} yields
(Optional) At most one VVP per variable
Overview 1
Overview 1
For example: how many?
Each constraint disjunction of these conjunctions
transform into conjunctive normal form (CNF)
Question: find a truth assignment of the Boolean variables such that the sentence is satisfied
Overview 1
Overview 1
Basic solving techniques
Overview 1
Search
Overview 1
Overview 1
Preprocessing
Overview 1
Overview 1
Overview 1
Overview 1
3-consistency, k-consistency (k n)
Eliminate non-acceptable tuples prior to search
Warning: arc-consistency does not solve the problem
still is not a solution!
Overview 1
Overview 1
Consider all values for a variable V1
For every value for V1, consider all values for V2
etc..
Maximum depth? fixed!
Maximum number of paths? size of search space, size of CSP
Overview 1
Overview 1
Are all possibilities acceptable?
This yields early pruning of inconsistent paths
Overview 1
Overview 1
Depth-first search & Chronological backtracking
Overview 1
Systematic search: Intelligent backtracking
What if the reason for failure was higher up in the tree?
Backtrack to source of conflict !!
Backjumping, conflict-directed backjumping, etc.
Overview 1
Heuristics:
most promising value first (find quickly first solution)
Overview 1
Overview 1
Root node
Overview 1
1
Q
3
Q
4
Q
Overview 1
Look-ahead techniques: propagate constraints as variables are instantiated
Overview 1
Overview 1
Binary branching
One branch for all the remaining values in the domain
Used in commercial constraint solvers: ILOG, Eclipse
Have different behaviors (e.g., WRT value ordering heuristics [Smith, IJCAI 95] )
Overview 1
Overview 1
Back-checking: expands nodes consistent with past
Backtracking: Chronological vs. intelligent
Overview 1
Overview 1
Modeling: abstraction and reformulation
Systematic search:
chronological backtracking
intelligent backtracking
Overview 1
Overview 1
Non-Systematic Search
Iterative repair, local search: modifies a global but inconsistent solution to decrease the number of violated constraints
Examples: Hill climbing, taboo search, simulated annealing, GSAT, WalkSAT, Genetic Algorithms, Swarm intelligence, etc.
Features: Incomplete & not sound
Overview 1
Overview 1
Basic solving techniques