Package org.jacop.constraints
Class Sequence
- java.lang.Object
-
- org.jacop.constraints.DecomposedConstraint<Constraint>
-
- org.jacop.constraints.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.7
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.List<Constraint>
constraints
(package private) IntVar[]
list
(package private) int
max
(package private) int
min
(package private) int
q
(package private) IntervalDomain
set
-
Fields inherited from class org.jacop.constraints.DecomposedConstraint
queueIndex
-
-
Constructor Summary
Constructors Constructor Description Sequence(IntVar[] list, IntervalDomain set, int q, int min, int max)
It creates a Sequence constraint.
-
Method Summary
All Methods Static 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.static java.util.List<Constraint>
decomposeByRegular(Sequence sequence)
Preferred and default option of decomposing Sequence 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
-
set
IntervalDomain set
-
min
int min
-
max
int max
-
q
int q
-
list
IntVar[] list
-
constraints
java.util.List<Constraint> constraints
-
-
Constructor Detail
-
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 sequencemin
- the minimal occurrences of values from set within a sequence.max
- the maximal occurrences of values from set within a sequence.
-
-
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.
-
decomposeByRegular
public static java.util.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 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.
-
-