Class Sequence


public class Sequence extends DecomposedConstraint<Constraint>
It constructs a Sequence constraint. The sequence constraint establishes the following relationship: For a given list of variables (list) and the length of each sequence (q) it makes sure that each subsequence of consecutive variables from the list contains between min and max values from the given set.
Version:
4.8
  • Field Details

  • Constructor Details

    • Sequence

      public Sequence(IntVar[] list, IntervalDomain set, int q, int min, int max)
      It creates a Sequence constraint.
      Parameters:
      list - variables which assignment is constrained by Sequence constraint.
      set - set of values which occurrence is counted within each sequence.
      q - the length of the sequence
      min - the minimal occurrences of values from set within a sequence.
      max - the maximal occurrences of values from set within a sequence.
  • Method Details

    • imposeDecomposition

      public void imposeDecomposition(Store store)
      Description copied from class: DecomposedConstraint
      It imposes the constraint in a given store.
      Specified by:
      imposeDecomposition in class DecomposedConstraint<Constraint>
      Parameters:
      store - the constraint store to which the constraint is imposed to.
    • decomposeByRegular

      public static List<Constraint> decomposeByRegular(Sequence sequence)
      Preferred and default option of decomposing Sequence constraint.
      Parameters:
      sequence - sequence constraint to be decomposed by regular.
      Returns:
      a list of constraints that are used to decompose the sequence constraints.
    • decompose

      public List<Constraint> decompose(Store store)
      Description copied from class: DecomposedConstraint
      It returns an array list of constraint which are used to decompose this constraint. It actually creates a decomposition (possibly also creating variables), but it does not impose the constraint.
      Specified by:
      decompose in class DecomposedConstraint<Constraint>
      Parameters:
      store - the constraint store in which context the decomposition takes place.
      Returns:
      an array list of constraints used to decompose this constraint.