The "standard" local consistency conditions all require that all consistent partial evaluations can be extended to another variable in such a way that the resulting assignment is consistent. A
partial evaluation is consistent if it satisfies all constraints whose scope is a subset of the assigned variables.
Node consistency Node consistency requires that every unary constraint on a variable is satisfied by all values in the domain of the variable, and vice versa. This condition can be trivially enforced by reducing the domain of each variable to the values that satisfy all unary constraints on that variable. As a result, unary constraints can be neglected and assumed incorporated into the domains. For example, given a variable V with a domain of \left \{ 1, 2, 3, 4 \right \} and a constraint V \le 3, node consistency would restrict the domain to \left \{1, 2, 3 \right \} and the constraint could then be discarded. This pre-processing step simplifies later stages.
Arc consistency A variable of a constraint satisfaction problem is arc consistent with another one if each of its admissible values are consistent with some admissible value of the second variable. Formally, a variable x_i is arc consistent with another variable x_j if, for every value a in the domain of x_i there exists a value b in the domain of x_j such that (a,b) satisfies the binary constraint between x_i and x_j. A problem is arc consistent if every variable is arc consistent with every other one. For example, consider the constraint x where the variables range over the domain 1 to 3. Because x can never be 3, there is no arc from 3 to a value in y so it is safe to remove the value 3 from x's domain, resulting in \{1, 2\}. Likewise, y can never be 1, so there is no arc, therefore 1 can be removed from y's domain, resulting in \{2, 3\}. Arc consistency can also be defined relative to a specific binary constraint: a binary constraint is arc consistent if every value of one variable has a value of the second variable such that they satisfy the constraint. This definition of arc consistency is similar to the above, but is given specific to a constraint. This difference is especially relevant for non-normalized problems, where the above definition would consider all constraints between two variables while this one considers only a specific one. If a variable is not arc consistent with another one, it can be made so by removing some values from its domain. This is the form of constraint propagation that enforces arc consistency: it removes, from the domain of the variable, every value that does not correspond to a value of the other variable. This transformation maintains the problem solutions, as the removed values are in no solution anyway. Constraint propagation can make the whole problem arc consistent by repeating this removal for all pairs of variables. This process might have to consider a given pair of variables more than once. Indeed, removing values from the domain of a variable may cause other variables to become no longer arc consistent with it. For example, if x_3 is arc consistent with x_2 but the algorithm reduces the domain of x_2, arc consistency of x_3 with x_2 does not hold any longer, and has to be enforced again. A simplistic algorithm would cycle over the pairs of variables, enforcing arc consistency, repeating the cycle until no domains change for a whole cycle. The
AC-3 algorithm improves over this algorithm by ignoring constraints that have not been modified since they were last analyzed. In particular, it works on a set of constraints that initially contains all constraints; at each step, it takes a constraint and enforces arc consistency; if this operation may have produced a violation of arc consistency over another constraint, it places that constraint back in the set of constraints to analyze. This way, once arc consistency is enforced on a constraint, this constraint is not considered again unless the domain of one of its variables is changed.
Path consistency (k-consistency) Path consistency is a property similar to arc consistency, but considers pairs of variables instead of only one. A pair of variables is path-consistent with a third variable if each consistent evaluation of the pair can be extended to the other variable in such a way that all
binary constraints are satisfied. Formally, x_i and x_j are path consistent with x_k if, for every pair of values (a,b) that satisfies the binary constraint between x_i and x_j, there exists a value c in the domain of x_k such that (a,c) and (b,c) satisfy the constraint between x_i and x_k and between x_j and x_k, respectively. The form of constraint propagation that enforces path consistency works by removing some satisfying assignment from a constraint. Indeed, path consistency can be enforced by removing from a binary constraint all evaluations that cannot be extended to another variable. As for arc consistency, this removal might have to consider a binary constraint more than once. As for arc consistency, the resulting problem has the same solutions of the original one, as the removed values are in no solution. The form of constraint propagation that enforces path consistency might introduce new constraints. When two variables are not related by a binary constraint, they are virtually related by the constraint allowing any pair of values. However, some pair of values might be removed by constraint propagation. The resulting constraint is no longer satisfied by all pairs of values. Therefore, it is no longer a virtual, trivial constraint. The name "path consistency" derives from the original definition, which involved a pair of variables and a path between them, rather than a pair and a single variable. While the two definitions are different for a single pair of variables, they are equivalent when referring to the whole problem.
Generalizations Arc and path consistency can be generalized to non-binary constraints using
tuples of variables instead of a single one or a pair. A tuple of i-1 variables is i-consistent with another variable if every consistent evaluation of the i-1 variables can be extended with a value of the other variable while preserving consistency. This definition extends to whole problems in the obvious way. Strong i-consistency is j-consistency for all j \leq i. The particular case of 2-consistency coincides with arc consistency (all problems are assumed node-consistent in this article). On the other hand, 3-consistency coincides with path consistency only if all constraints are binary, because path consistency does not involve ternary constraints while 3-consistency does. Another way of generalizing arc consistency is
hyper-arc consistency or
generalized arc consistency, which requires extendibility of a single variable in order to satisfy a constraint. Namely, a variable is hyper-arc consistent with a constraint if every value of the variable can be extended to the other variables of the constraint in such a way the constraint is satisfied.
Consistency and satisfiability Constraint propagation (enforcing a form of local consistency) might produce an
empty domain or an
unsatisfiable constraint. In this case, the problem has no solution. The converse is not true in general: an inconsistent instance may be arc consistent or path consistent while having no empty domain or unsatisfiable constraint. Indeed, local consistency is only relative to the consistency of groups of variables. For example, arc consistency guarantees that every consistent evaluation of a variable can be consistently extended to another variable. However, when a single value of a variable is extended to two other variables, there is no guarantee that these two values are consistent with each other. For example, x_1=1 may be consistent with x_2=1 and with x_3=1, but these two evaluations may not be consistent with each other. However, constraint propagation can be used to prove satisfiability in some cases. A set of binary constraints that is arc consistent and has no empty domain can be inconsistent only if the network of constraints contains cycles. Indeed, if the constraints are binary and form an acyclic graph, values can always be propagated across constraints: for every value of a variable, all variables in a constraint with it have a value satisfying that constraint. As a result, a solution can be found by iteratively choosing an unassigned variable and recursively propagating across constraints. This algorithm never tries to assign a value to a variable that is already assigned, as that would imply the existence of cycles in the network of constraints. A similar condition holds for path consistency. The special cases in which satisfiability can be established by enforcing arc consistency and path consistency are the following ones. • enforcing arc consistency establishes satisfiability of problems made of binary constraints with no
cycles (a
tree of binary constraints); • enforcing path consistency establishes satisfiability for binary constraints (possibly with cycles) with binary domains; • enforcing strong n consistency establishes satisfiability of problems containing n variables.
Special cases Some definitions or results about relative consistency hold only in special cases. When the domains are composed of
integers, bound consistency can be defined. This form of consistency is based on the consistency of the extreme values of the domains, that is, the minimum and maximum values a variable can take. When constraints are
algebraic or
Boolean, arc consistency is equivalent to adding new constraint or syntactically modifying an old one, and this can be done by suitably composing constraints.
Specialized constraints Some kinds of constraints are commonly used. For example, the constraint that some variables are all different are often used. Efficient specialized algorithms for enforcing arc consistency on such constraints exist. The constraint enforcing a number of variables to be different is usually written \mathop{\rm alldifferent}(x_1,\ldots,x_n) or alldifferent([X1,...,Xn]). This constraint is equivalent to the non-equality of all pairs of different variables, that is, x_i \not= x_j for every i \not= j. When the domain of a variable is reduced to a single value, this value can be removed from all other domains by constraint propagation when enforcing arc consistency. The use of the specialized constraint allows for exploiting properties that do not hold for individual binary
disequalities. A first property is that the total number of elements in the domains of all variables must be at least the number of variables. More precisely, after arc consistency is enforced, the number of unassigned variables must not exceed the number of values in the union of their domains. Otherwise, the constraint cannot be satisfied. This condition can be checked easily on a constraint in the alldifferent form, but does not correspond to arc consistency of the network of disequalities. A second property of the single alldifferent constraint is that hyper-arc consistency can be efficiently checked using a
bipartite matching algorithm. In particular, a graph is built with variables and values as the two sets of nodes, and a specialized
bipartite graph matching algorithm is run on it to check the existence of such a matching. A different kind of constraint that is commonly used is the cumulative one. It was introduced for problems of scheduling and placement. As an example, cumulative([S1,...,Sm], [D1,...,Dm], [R1,...,Rm], L) can be used to formalize the condition in which there are m activities, each one with starting time si, duration di and using an amount ri of a resource. The constraint states that the total available amount of resources is L. Specialized constraint propagation techniques for cumulative constraints exists; different techniques are used depending on which variable domains are already reduced to a single value. A third specialized constraint that is used in
constraint logic programming is the element one. In constraint logic programming, lists are allowed as values of variables. A constraint element(I, L, X) is satisfied if L is a list and X is the I-th element of this list. Specialized constraint propagation rules for these constraints exist. As an example, if L and I are reduced to a single-value domain, a unique value for X can be determined. More generally, impossible values of X can be inferred from the domain of I and vice versa. ==Directional consistency==