5.303. soft_alldifferent_var
| DESCRIPTION | LINKS | GRAPH |
- Origin
- Constraint
- Synonyms
, , , , .
- Arguments
- Restrictions
- Purpose
is greater than or equal to the minimum number of variables of the collection for which the value needs to be changed in order that all variables of take a distinct value.
- Example
-
Within the collection , 3 and 2 items are respectively fixed to values 5 and 1. Therefore one must change the values of at least items to get back to 6 distinct values. Consequently, the constraint holds since its first argument is greater than or equal to 3.
- Symmetries
Items of are permutable.
All occurrences of two distinct values of can be swapped; all occurrences of a value of can be renamed to any unused value.
- Usage
- Remark
Since it focus on the soft aspect of the constraint, the original articleΒ [PetitReginBessiere01], which introduce this constraint, describes how to evaluate the minimum value of and how to prune according to the maximum value of .
The constraint is called inΒ [HebrardMarxSullivanRazgon09].
- Algorithm
The filtering algorithm presented inΒ [PetitReginBessiere01] achieves arc-consistency.
- Reformulation
By introducing a variable that gives the number of distinct values used by variables of the collection , the constraint can be expressed as a conjunction of the constraint and of the linear constraint .
- See also
common keyword: , , , , Β (soft constraint).
related: , .
- Keywords
characteristic of a constraint: all different, disequality.
constraint type: soft constraint, value constraint, relaxation, variable-based violation measure.
final graph structure: strongly connected component, equivalence.
- Arc input(s)
- Arc generator
-
- Arc arity
- Arc constraint(s)
- Graph property(ies)
-
- Graph model
We generate a clique with binary equalities constraints between each pairs of vertices (this include an arc between a vertex and itself) and we state that is equal to the difference between the total number of variables and the number of strongly connected components.
PartsΒ (A) andΒ (B) of FigureΒ 5.303.1 respectively show the initial and final graph associated with the Example slot. Since we use the graph property we show the different strongly connected components of the final graph. Each strongly connected component of the final graph includes all variables that take the same value. Since we have 6 variables and 3 strongly connected components the cost variable is greater than or equal to .
Figure 5.303.1. Initial and final graph of the constraint


(a) (b)