Procurement Process Optimization with Python
Optimize your procurement process with Python and non-linear programming to minimize costs and streamline operations.
Procurement management is a strategic approach to acquiring goods or services from preferred vendors within your determined budget.
As a data scientist, can you optimize procurement with Python?
Analytics can help you balance supply and demand to ensure a minimum inventory level to meet your store's demand.
In this article, we will present a simple methodology using Non-Linear Programming with Python to design an optimal procurement process for a mid-size retail store considering:
- Transportation Costs from the Supplier Warehouse to the Store Reserve ($/Carton)
- Costs to finance your inventory (% of inventory value in $)
- Reserve (Store’s Warehouse) Rental Costs for storage ($/Carton)
SUMMARY
I. Scenario
As a Supply Planning manager you need to optimize inventory allocation to reduce transportation costs.
II. Build your Model
1. Declare your decision variables
What are you trying to decide?
2. Declare your objective function
What do you want to minimize?
3. Define the constraints
What are the limits in resources?
4. Solve the model and prepare the results
What is the suggestion of the model?
III. Conclusion & Next Steps
1. Inventory Management Rules with Python
What if we have a complex distribution of the demand?
2. Simulate scenarios with a digital twin
How to estimate the impact of a specific rule on cost and performance?
3. Automate Order Creation in your ERP
Deploy an automated bot that will create purchase orders in SAP
How do you automate procurement with Python?
Problem Statement
As a data scientist, you would like to support the store Manager of a mid-size retail location.
She is in charge of setting the replenishment quantity in the ERP.
When the inventory level for each SKU is below a certain threshold, your ERP automatically sends a Purchase Order (PO) to your supplier.
What is the optimal order quantity and frequency?
To determine the right quantity for your PO, you must balance the constraints of stock capacity, transportation, and inventory costs.
- A supplier receives your orders via EDI connection and ships them using a 3rd Party Transportation company at your expense
- 60 active stock-keeping units (SKU) with a purchasing price ($/carton) and a yearly sales quantity (Cartons/year)
- Transportation using a 3rd party company that operates parcel delivery invoiced per carton ($/Carton)
- Storage Location (Store’s Reserve) with a capacity of 480 boxes stored on shelves
To simplify the comprehension, let’s introduce some notations
What are the other parameters?
b = 42.250 $
A = -0.3975 $/Carton
What about the cost of storing goods?
You have the financial costs.
As a mid-size business, your cost of capital is quite high: 12.5%.
Storage Costs
In this model, we suppose we have the world's best landlord.
She invoices us by carton occupied, taking the average value per year.
We will not pay for the empty locations.
Imax= 480
Rmonth= 2,000 $/Month
Which Quantity per replenishment Qi should you set in the ERP to minimize the total costs?
In the next section, we will build a model to estimate this quantity using Python.
🏫 Discover 70+ case studies using analytics for supply chain optimization 🚚, sustainability🌳and business optimization 🏪: Cheat Sheet
Build your Model
Unlike the previous article in the series, we won’t use PuLP as we are not dealing with a linear programming problem.
SciPy optimization functions can solve this non-linear minimization problem.
Declare your decision variables
What are you trying to decide?
We want to set the quantity per replenishment order sent by our ERP to the supplier.
However, to simplify our calculation, we will use the number of replenishments per year Ri as a decision variable.
The replenishment quantity will be calculated using the formula below.
Note: We accept a replenishment case quantity that is not an integer.
Declare your objective function
What do you want to minimize?
The purchasing cost is not included in the objective function as it is out of the scope of our optimization targets.
Code
Define the constraints
What are the limits in resources that will determine your feasible region?
This is where problems start, as we have a non-linear constraint (1/Ri).
Solve the model and prepare the results
What are the results of your simulation?
Initial Guess
Unlike Linear Programming, we need to provide an initial vector of a potential solution to the algorithm for the first iteration to initiate it.
Here, we’ll assume that 2 replenishments per year for all SKUs could be a good candidate.
$63,206.7 total cost for initial guessing
Hopefully the optimal solution will be lower
Solve
Comment
I found no method to implement Integer Non-Linear Programming using Scipy solvers.
If you have a better solution than this quick-and-dirty rounding using another Python library, please share it in the comment section.
For 100 Iterations
-> Initial Solution: $28,991.9
-> Integer Solution: $29,221.3 with a maximum inventory of 356 cartons
You can find the complete code in this GitHub repository 👇
Conclusion
We can see here that transportation costs mainly drive our solution, as we have a maximum stock of 356 boxes.
This optimized solution is 56% better than the initial guess of 2 yearly replenishments for all references.
However, it’s based on a strong assumption of a constant demand.
Inventory Management with Python
In the retail industry, inventory management systems often employ a fixed, rule-driven approach to forecasting and replenishing stock.
What if we have a stochastic distribution of your demand, and we want to avoid stock-outs?
You can then face stock-outs as your ordering rules (inventory rules) are not robust enough to absorb the variability, as in the example below.
Therefore, you must implement advanced inventory management rules to ensure our stores have enough goods to sell.
They consider key parameters defining your demand distribution to ensure you have enough safety stock to absorb the variability.
For more information, have a look at this article 👇
What if we implement these rules vs. a simple EOQ?
You can simulate the effect on costs and performance with digital twin models.
Include the Model in a Digital Twin
A digital twin is a digital replica of a physical object or system.
This computer model can represent our store replenished by suppliers with a planner creating orders.
Such an optimization model can be implemented to simulate warehouse replenishment orders sent to suppliers or factories.
For instance, we can test several scenarios to see how the model reacts
- High rental costs and low transportation costs
- Non-linear purchasing costs
- Higher Minimum Order Quantity
💡 For more details,
Now that you have found the optimal ordering policy to minimize costs and avoid stock-outs, how can you implement it?
Have you heard about Robotic Process Automation?
SAP Automation of Order Creation for Retail
A purchase order is a document to request items or services from a vendor at an agreed-upon price.
A fashion retail company preparing for the spring/summer collection must create dozens of purchase orders for its suppliers.
To create our Purchase Order, we need to fill in multiple pieces of information.
This can become a nightmare if done manually!
I’ve designed a workflow to create this automation using SAP GUI tool and Visual Basic.
If you want to implement it, have a look at the article linked below 👇
About Me
Let’s connect on Linkedin and Twitter. I am a Supply Chain Engineer who uses data analytics to improve logistics operations and reduce costs.
For consulting or advice on analytics and sustainable supply chain transformation, feel free to contact me via Logigreen Consulting.
If you are interested in Data Analytics and Supply Chain, look at my website.
💌 New articles straight in your inbox for free: Newsletter
📘 Your complete guide for Supply Chain Analytics: Analytics Cheat Sheet