JaCoP.constraints
Class Stretch

java.lang.Object
  extended by JaCoP.constraints.DecomposedConstraint
      extended by JaCoP.constraints.Stretch

public class Stretch
extends DecomposedConstraint

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:
3.1
Author:
Radoslaw Szymanek and Polina Makeeva

Field Summary
 
Fields inherited from class JaCoP.constraints.DecomposedConstraint
queueIndex
 
Constructor Summary
Stretch(int[] values, int[] min, int[] max, IntVar[] x)
          It creates a Stretch constraint.
 
Method Summary
 java.util.ArrayList<Constraint> decompose(Store store)
          It returns an array list of constraint which are used to decompose this constraint.
 void imposeDecomposition(Store store)
          It imposes the constraint in a given store.
 
Methods inherited from class JaCoP.constraints.DecomposedConstraint
auxiliaryVariables, imposeDecomposition
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

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
Parameters:
store - the constraint store to which the constraint is imposed to.

decompose

public java.util.ArrayList<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
Parameters:
store - the constraint store in which context the decomposition takes place.
Returns:
an array list of constraints used to decompose this constraint.