Arc consistency (slides5) Flashcards
arc consistency
simplest form of propagation makes each arc consistent
X–>Y is consistent iff
-for every value x of X there is some allowed y
-If X loses a value, neighbors of X need to be rechecked
arc consistency properties
detects failure earlier than forward checking
can be run as a preprocessor or after each assignment
Generalized Arc Consistency (GAC)
implementation of Arc Consistency
GACSupport
does a value v for variable X have support in constraint c?
IsItGAC
does GACSupport answer yes for every value in the domain of each variable of a constraint c?
NoGACWipeout
are there non empty subsets of the domains of the variables such that IsItGAC answer yes?
MaxGAC
will IsItGAC answer yes for the domains of the variables and no for every superset of the domains
GACDomain
return the domains of the variables such that MaxGAC will answer yes
arc consistency algorithm
receives a binary CSP as input and returns the CSP possibly with reduced domains
main function is AC-3
calls RM-Inconsistent -Values function
function AC-3
function AC-3(csp) returns the CSP , possibly with reduced domains inputs: csp, a binary CSP with variables {X1,X2,...,Xn} local variables: queue: a queue of arcs, initially all the arcs in csp
while queue is not empty do
- (Xi,Xj)<–Remove-First(queue)
- if RM-Inconsistent-Values(Xi,Xj) then
- -for each Xk in Neighbors[Xi] do
- –add(Xk,Xi) to queue
function RM-Inconsistent-Values
function RM-Inconsistent-Values(Xi,Xj) returns true iff remove a value removed<--true return removed
complexity of AC-3
for binary constraint networks Time: O(ed^3) and O(n^2d^3) since e=O(n^2) -n = number of variables -e = number of constraints -d = domain size
Space: O(e): the queue contains at most e elements
Directional arc Consistency (DAC)
observation 1: arc revisions have a directional character but CSP is not directional
obs2: AC has to repeat arc revisions; the total number of revisions depends on the number of arcs but also on the size of domains
Definition: A binary CSP is directional arc consistent using a given order of variables iff for every constraint c(Xi,Xj) such that Xi<Xj the (Xi,Xj) is arc consistent
Algorithm DAC-1
1) Consistency of the constraint is required just in one direction
2) Variables are ordered
if the arc are explored in a “good” order, no revision has to be repeated!
how to use DAC setup
-AC is stronger than DAC(if CSP is AC then it is DAC as Well)
-is it useful?
–DAC-1 is much faster than any algorithm for AC
–there exist problems where DAC is enough
Example: if the constraint graph forms a tree then DAC is enough to solve the problem without backtracks
-how to order the vertices for DAC?
-How to order the vertices for search?