java.lang.Object
org.maxicp.cp.engine.core.AbstractCPConstraint
org.maxicp.cp.engine.constraints.Among
- All Implemented Interfaces:
CPConstraint,ConcreteConstraint<ConcreteCPModel>
Among constraint.
Enforces that the number of variables in x that take a value in a given set vals
is equal to N.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.maxicp.cp.engine.core.AbstractCPConstraint
getSolver, isActive, isScheduled, priority, registerDelta, setActive, setScheduled, updateDeltas
-
Constructor Details
-
Among
Creates an Among constraint enforcing thatNvariables inxtake their value invals.- Parameters:
x- the array of decision variablesvals- the set of target values to countN- the variable representing the number of variables inxtaking a value invals
-
-
Method Details
-
interSize
- Parameters:
var- the variable- Returns:
- the number of value in the domain of a var that are included in vals
-
post
public void post()Description copied from interface:CPConstraintInitializes the constraint when it is posted to the solver.- Specified by:
postin interfaceCPConstraint- Overrides:
postin classAbstractCPConstraint
-
propagate
public void propagate()Description copied from interface:CPConstraintPropagates the constraint.- Specified by:
propagatein interfaceCPConstraint- Overrides:
propagatein classAbstractCPConstraint
-