Professional Documents
Culture Documents
AC-1 could be very inefficient because the removal of any value from any domain
would cause all the elements of Q to be re-examined. This algorithm is improved to
AC-2, and AC-3 in the literature. The idea behind these algorithms is to examine
only those binary-constraints which could be affected by the removal of values. We
shall skip AC-2 (as it uses a similar principle but is inferior to AC-3 in time com-
plexity), and look at AC-3 below:
If Revise_Domain((x,y)) removes any value from the domain of x, then the domain
of any third variable z which is constrained by x must be examined. This is because
the removed value may be the only one which is compatible with some values c in
the domain of z (in which case, c has to be removed). That is why z→x (except
when z = y) is added to the queue Q if Revise_Domain(x→y, (Z, D, C)) returns True.
y→x is not added to Q as Dx was reduced because of y. This will not, in turn, cause
Dy to be reduced.
In the worst case, each call of Revise_Domain deletes one value from a domain.
Each arc x→y will be processed only when the domain of y is reduced. Since we
assume that the constraint graph has 2e arcs, and the maximum size of the domain
of the variables is a, a maximum of 2ea arcs will be added to Q. With each call of
Revise_Domain examining a2 pairs of labels, the upper bound of the time complex-