MatMod logo

Dudeney’s Tea Mixing (math12)

Run LPL Code  ,  PDF Document


“Mrs Spooner called this morning,” said the honest grocer to his assistant. “She wants twenty pounds of tea at $2.85 per lb. Of course, we have a good tea $3.0 per 1b, a slightly inferior at $2.7, and a cheap tea at 2.1” “What do you propose to do?” asked the innocent assistant. “Do?” exclaimed the grocer. “Why, just mix up the three teas in different proportions so that the twenty pounds will work out fairly at the lady’s price. Just don’t put in more of the best tea than necessary, as we make less profit on that, and of course you will use only our complete pound packets. Don’t do any weighing.” How was the poor fellow able to mix the three teas? Could you have shown him how to do it? (see [2] and [1]).

Modeling Steps

The different types of teas are the three sorts ’good’, ’middle’ and ’inferior’, each at a price.

  1. The variables are the numbers of complete pound packets of each type xt of tea that must be produced for the mixture. The variables must be integer (always complete packets).

  2. The total price of the mixture must be 20 28.5, and this amount must correspond to the mixture of the three kinds of teas.

  3. The total weight is 20. So, the sum of the numbers of complete pound packets for each type must be 20.

  4. To use the smallest amount possible of the first (best) tea, we minimize x1.

Listing 1: The Complete Model implemented in LPL [4]

model math12 "Dudeney's Tea Mixing"; 
  set t "various teas"; 
  parameter Price{t} := 
    [(good)=3.0 (middle)=2.7 (inferior)=2.1]; 
  integer variable X{t} [0..20]; 
    P: sum{t} Price*X = 20*2.85; 
    W: sum{t} X = 20; 
  minimize NrGood: X['good']; 


The optimal mixture is 10 packets of ’good’ tea and 10 packets of the ’middle’ tea and none from the ’inferior’ one.


  1. Is this result the only possible mixture?

  2. Formulate the model for the case where the grocer wants to maximize his profit and the profit per packets of the three types of tea are (2, 3, 4).

  3. Using the objective function of the previous question, and also the profit table. Increase successively the profit of the ’good’ tea. At which profit of the ’good’ tea does it become advantageous to switch to the other mixture?


  1. No, we could also mix 16 of the ’good’, 1 of the ’middle’, and 3 of the ’inferior’. To obtain this result, we minimize the quantity of the ’middle’.

  2. Remove the minimizing function and replace it by the two following instructions:

        parameter profit{t} := [2,3,4]; 
        maximize obj: sum{t} profit*X;

    We now have an optimization problem. Since there is less profit on the ’good’ tea, one should use a mixture with less of the ’good’ tea as the experienced grocer declared!

  3. At 2.51. Augment the profit of the good tea several times and iteratively solve the problem each time. You can also write a loop. If the profit of the best tea is lowered and even negative, he must maintain the mixture of 10 pounds of the best tea. This is due to the fact that there are only two solutions, if we maintain the total price of exactly 20 28.5! If we relax the constraint P to ’less or equal’, then other more plausible solutions become possible.


[1]   Nolan Clare.

[2]   Dudeney H.E. Amusements in Mathematics. Thomas Nelson and Sons, 1917.

[3]   MatMod. Homepage for Learning Mathematical Modeling :

[4]   Hürlimann T. Reference Manual for the LPL Modeling Language, most recent version.