Skip to content

K-Out-of-N Constraints

Definition

To require at least KK of NN inequalities ai⊤x≤di\boldsymbol{a}_i^{\top}\boldsymbol{x}\le d_i, introduce binary relaxation indicators yiy_i and impose

ai⊤x≤di+Myi(i=1,…,N),∑i=1Nyi≤N−K.\begin{gathered} \boldsymbol{a}_i^{\top}\boldsymbol{x}\le d_i+My_i\quad(i=1,\ldots,N),\\ \sum_{i=1}^Ny_i\le N-K. \end{gathered}

Here 0≤K≤N0\le K\le N and MM must validly relax each marked inequality. The video's equality ∑iyi=N−K\displaystyle \sum_i y_i=N-K gives the same allowed x\boldsymbol{x} values when such relaxation is valid.


Interpretation

The K-out-of-N construction requires enough conditions from a list to hold, without saying in advance which ones. Each indicator yiy_i can release one inequality, at most N−KN-K inequalities may be released, and so at least KK remain enforced. A released inequality is allowed to hold as well.

Four inequality constraints, each with a binary switch y; two switches are 0 so their constraints are enforced, and two are 1 so their constraints are released.

Here N=4N=4 and K=2K=2. The switches y2y_2 and y4y_4 equal 11, so the second and fourth inequalities are released, while y1=y3=0y_1=y_3=0 keeps the first and third enforced. The bound y1+y2+y3+y4≤2y_1+y_2+y_3+y_4\le2 forbids releasing a third one, so at least two of the four inequalities always hold.

Each part has one job. With yi=0y_i=0 the term MyiMy_i disappears and ai⊤x≤di\boldsymbol{a}_i^{\top}\boldsymbol{x}\le d_i is enforced; with yi=1y_i=1 the right-hand side grows by MM, which must be large enough to impose no restriction on the relevant values of x\boldsymbol{x}. For N=2N=2 and K=1K=1 this is the either-or construction, where the two indicators are yy and 1−y1-y. The counting constraint is the same kind of bound on a sum of binary variables as in mutually exclusive decisions.

Mind the direction: yi=1y_i=1 means that inequality ii is released, not that it holds. Read the other way round, ∑iyi≤N−K\displaystyle \sum_iy_i\le N-K would seem to say that at most N−KN-K inequalities hold, the opposite of what is intended. The construction also does not make exactly KK inequalities true, since a released inequality may still be satisfied.


Key Results

  • The formulation does not require exactly KK original inequalities to be true.
  • The practice solution uses the inequality version; the video uses equality.
  • For K=NK=N, no constraint may be relaxed.

Examples

The figure sets N=4N=4, K=2K=2: the binary bound y1+y2+y3+y4≤2y_1+y_2+y_3+y_4\le2 allows at most two released inequalities, leaving at least two enforced. The constant MM must be large enough to remove unintended restrictions from every released inequality.

  • At least two of four constraints can be enforced using y1+y2+y3+y4≤2y_1+y_2+y_3+y_4\le2.
  • At least two of three constraints leave at most one relaxation indicator equal to 1.

Prerequisites

Sources

Symbols: sum

Last updated: 20 October 2026 03:02