Linear programming
Linear programming is a technique to identify maximum and minimum solutions for problems, often referred to as optimization. It is a common technique because a surprising number of real world problems can be described or estimated using linear equations. For example, in manufacturing:
- Programming is a synonym for planning, or more specifically, planning of manufacturing activities, resources and products
- The linear objective function describes the potential amount of profit, loss, revenue or cost
- Variables are the resources (input) and/or products (output) related to the manufacturing activities
- Linear equality and inequality constraints describe requirements or restrictions caused by manufacturing activities
- Maximization is concerned with profit, revenue or output quantities
- Minimization is concerned with loss, costs or input quantities
A standard form of a linear programming problem is to find values of x1, x2, ... , xn so as to
Subject to
(note 1)
maximize z = c1x1 + c2x2 + ... + cnxn
Subject to
(note 2)
a11x1 + a12x2 + ... + a1nxn ≤ b1
a21x1 + a22x2 + ... + a2nxn ≤ b2
...
am1x1 + am2x2 + ... + amnxn ≤ bm
anda21x1 + a22x2 + ... + a2nxn ≤ b2
...
am1x1 + am2x2 + ... + amnxn ≤ bm
(note 3)
x1 ≥ 0, x2 ≥ 0, ... , xn ≥ 0
Notes:
(1) Objective function could also be expressed as minimizing z
(2) Functional constraints could also be expressed with ≥ or =
(3) This requirement is also known as the nonnegativity constraint
(1) Objective function could also be expressed as minimizing z
(2) Functional constraints could also be expressed with ≥ or =
(3) This requirement is also known as the nonnegativity constraint
Linear programming has very specific terms:
- A solution is any specification of values for x1, x2, ... , xn
- A feasible solution is one such that all constraints are satisfied
- The feasible region is the collection of all feasible solutions
- It is possible for a problem to have an empty feasible region, e.g. no feasible solution
- An optimal solution is a feasible solution that has the most favorable value of the objective function
- When maximizing the objective function, the most favorable value is the largest value
- When minimizing the objective function, the most favorable value is the smallest value
As an example, consider the following linear programming problem:
Maximize z = 20x1 + 40x2
Such that,
4x1 + 6x2 ≤ 120
2x1 + 6x2 ≤ 72
x2 ≤ 10
x1, x2 ≥ 0
2x1 + 6x2 ≤ 72
x2 ≤ 10
x1, x2 ≥ 0
The Octave script below uses the glpk() function to solve the example problem.
http://hughesbennett.co.uk/LinearProgramming