Module org.maxicp

Class Among

All Implemented Interfaces:
CPConstraint, ConcreteConstraint<ConcreteCPModel>

public class Among extends AbstractCPConstraint
Among constraint.

Enforces that the number of variables in x that take a value in a given set vals is equal to N.

  • Constructor Details

    • Among

      public Among(CPIntVar[] x, Set<Integer> vals, CPIntVar N)
      Creates an Among constraint enforcing that N variables in x take their value in vals.
      Parameters:
      x - the array of decision variables
      vals - the set of target values to count
      N - the variable representing the number of variables in x taking a value in vals
  • Method Details