Linear programming (LP) is one of the most widely used tools of operations research. It decides the best mix of activities when resources are limited.

What is Linear Programming

A linear programming problem has three parts. The decision variables x1, x2, … are the quantities to be chosen, such as the number of units of each product. The objective function is a linear expression Z = c1x1 + c2x2 + … to be maximised (profit) or minimised (cost). The constraints are linear inequalities or equations that express limits on resources, such as a1x1 + a2x2 ≤ b. The non-negativity conditions x1, x2, … ≥ 0 state that quantities cannot be negative. The word "linear" means that every term is a constant times a variable, with no products or powers.

Definition: Linear programming. A method of finding the values of decision variables that maximise or minimise a linear objective function subject to a set of linear constraints and non-negativity conditions.

Assumptions

LP assumes proportionality, so that profit and resource use grow in proportion to each variable, additivity, so that the total is the sum of the parts, divisibility, so that variables may take fractional values, and certainty, so that all the coefficients are known.

Steps of Formulation

  1. Identify the decision variables and define them clearly with units. 2. Write the objective function in terms of the variables. 3. Write each constraint from the limits given. 4. Add the non-negativity conditions. A clear table of the data, with products as columns and resources as rows, makes the formulation easy.

Applications

LP is used in production planning to decide what to make, in diet planning to meet nutrition at least cost, in transport and logistics, in blending of fuels and feeds, in staff scheduling, in investment choice, and in advertising to choose a media mix.

Table 4.1: Data for a production problem

Resource Chair (per unit) Table (per unit) Available
Wood (units) 2 3 120
Labour (hours) 4 2 160
Profit (Rs) 50 60 —

Example 4.1: Formulating an LP

Problem: A firm makes chairs and tables using the data in the table above. Formulate the LP to maximise profit.

Solution:

  1. Variables: x1 = number of chairs, x2 = number of tables.
  2. Objective: maximise Z = 50x1 + 60x2.
  3. Wood: 2x1 + 3x2 ≤ 120. Labour: 4x1 + 2x2 ≤ 160.
  4. Non-negativity: x1, x2 ≥ 0.

Result: Maximise Z = 50x1 + 60x2 subject to 2x1 + 3x2 ≤ 120, 4x1 + 2x2 ≤ 160, x1, x2 ≥ 0.

best = max((50 * a + 60 * b, a, b)
           for a in range(0, 41) for b in range(0, 41)
           if 2 * a + 3 * b <= 120 and 4 * a + 2 * b <= 160)
print("best integer plan (Z, chairs, tables):", best)

Output

best integer plan (Z, chairs, tables): (2700, 30, 20)

Common mistakes

  • Not defining the decision variables with clear units.
  • Writing a constraint the wrong way round, such as ≥ when the limit is a maximum.
  • Forgetting the non-negativity conditions.

Key takeaways

  • An LP has decision variables, an objective function, constraints and non-negativity.
  • Every term must be linear.
  • LP assumes proportionality, additivity, divisibility and certainty.
  • Formulation is easier with a table of the data.

Practice questions

  1. Name the parts of an LP problem.
  2. What does divisibility mean in LP?
  3. Give two applications of LP.

Answers to the practice questions

  1. Decision variables, objective function, constraints and non-negativity conditions.
  2. The variables may take fractional values.
  3. Production planning and diet planning (also transport, blending).

Sources

  • Official BCA syllabus Mathematics Foundations to Computer Science II, course code 25BCA402DS01, Unit IV