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.8
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.List<Constraint>constraints(package private) IntVar[]list(package private) intmax(package private) intmin(package private) intq(package private) IntervalDomainset-
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.voidimposeDecomposition(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:DecomposedConstraintIt imposes the constraint in a given store.- Specified by:
imposeDecompositionin 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:DecomposedConstraintIt 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:
decomposein 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.
-
-