Explore Library
Code QuizAdvanced

AC-3 Revise Inverted Test

The AC-3 revise step removes values that actually have support.

Codejavascript
// Remove values of xi with no consistent partner in xj
function revise(domains, xi, xj, constraint) {
  let revised = false;
  for (const x of [...domains[xi]]) {
    if (domains[xj].some(y => constraint(x, y))) {
      domains[xi] = domains[xi].filter(v => v !== x);
      revised = true;
    }
  }
  return revised;
}

Arc consistency deletes valid values and keeps unsupported ones. What is the bug?