CSPS: Arc Consistency
CSPS: Arc Consistency
Consistency
Arc Consistency
Textbook 4.5
Recap
Consistency
Arc Consistency
Lecture Overview
Recap
Consistency
Arc Consistency
Recap
Consistency
Arc Consistency
Denition
A constraint satisfaction problem consists of: a set of variables a domain for each variable a set of constraints
Denition
A model of a CSP is an assignment of values to variables that satises all of the constraints.
Recap
Consistency
Arc Consistency
We map CSPs into search problems: nodes: assignments of values to a subset of the variables neighbours of a node: nodes in which values are assigned to one additional variable start node: the empty assignment (no variables assigned values) goal node: a node which assigns a value to each variable, and satises all of the constraints Note: the path to a goal node is not important
Recap
Consistency
Arc Consistency
Lecture Overview
Recap
Consistency
Arc Consistency
Recap
Consistency
Arc Consistency
Consistency Algorithms
Idea: prune the domains as much as possible before selecting values from them.
Denition
A variable is domain consistent if no value of the domain of the node is ruled impossible by any of the constraints. Example: dom(B ) = {1, 2, 3, 4} isnt domain consistent if we have the constraint B = 3.
Recap
Consistency
Arc Consistency
Constraint Networks
Domain consistency only talked about constraints involving a single variable
what can we say about constraints involving multiple variables?
Denition
A constraint network is dened by a graph, with one node for every variable one node for every constraint and undirected edges running between variable nodes and constraint nodes whenever a given variable is involved in a given constraint. When all of the constraints are binary, constraint nodes are not necessary: we can drop constraint nodes and use edges to indicate that a constraint holds between a pair of variables.
why cant we do the same with general k -ary constraints?
CSPs: Arc Consistency CPSC 322 CSPs 3, Slide 7
Recap
Consistency
Arc Consistency
A<B
B<C
Recap
Consistency
Arc Consistency
Lecture Overview
Recap
Consistency
Arc Consistency
Recap
Consistency
Arc Consistency
Arc Consistency
Denition
) is arc consistent if for each value of X in An arc X, r(X, Y in dom(Y ) such that r(X, Y ) is dom(X ) there is some value Y satised. ) such that r(X, Y dom(Y ) In symbols, X dom(X ), Y is satised. A network is arc consistent if all its arcs are arc consistent. is not arc consistent, all values of X in If an arc X, Y ) dom(X ) for which there is no corresponding value in dom(Y may be deleted from dom(X ) to make the arc X, Y consistent.
This removal can never rule out any models (do you see why?)
CSPs: Arc Consistency CPSC 322 CSPs 3, Slide 10
Recap
Consistency
Arc Consistency
Recap
Consistency
Arc Consistency
Regardless of the order in which arcs are considered, we will terminate with the same result: an arc consistent network. Worst-case complexity of this procedure:
let the max size of a variable domain be d let the number of constraints be e complexity is O(ed3 )
Recap
Consistency
Arc Consistency
Recap
Consistency
Arc Consistency
When we change the domain of a variable X in the course of making an arc X, r arc consistent, we add every arc Z, r where r involves X and:
r=r Z=X
Recap
Consistency
Arc Consistency
When we change the domain of a variable X in the course of making an arc X, r arc consistent, we add every arc Z, r where r involves X and:
r=r Z=X
We dont add back other arcs that involve the same variable X
Weve just reduced the domain of X If an arc X, r was arc consistent before, it will still be arc consistent
in the for all well just check fewer values
Recap
Consistency
Arc Consistency
We dont add back other arcs that involve the same constraint and a dierent variable:
Imagine that such an arcinvolving variable Y had been arc consistent before, but was no longer arc consistent after X s domain was reduced. This means that some value in Y s domain could satisfy r only when X took one of the dropped values But we dropped these values precisely because there were no values of Y that allowed r to be satised when X takes these valuescontradiction!
CSPs: Arc Consistency CPSC 322 CSPs 3, Slide 14
Recap
Consistency
Arc Consistency
dom(A) = {1, 2, 3, 4}; dom(B ) = {1, 2, 3, 4}; dom(C ) = {1, 2, 3, 4} Suppose you rst select the arc A, A < B .
Remove A = 4 from the domain of A. Add nothing to T DA.
The other two edges are arc consistent, so the algorithm terminates with dom(A) = {1, 2}, dom(B ) = {2, 3}, dom(C ) = {3, 4}.
CSPs: Arc Consistency CPSC 322 CSPs 3, Slide 15