girgit.org

Linear Programming

Turning a story into maths: formulating an LPP

The big ideaTo turn a word problem into an LPP you need four things: the decision variables, the objective function, the constraints, and the non-negativity conditions.

In simple words

First give a letter to each thing you have to choose, like "how many desks". Then write what you want to make big or small as a sum, like "profit = 600 for each desk plus 250 for each chair". Then write every limit as a "no more than" or "at least" line. Last, say that you cannot buy a negative number of anything.

The recipe: four ingredients

IngredientAsk yourselfFor the furniture dealer
Decision variablesWhat am I free to choose?x = number of desks, y = number of chairs
Objective functionWhat do I want to make as big (or as small) as possible?Profit Z = 600x + 250y, to be maximised
ConstraintsWhat limits must every plan obey?Money: 4500x + 1500y ≤ 90000. Space: x + y ≤ 40
Non-negativityCan any variable be negative?No: x ≥ 0, y ≥ 0

Building the dealer's LPP step by step

  1. Name the choices. Let x be the number of desks and y the number of chairs he buys. These are the decision variables: the numbers we decide.
  2. No negative furniture. He cannot buy −3 desks, so \( x \ge 0 \) and \( y \ge 0 \). These are the non-negative constraints (also called non-negative restrictions).
  3. The money limit. x desks cost 4500x rupees and y chairs cost 1500y rupees. The total can be at most ₹90,000: \( 4500x + 1500y \le 90000 \). Divide every term by 1500 to make it easier to draw: \( 3x + y \le 60 \). This is the investment constraint.
  4. The space limit. Each piece takes one place and there are 40 places: \( x + y \le 40 \). This is the storage constraint.
  5. The goal. Profit is ₹600 per desk and ₹250 per chair, so Z = 600x + 250y. We want Z as large as possible. Z is the objective function.

Put together, the whole problem is:

\[ \text{Maximise } Z = 600x + 250y \] \[ \text{subject to } 3x + y \le 60,\quad x + y \le 40,\quad x \ge 0,\quad y \ge 0. \]

Try it: change the dealer's story and watch every number travel to its place in the LPP.

What exactly is an LPP?

A linear programming problem asks for the optimal value (the maximum or the minimum) of a linear function of several variables, called the objective function, when the variables are non-negative and must satisfy a set of linear inequalities, called linear constraints.

  • A linear objective function has the form Z = ax + by, where a and b are fixed numbers (constants). For the dealer, a = 600 and b = 250.
  • Constraints are the linear inequalities, equations or restrictions on the variables. The dealer has four: the two "≥ 0" conditions, the money limit and the space limit.
  • The objective function is not a constraint. It is the score we are trying to improve.

Turning words into signs

The problem saysWrite
at most, not more than, up to, cannot exceed, has only≤
at least, not less than, a minimum of, must meet≥
exactly, must use all=

Worked example: the mess snack (a diet problem)

Chana costs ₹20 a packet and gives 3 units of protein and 1 of iron. Palak dal costs ₹30 a bowl and gives 2 of protein and 3 of iron. Each snack needs at least 12 units of protein and at least 11 of iron. Formulate the LPP for the cheapest snack.

A table of the data keeps it tidy: one row per food, one column per nutrient, and a last row for the need.

ProteinIronCost
Chana (x packets)31₹20
Palak dal (y bowls)23₹30
Needat least 12at least 11as low as possible

Read each column down to make one line: protein \( 3x + 2y \ge 12 \), iron \( x + 3y \ge 11 \), and cost Z = 20x + 30y. So:

\[ \text{Minimise } Z = 20x + 30y \] \[ \text{subject to } 3x + 2y \ge 12,\quad x + 3y \ge 11,\quad x \ge 0,\quad y \ge 0. \]

Don't mix these up

  • Each constraint uses one resource in one unit: all rupees, or all pieces, or all units of iron. Never add rupees to pieces.
  • "At least" is ≥, and diet problems are usually minimise with ≥ constraints; profit problems are usually maximise with ≤ constraints.
  • Always write x ≥ 0, y ≥ 0. Leaving them out loses marks and can give a wrong region.

Try it. A tailor makes shirts and kurtas. A shirt needs 2 hours of cutting and 1 hour of stitching; a kurta needs 1 hour of cutting and 3 hours of stitching. Each week there are 16 hours for cutting and 18 hours for stitching. A shirt earns ₹150 and a kurta ₹200. Write the LPP for the most profit.

Answer
Let x = shirts, y = kurtas. Maximise Z = 150x + 200y subject to \( 2x + y \le 16 \) (cutting), \( x + 3y \le 18 \) (stitching), \( x \ge 0,\ y \ge 0 \). Concept 4 solves it.

Words to know

Decision variables
The unknown amounts you get to choose, such as x and y.
Objective function
Z = ax + by, the quantity to be made as large or as small as possible.
Constraints
The linear inequalities or equations the variables must obey.
Non-negative restrictions
x ≥ 0, y ≥ 0: you cannot have less than none of something.
Optimal value
The best value of Z: the maximum or the minimum, as the problem asks.

A baker has at most 24 kg of flour. Each cake uses 0.5 kg and each loaf of bread 0.75 kg. If x cakes and y loaves are made, the flour constraint is

  1. \( 0.5x + 0.75y \ge 24 \)
  2. \( 0.5x + 0.75y \le 24 \)
  3. \( x + y \le 24 \)

Which of these can be the objective function of an LPP?

  1. Z = xy + 3x
  2. Z = 7x − 2y
  3. 7x − 2y ≤ 5

Why do we write x ≥ 0 and y ≥ 0 in the dealer's problem?

  1. He must buy at least one of each
  2. He cannot buy a negative number of desks or chairs
  3. So that the profit is positive