code: private void alk(final EncodingResult result, final Variable[] vars, int rhs) {
      if (rhs < 0)
        throw new IllegalArgumentException("Invalid right hand side of cardinality constraint: " + rhs);
      if (rhs > vars.length) {
        result.addClause();
        return;
      }
      if (rhs == 0)
        return;
      if (rhs == 1) {
        result.addClause((Literal[]) vars);
        return;
      }
      if (rhs == vars.length) {
        for (final Variable var : vars)
          result.addClause(var);
        return;
      }
      switch (this.config().alkEncoder) {
        case TOTALIZER:
          if (this.alkTotalizer == null)
            this.alkTotalizer = new CCALKTotalizer();
          this.alkTotalizer.build(result, vars, rhs);
          break;
        case MODULAR_TOTALIZER:
          if (this.alkModularTotalizer == null)
            this.alkModularTotalizer = new CCALKModularTotalizer(this.f);
          this.alkModularTotalizer.build(result, vars, rhs);
          break;
        case CARDINALITY_NETWORK:
          if (this.alkCardinalityNetwork == null)
            this.alkCardinalityNetwork = new CCALKCardinalityNetwork();
          this.alkCardinalityNetwork.build(result, vars, rhs);
          break;
        case BEST:
          this.bestALK(vars.length).build(result, vars, rhs);
          break;
        default:
          throw new IllegalStateException("Unknown at-least-k encoder: " + this.config().alkEncoder);
      }
    }
docs: Encodes an at-lest-k constraint.
  @param result the result
  @param vars   the variables of the constraint
  @param rhs    the right hand side of the constraint