AI Lec12
AI Lec12
Constraint Satisfaction
Problems
Recall
• Search problems:
Example:
{WA=red, NT=green, Q=red, NSW=green,V=red, SA=blue,T=green}
Real-world CSPs
• Assignment problems, e.g., who teaches what class?
• Hardware configuration
• Spreadsheets
• Transportation scheduling
• Factory scheduling
• Floor planning
• Continuous variables:
– Common in operations research
Problem formalization:
Example: 8-queen
8-Queen: Place 8 queens on an 8x8 chess board so no queen can
attack another one.
Problem formalization 1:
• One variable per queen, Q1, Q2, . . . , Q8.
• Each variable could have a value between 1 and 64.
• Solution: Q1 = 1, Q2 = 13, Q3 = 24, . . . , Q8 = 60.
Example: 8-queen
8-Queen: Place 8 queens on an 8x8 chess board so no queen can
attack another one.
Problem formalization 2:
• One variable per queen, Q1, Q2, . . . , Q8.
• Each variable could have a value between 1 and 8 (columns).
• Solution: Q1 = 1, Q2 = 7, Q3 = 5, . . . , Q8 = 3.
Brute force?
Should we simply generate and test all configurations?
···
Example Cryptarithmetic
Example Cryptarithmetic
• MRV: Choose the variable with the fewest legal values in its
domain
• The total for all subproblems takes O( nc dc) in the worst case.
Problem structure
Example:
• Assume n = 80, d = 2.
David L. Waltz
28 May 1943 – 22 March 2012
CCLS founder and leader 2003-2012
David&L.&Waltz&was&a&computer&scien7st&who&made&significant&
contribu7ons& in& several& areas& of& ar7ficial& intelligence,&
including& constraint& sa7sfac7on,& case>based& reasoning& and&
the& applica7on& of& massively& parallel& computa7on& to& AI&
problems.&&
Credit
• Artificial Intelligence, A Modern Approach. Stuart Russell and
Peter Norvig. Third Edition. Pearson Education.
http://aima.cs.berkeley.edu/