CSP Flashcards
What are 4 main kinds of variables?
1) Boolean: |dom(V)| = 2
2) Finite: the domain contains a finite number of values
3) Infinite but discrete: the domain is countably infinite
4) Continuous: e.g real numbers between 0 and 1
What is a possible world?
Possible world is a complete assignment of values to a set of variables
Describe number of possible states.
Number of possible state is a product of cardinality of each domain, always exponential on the number of variables. (size of the domain)^(number of V)
What are constaints?
Constraints are restrictions on the values that one or more variables can take.
Name 2 types of constraints.
1) Unary constraint: restriction involving a single variable
2) k-ary constraint: restriction involving the domain of k different variables.
How can we specify constraints?
Constraints can be specified by:
- giving a function that returns true when given values for each variable which satisfy the constraint
- giving a list of valid domain values for each variable participating in the constraint
Define Constraint Satisfaction Problem.
A constraint satifaction problem consists of
- a set of variables
- a domain dom(v) for each variable
- a set of constraints C
What is a model of a CSP?
A model of a CSP is an assignment of values to all of its variables that satisfies all of its constraints.
Name several problems that can be solved with CSP.
- determine whether or not a model exists
- find a model
- find all of the models
- count the number of models
- find the best model, given some measure of model quality (optimization problem)
- determine whether some property of the variables holds in all models
Why even the simpliest problem of determing whether or not a model exists in a general CSP with finite domains is NP-hard?
Because there is no known algorithms with worst case polynomial time. we can’t hope to find an algorithm that is polynomial for all CSP’s.
Describle how generate and Test (GT) algorithms work.
Idea: Systematically check all possible worlds. ( Possible worlds: cross product of domains)
- Generate possible worlds one at a time.
- Test constraints for each one
If there are k variables, each with domain size d, and there are c constraint, the complexity of Generate & Test is…
O(cd^k)
When representing CSP as a search problem what are states, start state, successor function, goal state, and soltuion? Which algorithm would be most appropriate for this formulation?
States: partial assignment of values to variables.
Start state: empty assignment.
Successor function: states with the next variable assigned
Goal state: complete assignment of values to variables that satisfy all constraints
Solution: assignment
Depth-first search is the most appropriate because:
- no cycles
- Possibly very very large branching factor b
- All solutions are at the same depth
Explain how solving CSP using search works.
- Explore search space vie DFS but evaluate each constraint as soon as all its variables are bound.
- Any partial assignment that doesn’t satisfy the constraint can be pruned
What is the problem with solving CSP as graph search?
Problem of solving CSP as graph search: Performanve heavily depends on the order in which variables are considered.