AI 2.1
AI 2.1
A Constraint Satisfaction Problem (CSP) involves choosing the best option from a set of available
choices while satisfying given constraints. Constraints can be negative (limitations) or positive
(desired elements).
Examples of CSPs
• Map coloring problem: Assigning colors to regions while ensuring no two adjacent regions
have the same color.
• A possible solution: {WA = red, NT = green, Q = red, NSW = green, V = red, SA = blue, T =
red}.
Constraint Graph
For example, in the map coloring problem, each region is a node, and edges represent adjacency
constraints.
Thus, CSPs are effectively solved using search algorithms with constraints ensuring valid solutions.
Key Concepts:
1. Process:
o Generate possible solutions.
o Test each solution to check if it’s correct.
o Stop if a solution is found; otherwise, repeat.
2. Why It’s Called British Museum Search?
o Similar to searching for an object in a large museum by wandering randomly.
3. Use of Heuristic Function:
o Helps eliminate unlikely paths, ranking better alternatives.
o Reduces unnecessary searches in large problem spaces.
4. Limitations & Improvements:
o Inefficient for complex problems.
o Can be improved by combining with other techniques (e.g., Constraint Satisfaction in
AI programs like DENDRAL).
Algorithm Steps:
1. Generate a possible solution (e.g., picking a point in the problem space).
2. Test if it meets the goal condition.
3. If correct, stop. If not, repeat from Step 1.
Real-Life Example:
• Monkeys & Shakespeare: If monkeys type randomly for long enough, they could eventually
produce all of Shakespeare’s works.
• DENDRAL (AI System): Uses Generate-and-Test to determine organic compound structures
from NMR spectrograms.
Final Thought: A better generator = faster search with lower complexity! 🚀