Constraint Satisfaction Problem
in AI
Overview of CSP and Applications
Key Components of CSP
• 1. Variables: Unknowns to assign values to
• 2. Domains: Possible values each variable can
take
• 3. Constraints: Rules that variables must
satisfy
Example Problem: Map Coloring
• Variables: WA, NT, SA, Q, NSW, V, T
• Domains: {Red, Green, Blue}
• Constraints:
• - WA ≠ NT, WA ≠ SA
• - NT ≠ SA, NT ≠ Q
• - SA ≠ Q, SA ≠ NSW, SA ≠ V
• - Q ≠ NSW, NSW ≠ V
Types of Constraints
• 1. Unary Constraints: Involve a single variable
(e.g., X ≠ 3)
• 2. Binary Constraints: Involve two variables
(e.g., X ≠ Y)
• 3. Global Constraints: Involve more than two
variables (e.g., AllDifferent(X, Y, Z))
Solving Techniques
• 1. Backtracking Search: Assign values and
backtrack if needed
• 2. Forward Checking: Remove invalid values
from future domains
• 3. Constraint Propagation: Use Arc Consistency
to reduce domains
• 4. Heuristics:
• - MRV (Minimum Remaining Values)
• - Degree Heuristic
Applications of CSP in AI
• - Scheduling problems (e.g., class timetabling)
• - Map coloring
• - Sudoku solving
• - Cryptarithmetic puzzles
• - Resource allocation
• - Planning and robotics