Maximize your Business Profitability with Python

Use linear programming to help your local bakery to improve its business profitability by selecting the right items to sell.

Question?
Maximize your Business Profitability with Python

In my previous articles, the primary objective was on using Linear Programming, Machine Learning, or Statistics to reduce operational costs.

Because, as a Supply Chain Solution Designer at a 3PL, my mission was always to reduce costs to maintain competitive pricing for our customers.

However, these tools and concepts can maximise profitability by focusing production on high-margin products.

In this article, I will show you how to help your local bakery maximise its profit by producing the right items using Linear Programming with Python.

💌 New articles straight to your inbox for free: Newsletter

Scenario


Problem Statement

You want to help your local bakery maximise its profit.

They sell several types of products, including cakes, pastries and sandwiches.

Available resources

  • 4 bakers working 6 hours per day (Total: 24 hours/day)
  • 1 assistant for sandwiches 4 hours per day
  • 2 ovens that can be used 24 hours per day (Total: 48 hours/day)
  • 100 slots available for stock and display

These items have different resource needs and profit levels.

Resources needs for each of your SKU — (Image by Author)

Objective

What do you need to produce to maximise your daily profit?

  • Results
Lemon Cake = 0
Sandwich = 20
Chocolate Cake = 32
Croissant = 0
Chocolate Eclair = 0
Panini = 0
Profit reached: 328 euros/day

Based on these results, your local bakery owner should focus on Chocolate Cakes and Sandwiches to reach a maximum profit of 328 euros/day.

This result can be improved by adding more constraints and parameters to ensure your model reflects the realities of your business.

  • What is the utilisation ratio of your resources?
Lemon Cake = 0
Sandwich = 20
Chocolate Cake = 32
Croissant = 0
Chocolate Eclair = 0
Panini = 01,440/1,440 minutes of bakers used
2,880/2,880 minutes of oven used
240/240 minutes of assistants working time used
126/200 display slots
Profit reached: 328.0 euros

Good news! You are fully utilising your equipment and workforce.

  • What if we have two more assistants to make sandwiches?
Lemon Cake = 0
Sandwich = 60
Chocolate Cake = 32
Croissant = 0
Chocolate Eclair = 0
Panini = 0
Profit reached: 504 euros
  • 50% profit increase if you recruit two more assistants (4h/day) by selling more sandwiches

The results are clear and backed by data.

How can you implement that for your business?

Build your Model

We will be using the PuLP library of Python.

PuLP is a modelling framework for Linear (LP) and Integer Programming (IP) problems written in Python.

Declare your variables, parameters and model

  • LpMaximize: your objective is to maximise your profit
  • lowBound =0: you cannot have a negative value of pastries
  • cat = ‘Integer’: let’s try to sell entire croissants :)

These parameters can be loaded from an Excel file.

Define the objective and add constraints

Solve your model and analyse the results

The full source code is available here.

🔗
You can find the full code in this GitHub repository: Link.

Next Steps

💡
If you have any question, feel free to ask it here: Ask a Question

Improve your model

Your local bakery cannot stop selling Lemon Cake overnight because it is not profitable.

Therefore, in your model, you can add constraints of a minimum quantity for each item to guarantee that your fans of lemon cake will have their favourite product.

Additional parameters and constraints can be added like ingredients quantity, shelf life.

What about considering the entire value chain?

On my channel, I explain how I used Python modelling to help my friend's small business as an example.

Value chain of my friend's business

 They sell cups made from renewable materials to coffee shops and distributors.

The idea was to simulate the impact of multiple business decisions (selling via distributors, using air freight for replenishment) on the overall profitability and cash flow.

For more details,

About Me

Let’s connect on LinkedIn and Twitter. I am a Supply Chain Engineer using data analytics to optimise logistics operations and reduce costs.

Question?
Question?