Package org.jacop.constraints
Class Sequence
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.9
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) List
<Constraint> (package private) IntVar[]
(package private) int
(package private) int
(package private) int
(package private) IntervalDomain
Fields inherited from class org.jacop.constraints.DecomposedConstraint
queueIndex
-
Constructor Summary
ConstructorsConstructorDescriptionSequence
(IntVar[] list, IntervalDomain set, int q, int min, int max) It creates a Sequence constraint. -
Method Summary
Modifier and TypeMethodDescriptionIt returns an array list of constraint which are used to decompose this constraint.static 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 Details
-
set
IntervalDomain set -
min
int min -
max
int max -
q
int q -
list
IntVar[] list -
constraints
List<Constraint> constraints
-
-
Constructor Details
-
Sequence
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 Details
-
imposeDecomposition
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
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
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.
-