Topic # 02 CSP (A)
Topic # 02 CSP (A)
SATISFACTION PROBLEMS
CS-323 Artificial Intelligence
TE- CIS
Course Teacher: Anita Ali
What is a CSP?
◦ Real world is full of constraints
◦ Constraint Graph
◦ Nodes – Variables
Solution
Binary CSP
∀ 𝒙 ∈ 𝑫𝒊 ∃𝒚 ∈ 𝑫𝒋
such that (x, y) satisfies the constraint on the arc
Vj
Vi
∀ 𝒙 ∈ 𝑫𝒊 ∃𝒚 ∈ 𝑫𝒋
such that (x, y) satisfies the constraint on the arc
ARC CONSISTENCY
◦ Network Z = {x , y} ◦ Network Z = {x , y}
◦ R xy: x < y ◦ R xy: x < y
◦ Dx= { 1, 2 } , Dy = { 2 , 3} ◦ Dx= { 1, 2 , 3 } , Dy = { 1 , 2 , 3 }
Constraint Propagation (CP)
◦ Arc consistency on arc (Vi, Vj) can be achieved
by deleting values from Di that fail this condition Vj
Vi
◦ & then we need to check any other constraint
arc that has Di at its head (we are propagating
the constraint ☺)
Graph Coloring
◦ A classical example to understand &
solving CSPs
Domains: Colors
V2 R,
G, B
V1 V3
R,
G
G
Arc Consistency
◦ Necessary but not sufficient condition for solution
R, R,
G G
R, R,
G G
B
,G
R, R,
G G
{G, B}
V4 V3 {R,B}
V1 V2
{R} {G, B}