Linear Programming problems¶
Part 1 · Linear functions, polyhedra and linear programming problems · Chapter 4 · Lecture notes, volume 1 (PDF) · Slides · Exercises: Linear Programming problems · App: The graphical method
Prerequisites
-
From this module, Chapter 3 «Linear optimization problems»: LP problems, feasible and optimal solutions, optimal value.
-
From this module, Chapter 1 «Linear functions»: the gradient and the level sets of a linear function.
Objectives
At the end of this chapter you will be able to:
-
write an LP problem in canonical maximization form and in standard maximization form;
-
describe the feasible region and the objective function of each form;
-
obtain a lower bound on the optimal value from a feasible solution;
-
solve an LP problem with two or three variables by the graphical method.
4.1 Canonical maximization form¶
Definition 4.1: Linear Programming problems in canonical maximization form
Given:
-
an objective-function vector \({\boldsymbol c} \in \R^{n}\)
-
a constraint matrix \({\boldsymbol A} \in \R^{m \times n }\)
-
a right-hand-side (RHS) vector \({\boldsymbol b} \in \R^{m}\) with \(m\) rows
\[ \underbrace{ \begin{pmatrix} c_{1} \\ c_{2} \\ \vdots \\ \vdots \\ c_{n} \\ \end{pmatrix} }_{{\boldsymbol c}} \in \R^{n} \qquad \qquad \underbrace{ \begin{pmatrix} a_{11} & a_{12} & \dots & \dots & a_{1n}\\ a_{21} & a_{22} & \dots & \dots & a_{2n}\\ \vdots & \vdots & \ddots & \ddots & \vdots \\ a_{m1} & a_{m2} & \dots & \dots & a_{mn}\\ \end{pmatrix} }_{{\boldsymbol A}} \in \R^{m \times n } \qquad \qquad \underbrace{ \begin{pmatrix} b_{1} \\ b_{2} \\ \vdots \\ b_{m} \\ \end{pmatrix} }_{{\boldsymbol b}} \in \R^{m} \]
a Linear Programming problem LP in canonical maximization form with \(n\) non-negative variables
and \(m\) less-than-or-equal-to linear constraints is the following optimization problem:
where \({\boldsymbol 0} = \begin{pmatrix} 0 \\ 0 \\ \vdots \\ 0 \\ \end{pmatrix}\) is a (column) vector of \(n\) zeros.
Example 4.1: LP problem in canonical maximization form: the paint production example
The paint production example. This LP problem is the guiding example of the module. A company produces two paints, an exterior paint and an interior paint: \(x_1\) and \(x_2\) are the tonnes of exterior and interior paint produced per day, real numbers because paint is divisible.
-
The profit is \(5\) for a tonne of exterior paint and \(2\) for a tonne of interior paint (in thousands of euros): the objective maximizes the total profit \(5x_1+2x_2\).
-
First constraint (market): three times the interior paint can exceed the exterior paint by at most \(12\) tonnes, that is, \(-x_1+3x_2 \le 12\).
-
Second constraint: the mixing plant is available for \(12\) hours per day; a tonne of exterior paint takes \(1\) hour and a tonne of interior paint \(2\).
-
Third constraint (market): three times the exterior paint can exceed twice the interior paint by at most \(8\) tonnes, that is, \(3x_1-2x_2 \le 8\).
Consider the following input data of an LP problem with \(n=2\) and \(m=3\):
The numerical entries of the two column vectors and the matrix are
The problem involves \(n=2\) non-negative variables \({\boldsymbol x}= \begin{pmatrix} x_1 \\[1ex] x_2\\ \end{pmatrix}.\)
The associated LP problem in canonical maximization form with \(n=2\) non-negative variables and \(m=3\) less-than-or-equal-to linear constraints reads as follows:
Building models from real problems is the subject of the module «LP Modelling».
Example 4.2: LP problem in canonical maximization form
Consider the following input data of an LP problem with \(n=2\) and \(m=2\):
The numerical entries of the two column vectors and the matrix are
The problem involves \(n=2\) non-negative decision variables \({\boldsymbol x}= \begin{pmatrix} x_1 \\[1ex] x_2\\ \end{pmatrix}.\)
The associated LP problem in canonical maximization form with \(n=2\) non-negative variables and \(m=2\) less-than-or-equal-to linear constraints reads as follows:
4.1.1 Feasible region and objective function¶
Definition 4.2: feasible region and objective function
-
The feasible region of an LP problem (4.1) is the polyhedron \(F\) defined as follows:
\[\begin{equation*} \label{FeasibleRegion} \begin{split} F = \left\{~ \underbrace{ \begin{pmatrix} x_{1} \\ x_{2} \\ \vdots \\ x_{n} \\ \end{pmatrix}}_{{\boldsymbol x}} \in \R^n : \right. ~~ & \underbrace{\sum_{j=1}^n a_{ij} \, x_j \le b_i,~~\forall i \in \{1,2,\dots,m\}}_{{\boldsymbol A}\,{\boldsymbol x} \le {\boldsymbol b}}, \\[1ex] & \left. \vphantom{\begin{pmatrix} x_{1} \\ x_{2} \\ \vdots \\ x_{n} \end{pmatrix}} \underbrace{x_j \ge 0,~~\forall j \in \{1,2,\dots,n\}}_{{\boldsymbol x} \ge {\boldsymbol 0}} ~\right\}. \end{split} \tag{4.2} \end{equation*}\]The feasible region is defined by the less-than-or-equal-to linear constraints \(\eqref{Cons}\) and the non-negativity constraints \(\eqref{NonNegCons}\).
-
The objective function \(\eqref{ObjFunc}\) of an LP problem (4.1) to be maximized is the (scalar) linear function \(f\) defined as follows:
\[\begin{equation*} \label{ObjectiveFunction} f: \R^{n} \rightarrow \R, \qquad f : \underbrace{\begin{pmatrix} x_1 \\ x_2 \\ \vdots \\ x_n \end{pmatrix}}_{{\boldsymbol x}} \mapsto \underbrace{\sum_{j=1}^n c_j x_j}_{{\boldsymbol c}' {\boldsymbol x}} \tag{4.3} \end{equation*}\]
Example 4.3: objective function
The objective function of the LP problem of Example 4.1 is the scalar linear function:
Example 4.4: feasible region
The feasible region of the LP problem of Example 4.1 is the polyhedron:
4.1.2 Lower bounds¶
Definition 4.3: feasible solution and lower bound
-
Given
\[ \underbrace{\begin{pmatrix} \bar x_1 \\ \bar x_2 \\ \vdots \\ \bar x_n \end{pmatrix}}_{{ \bar{\boldsymbol x}}(\, LP \,)} \in F \]a feasible solution of the LP problem (4.1) (a point satisfying constraints \(\eqref{Cons}\) and \(\eqref{NonNegCons}\)), we can compute a lower bound \(LB(\bar{\boldsymbol x})\) on the optimal value \(z(\, LP \,)\) as follows:
\[\begin{equation*} \label{FeasSolCanonical} LB(\bar{\boldsymbol x})= \sum_{j=1}^n c_j \; \bar{x}_j \tag{4.4} \end{equation*}\]
For every feasible solution \({ \bar{\boldsymbol x}}(\, LP \,) \in F\) of an LP problem (4.1), we have
Example 4.5: Feasible solutions and lower bounds
Consider the LP problem of Example 4.1. A feasible solution is for example \({ \bar{\boldsymbol x}}(\, LP \,)= \begin{pmatrix} 0 \\ 4 \end{pmatrix}\) (where \(\bar{x}_1=0\) and \(\bar{x}_2=4\)) since:
Accordingly, a lower bound \(LB(\bar{\boldsymbol x})\) on the optimal value \(z(\, LP \,)\) of the LP problem is:
4.1.3 Graphical solution method¶
An optimal solution of an LP problem (4.1) in canonical maximization form with two variables can be graphically determined using the direction of the objective function gradient and the level sets perpendicular to the gradient.
Example 4.6: Graphical solution method
For the LP problem of Example 4.1:
an optimal solution is:
and the optimal value is:
In the paint production example, the company produces \(5\) tonnes of exterior paint and \(\frac{7}{2}\) tonnes of interior paint per day, with a profit of \(32\) thousand euros: a fractional quantity of paint is a natural answer.
In dashed blue, from left to right, the level sets \(5\,x_1 + 2\,x_2 = 0\), \(5\,x_1 + 2\,x_2 = 8\), \(5\,x_1 + 2\,x_2 = \frac{40}{3}\), \(5\,x_1 + 2\,x_2 = \frac{108}{5}\) and \(5\,x_1 + 2\,x_2 = 32\) of the objective function; the optimal vertex is depicted in blue.
Example 4.7: Graphical solution method
For the LP problem of Example 4.2:
an optimal solution is:
and the optimal value is:
In dashed blue, from bottom to top, the level sets \(-2\,x_1 - 4\,x_2 = -6\) and \(-2\,x_1 - 4\,x_2 = -8\) of the objective function; the optimal vertex \((1,1)\) is depicted in blue, and the gradient is drawn from the point \((2,4)\).
4.2 Standard maximization form¶
Definition 4.4: Linear Programming problems in standard maximization form
Given:
-
an objective-function vector \({\boldsymbol c} \in \R^{n}\)
-
a constraint matrix \({\boldsymbol A} \in \R^{m \times n }\)
-
a right-hand-side (RHS) vector \({\boldsymbol b} \in \R^{m}\) with \(m\) rows
\[ \underbrace{ \begin{pmatrix} c_{1} \\ c_{2} \\ \vdots \\ \vdots \\ c_{n} \\ \end{pmatrix} }_{{\boldsymbol c}} \in \R^{n} \qquad \qquad \underbrace{ \begin{pmatrix} a_{11} & a_{12} & \dots & \dots & a_{1n}\\ a_{21} & a_{22} & \dots & \dots & a_{2n}\\ \vdots & \vdots & \ddots & \ddots & \vdots \\ a_{m1} & a_{m2} & \dots & \dots & a_{mn}\\ \end{pmatrix} }_{{\boldsymbol A}} \in \R^{m \times n } \qquad \qquad \underbrace{ \begin{pmatrix} b_{1} \\ b_{2} \\ \vdots \\ b_{m} \\ \end{pmatrix} }_{{\boldsymbol b}} \in \R^{m} \]
a Linear Programming problem LP in standard maximization form with \(n\) non-negative variables
and \(m\) equality linear constraints is the following optimization problem:
where \({\boldsymbol 0} = \begin{pmatrix} 0 \\ 0 \\ \vdots \\ 0 \\ \end{pmatrix}\) is a (column) vector of \(n\) zeros.
Example 4.8: LP problem in standard maximization form
Consider the following input data of an LP problem with \(n=3\) and \(m=1\):
The numerical entries of the two column vectors and the matrix are
The problem involves \(n=3\) non-negative variables \({\boldsymbol x}= \begin{pmatrix} x_1 \\[1ex] x_2 \\[1ex] x_3\\ \end{pmatrix}.\)
The associated LP problem in standard maximization form with \(n=3\) non-negative variables and \(m=1\) equality linear constraints reads as follows:
4.2.1 Feasible region and objective function¶
Definition 4.5: feasible region and objective function
-
The feasible region of an LP problem (4.6) is the polyhedron \(F\) defined as follows:
\[\begin{equation*} \label{STANDARD_FeasibleRegion} \begin{split} F = \left\{~ \underbrace{ \begin{pmatrix} x_{1} \\ x_{2} \\ \vdots \\ x_{n} \\ \end{pmatrix}}_{{\boldsymbol x}} \in \R^n : \right. ~~ & \underbrace{\sum_{j=1}^n a_{ij} \, x_j = b_i,~~\forall i \in \{1,2,\dots,m\}}_{{\boldsymbol A}\,{\boldsymbol x} ={\boldsymbol b}}, \\[1ex] & \left. \vphantom{\begin{pmatrix} x_{1} \\ x_{2} \\ \vdots \\ x_{n} \end{pmatrix}} \underbrace{x_j \ge 0,~~\forall j \in \{1,2,\dots,n\}}_{{\boldsymbol x} \ge {\boldsymbol 0}} ~\right\}. \end{split} \tag{4.7} \end{equation*}\]The feasible region is defined by the equality linear constraints \(\eqref{STANDARD_Cons}\) and the non-negativity constraints \(\eqref{STANDARD_NonNegCons}\).
-
The objective function \(\eqref{STANDARD_ObjFunc}\) of an LP problem (4.6) to be maximized is the (scalar) linear function \(f\) defined as follows:
\[\begin{equation*} \label{STANDARD_ObjectiveFunction} f: \R^{n} \rightarrow \R, \qquad f : \underbrace{\begin{pmatrix} x_1 \\ x_2 \\ \vdots \\ x_n \end{pmatrix}}_{{\boldsymbol x}} \mapsto \underbrace{\sum_{j=1}^n c_j x_j}_{{\boldsymbol c}' {\boldsymbol x}} \tag{4.8} \end{equation*}\]
Example 4.9: objective function
The objective function of the LP problem of Example 4.8 is the scalar linear function:
Example 4.10: feasible region
The feasible region of the LP problem of Example 4.8 is the polyhedron:
4.2.2 Lower bounds¶
Definition 4.6: feasible solution and lower bound
-
Given
\[ \underbrace{\begin{pmatrix} \bar x_1 \\ \bar x_2 \\ \vdots \\ \bar x_n \end{pmatrix}}_{{ \bar{\boldsymbol x}}(\, LP \,)} \in F \]a feasible solution of the LP problem (4.6) (a point satisfying constraints \(\eqref{STANDARD_Cons}\) and \(\eqref{STANDARD_NonNegCons}\)), we can compute a lower bound \(LB(\bar{\boldsymbol x})\) on the optimal value \(z(\, LP \,)\) as follows:
\[\begin{equation*} \label{FeasSolStandard} LB(\bar{\boldsymbol x})= \sum_{j=1}^n c_j \; \bar{x}_j \tag{4.9} \end{equation*}\]
For every feasible solution \({ \bar{\boldsymbol x}}(\, LP \,) \in F\) of an LP problem (4.6), we have
Example 4.11: Feasible solutions and lower bounds
Consider the LP problem of Example 4.8. A feasible solution is for example \({ \bar{\boldsymbol x}}(\, LP \,)= \begin{pmatrix} 1 \\ \frac13 \\ 1 \end{pmatrix}\) (where \(\bar{x}_1 = 1\), \(\bar{x}_2 = \tfrac13\) and \(\bar{x}_3 = 1\)) since:
Accordingly, a lower bound \(LB(\bar{\boldsymbol x})\) on the optimal value \(z(\, LP \,)\) of the LP problem is:
4.2.3 Graphical solution method¶
An optimal solution of an LP problem (4.6) in standard maximization form with two or three variables can be graphically determined using the direction of the objective function gradient and the level sets perpendicular to the gradient.
Example 4.12: Graphical solution method
For the LP problem of Example 4.8:
All optimal solutions lie on the line segment
i.e., on the segment joining the points \(\begin{pmatrix} 2\\ 0\\ 0 \end{pmatrix}\) and \(\begin{pmatrix} 0\\ 0\\ 4 \end{pmatrix}\). Taking for instance the optimal solution \(\tilde{\boldsymbol x}(\, LP \,) = \begin{pmatrix} 2\\ 0\\ 0 \end{pmatrix}\) (where \(\tilde{x}_1=2\), \(\tilde{x}_2=0\) and \(\tilde{x}_3=0\)), the optimal value is: \(z(\, LP \,) = 2\,\tilde{x}_1 + 2\,\tilde{x}_2 + \tilde{x}_3 = 2 \cdot 2 + 2 \cdot 0 + 0 = 4.\)
4.3 In summary¶
In summary
-
Canonical maximization form: \(\max {\boldsymbol c}'{\boldsymbol x}\) with \({\boldsymbol A}{\boldsymbol x} \le {\boldsymbol b}\) and \({\boldsymbol x} \ge {\boldsymbol 0}\); standard maximization form: the same with \({\boldsymbol A}{\boldsymbol x} = {\boldsymbol b}\).
-
Every feasible solution \(\bar{\boldsymbol x}\) gives the lower bound \(LB(\bar{\boldsymbol x}) \le z(LP)\).
-
The graphical method moves a level set of the objective function in the direction of the gradient, as long as it meets the feasible region.
Exercises on this chapter: Linear Programming problems
Interactive lab¶
The apps of this chapter: move the sliders and drag the points. Each app also opens full page in the interactive lab: The graphical method.