Practice: Formulating a Linear Program

Recognition · Classification

A bakery decides how many loaves and how many cakes to bake. Flour is limited to 50 kg, each loaf uses 0.5 kg and each cake 0.2 kg. A loaf sells for £3 and a cake for £5. Which quantity should be a decision variable?

1 hint available, least help first.

Hint 1: Retrieval cue

Which of these can the bakery set directly, without first setting something else?

Construction · Direct application

A feed supplier blends two ingredients, barley and soy, into a batch of animal feed. Each kilogram of barley costs £0.40 and supplies 8 g of protein and 2 g of fat. Each kilogram of soy costs £0.90 and supplies 35 g of protein and 6 g of fat. A batch must weigh exactly 100 kg, must supply at least 1500 g of protein, and must supply no more than 400 g of fat. The supplier has used the same two ingredients for years. Formulate the problem of producing a batch at least cost as a linear program.

Define your variables with units, write the objective, write one constraint per restriction, and state the sign restrictions.

Write your answer, then compare it with the worked solution.

3 hints available, least help first.

Hint 1: Retrieval cue

What is the supplier actually choosing, and in what units?

Hint 2: Concept cue

Three sentences state restrictions: the batch weight, the protein minimum, and the fat maximum. One sentence states none.

Hint 3: Next step

"Exactly 100 kg" is an equality constraint; "at least" points one way and "no more than" the other.

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

Let x be the kilograms of barley in the batch and y the kilograms of soy in the batch. Objective: minimize 0.40 x + 0.90 y , the batch cost in pounds. Batch weight: x + y = 100 , an equality because the batch must weigh exactly 100 kg. Protein: 8 x + 35 y ≥ 1500 , in grams. Fat: 2 x + 6 y ≤ 400 , in grams. Sign restrictions: x ≥ 0 , y ≥ 0 . The sentence about having used the same ingredients for years restricts nothing and becomes no constraint.

A complete answer does each of these:

  • constraints complete and linear
  • objective matches goal
  • sign restrictions stated
  • units consistent
  • variables defined with units

Error diagnosis · Explanation

A workshop makes chairs and desks. Each chair needs 3 hours of carpentry, each desk 5 hours, and 120 carpentry hours are available. A chair yields £40 profit and a desk £60.

A student formulates:

"Let c be chairs made, d be desks made, P be the total profit, and H be the carpentry hours used.

maximise P

subject to P = 40 c + 60 d , H = 3 c + 5 d , H ≤ 120 , P ≥ 0 , c , d ≥ 0 ."

Identify which of the student's variables are not decisions. Explain what the constraint P ≥ 0 does to the model, and give the formulation the student should have written.

Write your answer, then compare it with the worked solution.

2 hints available, least help first.

Hint 1: Retrieval cue

Which of the four symbols can the workshop set directly?

Hint 2: Concept cue

Ask what the description says about profit being nonnegative. Does any sentence require it?

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

P and H are not decisions. The workshop chooses c and d ; profit and hours used follow from that choice, and each needs a defining equation purely to introduce a symbol that adds nothing. P ≥ 0 is a genuine error rather than mere clutter: combined with P = 40 c + 60 d it forbids any plan with negative profit. Here every feasible plan has P ≥ 0 anyway, so the optimum is unchanged, but the restriction is not implied by the description and would exclude admissible plans in a problem where some costs were fixed or some contributions negative. The correct formulation is: maximize 40 c + 60 d subject to 3 c + 5 d ≤ 120 and c , d ≥ 0 .

A complete answer does each of these:

  • variables defined with units
  • constraints complete and linear
  • objective matches goal

Method selection · Evaluation · Transfer

Four planning situations are described below. For each one, decide whether a linear program is an appropriate model as stated. If it is not, name the specific feature that rules it out and say what class of model the situation calls for instead. Do not formulate the programs.

(a) A refinery blends three crude streams into petrol, choosing how many barrels of each to use, subject to octane and sulphur limits expressed as averages weighted by volume.

(b) A haulier assigns whole lorries to six routes; a route either gets a lorry or it does not, and a lorry cannot be split.

(c) A shop sets the price of a single product and the quantity it stocks, seeking to maximize revenue, which is price multiplied by quantity sold.

(d) A supplier buys a raw material at £2 per kilogram for the first 500 kg and £1.60 per kilogram beyond that, choosing how much to buy and how to allocate it across two processes.

Write your answer, then compare it with the worked solution.

2 hints available, least help first.

Hint 1: Retrieval cue

A linear program needs linear expressions and divisible decisions. Which of these four descriptions breaks one of those?

Hint 2: Strategy cue

Try writing just the objective for each situation. The one whose objective multiplies two decisions together is disqualified immediately.

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

(a) A linear program is appropriate. A volume-weighted average constraint such as the octane limit clears its denominator into a linear inequality, so the apparent ratio is not a genuine nonlinearity. (b) Not a linear program as stated. The decisions are indivisible and the all-or-nothing assignment requires binary variables; this calls for an integer or binary program. (c) Not a linear program. The objective is price multiplied by quantity, a product of two decision variables, which is nonlinear; it calls for a nonlinear programming method. (d) Not a linear program as stated. The price break creates a piecewise cost that is not a single linear expression; it can be modelled with additional variables and binary indicators, giving a mixed-integer program, or approximated linearly if the break is known always to be crossed.

A complete answer does each of these:

  • classifies each situation
  • names the disqualifying feature
  • identifies alternative model class
  • recognises apparent nonlinearity

Method selection · Classification · Evaluation

Three situations are described below. For each, say whether a linear program models it as stated. Where it does not, name the specific feature that rules it out and the class of model the situation calls for instead. Do not write any formulations.

(a) A dairy splits its milk supply between cheese and butter production. Each tonne of cheese needs 9 tonnes of milk and 3 hours of vat time; each tonne of butter needs 22 tonnes of milk and 1 hour. Milk and vat time are both limited, and the dairy maximizes contribution per tonne.

(b) A council must decide which four of eleven proposed bus shelters to build, within a fixed capital budget, maximizing the total number of passengers served.

(c) A mill blends two grades of flour so that the protein content of the mixture is at least 12 per cent, where the protein content is the mass-weighted average of the two grades' protein percentages.

Write your answer, then compare it with the worked solution.

3 hints available, least help first.

Hint 1: Retrieval cue

A linear program needs divisible decisions, linear expressions, and data that does not depend on the choices.

Hint 2: Concept cue

For each situation, test those three requirements in turn. Which one, if any, actually fails?

Hint 3: Strategy cue

Where a constraint contains a fraction, try multiplying through by the denominator before deciding it is nonlinear.

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

(a) A linear program is appropriate. The decisions are continuous tonnages, every restriction is a sum of constant-times-variable terms, and the objective is linear. (b) Not a linear program as stated. A shelter is built or it is not, so the decisions are indivisible, and the requirement to choose exactly four is a count of binary choices. This calls for a binary or integer program; a fractional solution such as building 0.6 of a shelter has no meaning, and rounding it may break the budget or the count. (c) A linear program is appropriate. The mass-weighted average looks like a ratio of decision variables, but the constraint ( ∑ j p j x j ) / ( ∑ j x j ) ≥ 12 multiplies through by the positive denominator to give ∑ j ( p j − 12 ) x j ≥ 0 , which is linear. Rejecting this situation on the appearance of a ratio would discard a correct model.

A complete answer does each of these:

  • classifies each situation
  • identifies alternative model class
  • names the disqualifying feature
  • recognises apparent nonlinearity

Error diagnosis · Comparison

A student is asked whether a linear program can model this situation:

A cooperative blends two feed grades so that the mixture's protein content, the mass-weighted average of the two grades' protein percentages, is at least 14 per cent. It chooses how many tonnes of each grade to buy, minimizing cost.

The student answers:

"No. The protein constraint is an average, so it divides one decision variable by another. Division makes it nonlinear, so this needs nonlinear programming."

The student's answer is wrong. Identify the error in the reasoning, show what the constraint becomes when handled correctly, and state the general test they should have applied instead.

Write your answer, then compare it with the worked solution.

2 hints available, least help first.

Hint 1: Retrieval cue

Is the denominator ever zero or negative here?

Hint 2: Concept cue

An inequality may be multiplied through by a strictly positive quantity without changing its solution set.

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

The error is treating the appearance of a ratio as proof of nonlinearity. The constraint is

p 1 x 1 + p 2 x 2 x 1 + x 2 ≥ 14 ,

and the denominator x 1 + x 2 is strictly positive whenever anything is blended, so multiplying through preserves the inequality:

p 1 x 1 + p 2 x 2 ≥ 14 ( x 1 + x 2 ) ⟺ ( p 1 − 14 ) x 1 + ( p 2 − 14 ) x 2 ≥ 0 .

That is linear in x 1 and x 2 , so a linear program models the situation as stated. The general test is not whether a fraction appears, but whether the constraint can be rearranged into a sum of constant-times-variable terms. A genuine disqualifier is structural, indivisible decisions, a product of two decision variables, a cost that bends, not cosmetic.

A complete answer does each of these:

  • names the disqualifying feature
  • recognises apparent nonlinearity
Practice data

Your practice record is stored in this browser only. Clearing it removes every answer and every scheduled review, and cannot be undone.

Results update as you type. Use the up and down arrow keys to move between results, Enter to open one, and Escape to close.

Type to search.

Settings

Appearance

Interface density

Your record

Your progress is stored in this browser and nowhere else: an identifier, the answers you have given, the mastery states and review schedule derived from them, and the lesson you last opened. Clearing it makes you a new learner on this device. It cannot be undone, and it will not affect your appearance or density settings.

Focus timer

Focus--minutes remaining

Phase

Kept in this browser only, and used to label the session in your own history.

Today

Nothing recorded yet. Finish a focus session and it will appear here.

Settings

Focus sessions between long breaks.

Sessions you are aiming for in a day.

Notifications

Your history

Sessions are stored in this browser and nowhere else. They are not evidence and never reach your mastery record.