Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

4.

2 Node and Arc-consistency Achieving Algorithms 87

PROCEDURE AC-4(Z, D, C)
BEGIN
/* step 1: construction of M, S, Counter and LIST */
M ← 0; S ← { };
FOR each Ci,j in C DO /* Note: Ci,j and Cj,i are the same object */
FOR each b in Di DO /* examine <i,b> using variable j */
BEGIN
Total ← 0;
FOR each c in Dj DO
IF satisfies((<i,b><j,c>), CE({i,j})) THEN
BEGIN
Total ← Total + 1;
S<j,c> ← S<j,c> + {<i,b>};
/* <i,b> gives support to <j,c> */
END;
IF (Total = 0) THEN /* reject <i,b> */
BEGIN
M[i,b] ← 1;
Di ← Di − {b};
END
ELSE Counter[(i, j), b] ← Total;
/* support <i,b> receives from j */
END
LIST ← {<i,b> | M[i,b] = 1} ;
/* LIST = set of rejected labels awaiting processing */
/* step 2: remove unsupported labels */
WHILE LIST ≠ { } DO
BEGIN
pick any label <j,c> from LIST; LIST ← LIST − {<j,c>};
FOR each <i,b> in S<j,c> DO
BEGIN
Counter[(i, j), b] ← Counter[(i, j), b] − 1;
IF ((Counter[(i, j), b] = 0) AND (M[i, b] = 0)) THEN
BEGIN
LIST ← LIST + {<i,b>};
M[i,b] ← 1;
Di ← Di − {b};
END;
END
END
return(Z, D, C);
END /* of AC-4 */

You might also like