5.202. inverse_within_range
DESCRIPTION | LINKS | GRAPH |
- Origin
- Constraint
- Synonyms
, .
- Arguments
- Restrictions
- Purpose
If the variable of the collection is assigned to and if is greater than or equal to 1 and less than or equal to the number of items of the collection then the variable of the collection is assigned to .
Conversely, if the variable of the collection is assigned to and if is greater than or equal to 1 and less than or equal to the number of items of the collection then the variable of the collection is assigned to .
- Example
-
Since the second item of is assigned to 4, the fourth item of is assigned to 2. Similarly, since the third item of is assigned to 2, the second item of is assigned to 3. FigureΒ 5.202.1 illustrates the correspondence between and .
Figure 5.202.1. Correspondence between the items of and the items of : on the side values between 1 and are shown in blue, on the side values between 1 and are shown in red.
- Typical
- Symmetry
Arguments are permutable w.r.t. permutation .
- Usage
Consider an integer value and a sequence of variables from which you have to select a subsequence such that:
All variables of have to be assigned to distinct values from ,
All variables not in have to be assigned a value, not necessarily distinct, outside .
As for the constraint we may want to create explicitly a value variable for each value in [1,m] in order to state some specific constraints on the value variables or to use a heuristics involving the original variables of as well as the value variables. The purpose of the constraint is to link the variables of with the value variables.
- See also
common keyword: Β (channelling constraint).
specialisation: Β (the 2 collections have not necessarly the same number of items).
- Keywords
constraint type: graph constraint.