Download Constraint Satisfaction Problems: Lecture Notes - Prof. Introduction to Artificial Intelli and more Summaries Material Engineering in PDF only on Docsity!
Set 5: Constraint Satisfaction Problems
Chapter 6 R&N
ICS 271 Fall 2016 Kalev Kask
Outline
- The constraint network model
- Variables, domains, constraints, constraint graph, solutions
- Examples:
- graph-coloring, 8-queen, cryptarithmetic, crossword puzzles, vision problems,scheduling, design
- The search space and naive backtracking,
- The constraint graph
- Consistency enforcing algorithms
- arc-consistency, AC-1,AC- 3
- Backtracking strategies
- Forward-checking, dynamic variable orderings
- Special case: solving tree problems
- Local search for CSPs
A B
red green red yellow green red green yellow yellow green yellow red
Constraint Satisfaction
Example: map coloring
Variables - countries (A,B,C,etc.)
Values - colors (e.g., red, green, yellow)
Constraints: A B , A D , D E , e tc.
C
A
B
D
E
F
G
Hard vs Soft Constraints
- Hard constraints : must be satisfied
- Soft constraints : capture preferences
Sudoku
Each row, column and major block must be all different
“Well posed” if it has unique solution: 27 constraints
Example : The 4-queen problem
Q
Q
Q
Q Q
Q
Q
Q
Place 4 Queens on a chess board of 4x4 such that no two queens reside in the same row, column or diagonal.
Standard CSP formulation of the problem:
- Variables : each row is a variable.
Q
Q
Q
Q
X 1
X 4
X 3
X 2
- Domains : Di { 1 , 2 , 3 , 4 }.
- Constraints : There are ( 42 ) = 6 constraints involved: R 12 {( 1 , 3 )( 1 , 4 )( 2 , 4 )( 3 , 1 )( 4 , 1 )( 4 , 2 )} R 13 {( 1 , 2 )( 1 , 4 )( 2 , 1 )( 2 , 3 )( 3 , 2 )( 3 , 4 )( 4 , 1 )( 4 , 3 )} R 14 {( 1 , 2 )( 1 , 3 )( 2 , 1 )( 2 , 3 )( 2 , 4 )( 3 , 1 )( 3 , 2 )( 3 , 4 )( 4 , 2 )( 4 , 3 )} R 23 {( 1 , 3 )( 1 , 4 )( 2 , 4 )( 3 , 1 )( 4 , 1 )( 4 , 2 )} R 24 {( 1 , 2 )( 1 , 4 )( 2 , 1 )( 2 , 3 )( 3 , 2 )( 3 , 4 )( 4 , 1 )( 4 , 3 )} R 34 {( 1 , 3 )( 1 , 4 )( 2 , 4 )( 3 , 1 )( 4 , 1 )( 4 , 2 )} - Constraint Graph : X 1
X (^2) X 4
X 3
Class scheduling/Timetabling
But only dn^ unique assignments