VOOZH about

URL: https://towardsdatascience.com/procurement-process-optimization-with-python-a4c7a2e3ba76/

⇱ Procurement Process Optimization with Python | Towards Data Science


Procurement Process Optimization with Python

Optimize your procurement process with Python and non-linear programming to minimize costs and streamline operations.

7 min read
👁 Optimize Store Procurement Strategy - (Image by Author)
Optimize Store Procurement Strategy – (Image by Author)

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
👁 Cell with a capacity of 16 boxes - (Image by Author)
Cell with a capacity of 16 boxes – (Image by Author)

To simplify the comprehension, let’s introduce some notations

👁 Notations - (Image by Author)
Notations – (Image by Author)

What are the other parameters?

👁 Equations— (Image by Author)
Equations— (Image by Author)

b = 42.250 $ A = -0.3975 $/Carton

What about the cost of storing goods?

You have the financial costs.

👁 Equations - (Image by Author)
Equations – (Image by Author)

As a mid-size business, your cost of capital is quite high: 12.5%.

Storage Costs

👁 Equations - (Image by Author)
Equations – (Image by Author)

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.

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.

👁 Equations - (Image by Author)
Equations – (Image by Author)

However, to simplify our calculation, we will use the number of replenishments per year Ri as a decision variable.

👁 Equations - (Image by Author)
Equations – (Image by Author)

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?

👁 Equations - (Image by Author)
Equations – (Image by Author)

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?

👁 Equations - (Image by Author)
Equations – (Image by Author)

This is where problems start, as we have a non-linear constraint (1/Ri).

👁 Equations - (Image by Author)
Equations – (Image by Author)

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 👇

GitHub – samirsaci/procurement-management: Procurement Process Optimization with Python

Conclusion

We can see here that transportation costs mainly drive our solution, as we have a maximum stock of 356 boxes.

This optimised 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.

👁 Example of a stochastic demand with a deterministic inventory policy — (Image by Author)
Example of a stochastic demand with a deterministic inventory policy — (Image by Author)

Therefore, you must implement advanced inventory management rules to ensure our stores have enough goods to sell.

👁 Demand distribution characteristics— (Image by Author)
Demand distribution characteristics— (Image by Author)

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 👇

Inventory Management for Retail – Stochastic Demand

We want to test these solutions.

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.

👁 Supply Chain Digital Twin with Python - (Image by Author)
Supply Chain Digital Twin with Python – (Image by Author)

This computer model can represent our store replenished by suppliers, with a planner creating orders.

👁 Example of Factory Parameters - (Image by Author)
Example of Factory Parameters – (Image by Author)

Such an optimisation 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,

What is a Supply Chain Digital Twin?

Now that you have found the optimal ordering policy to minimise 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.

👁 Purchase Order Creation Menu in SAP - (Image by Author)
Purchase Order Creation Menu in SAP – (Image by Author)

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!

👁 Example of Automation of Purchase Order Creation - (Image by Author)
Example of Automation of Purchase Order Creation – (Image by Author)

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 👇

SAP Automation of Orders Creation for Retail

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.

Samir Saci | Data Science & Productivity

💌 New articles straight in your inbox for free: Newsletter
📘 Your complete guide for Supply Chain Analytics: Analytics Cheat Sheet


Written By

Samir Saci

Towards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.

Write for TDS

Related Articles