You are on page 1of 1

4.

2 Node and Arc-consistency Achieving Algorithms 81

PROCEDURE NC-1(Z, D, C)
BEGIN
FOR each x in Z
FOR each v in Dx
IF NOT satisfies((<x,v>), Cx)
THEN Dx ← Dx − {v};
return(Z, D, C); /* certain Dx may be updated */
END /* of NC-1 */

When NC-1 terminates, the original problem is reduced to one which satisfies node-
consistency. This is obtained by removing from each domain values which do not
satisfy the unary constraint of the variable represented by that node. (If the domains
are represented by functions, then the role of NC-1 is to modify those functions.)
Let a be the maximum size of the domains and n be the number of variables in the
problem. Since every value is examined once, the time complexity of NC-1 is
O(an).

4.2.2 A naive algorithm for achieving AC

By achieving arc-consistency (AC, see Definition 3-9) one can potentially remove
more redundant values from the domains than in applying NC-1. The Waltz filtering
algorithm is basically an algorithm which achieves AC, and it has been demon-
strated to be effective in many applications. A naive AC achievement algorithm,
called AC-1 in the literature, is shown below:

PROCEDURE AC-1(Z, D, C)
BEGIN
NC-1(Z, D, C); /* D is possibly updated */
Q ← {x→y | Cx,y ∈ C}
/* x→y is an arc; Cy,x is the same object as Cx,y */
REPEAT
Changed ← False;
FOR each x→y ∈ Q DO
Changed ← (Revise_Domain(x→y, (Z, D, C)) OR
Changed);
/* side effect of Revise_Domain: Dx may be reduced */
UNTIL NOT Changed;
return(Z, D, C);
END /* of AC-1 */

Q is the list of binary-constraints to be examined, where the variables in the binary

You might also like