An example of the use of linear programming in determining the optimal product-range structure in a bakery

November 2020 | Przegląd Piekarski i Cukierniczy (Baking and Confectionery Review)

RUNNING THE COMPANY

Anyone who understands mathematics at primary school level can carry out a process of optimisation in their bakery. Its result will be a clearly noticeable growth in profits or a reduction in risk. Every bakery owner has several areas where they see the possibility of optimisation, savings or growth in profits.

Personally I do not know anyone who likes mathematics. Nor do I know anyone who does not use calculation to earn money, or at least to make life easier for themselves. Extreme emotions are therefore connected with mathematics: on the one hand we avoid it, and on the other we cannot live without it.

Instinctively we feel that by calculating skilfully we can raise our earnings, shorten our travelling time or minimise risk. We see how much bread goes for disposal, how inadequately we have designed the structure of our product range. We feel helpless, because we do not know how to set about optimisation.

We feel that in order to do this we have to go deep into mathematical analysis, differential operations, some formulas and graphs. Who has time for that today? Often we do not have time to make basic summaries. We have trouble with basic calculations. Inwardly we feel that the division of costs into fixed and variable proposed by the bookkeeper is inappropriate. We are reluctant to step onto unknown ground, especially ground saturated with rules and equations, ground shrouded in a fog of abstract mathematical expressions.

The truth, however, is different. Thanks to publications such as this one, and to new calculators working online in the network, we can relatively easily and painlessly carry out certain important improvements.

W-MOSZCZYNSKI ppic 11-20

This is the first article in a series of publications promoting the application of simple mathematics to improving the quality of our business, increasing profitability, reducing risk and generally improving the properties of our processes. Today we will learn how to optimise the range of products sold. We will use the algorithms of so-called linear programming. Simple enough for anyone who has had minimal contact with mathematics to understand them.

What is linear programming and when did it come into being?

Linear programming, in its simplest form, consists of an objective equation and several inequalities representing constraints.

Linear programming was very widely used during the Second World War. The Allies realised that they might not win against the Third Reich and the Empire of Japan by applying traditional methods of managing logistics and supply. Having limited resources of means for waging the war, they had to know how to dispose of them so that their use should be as good as possible. Mathematicians came to the rescue. Thanks to them, logistical processes in the American army improved considerably. The equations reduced the risk of losing cargo, maximised the availability of dressing materials and maximised losses in the enemy’s ranks. What is interesting is that linear programming was invented in 1939 by the Soviet economist Leonid Kantorovich.

An example of linear programming

Let us assume that in our bakery we produce three kinds of bread. The table shows the net profit from the sale of each kind of bread.

Bread Net profit per loaf
Baltonowski bread 1.0 zł
Staropolski bread 2.4 zł
Sierpecki bread 1.2 zł

These breads differ slightly in their ingredients, and their unit profit is also different. The inhabitants of the town in which we sell our products seem to have no particular preferences and will buy every kind of bread from us. In this task, as bakery owners, we want to maximise the profit from the sale of bread by changing the structure of sales.

Formulating the objective function

So let us write down our objective function:

F(x₁, x₂, x₃) = 1.0x₁ + 2.4x₂ + 1.2x₃ → max

The above expression represents the sum of the profits from the sale of the individual breads. What we are concerned with is that this sum should be as large as possible. We then speak of maximising the objective function.

In our equation x₁ denotes the number of loaves of Baltonowski bread sold, x₂ – of Staropolski, x₃ – of Sierpecki.

Formulating the constraints

The table below shows the consumption of two ingredients which must be present in the production of bread.

Raw materials Baltonowski x₁ Staropolski x₂ Sierpecki x₃ Limit of raw materials
Ingredient 1 0.05 0.03 0.0 260
Ingredient 2 0.01 0.06 0.04 310

Now we have to write the above constraints as mathematical inequalities.

The constraint connected with the use of ingredient 1 can be written in the following way:

0.05x₁ + 0.03x₂ ≤ 260

As we remember, x₁ is the number of loaves of Baltonowski bread produced. In producing every loaf of this bread, 0.05 g of ingredient 1 is used. Production can be continued until ingredient 1 is exhausted, that is, until the stock of 260 kg is used up.

All the limiting conditions in this task can be written in the following way:

0.05x₁ + 0.03x₂ + 0.0x₃ ≤ 260
0.01x₁ + 0.06x₂ + 0.04x₃ ≤ 310
x₁ ≥ 0
x₂ ≥ 0
x₃ ≥ 0

The last three inequalities deserve attention; they say that the number of the individual breads, x₁, x₂, x₃, must be greater than or equal to zero. If we had forgotten about this, the algorithm maximising the profit from sales could show us negative values. Mathematics is a science requiring precision. The algorithm does not know that negative sales do not exist.

We have just created a linear programming algorithm. Formulating the algorithm is the most difficult stage of the work. This activity requires a certain practice and abstract thinking. A basic knowledge of the principles of mathematics is enough here.

Solving the algorithm

Until recently, solving such algorithms was quite a feat. A knowledge of operations on matrices and a thorough acquaintance with laborious calculation procedures were necessary. Fortunately we live in times in which we can solve most problems over the internet. It is similar here. It is enough to type into a browser the phrase „Simplex calculator” in order to find many forms available online for entering and calculating our algorithm. I made use of the calculator from the site maslowski.pl.

Solving the algorithm by means of the PuLP library

Professional analysts do not use internet calculators. In order to calculate our algorithm I will make use of the free PuLP library of the Python language.

After defining the objective and the variables x1, x2, x3, I enter the algorithm defined by us.

The algorithm defined by us indicated that from the stocks of ingredient 1 and ingredient 2 held, 2332 loaves of Baltonowski bread and 4778 loaves of Staropolski bread should be produced. Such a structure of sales will cause the maximisation of the profit from sales to the level of 13,799 zł. The algorithm indicated that Sierpecki bread should not be produced.

What would happen if, however, the inhabitants of the town did like Sierpecki bread? We would then have to change in our algorithm the condition from x₃ ≥ 0 to x₃ ≥ 2500. After recalculation it turns out that the total profit from sales fell to 13,466 zł.

This means that on the sale of every loaf of Sierpecki bread we are subsidising 333 zł / 2500 = 0.13 zł. We should therefore raise the price of this bread so that the unit profit approaches the level of 1.33 zł.

It follows from the optimisation algorithm that we can produce 2500 loaves of Sierpecki bread on condition that the unit profit from this bread is raised to the level of 1.33 zł. Such a price of bread gives the possibility of obtaining a profit of 13,792 zł.

Summary

The application of linear programming for the purpose of optimising production processes can bring great benefits. As I have shown, the most difficult element is the formulation of the mathematical equations and inequalities. Knowledge in the field of mathematics is not needed here, but common sense and a little abstract thinking.

In the past, calculating optimisation algorithms was a real problem. Today we can make use of simplex calculators, which are entirely sufficient to obtain correct results.

Wojciech Moszczyński

Wojciech Moszczyński — graduate of the Department of Econometrics and Statistics of Nicolaus Copernicus University in Toruń; specialist in econometrics, finance, data science, and management accounting. He specializes in the optimization of production and logistics processes. He conducts research in the area of the development and application of artificial intelligence. For years he has been engaged in the popularization of machine learning and data science in business environments.

Bądź pierwszy, który skomentuje ten wpis!

Dodaj komentarz

Twój adres email nie zostanie opublikowany.


*