Package org.jacop.constraints
Class Stretch
- java.lang.Object
-
- org.jacop.constraints.DecomposedConstraint<Constraint>
-
- org.jacop.constraints.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 Summary
Fields Modifier and Type Field Description (package private) java.util.List<Constraint>
constraints
(package private) int[]
max
(package private) int[]
min
(package private) int[]
values
(package private) IntVar[]
x
-
Fields inherited from class org.jacop.constraints.DecomposedConstraint
queueIndex
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<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 org.jacop.constraints.DecomposedConstraint
auxiliaryVariables, checkInput, checkInput, checkInputForDuplication, checkInputForDuplicationSkipSingletons, checkInputForNullness, checkInputForNullness, checkInputForNullness, derivative, getDubletonsSkipSingletons, imposeDecomposition
-
-
-
-
Field Detail
-
values
int[] values
-
min
int[] min
-
max
int[] max
-
x
IntVar[] x
-
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
-
imposeDecomposition
public void imposeDecomposition(Store store)
Description copied from class:DecomposedConstraint
It imposes the constraint in a given store.- Specified by:
imposeDecomposition
in classDecomposedConstraint<Constraint>
- Parameters:
store
- the constraint store to which the constraint is imposed to.
-
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 classDecomposedConstraint<Constraint>
- Parameters:
store
- the constraint store in which context the decomposition takes place.- Returns:
- an array list of constraints used to decompose this constraint.
-
-