5.302. soft_same_var

DESCRIPTIONLINKSGRAPH
Origin

[vanHoeve05]

Constraint

soft_same_var(C,VARIABLES1,VARIABLES2)

Synonym(s)

soft_same.

Argument(s)
Cdvar
VARIABLES1collection(vardvar)
VARIABLES2collection(vardvar)
Restriction(s)
C0
C|VARIABLES1|
|VARIABLES1|=|VARIABLES2|
required(VARIABLES1,var)
required(VARIABLES2,var)
Purpose

C is the minimum number of values to change in the VARIABLES1 and VARIABLES2 collections so that the variables of the VARIABLES2 collection correspond to the variables of the VARIABLES1 collection according to a permutation.

Example
(
4,9,9,9,9,9,1,
9,1,1,1,1,8
)

As illustrated by Figure 5.302.1, there is a correspondence between two pairs of values of the collections 9,9,9,9,9,1 and 9,1,1,1,1,8. Consequently, we must unset at least 62 items (6 is the number of items of the VARIABLES1 and VARIABLES2 collections). The soft_same_var constraint holds since its first argument C is set to 62.

Figure 5.302.1. Correspondence between collection 9,9,9,9,9,1 and collection 9,1,1,1,1,8
ctrs/soft_same_var1
Usage

A soft same constraint.

Algorithm

[vanHoeve05].

See also

same.

Key words

constraint arguments: constraint between two collections of variables.

constraint type: soft constraint, relaxation, variable-based violation measure.

filtering: minimum cost flow.


Arc input(s)

VARIABLES1 VARIABLES2

Arc generator
PRODUCTcollection(variables1,variables2)

Arc arity
2
Arc constraint(s)
variables1.var=variables2.var
Graph property(ies)
NSINK_NSOURCE=|VARIABLES1|C


Graph model

Parts (A) and (B) of Figure 5.302.2 respectively show the initial and final graph associated with the Example slot. Since we use the NSINK_NSOURCE graph property, the source and sink vertices of the final graph are stressed with a double circle. The soft_same_var constraint holds since the cost 4 corresponds to the difference between the number of variables of VARIABLES1 and the sum over the different connected components of the minimum number of sources and sinks.

Figure 5.302.2. Initial and final graph of the soft_same_var constraint

ctrs/soft_same_varA
(a)

ctrs/soft_same_varB
(b)