Linear programming problem has the form of

If the formulation contains anything nonlinear (strictly speaking, non-convex), it cannot be solved easily in general. This is helpful to write the problem in a modelling language like AMPL and feed into a LP solver.

## Minima and Maxima

If a minimum or maximum function is involved, e.g.

it can be linearized by introducing an additional variable $x_{\max}$ and the constraints

# Minimax objective

Minimizing the objective function of $z = \max_k \sum_j f_k(x_j)$ can be transformed into minimizing the decision variable $z$ with extra constraints defining z:

## Absolute values

In case any absolute value of a free variable (i.e. $\in\mathbb{R}$) is involved, say $|x|$, we may convert it by introducing additional variables $x^+, x^-$, and additional constraints:

If we minimize the sum of $x^+$ and $x^-$ in objective function, one of them will be equal to zero. This will not work for maximization problem or problem without objective functions. For the latter, simple minimize for the sum of non-negative parts converted. For the former, switch the problem into minimization of negative of objective function.

## Fractions in objective function

This is a method introduced by A. Charnes and W.W. Cooper in their paper, Programming with Linear Fractional Functional, Naval Research Logistics Quaterly, Vol.9 pp.181–186, 1962.

Consider the case that a faction of polynomials is at the objective, e.g.

We define

and change the problem into:

In other words, we linearize the objective function by substituting for $t$, and convert all existing constraints by multiplying them with $t$. Finally, we introduce the additional constraint that $t$ multiply by the denominator of the original fraction shall equal to one.

In such a converted problem, the decision variables $x_j$ are transformed into $y_j = x_jt$, together with the newly introduced variable $t$, we can recover $x_j$ after the solution is found.

# Either-or constraints

Either $f(x) \le 0$ or $g(x) \le 0$ but not necessarily both as constraints: We can find some fairly large bounds $M_i$ such that we are quite sure $% $ and $% $ in the domain we concerned. Then set up:

for an extra binary variable $b$. Similar binary variable trick can be applied to objective functions that takes different value based on some conditions. If the two constraints are mututally exclusive, however, we should add

The bounds with binary variable trick can help imposing constraints like both-or-nothing as well. Below is an example of imposing exactly $m$ out of $N$ constraints active:

## Multiplication

Multiplication in general cannot be linearized. However, if one of the two multiplicands is range-bounded, their product can be converted into linear form.

Let’s introduce for the product $x_iy_i$:

and notice that

Then we can convert a multiplication into difference of variables $u^2$ and $v^2$, on the condition that their introduction can make the system remain linear.

Alternatively, consider $x_iy_i$, which $y_i$ is a free variable (or lower-bounded only) but $m_i\le x_i\le M_i$. Then we have

or, by realizing that $\frac{1}{2}(m_i+M_i)-\frac{1}{2}(M_i-m_i)\le x_i\le \frac{1}{2}(m_i+M_i)-\frac{1}{2}(M_i-m_i)$,

Thus we can replace the product $x_iy_i$ by using the RHS of the above inequalities, optionally with some modification to the corresponding constraint to reflect the substitution is not exact.

In the particular case of binary variables, say, the product $\delta_1\delta_2$, it can be replaced by a new binary variable $x$ such that:

In another case of a binary variable $\delta$ multiply by a bounded real number $m\le x\le M$, the product $\delta x$ can be replaced by a new variable $x'$ such that:

For other cases, such as multiplication of two unbounded real number, we may need approximation techniques, i.e. approximate a convex curve by piecewise linear functions.

## Discontinuity, Indicator Variables, and Upper-Bounds (MILP)

Let the range of a decision variable $x_i$ to be either $a\le x\le b$ or $c\le x\le d$ which $% $. We may introduce an indicator variable $\delta$ to represent this:

Another case that indicator variables can apply is a conditional equation. Let there be a quantity

Then we can replace the definition of $z$ by

for a fairly large value $M$ to serve as the upper-bound of $x$.

The introduction of an upper-bound is useful to incorporate exotic constraints in the linear programming. For example, either one of two constraints must be satisfied, but not necessarily both. Say, we have the following constraints:

where at least one of them must be satisfied. Then we can introduce an upper-bound $M$ and an indicator variable $\delta$ to invalidate one of them, i.e.

In general, we can mandate at least $k$ out of $n$ such constraints must be satisfied:

This provide each constraint with an independent indicator variable $\delta_j$, which tells if it have to be relaxed. Thus we can control the least number of constraints satisfied ($k$) by controlling the most number of constraints not satisfied ($n-k$).

A variation of such either-or constraints is the all-or-nothing constraints. Consider the two constraints case above, if it is an all-or-nothing rule, it means an either-or rule for the below:

Similarly, for the case of $n$-constraints case, the all-or-nothing rule means

# Reference

H.P. Williams, Model building in mathematical programming, 5th ed., John Wiley & Sons, 2013.