CSP Flashcards
Discrete CSP
If all the variables have countable domains (finite and infinite domains)
Continuous CSP
If domain is uncountable
Time complexity
Linear constraints are solvable in polynomial time (nd). Non linear is exponential (d^n)
Types of constraints
Unary
Binary
Higher order
Preferences (Soft)
Example of crypt arithmetic puzzles
SEND+MORE=MONEY
When are auxiliary variables used
When there are higher order constraints >=5
Higher-order constraints can be transformed into equi-satisfiable binary constraints using auxiliary variables.
What is a binary CSP?
A CSP where each constraint is binary or unary
What is a constraint graph
The graph formed from binary CSP (A CSP where each constraint is binary or unary) whose nodes are variables and edges are constraints
Examples of real world CSP
- Job scheduling
- Class timetabling
- Queens or Rook placement on chess board
- Assignment problems
Define Constraint network
A constraint network is a triple <V, D, C>
Variables, Domains, and constraints (relations on the domain of the variables)
Satisfying constraints
If the assignment is consistent with all the constraints
What is a consistent and total assignment
If the assignment holds tru for all variables and respects all the constraints - Consistent
If all variables are assigned - Total
How to view CSP as search problem
We can view a constraint network as a search problem, if we take the states as the variable assignments, the actions as assignment extensions, and the goal states as consistent assignments.
โทIdea: Every constraint network induces a single state problem.
Given a constraint network
๐พ :=ใ๐,๐ท,Cใ,
then ฮ ๐พ :=ใ๐ฎ๐พ,๐๐พ,๐ฏ๐พ,โ๐พ,๐ข๐พใis called the search problem induced by ๐พ, iff
โทStates ๐ฎ๐พ are variable assignments
โทActions ๐๐พ: extend ๐โ๐ฎ๐พ by a pair ๐ฅโฆ๐ฃ not conflicted with ๐.
โทTransition model ๐ฏ(๐,๐)=๐,๐ฅโฆ๐ฃ (extended assignment)
โทInitial state โ๐พ: the empty assignment ๐.
โทGoal states ๐ข๐พ: the total assignments
Backtracking search in CSP
DFS for CSP with single variable assignment extension. It is the basic uninformed algorithm for CSPs. It can solve the ๐-queens problem for โ๐,25
How to make backtracking better?
Heuristics: Minimum Remaining Values (Which Variable) and Least Constraining Value Heuristic (Value Ordering)
Minimum Remaining Values (Which Variable)
The minimum remaining values (MRV) heuristic for backtracking search always chooses the variable with the fewest legal values, i.e. a variable ๐ฃ that given an initial assignment ๐ minimizes its domain count.
Why does MRV work?
By choosing a most constrained variable ๐ฃ first, we reduce the branching factor (number of sub trees generated for ๐ฃ) and thus reduce the size of our search tree.