Package com.artelys.kalis
Class KOccurrence
- java.lang.Object
-
- com.artelys.kalis.KConstraint
-
- com.artelys.kalis.KOccurrence
-
public class KOccurrence extends KConstraint
This class creates an occurence constraint of a value in a list of variables
Example :
KIntVarArray Tab(...); KIntVar countVar(...); problem.post( KOccurTerm(0,Tab) <= 5 ); // No more than 5 occurence of 0 in Tab problem.post( KOccurTerm(1,Tab) < 5 ); // No more than 4 occurence of 1 in Tab problem.post( KOccurTerm(2,Tab) >= countVar ); // No Less than countVar occurence of 2 in Tab problem.post( KOccurTerm(3,Tab) > countVar ); // No Less than countVar occurence of 3 in Tab
- Since:
- 2016.1
- See Also:
KConstraint
-
-
Field Summary
-
Fields inherited from class com.artelys.kalis.KConstraint
swigCMemOwn
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
KOccurrence(long cPtr, boolean cMemoryOwn)
KOccurrence(KIntVarArray variables, KIntArray targets, int minOccur, int maxOccur)
ConstructorKOccurrence(KOccurrence toCopy)
Copy constructorKOccurrence(KOccurTerm oc, int cste, boolean atLeast, boolean atMost)
ConstructorKOccurrence(KOccurTerm oc, KIntVar v1, boolean atLeast, boolean atMost)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete()
protected void
finalize()
protected static long
getCPtr(KOccurrence obj)
-
Methods inherited from class com.artelys.kalis.KConstraint
askIfEntailed, getArity, getCopyPtr, getCPtr, getInstance, getInstanceCopyPtr, getLinearRelaxation, getLinearRelaxation, getName, getPriority, getProblem, getTag, getTypeInfo, isGetLinearRelaxationImplemented, print, print, setName, setPriority, setTag
-
-
-
-
Constructor Detail
-
KOccurrence
protected KOccurrence(long cPtr, boolean cMemoryOwn)
-
KOccurrence
public KOccurrence(KOccurTerm oc, KIntVar v1, boolean atLeast, boolean atMost)
Constructor- Parameters:
oc
- the occurence termv1
- the counting variableatLeast
- constrain on inf the number of occurence Yes/NoatMost
- constrain on sup the number of occurence Yes/No
-
KOccurrence
public KOccurrence(KOccurTerm oc, int cste, boolean atLeast, boolean atMost)
Constructor- Parameters:
oc
- the occurence termcste
- the constant number of occurenceatLeast
- constrain on inf the number of occurence Yes/NoatMost
- constrain on sup the number of occurence Yes/No
-
KOccurrence
public KOccurrence(KIntVarArray variables, KIntArray targets, int minOccur, int maxOccur)
Constructor- Parameters:
variables
- the variables arraytargets
- the targets value to countminOccur
- minimal number of occurrencesmaxOccur
- maximal number of occurrences
-
KOccurrence
public KOccurrence(KOccurrence toCopy)
Copy constructor
-
-
Method Detail
-
getCPtr
protected static long getCPtr(KOccurrence obj)
-
finalize
protected void finalize()
- Overrides:
finalize
in classKConstraint
-
delete
public void delete()
- Overrides:
delete
in classKConstraint
-
-