Linear programming is a combinatorial optimisation method to operate specific systems optimally under resource constraints
Problem Statement
A small manufacturer makes two products
AandB, each of which requires two resources and
- Each unit of
Arequires unit of and units of- Each unit of
Brequires unit of and units ofBut the manufacturer only has units of and units of
On every unit of
Asold the manufacturer makes$6profit On every unit ofBsold the manufacturer makes$5profitHow many units of the product
AandBshould the manufacturer produce to maximize profit?
Formalising The Problem
Let
x = num(A units produced)andy = num(B units produced)and the total profit (our objective function).We now have constraints on the products:
- As the manufacturer only has units of , then for , we have ,
- As they only have units of , then for we have .
- A simple constraint additionally is that as we can never lose products in our case.
We want to maximise our objective function subjected to certain constraints.
Most linear programming problems present themselves in terms of a linear objective function under linear and non-negative constraints.
Defining Jargon
- The variables and are called decision variables
- The profit function that is being optimised is called the objective function
- The restrictions below are called linear constraints. These restrict the values the decision variables can take.
All Linear Programming (LP) problems have a linear objective function, a set of linear constraints and a non-negativity constraint on all decision variables.
Canonical Form Of A Linear Programming Problem
Linear Programming (LP) is a method to achieve the best outcome, such as maximum profit or lowest cost, in a mathematical model whose requirements are represented by linear relationships.
- Let be the decision variables that represent the unknowns to solve for.
The goal is to maximise an objective function which is a linear function of the decision variables
Where are known coefficients representing the contribution of each decision variable to the objective.
The decision variables are subject to a set of linear inequality constraints:
Where are known coefficients, and are constants representing the right-hand side of each constraint.
Additionally, all decision variables must be non-negative, to ensure practical feasibility (e.g. you can’t produce a negative quantity of something.)
Graphical Solution
A graphical solution is applicable in practice to solutions involving 2 (or even 3 decision variables). It helps with gaining insight about solutions of general linear programs, otherwise its practically useless.
First, each constraint individually defines a half space, i.e. it divides a region that greater than and one that’s less than. This is the shaded region in each graph.

To satisfy all constraints, is equivalent to the intersection between all half spaces. Doing so, you will notice that all values are constrained in the first quadrant.

The feasible region is the region where the given linear program has feasible solutions satisfying all its constraints. This is the purple area (intersection of all half spaces).
This is the only region we care of, via the constraints, this is the area where the optimal solution exists in, including the border (<=)
The feasible region is a convex polygon/polyhedron.
Convex Polyhedrons
A definition of convexity is that, for any two points in a feasible region (closed region), drawing a line from one point to another (once again for ANY two points), returns a line that is completely contain within the region.
As long as the points are within the region, the line cannot be outside, it must be within or on the surface of the polyhedron.
Given any two points inside or on the surface/boundary of the polyhedron, the line segment connecting those two points always lies entirely within the polyhedron
For any point in the feasible region, there is always a point on the boundary/surface of the feasible region that will dominate it (i.e., will give a better evaluation of the objective function)
This lets us know that our search should only be on the boundary of the region, greatly constraining the search space.
Further, among all points on the boundary/surface of the feasible regions, there is at least one corner point of the feasible region that will always dominate, given the objective function.
This lets us reduce the search space further into the corners of the region.
If a point was perturbed by a neighbouring point to , the objective function increases, as the coefficient of decision variables of the objective function is positive, you would have a objective function that increases by the coefficient times . If the coefficient was negative would be greater. This also applies for .
As you continue to do this reaches the boundary and there is no neighbouring point gt/lt . So you would have a neighbouring point that dominates it. Taking this a little further, if you do this for both and you would reach the corners of the lines

The objective function is a family of lines depending on . If is fixed, it will converge into one line with a slope. If viewing this family as a sweep of lines convering to , the first point it touches is , the point sticking out (as its convex).
In fact the largest value for that intersects with one of those points will be at which is .

Approaching Graphical Solution Using Algebra
The graphical solution has no use for general purposes algorithms, it only provides insights.
To approach the solution algebraically is to convert the inequality constraints into equality constraints. This is achieved by adding slack variables.
Having a means that there is some slack on the LHS for it to become a strict equality. For example, becomes for some slack , similarly the becomes for some slack
Additionally, in actuality when adding new variables, all formulas (inequalities) must contain those variables so and is more correct.
The objective function can thus be written as:
Subject to the constraints
Where
First of all we can represent the constraints in matrix form :
Now there’s 4 variables and 2 equations, this is an undetermined system so a solution cannot be found using systems of linear equations. To do this we would need the same equations as variable. However, if we can fix two of variables to some value, which leaves two free variables, then we can solve for the free variables.
We are always fixing the values to , because… In our problem we have possible fixings.

By fixing these points to , we enumerate through all possible corner points and some points being in the infeasible regions
Basic Vs Non Basic Variables
Bases are a collection of column vectors that define the space, e.g. x, y, z coordinates form the basis of 3 dimensions.
In the context of linear programming, basic variables are the free variables (not set to 0). They correspond to column (unit) vectors that form a basis (vector space) of the iterative linear programming solution (explained in Tableau Simplex).
Where are non-basic variables are the variable that are fixed to zero. They are so called, because they are outside the basis of the linear programming problem
Now let’s evaluate the objective function corresponding to all possible ways of fixing variables to become non-basic variables

Generalising The Algebraic Method
Let some general linear programming formulation contain decision variables and linear constraints. For linear constraints, there will be slack variables helping form linear equations (rather than inequalities).
To assign out of (decision+slack) variables to , and solve for the remaining variables. There are such possibilities.
Substitute the values of that decision variables take into the objective function. Once all possibilities are explored, choose the optimum over all the solutions.
The issues with this are this algorithm grows combinatorially for large , evaluates infeasible solutions, doesn’t tell you if the optima has been reached as the search is exhaustive (brute-force), and does not give progressively better solutions (in terms of the objective function), the search is fairly random.
The Simplex Algorithm is a polynomial time algorithms (in practice) that optimises these issues.
A polynomial time algorithm is one whose running time grows at most as a polynomial function of the input size. I.e. an algorithm that runs in for some input size and constant .
This means the algorithm is considered efficient and scalable for large inputs.
