Class Stretch


  • public class Stretch
    extends DecomposedConstraint<Constraint>
    It constructs a Stretch constraint based on Regular constraint. An example of a Stretch constraint is values = [1, 2], min = [1, 2], max = [2, 3], and x = [x1, x2, x3, x4]. It specifies that variables x are equal to value 1 and 2, and any sequence of values 1 has to be of length between 1 and 2, and any sequence of values 2 has to be of length between 2 and 3.
    Version:
    4.8
    • Field Detail

      • values

        int[] values
      • min

        int[] min
      • max

        int[] max
      • constraints

        java.util.List<Constraint> constraints
    • Constructor Detail

      • Stretch

        public Stretch​(int[] values,
                       int[] min,
                       int[] max,
                       IntVar[] x)
        It creates a Stretch constraint.
        Parameters:
        values - a list of values which can be taken by variables.
        min - the minimal sequence length for each value.
        max - the maximal sequence length for each value.
        x - variables which assignment is constrained by Stretch constraint.
    • Method Detail

      • decompose

        public java.util.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.