Limitations on tuples
When using tuples in your models, you should be aware of various limitations.
Data types in tuples
Not all data types are allowed inside tuples. The limitations are given here.
Data types allowed in tuples
-
Primitives (int, float, string)
-
Tuples (also known as subtuples)
-
Arrays with primitive items (not string), that is: integer or float arrays
-
Sets with primitive items, that is: integer, float or string sets
Arrays and sets in tuples are not compared by content. If collections inside a tuple are modified, duplicates are not detected.
Data types not allowed in tuples
-
Sets of tuples (instances of
IloTupleSet
) -
Arrays of strings, tuples, and tuple sets
-
Multidimensional arrays
Tuple indices and tuple patterns
You cannot mix tuple indexes and patterns within the declaration and the use of decision expressions. For example, these code lines raise the following error message Data not consistent for "xxx": can not mix pattern and index between declaration of dexpr and instantiation.
Do not mix tuple indices and tuple patterns in dexpr
dexpr float y[i in t] = ...;
subject to {
forall(<a,b,c> in t) y[<a,b,c>]==...; };
dexpr float y[<a,b,c> in t] = ...;
subject to {
forall(i in t) y[i]==...;
};
Performance and memory consumption
If you choose to label constraints in large models, use tuple indices instead of tuple patterns to avoid increasing the performance and memory cost. See Constraint labels.