Back to CSP Topics

Forward Checking

Advanced Constraint Propagation in CSP Solving

What is Forward Checking?

🔄 Core Concept:

Forward Checking is a constraint propagation technique that maintains consistency by immediately removing inconsistent values from the domains of unassigned variables whenever a new assignment is made.

  • Immediate Propagation: Update domains instantly after each assignment
  • Early Failure Detection: Detect impossible situations before exploring further
  • Search Space Reduction: Dramatically reduce backtracking
⚡ How It Works:
  1. Assign a value to variable X
  2. Propagate constraints to all neighbors of X
  3. Eliminate inconsistent values from neighbor domains
  4. Check for empty domains (early failure detection)
  5. Continue or backtrack based on domain status

Example 1: Regional Map Coloring with Forward Checking

Watch how Forward Checking immediately reduces domains of neighboring regions when you assign a color, dramatically reducing the search space and detecting conflicts early.

Interactive Map with Forward Checking
A B C D E F
Forward Checking Stats
Regions Assigned
0
Domain Eliminations
0
Early Failures Detected
0
Current Domain Status
Forward Checking Log

Example 2: N-Queens with Forward Checking