sameCommonSubsequence

A binary constraint on a pair of sequence variables. The constraint states that the relative position of some related subsets of interval variables is the same in both sequences, seq1 and seq2.

context type
Model files (.mod) - Not allowed in a CPLEX constraint block. Boolean (1 if the constraint is true, 0 otherwise)

Syntax

dvar sequence seq1 in ...;
dvar sequence seq2 in ...;
dvar interval a1[...] ...; // Reordering of a subset of the interval variables of seq1
dvar interval a2[...] ...; // Reordering of a subset of the interval variables of seq2

constraints {
  sameCommonSubsequence(seq1, seq2, a1, a2); // relates a1[i] to a2[i]
  sameCommonSubsequence(seq1, seq2); // intervals are related according to their order in the definition of the sequences
}

Description

This function creates a same-common-subsequence constraint between sequence variables seq1 and seq2. Sequence variables seq1 and seq2 should be of the same size. The mapping between interval variables of the two sequences is given by the order of the interval variables in the arrays a1 and a2 used in the definition of the sequences. The constraint states that the sub-sequences defined by seq1 and seq2 by only considering the pairs of present intervals (a1[i], a2[i]) are identical, modulo the mapping between intervals a1[i] and a2[i]. By default, the name of the constraint is the empty string, but you can specify a name of your own choice.

Note: This constraint cannot be used in a meta-constraint.

Examples

Two examples of use-cases where these constraints are useful:

  • First in/first out and no-bypass constraints

  • Scenario-Based approaches for scheduling with uncertainties

For more information, see the example description in sameSequence.