java.lang.Object
org.maxicp.cp.engine.core.AbstractCPConstraint
org.maxicp.cp.engine.constraints.CostCardinalityMaxDC
- All Implemented Interfaces:
CPConstraint,ConcreteConstraint<ConcreteCPModel>
- Direct Known Subclasses:
CostAllDifferentDC
Implementation of the Global Cardinality Constraint with Costs from the paper
Margaux Schmied, Jean-Charles Régin: Efficient Implementation of the Global Cardinality Constraint with Costs. CP 2024
- Author:
- Margaux Schmied
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCostCardinalityMaxDC(CPIntVar[] x, int[] upper, int[][] costs, CPIntVar H) Constraint the maximum number of occurrences of a range of values in x.CostCardinalityMaxDC(CPIntVar[] x, int[] upper, int[][] costs, CPIntVar H, CostCardinalityMaxDC.Algorithm algorithm) Constraint the maximum number of occurrences of a range of values in x. -
Method Summary
Methods inherited from class org.maxicp.cp.engine.core.AbstractCPConstraint
getSolver, isActive, isScheduled, priority, registerDelta, setActive, setScheduled, updateDeltas
-
Constructor Details
-
CostCardinalityMaxDC
public CostCardinalityMaxDC(CPIntVar[] x, int[] upper, int[][] costs, CPIntVar H, CostCardinalityMaxDC.Algorithm algorithm) Constraint the maximum number of occurrences of a range of values in x.- Parameters:
x- The variables to constraint (at least one), only non-negative valuesupper- The upper cardinality bounds, upper[i] is the maximum number of occurrences of value i in x The size of upper must be equal to the number of columns in costs and equal to the larest value in x.costs- The costs associated with each value in x.H- The maximum cost allowed for the assignment.algorithm- The algorithm to use for the constraint, either SCHMIED_REGIN_2024 or REGIN_2002.
-
CostCardinalityMaxDC
Constraint the maximum number of occurrences of a range of values in x.- Parameters:
x- The variables to constraint (at least one), only non-negative valuesupper- The upper cardinality bounds, upper[i] is the maximum number of occurrences of value i in x The size of upper must be equal to the number of columns in costs and equal to the larest value in x.costs- The costs associated with each value in x.H- The maximum cost allowed for the assignment.
-
-
Method Details
-
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
-
getMinCostAssignment
public int getMinCostAssignment() -
getAssignment
-