Recap: Constraint Satisfaction Problems
- Standard Search Problems:
- State is a “black box” (arbitrary data structure)
- Goal test can be any function over states
- Constraint Satisfaction Problems (CSPs):
- A special subset of search problems
- State is defined by variables with values from a domain
- Goal Test is a set of constraints specifying allowable combinations of values for subsets of variables.
Recap: Backtracking Search
- Basic uninformed algorithm for solving CSPs
- Idea 1: One variable at a time
- Variable assignments commutative
- Fixed ordering of variables and only considering assignment to a single variable at each step
- Idea 2: Check constraints as you go
- “Incremental Goal Test”
Recap - Filtering: Forward Checking
- Filtering: Keep track of domains for unassigned variables and cross off bad options.
- Forward Checking: Cross off values that violate a constraint when a value assignment is added to the current state.
Recap: Consistency of a Single Arc
- Arc is consistent iff for every in the tail, there exists some in the head which could be assigned without violating a constraint.
- Forward Checking: Enforcing consistency of arcs from unassigned variables (i.e. X) pointing to the variable with a new assignment (i.e. Y)
- Important: If loses a value, neighbors of need to be rechecked!
- AC-3 Algorithm
CSP Ordering
Ordering of Variables
Minimum Remaining Values
Degree Heuristic
Least Constraining Value
Main Idea:
- Which variable should be assigned next?
- MRV, Degree
- In what order should it’s values be tried?
- LCV
Minimum Remaining Values
- Variable Ordering: The Minimum Remaining Values (MRV) heuristic
- Choose variable with the fewest number of remaining values in it’s domain
- Also called “most constrained variable”
- “Fail-Fast” ordering
Degree Heuristic
- Degree Heuristic: Select variable involved in the largest number of constraints.
- Makes the largest number of other variables more “constrained” and enables early failures indirectly
Least Constraining Value (LCV)
- Value Ordering: The least constraining value heuristic
- Given a choice of variable, choose the least constraining value.
- Value that rules out fewest values in other unassigned variables.
- Why Least?
- Once variable to be assigned is determined, we only need one consistent solution.
CSP Problem Structure
- Extreme Case: Independent Subproblems
- Independent subproblems are identifiable as ’connected components’ of constraint graph
- Decomposing graph into subproblems, then can save in time complexity.
Tree-Structured CSPs
- Theorem: If constraint graph has no loops (tree structure), then can be solved in
- Compare to general CSPs, where worst case is
- Algorithm:
- Order: Choose root variable, order variables so that parents precede children.
- Enforce arc consistency from leaf to root
- Parent()
- Runtime:
Nearly Tree-Structured CSPs
- Cutset: set of variables such that after removing variables in this set and constraints associated, then the constraint graph becomes a tree.
- Cutset Conditioning: Instantiate the variables in the cutset, update the domains for the remaining variables, and solve CSP subproblem by remaining constraint tree.
- When number of variables in cutset is , the worst-case runtime is:
- , fast for small c.