Name: R.Viswaesvaran - Class: 11a - Sns Academy
Name: R.Viswaesvaran - Class: 11a - Sns Academy
PROBLEM
• Name: R.Viswaesvaran
• Class: 11a
• SNS ACADEMY
1
Formal Definition of CSP
• A constraint satisfaction problem (CSP) is
a triple (V, D, C) where
– V is a set of variables X1, ... , Xn.
– D is the union of a set of domain sets D1,...,Dn,
where Di is the domain of possible values for
variable Xi.
– C is a set of constraints on the values of the
variables, which can be pairwise (simplest and
most common) or k at a time.
2
CSPs vs. Standard Search Problems
–
–
•
– 3
Constraint graph
• Binary CSP: each constraint relates two variables
• Constraint graph: nodes are variables, arcs are
constraints
•
4
Varieties of constraints
• Unary constraints involve a single variable,
– e.g., SA ≠ green
–
5
–
Real-world CSPs
• Assignment problems
– e.g., who teaches what class
• Timetabling problems
– e.g., which class is offered when and where?
• Transportation scheduling
• Factory scheduling
•
•
–
• 6
The Consistent Labeling Problem
7
Standard Search Formulation
9
Backtracking Tree Search
13
Least Constraining Value
• Given a variable, choose the least
constraining value:
– the one that rules out the fewest values in the
remaining variables
• Combining these heuristics makes 1000
queens feasible
• 14
Forward Checking
Forward checking is based on the idea that
once variable ui is assigned a value v,
then certain future variable-value pairs (uj,v’)
become impossible.
ui,v)
uj,v’ uj,v’
15
Book’s Forward Checking Example
• Idea:
– Keep track of remaining legal values for unassigned variables
– Terminate search when any variable has no legal values
–
16
Forward Checking
• Idea:
– Keep track of remaining legal values for unassigned variables
– Terminate search when any variable has no legal values
–
17
Constraint Propagation
• Forward checking propagates information from assigned
to unassigned variables, but doesn't provide early
detection for all failures:
–
•
19
Comparison of Methods
20
Local Search for CSPs
• Hill-climbing, simulated annealing typically work with
"complete" states, i.e., all variables assigned
• To apply to CSPs:
– allow states with unsatisfied constraints
– operators reassign variable values
•
–
– 21
Summary
• CSPs are a special kind of problem:
– states defined by values of a fixed set of variables
– goal test defined by constraints on variable values