java.lang.Object
org.maxicp.cp.engine.core.CPFixedSetVar
- All Implemented Interfaces:
CPSetVar,CPVar,ConcreteVar,Var
A fixed set variable that contains a specific set of values.
-
Constructor Summary
ConstructorsConstructorDescriptionCPFixedSetVar(CPSolver cp, int[] values) Creates a fixed set variable with the given values. -
Method Summary
Modifier and TypeMethodDescriptioncard()Returns a variable that represents the cardinality of the set.voidexclude(int v) Excludes a value from the set.voidExcludes all the possible values from the set.intfillExcluded(int[] dest) Copies the values (in an arbitrary order) of the set of excluded elements into an array.intfillIncluded(int[] dest) Copies the values (in an arbitrary order) of the set of included elements into an array.intfillPossible(int[] dest) Copies the values (in an arbitrary order) of the set of possible elements into an array.Returns the solver of the set variable.voidinclude(int v) Includes a value in the set.voidIncludes all the possible values in the set.booleanisExcluded(int v) Returns if a value is excluded from the set.booleanisFixed()Returns if the set variable is fixed.booleanisIncluded(int v) Returns if a value is included in the set.booleanisPossible(int v) Returns if a value is possible in the set.intReturns the size of the set of excluded elementsintReturns the size of the set of included elementsintReturns the size of the set of possible elementsvoidAsk that theCPConstraint.propagate()method of the constraint c is called when the domain of the set variable changes (I,P or E).intsize()
-
Constructor Details
-
CPFixedSetVar
Creates a fixed set variable with the given values.- Parameters:
cp- the solver in which the variable is createdvalues- the values of the set
-
-
Method Details
-
size
public int size() -
card
Description copied from interface:CPSetVarReturns a variable that represents the cardinality of the set. -
fillPossible
public int fillPossible(int[] dest) Description copied from interface:CPSetVarCopies the values (in an arbitrary order) of the set of possible elements into an array.- Specified by:
fillPossiblein interfaceCPSetVar- Parameters:
dest- an array large enoughdest.length >= nPossible()- Returns:
- the size of the set of possible elements
-
fillIncluded
public int fillIncluded(int[] dest) Description copied from interface:CPSetVarCopies the values (in an arbitrary order) of the set of included elements into an array.- Specified by:
fillIncludedin interfaceCPSetVar- Parameters:
dest- an array large enoughdest.length >= nIncluded()- Returns:
- the size of the set of included elements
-
fillExcluded
public int fillExcluded(int[] dest) Description copied from interface:CPSetVarCopies the values (in an arbitrary order) of the set of excluded elements into an array.- Specified by:
fillExcludedin interfaceCPSetVar- Parameters:
dest- an array large enoughdest.length >= nExcluded()- Returns:
- the size of the set of excluded elements
-
isPossible
public boolean isPossible(int v) Description copied from interface:CPSetVarReturns if a value is possible in the set.- Specified by:
isPossiblein interfaceCPSetVar- Parameters:
v- the value to check- Returns:
- true if the value is possible, false otherwise
-
isIncluded
public boolean isIncluded(int v) Description copied from interface:CPSetVarReturns if a value is included in the set.- Specified by:
isIncludedin interfaceCPSetVar- Parameters:
v- the value to check- Returns:
- true if the value is included, false otherwise
-
isExcluded
public boolean isExcluded(int v) Description copied from interface:CPSetVarReturns if a value is excluded from the set.- Specified by:
isExcludedin interfaceCPSetVar- Parameters:
v- the value to check- Returns:
- true if the value is excluded, false otherwise
-
isFixed
public boolean isFixed()Description copied from interface:CPSetVarReturns if the set variable is fixed. -
nIncluded
public int nIncluded()Description copied from interface:CPSetVarReturns the size of the set of included elements -
nPossible
public int nPossible()Description copied from interface:CPSetVarReturns the size of the set of possible elements -
nExcluded
public int nExcluded()Description copied from interface:CPSetVarReturns the size of the set of excluded elements -
getSolver
Description copied from interface:CPSetVarReturns the solver of the set variable. -
getModelProxy
- Specified by:
getModelProxyin interfaceCPSetVar- Specified by:
getModelProxyin interfaceVar
-
exclude
public void exclude(int v) Description copied from interface:CPSetVarExcludes a value from the set. -
include
public void include(int v) Description copied from interface:CPSetVarIncludes a value in the set. -
propagateOnDomainChange
Description copied from interface:CPSetVarAsk that theCPConstraint.propagate()method of the constraint c is called when the domain of the set variable changes (I,P or E). If intererested also in the change of the cardinality variable, callCPIntVar.propagateOnBoundChange(CPConstraint)on the cardinality variable.- Specified by:
propagateOnDomainChangein interfaceCPSetVar- Parameters:
c- the constraint to notify
-
includeAll
public void includeAll()Description copied from interface:CPSetVarIncludes all the possible values in the set.- Specified by:
includeAllin interfaceCPSetVar
-
excludeAll
public void excludeAll()Description copied from interface:CPSetVarExcludes all the possible values from the set.- Specified by:
excludeAllin interfaceCPSetVar
-