In
computer science
Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to Applied science, practical discipli ...
, an interchangeability algorithm is a technique used to more efficiently solve
constraint satisfaction problem
Constraint satisfaction problems (CSPs) are mathematical questions defined as a set of objects whose state must satisfy a number of constraints or limitations. CSPs represent the entities in a problem as a homogeneous collection of finite constr ...
s (CSP). A CSP is a mathematical problem in which objects, represented by variables, are subject to constraints on the values of those variables; the goal in a CSP is to assign values to the variables that are consistent with the constraints. If two variables ''A'' and ''B'' in a CSP may be swapped for each other (that is, ''A'' is replaced by ''B'' and ''B'' is replaced by ''A'') without changing the nature of the problem or its solutions, then ''A'' and ''B'' are ''interchangeable'' variables. Interchangeable variables represent a symmetry of the CSP and by exploiting that symmetry, the
search space for solutions to a CSP problem may be reduced. For example, if solutions with ''A''=1 and ''B''=2 have been tried, then by interchange symmetry, solutions with ''B''=1 and ''A''=2 need not be investigated.
The concept of interchangeability and the interchangeability algorithm in constraint satisfaction problems was first introduced by Eugene Freuder in 1991.
[Freuder, E.C.]
Eliminating Interchangeable Values in Constraint Satisfaction Problems
In: In Proc. of AAAI-91, Anaheim, CA (1991) 227–233 The interchangeability algorithm reduces the search space of
backtracking search
Backtracking is a class of algorithms for finding solutions to some computational problems, notably constraint satisfaction problems, that incrementally builds candidates to the solutions, and abandons a candidate ("backtracks") as soon as it de ...
algorithms, thereby improving the efficiency of
NP-complete
In computational complexity theory, a problem is NP-complete when:
# it is a problem for which the correctness of each solution can be verified quickly (namely, in polynomial time) and a brute-force search algorithm can find a solution by tryi ...
CSP problems.
Definitions
;Fully Interchangeable
:A value a for variable is fully interchangeable with value if and only if every solution in which v = a remains a solution when is substituted for and vice versa.
;Neighbourhood Interchangeable
:A value a for variable is neighbourhood interchangeable with value b if and only if for every constraint on , the values compatible with v = a are exactly those compatible with v = b.
;Fully Substitutable
:A value a for variable is fully substitutable with value if and only if every solution in which v = a remains a solution when is substituted for a (but not necessarily vice versa).
;Dynamically Interchangeable
:A value a for variable is dynamically interchangeable for with respect to a set A of variable assignments if and only if they are fully interchangeable in the subproblem induced by A.
Pseudocode
Neighborhood Interchangeability Algorithm
Finds neighborhood interchangeable values in a CSP.
Repeat for each variable:
:Build a
discrimination tree by:
:Repeat for each value, v:
::Repeat for each neighboring variable W:
:::Repeat for each value w consistent with v:
::::Move to if present, construct if not, a node of the discrimination tree corresponding to w, W
''K''-interchangeability algorithm
The algorithm can be used to explicitly find solutions to a constraint satisfaction problem. The algorithm can also be run for steps as a preprocessor to simplify the subsequent backtrack search.
Finds k-interchangeable values in a CSP.
Repeat for each variable:
:Build a discrimination tree by:
:Repeat for each value, v:
::Repeat for each (''k'' − 1)-tuple of variables
:::Repeat for each (''k'' − 1)-tuple of values , which together with constitute a solution to the subproblem induced by :
::::Move to if present, construct if not, a node of the discrimination tree corresponding to w, W
Complexity analysis
In the case of neighborhood interchangeable algorithm, if we assign the worst case bound to each loop. Then for ''n'' variables, which have at most ''d'' values for a variable, then we have a bound of :
.
Similarly, the complexity analysis of the ''k''-interchangeability algorithm for a worst case
, with
-tuples of variables and
, for
-tuples of values, then the bound is :
.
Example
![Interchangeability](https://upload.wikimedia.org/wikipedia/commons/b/ba/Interchangeability.png)
The figure shows a simple graph coloring example with colors as vertices, such that no two vertices which are joined by an edge have the same color. The available colors at each vertex are shown. The colors yellow, green, brown, red, blue, pink represent vertex and are fully interchangeable by definition. For example, substituting maroon for green in the solution orange, X (orange for X), green, Y will yield another solution.
Applications
In Computer Science, the interchangeability algorithm has been extensively used in the fields of
artificial intelligence
Artificial intelligence (AI) is intelligence—perceiving, synthesizing, and inferring information—demonstrated by machines, as opposed to intelligence displayed by animals and humans. Example tasks in which this is done include speech re ...
,
graph coloring problem
In graph theory, graph coloring is a special case of graph labeling; it is an assignment of labels traditionally called "colors" to elements of a graph subject to certain constraints. In its simplest form, it is a way of coloring the vertices ...
s, abstraction frame-works and solution adaptation.
[Full Dynamic Substitutability by SAT Encoding by Steven Prestwich, Cork Constraint Computation Centre, Department of Computer Science, University College, Cork, Ireland]
References
{{reflist
Constraint programming