• Foundation
  • About 16 min
  • 5 practice questions

Formulating linear programming problems

Turn word problems on production, purchase and mixing into LPPs: choose decision variables, write the objective function, and translate every condition into a linear constraint.

If something looks wrong, please tell us.

Solving an LPP is mechanical once it is written correctly; most errors happen in the writing. This lesson gives a fixed routine for formulation and applies it to three common types of situation. All the numbers are illustrative.

A routine for formulation

From words to an LPP

  1. Identify what is to be decided; name the decision variables x and y with units
  2. Identify the goal: maximise (profit, output) or minimise (cost, time)
  3. Write the objective function Z = ax + by
  4. Turn each limit or requirement into a linear inequality
  5. Add x ≥ 0, y ≥ 0

A table of the data, with one row per resource and one column per product, makes the constraints easy to read off. Each row gives one constraint: (amount per unit of x) × x + (amount per unit of y) × y compared with the amount available or required.

Worked example 1: a production problem (maximise)

A workshop makes two kinds of wooden toys, A and B. Each toy A needs 3 hours of cutting and 1 hour of painting; each toy B needs 2 hours of cutting and 2 hours of painting. Each week there are at most 120 hours of cutting and 80 hours of painting. The profit is ₹25 on A and ₹40 on B. Formulate the LPP.

Data for worked example 1
ResourcePer toy APer toy BAvailable
Cutting (hours)32120
Painting (hours)1280
Profit (₹)2540To be maximised

Let x = number of toys A and y = number of toys B made per week. Maximise Z = 25x + 40y subject to 3x + 2y ≤ 120 (cutting), x + 2y ≤ 80 (painting), x ≥ 0, y ≥ 0.

Worked example 2: a mixing problem (minimise)

A school canteen makes a snack pack from two items. Each unit of item A gives 4 g of protein and 2 g of fibre and costs ₹10; each unit of item B gives 2 g of protein and 4 g of fibre and costs ₹12. A pack must contain at least 20 g of protein and at least 16 g of fibre. Formulate the LPP to minimise the cost of a pack.

Let x and y be the units of A and B in a pack. Minimise Z = 10x + 12y subject to 4x + 2y ≥ 20 (protein), 2x + 4y ≥ 16 (fibre), x ≥ 0, y ≥ 0. Requirements of the form 'at least' give ≥ constraints, which is typical of minimising problems. (The constraints may be simplified to 2x + y ≥ 10 and x + 2y ≥ 8.)

Worked example 3: a purchase problem with three conditions

A shopkeeper buys fans at ₹1000 each and lamps at ₹500 each, has at most ₹20,000 to spend and space for at most 30 items, and wants at least as many lamps as fans. The profit is ₹150 per fan and ₹60 per lamp. Let x fans and y lamps be bought. Maximise Z = 150x + 60y subject to 1000x + 500y ≤ 20000, i.e. 2x + y ≤ 40 (money); x + y ≤ 30 (space); y ≥ x (at least as many lamps as fans); x ≥ 0, y ≥ 0.

Translating common phrases
PhraseInequality
At most 30 itemsx + y ≤ 30
At least 20 g of protein4x + 2y ≥ 20
At least as many lamps as fansy ≥ x
The number of A is at least twice the number of Bx ≥ 2y
Exactly 10 units in totalx + y = 10
Cannot exceed 120 hours3x + 2y ≤ 120

One constraint per limited resource or requirement; 'at most / cannot exceed' gives ≤, 'at least / not less than' gives ≥; never forget x ≥ 0, y ≥ 0.

Common mistakes

  • Mixing up rows and columns: the coefficients of one constraint come from one resource, across both products.
  • Writing 'at least' as ≤ or 'at most' as ≥.
  • Using total amounts instead of per-unit amounts in the objective function.
  • Forgetting the non-negative restrictions.
  • Leaving units inconsistent (for example rupees and thousands of rupees in one inequality).

Key takeaways

  • Define the decision variables clearly, with units.
  • Profit or output problems are usually maximised; cost problems minimised.
  • A data table gives each constraint as a row.
  • Simplify constraints by dividing by common factors, but keep the inequality sign the right way round.

Check your understanding

  1. 1. Product A needs 3 machine-hours and product B needs 2 machine-hours, and 120 machine-hours are available. With x units of A and y of B, the machine constraint is

    1. 2x + 3y ≤ 120
    2. 3x + 2y ≤ 120
    3. 3x + 2y ≥ 120
    4. x + y ≤ 120
    Show answer

    Answer: B. Machine time used is 3 hours for each A and 2 for each B, so 3x + 2y, and it cannot exceed the 120 hours available.

  2. 2. Food P gives 4 units of protein per kg and food Q gives 2 units per kg; at least 20 units are needed. With x kg of P and y kg of Q, the constraint is

    1. 4x + 2y ≤ 20
    2. 2x + 4y ≥ 20
    3. 4x + 2y ≥ 20
    4. x + y ≥ 20
    Show answer

    Answer: C. Protein supplied is 4x + 2y units, and 'at least 20' means ≥ 20.

  3. 3. The profit is ₹25 on each item A and ₹40 on each item B. With x of A and y of B, the objective is to

    1. maximise Z = 25x + 40y
    2. minimise Z = 25x + 40y
    3. maximise Z = 40x + 25y
    4. maximise Z = 65(x + y)
    Show answer

    Answer: A. Total profit is 25x + 40y rupees, and profit is to be made as large as possible.

  4. 4. 'The number of item B must be at least twice the number of item A.' With x of A and y of B, this is

    1. x ≥ 2y
    2. y ≤ 2x
    3. 2y ≥ x
    4. y ≥ 2x
    Show answer

    Answer: D. B is at least twice A: y ≥ 2 × x, i.e. y ≥ 2x. Writing x ≥ 2y reverses the roles.

  5. 5. Assertion (A): The condition 'the store-room can hold at most 50 items' is written x + y ≥ 50. Reason (R): 'At most' means 'less than or equal to'.

    1. Both A and R are true, and R is the correct explanation of A
    2. Both A and R are true, but R is not the correct explanation of A
    3. A is true, but R is false
    4. A is false, but R is true
    Show answer

    Answer: D. R is true. By R the condition is x + y ≤ 50, so A, which uses ≥, is false.

Privacy · Terms · Refunds · Delivery