2 Linear optimization

In this chapter we discuss various aspects of linear optimization. We first introduce the basic concepts of linear optimization and discuss the underlying geometric interpretations. We then give examples of the most frequently used reformulations or modeling tricks used in linear optimization, and finally we discuss duality and infeasibility theory in some detail.

2.1 Introduction

2.1.1 Basic notions

The most basic type of optimization is linear optimization. In linear optimization we minimize a linear function given a set of linear constraints. For example, we may wish to minimize a linear function

x1+2x2x3

under the constraints that

x1+x2+x3=1,x1,x2,x30.

The function we minimize is often called the objective function; in this case we have a linear objective function. The constraints are also linear and consist of both linear equalities and inequalities. We typically use more compact notation

(2.1)minimizex1+2x2x3subject tox1+x2+x3=1,x1,x2,x30,

and we call (2.1) a linear optimization problem. The domain where all constraints are satisfied is called the feasible set; the feasible set for (2.1) is shown in Fig. 2.1.

_images/fig-lo1.png

Fig. 2.1 Feasible set for x1+x2+x3=1 and x1,x2,x30.

For this simple problem we see by inspection that the optimal value of the problem is 1 obtained by the optimal solution

(x1,x2,x3)=(0,0,1).

Linear optimization problems are typically formulated using matrix notation. The standard form of a linear minimization problem is:

(2.2)minimizecTxsubject toAx=b,x0.

For example, we can pose (2.1) in this form with

x=[x1x2x3],c=[121],A=[111].

There are many other formulations for linear optimization problems; we can have different types of constraints,

Ax=b,Axb,Axb,lcAxuc,

and different bounds on the variables

lxxux

or we may have no bounds on some xi, in which case we say that xi is a free variable. All these formulations are equivalent in the sense that by simple linear transformations and introduction of auxiliary variables they represent the same set of problems. The important feature is that the objective function and the constraints are all linear in x.

2.1.2 Geometry of linear optimization

A hyperplane is a subset of Rn defined as {xaT(xx0)=0} or equivalently {xaTx=γ} with aTx0=γ, see Fig. 2.2.

_images/fig-hyperplane.png

Fig. 2.2 The dashed line illustrates a hyperplane {xaTx=γ}.

Thus a linear constraint

Ax=b

with ARm×n represents an intersection of m hyperplanes.

Next, consider a point x above the hyperplane in Fig. 2.3. Since xx0 forms an acute angle with a we have that aT(xx0)0, or aTxγ. The set {xaTxγ} is called a halfspace. Similarly the set {xaTxγ} forms another halfspace; in Fig. 2.3 it corresponds to the area below the dashed line.

_images/fig-halfspace.png

Fig. 2.3 The grey area is the halfspace {xaTxγ}.

A set of linear inequalities

Axb

corresponds to an intersection of halfspaces and forms a polyhedron, see Fig. 2.4.

_images/polyhedron.png

Fig. 2.4 A polyhedron formed as an intersection of halfspaces.

The polyhedral description of the feasible set gives us a very intuitive interpretation of linear optimization, which is illustrated in Fig. 2.5. The dashed lines are normal to the objective c=(1,1), and to minimize cTx we move as far as possible in the opposite direction of c, to the furthest position where a dashed line intersect the polyhedron; an optimal solution is therefore always either a vertex of the polyhedron, or an entire facet of the polyhedron may be optimal.

_images/lpcontour.png

Fig. 2.5 Geometric interpretation of linear optimization. The optimal solution x is at a point where the normals to c (the dashed lines) intersect the polyhedron.

The polyhedron shown in the figure is nonempty and bounded, but this is not always the case for polyhedra arising from linear inequalities in optimization problems. In such cases the optimization problem may be infeasible or unbounded, which we will discuss in detail in Sec. 2.3 (Infeasibility in linear optimization).

2.2 Linear modeling

In this section we present useful reformulation techniques and standard tricks which allow constructing more complicated models using linear optimization. It is also a guide through the types of constraints which can be expressed using linear (in)equalities.

2.2.1 Maximum

The inequality tmax{x1,,xn} is equivalent to a simultaneous sequence of n inequalities

txi, i=1,,n

and similarly tmin{x1,,xn} is the same as

txi, i=1,,n.

Of course the same reformulation applies if each xi is not a single variable but a linear expression. In particular, we can consider convex piecewise-linear functions f:RnR defined as the maximum of affine functions (see Fig. 2.6):

f(x):=maxi=1,,m{aiTx+bi}
_images/pwlconvex.png

Fig. 2.6 A convex piecewise-linear function (solid lines) of a single variable x. The function is defined as the maximum of 3 affine functions.

The epigraph f(x)t (see Sec. 12 (Notation and definitions)) has an equivalent formulation with m inequalities:

aiTx+bit,i=1,,m.

Piecewise-linear functions have many uses linear in optimization; either we have a convex piecewise-linear formulation from the onset, or we may approximate a more complicated (nonlinear) problem using piecewise-linear approximations, although with modern nonlinear optimization software it is becoming both easier and more efficient to directly formulate and solve nonlinear problems without piecewise-linear approximations.

2.2.2 Absolute value

The absolute value of a scalar variable, |x|:=max{x,x}, is a special case of Sec. 2.2.1 (Maximum). To model the epigraph

|x|t,

we can thus use two inequalities

txt.

2.2.3 The 1 norm

All norms are convex functions, but the 1 and norms are of particular interest for linear optimization. The 1 norm of vector xRn is defined as

x1:=|x1|+|x2|++|xn|.

To model the epigraph

(2.3)x1t,

we introduce the following system

(2.4)|xi|zi,i=1,,n,i=1nzi=t,

with additional (auxiliary) variable zRn. Clearly (2.3) and (2.4) are equivalent, in the sense that they have the same projection onto the space of x and t variables. Therefore, we can model (2.3) using linear (in)equalities

(2.5)zixizi,i=1nzi=t,

with auxiliary variables z. Similarly, we can describe the epigraph of the norm of an affine function of x,

Axb1t

as

ziaiTxbizi,i=1nzi=t,

where ai is the ith row of A (taken as a column-vector).

Example 2.1 Basis pursuit

The 1 norm is overwhelmingly popular as a convex approximation of the cardinality (i.e., number on nonzero elements) of a vector x. For example, suppose we are given an underdetermined linear system

Ax=b

where ARm×n and mn. The basis pursuit problem

(2.6)minimizex1subject toAx=b,

uses the 1 norm of x as a heuristic for finding a sparse solution (one with many zero elements) to Ax=b, i.e., it aims to represent b as a linear combination of few columns of A. Using (2.5) we can pose the problem as a linear optimization problem,

(2.7)minimizeeTzsubject tozxz,Ax=b,

where e=(1,,1)T.

2.2.4 The norm

The norm of a vector xRn is defined as

x:=maxi=1,,n|xi|,

which is another example of a simple piecewise-linear function. Using Sec. 2.2.2 (Absolute value) we model

xt

as

txit,i=1,,n.

Again, we can also consider affine functions of x, i.e.,

Axbt,

which can be described as

taiTxbt,i=1,,n.
Example 2.2 Dual norms

It is interesting to note that the 1 and norms are dual. For any norm on Rn, the dual norm is defined as

x=max{xTvv1}.

Let us verify that the dual of the norm is the 1 norm. Consider

x,=max{xTvv1}.

Obviously the maximum is attained for

vi={+1,xi0,1,xi<0,

i.e., x,=i|xi|=x1. Similarly, consider the dual of the 1 norm,

x,1=max{xTvv11}.

To maximize xTv subject to |v1|++|vn|1 we simply pick the element of x with largest absolute value, say |xk|, and set vk=±1, so that x,1=|xk|=x. This illustrates a more general property of dual norms, namely that x=x.

2.2.5 Homogenization

Consider the linear-fractional problem

(2.8)minimizeaTx+bcTx+dsubject to cTx+d>0,Fx=g.

Perhaps surprisingly, it can be turned into a linear problem if we homogenize the linear constraint, i.e. replace it with Fy=gz for a single variable zR. The full new optimization problem is

(2.9)minimizeaTy+bzsubject to cTy+dz=1,Fy=gz,z0.

If x is a feasible point in (2.8) then z=(cTx+d)1, y=xz is feasible for (2.9) with the same objective value. Conversely, if (y,z) is feasible for (2.9) then x=y/z is feasible in (2.8) and has the same objective value, at least when z0. If z=0 and x is any feasible point for (2.8) then x+ty,t+ is a sequence of solutions of (2.8) converging to the value of (2.9). We leave it for the reader to check those statements. In either case we showed an equivalence between the two problems.

Note that, as the sketch of proof above suggests, the optimal value in (2.8) may not be attained, even though the one in the linear problem (2.9) always is. For example, consider a pair of problems constructed as above:

minimizex1/x2subject to x2>0,x1+x2=1.minimizey1subject to y1+y2=z,y2=1,z0.

Both have an optimal value of 1, but on the left we can only approach it arbitrarily closely.

2.2.6 Sum of largest elements

Suppose xRn and that m is a positive integer. Consider the problem

(2.10)minimizemt+iuisubject to ui+txi,i=1,,n,ui0,i=1,,n,

with new variables tR, uiRn. It is easy to see that fixing a value for t determines the rest of the solution. For the sake of simplifying notation let us assume for a moment that x is sorted:

x1x2xn.

If t[xk,xk+1) then ul=0 for lk+1 and ul=xlt for lk in the optimal solution. Therefore, the objective value under the assumption t[xk,xk+1) is

objt=x1++xk+t(mk)

which is a linear function minimized at one of the endpoints of [xk,xk+1). Now we can compute

objxk+1objxk=(km)(xkxk+1).

It follows that objxk has a minimum for k=m, and therefore the optimum value of (2.10) is simply

x1++xm.

Since the assumption that x is sorted was only a notational convenience, we conclude that in general the optimization model (2.10) computes the sum of m largest entries in x. In Sec. 2.4 (Duality in linear optimization) we will show a conceptual way of deriving this model.

2.3 Infeasibility in linear optimization

In this section we discuss the basic theory of primal infeasibility certificates for linear problems. These ideas will be developed further after we have introduced duality in the next section.

One of the first issues one faces when presented with an optimization problem is whether it has any solutions at all. As we discussed previously, for a linear optimization problem

(2.11)minimizecTxsubject toAx=b,x0.

the feasible set

Fp={xRnAx=b,x0}

is a convex polytope. We say the problem is feasible if Fp and infeasible otherwise.

Example 2.3 Linear infeasible problem

Consider the optimization problem:

minimize2x1+3x2x3subject tox1+x2+2x3=1,2x1x2+x3=0.5,x1+5x3=0.1,xi0.

This problem is infeasible. We see it by taking a linear combination of the constraints with coefficients y=(1,2,1)T:

x1+x2+2x3=1,/12x1x2+x3=0.5,/2x1+5x3=0.1,/(1)2x1x2x3=0.1.

This clearly proves infeasibility: the left-hand side is negative and the right-hand side is positive, which is impossible.

2.3.1 Farkas’ lemma

In the last example we proved infeasibility of the linear system by exhibiting an explicit linear combination of the equations, such that the right-hand side (constant) is positive while on the left-hand side all coefficients are negative or zero. In matrix notation, such a linear combination is given by a vector y such that ATy0 and bTy>0. The next lemma shows that infeasibility of (2.11) is equivalent to the existence of such a vector.

Lemma 2.1 Farkas' lemma

Given A and b as in (2.11), exactly one of the two statements is true:

  1. There exists x0 such that Ax=b.

  2. There exists y such that ATy0 and bTy>0.

Proof
2.1

Let a1,,an be the columns of A. The set {Axx0} is a closed convex cone spanned by a1,,an. If this cone contains b then we have the first alternative. Otherwise the cone can be separated from the point b by a hyperplane passing through 0, i.e. there exists y such that yTb>0 and yTai0 for all i. This is equivalent to the second alternative. Finally, 1. and 2. are mutually exclusive, since otherwise we would have

0<yTb=yTAx=(ATy)Tx0.

Farkas’ lemma implies that either the problem (2.11) is feasible or there is a certificate of infeasibility y. In other words, every time we classify model as infeasible, we can certify this fact by providing an appropriate y, as in Example 2.3.

2.3.2 Locating infeasibility

As we already discussed, the infeasibility certificate y gives coefficients of a linear combination of the constraints which is infeasible “in an obvious way”, that is positive on one side and negative on the other. In some cases, y may be very sparse, i.e. it may have very few nonzeros, which means that already a very small subset of the constraints is the root cause of infeasibility. This may be interesting if, for example, we are debugging a large model which we expected to be feasible and infeasibility is caused by an error in the problem formulation. Then we only have to consider the sub-problem formed by constraints with index set {jyj0}.

Example 2.4 All constraints involved in infeasibility

As a cautionary note consider the constraints

0x1x2xn1.

Any problem with those constraints is infeasible, but dropping any one of the inequalities creates a feasible subproblem.

2.4 Duality in linear optimization

Duality is a rich and powerful theory, central to understanding infeasibility and sensitivity issues in linear optimization. In this section we only discuss duality in linear optimization at a descriptive level suited for practitioners; we refer to Sec. 8 (Duality in conic optimization) for a more in-depth discussion of duality for general conic problems.

2.4.1 The dual problem

Primal problem

We consider as always a linear optimization problem in standard form:

(2.12)minimizecTxsubject toAx=b,x0.

We denote the optimal objective value in (2.12) by p. There are three possibilities:

  • The problem is infeasible. By convention p=+.

  • p is finite, in which case the problem has an optimal solution.

  • p=, meaning that there are feasible solutions with cTx decreasing to , in which case we say the problem is unbounded.

Lagrange function

We associate with (2.12) a so-called Lagrangian function L:Rn×Rm×R+nR that augments the objective with a weighted combination of all the constraints,

L(x,y,s)=cTx+yT(bAx)sTx.

The variables yRm and sR+n are called Lagrange multipliers or dual variables. For any feasible xFp and any (y,s)Rm×R+n we have

L(x,y,s)=cTx+(y)T0(s)TxcTx.

Note the we used the nonnegativity of s, or in general of any Lagrange multiplier associated with an inequality constraint. The dual function is defined as the minimum of L(x,y,s) over x. Thus the dual function of (2.12) is

g(y,s)=minxL(x,y,s)=minxxT(cATys)+bTy={bTy,cATys=0,,otherwise.

Dual problem

For every (y,s) the value of g(y,s) is a lower bound for p. To get the best such bound we maximize g(y,s) over all (y,s) and get the dual problem:

(2.13)maximizebTysubject tocATy=s,s0.

The optimal value of (2.13) will be denoted d. As in the case of (2.12) (which from now on we call the primal problem), the dual problem can be infeasible (d=), have an optimal solution (<d<+) or be unbounded (d=+). Note that the roles of and + are now reversed because the dual is a maximization problem.

Example 2.5 Dual of basis pursuit

As an example, let us derive the dual of the basis pursuit formulation (2.7). It would be possible to add auxiliary variables and constraints to force that problem into the standard form (2.12) and then just apply the dual transformation as a black box, but it is both easier and more instructive to directly write the Lagrangian:

L(x,z,y,u,v)=eTz+uT(xz)vT(x+z)+yT(bAx)

where e=(1,,1)T, with Lagrange multipliers yRm and u,vR+n. The dual function

g(y,u,v)=minx,zL(x,z,y,u,v)=minx,zzT(euv)+xT(uvATy)+yTb

is only bounded below if e=u+v and ATy=uv, hence the dual problem is

(2.14)maximizebTysubject toe=u+v,ATy=uv,u,v0.

It is not hard to observe that an equivalent formulation of (2.14) is simply

(2.15)maximizebTysubject toATy1,

which should be associated with duality between norms discussed in Example 2.2.

Example 2.6 Dual of a maximization problem

We can similarly derive the dual of problem (2.13). If we write it simply as

maximizebTysubject tocATy0,

then the Lagrangian is

L(y,u)=bTy+uT(cATy)=yT(bAu)+cTu

with uR+n, so that now L(y,u)bTy for any feasible y. Calculating minumaxyL(y,u) is now equivalent to the problem

minimizecTusubject toAu=b,u0,

so, as expected, the dual of the dual recovers the original primal problem.

2.4.2 Weak and strong duality

Suppose x and (y,s) are feasible points for the primal and dual problems (2.12) and (2.13), respectively. Then we have

bTy=(Ax)Ty=(x)T(ATy)=(x)T(cs)=cTx(s)TxcTx

so the dual objective value is a lower bound on the objective value of the primal. In particular, any dual feasible point (y,s) gives a lower bound:

bTyp

and we immediately get the next lemma.

Lemma 2.2 Weak duality

dp.

It follows that if bTy=cTx then x is optimal for the primal, (y,s) is optimal for the dual and bTy=cTx is the common optimal objective value. This way we can use the optimal dual solution to certify optimality of the primal solution and vice versa.

The remarkable property of linear optimization is that d=p holds in the most interesting scenario when the primal problem is feasible and bounded. It means that the certificate of optimality mentioned in the previous paragraph always exists.

Lemma 2.3 Strong duality

If at least one of d,p is finite then d=p.

Proof
2.2

Suppose <p<; the proof in the dual case is analogous. For any ε>0 consider the feasibility problem with variable x0 and constraints

[cTA]x=[p+εb]that iscTx=pε,Ax=b.

Optimality of p implies that the above problem is infeasible. By Lemma 2.1 there exists y^=[y0 y]T such that

[c, AT]y^0 and [p+ε, bT]y^>0.

If y0=0 then ATy0 and bTy>0, which by Lemma 2.1 again would mean that the original primal problem was infeasible, which is not the case. Hence we can rescale so that y0=1 and then we get

cATy0andbTypε.

The first inequality above implies that y is feasible for the dual problem. By letting ε0 we obtain dp.

We can exploit strong duality to freely choose between solving the primal or dual version of any linear problem.

Example 2.7 Sum of largest elements

Suppose that x is now a constant vector. Consider the following problem with variable z:

maximizexTzsubject toizi=m,0z1.

The maximum is attained when z indicates the positions of m largest entries in x, and the objective value is then their sum. This formulation, however, cannot be used when x is another variable, since then the objective function is no longer linear. Let us derive the dual problem. The Lagrangian is

L(z,s,t,u)=xTz+t(meTz)+sTz+uT(ez)==zT(xte+su)+tm+uTe

with u,s0. Since si0 is arbitrary and not otherwise constrained, the equality xit+siui=0 is the same as ui+txi and for the dual problem we get

minimizemt+iuisubject to ui+txi,i=1,,n,ui0,i=1,,n,

which is exactly the problem (2.10) we studied in Sec. 2.2.6 (Sum of largest elements). Strong duality now implies that (2.10) computes the sum of m biggest entries in x.

2.4.3 Duality and infeasibility: summary

We can now expand the discussion of infeasibility certificates in the context of duality. Farkas’ lemma Lemma 2.1 can be dualized and the two versions can be summarized as follows:

Lemma 2.4 Primal and dual Farkas' lemma

For a primal-dual pair of linear problems we have the following equivalences:

  1. The primal problem (2.12) is infeasible if and only if there is y such that ATy0 and bTy>0.

  2. The dual problem (2.13) is infeasible if and only if there is x0 such that Ax=0 and cTx<0.

Weak and strong duality for linear optimization now lead to the following conclusions:

  • If the problem is primal feasible and has finite objective value (<p<) then so is the dual and d=p. We sometimes refer to this case as primal and dual feasible. The dual solution certifies the optimality of the primal solution and vice versa.

  • If the primal problem is feasible but unbounded (p=) then the dual is infeasible (d=). Part (ii) of Farkas’ lemma provides a certificate of this fact, that is a vector x with x0, Ax=0 and cTx<0. In fact it is easy to give this statement a geometric interpretation. If x0 is any primal feasible point then the infinite ray

    tx0+tx, t[0,)

    belongs to the feasible set Fp because A(x0+tx)=b and x0+tx0. Along this ray the objective value is unbounded below:

    cT(x0+tx)=cTx0+t(cTx).
  • If the primal problem is infeasible (p=) then a certificate of this fact is provided by part (i). The dual problem may be unbounded (d=) or infeasible (d=).

Example 2.8 Primal-dual infeasibility

Weak and strong duality imply that the only case when dp is when both primal and dual problem are infeasible (d=, p=), for example:

minimizexsubject to0x=1.

2.4.4 Dual values as shadow prices

Dual values are related to shadow prices, as they measure, under some nondegeneracy assumption, the sensitivity of the objective value to a change in the constraint. Consider again the primal and dual problem pair (2.12) and (2.13) with feasible sets Fp and Fd and with a primal-dual optimal solution (x,y,s).

Suppose we change one of the values in b from bi to bi. This corresponds to moving one of the hyperplanes defining Fp, and in consequence the optimal solution (and the objective value) may change. On the other hand, the dual feasible set Fd is not affected. Assuming that the solution (y,s) was a unique vertex of Fd this point remains optimal for the dual after a sufficiently small change of b. But then the change of the dual objective is

yi(bibi)

and by strong duality the primal objective changes by the same amount.

Example 2.9 Student diet

An optimization student wants to save money on the diet while remaining healthy. A healthy diet requires at least P=6 units of protein, C=15 units of carbohydrates, F=5 units of fats and V=7 units of vitamins. The student can choose from the following products:

P

C

F

V

price

takeaway

3

3

2

1

5

vegetables

1

2

0

4

1

bread

0.5

4

1

0

2

The problem of minimizing cost while meeting dietary requirements is

minimize5x1+x2+2x3subject to3x1+x2+0.5x36,3x1+2x2+4x315,2x1+x35,x1+4x27,x1,x2,x30.

If y1,y2,y3,y4 are the dual variables associated with the four inequality constraints then the (unique) primal-dual optimal solution to this problem is approximately:

(x,y)=((1,1.5,3),(0.42,0,1.78,0.14))

with optimal cost p=12.5. Note y2=0 indicates that the second constraint is not binding. Indeed, we could increase C to 18 without affecting the optimal solution. The remaining constraints are binding.

Improving the intake of protein by 1 unit (increasing P to 7) will increase the cost by 0.42, while doing the same for fat will cost an extra 1.78 per unit. If the student had extra money to improve one of the parameters then the best choice would be to increase the intake of vitamins, with shadow price of just 0.14.

If one month the student only had 12 units of money and was willing to relax one of the requirements then the best choice is to save on fats: the necessary reduction of F is smallest, namely 0.51.781=0.28. Indeed, with the new value of F=4.72 the same problem solves to p=12 and x=(1.08,1.48,2.56).

We stress that a truly balanced diet problem should also include upper bounds.