Skip to content

Either-Or Constraints

Definition

To require at least one of a⊤x≤b\boldsymbol{a}^{\top}\boldsymbol{x}\le b and d⊤x≤e\boldsymbol{d}^{\top}\boldsymbol{x}\le e, introduce y∈{0,1}y\in\{0,1\} and write

a⊤x≤b+My,d⊤x≤e+M(1−y).\boldsymbol{a}^{\top}\boldsymbol{x}\le b+My,\qquad \boldsymbol{d}^{\top}\boldsymbol{x}\le e+M(1-y).

The finite constant MM must be large enough that the relaxed inequality imposes no unintended restriction over the relevant variable domain.


Interpretation

Either-or constraints require a solution to satisfy at least one of two inequalities. A binary variable yy decides which inequality is enforced, and a large constant MM switches the other one off. Points satisfying both are also allowed, so this is the inclusive "or".

Two overlapping shaded regions, each satisfying one of two constraints, with points (7, 1) and (1, 7) in one region each and the point (5, 5) in neither; their union is not convex.

The blue region satisfies 3x1+2x2≤183x_1+2x_2\le18, the red region x1+4x2≤16x_1+4x_2\le16, and the allowed set is their union. The point (1,7)(1,7) gives 17≤1817\le18 but 29>1629>16, so it is allowed with y=0y=0, which enforces the first inequality. The point (7,1)(7,1) gives 23>1823>18 but 11≤1611\le16, so it needs y=1y=1. The point (5,5)(5,5) violates both and is excluded whatever yy is.

With y=0y=0 the second inequality becomes d⊤x≤e+M\boldsymbol{d}^{\top}\boldsymbol{x}\le e+M, which should hold for every relevant x\boldsymbol{x} and so restricts nothing; for y=1y=1 the roles swap. Hence MM must cover the largest amount by which the switched-off left-hand side can exceed its right-hand side. If MM is too small, allowed points are cut away; a much larger MM is still correct but weakens the LP relaxation, where yy may be fractional.

The binary variable is needed: the union contains (7,1)(7,1) and (1,7)(1,7) but not their midpoint (4,4)(4,4), since 20>1820>18 and 20>1620>16. A system of linear inequalities always contains the average of any two of its points (see convex combinations), so none in x1,x2x_1,x_2 alone describes this set. With several binaries the same device gives K-out-of-N constraints and nonconvex region modelling.


Key Results

  • For y=0y=0, the first inequality is enforced; for y=1y=1, the second is enforced.
  • A valid value of MM requires information about bounds on the expressions being relaxed.
  • This is a modelling device; it does not mean multiplying two decision variables.

Examples

The blue inequality is enforced when y=0y=0, and the red one when y=1y=1. The illustrated union is nonconvex, so it cannot be represented by one system of continuous linear inequalities in x\boldsymbol{x} alone.

  • 3x1+2x2≤18+My3x_1+2x_2\le18+My and x1+4x2≤16+M(1−y)x_1+4x_2\le16+M(1-y) implement the video example.
  • The week 3 exercise applies the same switch to two inequalities involving four variables.

Prerequisites

Sources

Aliases: disjunctive constraints Symbols: element of

Last updated: 22 October 2026 19:04