Definition
Constraint Satisfaction Problem
A constraint satisfaction problem is an instance
consisting of:
- A finite set of variables
- A finite domain
of values - A finite set of constraints
Each constraint is a pair
where:
is a tuple of variables called the scope is an -ary relation specifying the admissible assignments to the variables in An assignment
satisfies the instance if for every constraint with , one has . The constraint satisfaction problem asks whether there exists an assignment satisfying all constraints.
Constraint Satisfaction Problem
A constraint satisfaction problem consists of three main components:
- A finite set of variables
- Associated domains for each variable: Each variables
has a non-empty domain of possible values it can take. - A finite set of constraints:
A constraint
between a subset of variables is defined as a subset of the Cartesian product of their domains This means a constraint lists all the allowed combinations of values for the variables it involves. For example, a constraint might be , meaning and cannot have the same value.
Types of Constraints
Unary Constraint
A unary constraint restricts the domain of a single variable. For example
Binary Constraint
A binary constraint restricts the values of a pair of variables. For example,
Constraint Satisfaction Problem
A state is defined by a set of variables
, each of which has an associated domain of possible values. The goal test is a set of constraints that specify allowable combinations for values of subsets of these variables. Essentially, you have a problem defined by variables, the possible values those variables can take, and a set of rules (constraints) that must be satisfied by any valid combination of values.
Comparison to Standard Search
In standard search problem, a state is often treated as a “black box” with no discernible internal structure from the algorithm’s perspective. The algorithm can only interact with states using problem-specific routines like a successor function, a heuristic function, and a goal test.
CSPs, on the other hand, have a more structured and standardised representation for states and the goal test. This structure allows for the development of search algorithms that can exploit this common representation and use general-purpose heuristics rather than problem-specific ones.