CSP Filtering

Filtering improves CSP performance by pruning variable domains early, reducing the number of branches that violate constraints during backtracking search. Instead of waiting to discover a contradiction deep in the search tree, filtering anticipates conflicts and eliminates them ahead of time. There are multiple approaches to this:

  • Forward checking immediately prunes values that violate binary constraints from a variable ‘s unassigned neighbors. It does so by checking if ‘s domain still has at least one valid value. If a neighbor’s domain becomes empty, a backtrack is triggered.
    ⠀
  • Arc consistency (AC-3) is a generalized version of forward checking, such that every value of a variable should be “supported” by at least one compatible value in each of its neighbors. In other words, given an arc :
  1. Begin by storing all arcs in a queue .
  2. While or :
  • Pop an arc .
  • Enforce the condition that for every value , there exists some such that satisfies all constraints.
    • If no such exists, remove from ’s domain.
  • If at least one value is removed for  when enforcing arc consistency for an arc , add arcs of the form  to  for all unassigned variables . Do not add duplicate arcs.
  1. Perform a backtracking search if .
    ⠀
  • -Consistency is a generalized version of AC-3