
Back
June 21, 2024
ML Infra, Classifiers & RL
Supply Chain Optimization
Pfactorial
Share

Introduction
Ever wonder how your favorite toy gets from all its different parts to your hands?
Imagine a complex puzzle where each piece is made in a different location. Supply chain optimization is about solving that puzzle efficiently. It's the behind-the-scenes magic that ensures every part arrives at the right place, at the right time, to create the final product you love. This blog dives into the world of supply chain optimization, exploring how it streamlines the journey from raw materials to your doorstep, saving time, money, and resources along the way.

Supply chain optimization involves finding the best path to achieve and based on constraints. The process of designing and optimizing a supply chain network allows businesses to achieve several goals: maximizing profits, minimizing operating expenses, and ensuring a positive customer experience. This involves efficiently managing distribution, inventory, manufacturing, and transportation costs. The ultimate aim is to deliver products to customers in the way they want, when they want it, where they want it, all while maintaining the lowest cost and highest profit margins
Machine learning in supply chain
Due to heavy reliance on data, the supply chain industry presents numerous opportunities for the application of machine learning. The integration of machine learning into supply chain management represents a transformative leap in how businesses handle logistics, inventory management, and overall operational efficiency. By using the power of advanced algorithms, machine learning enables organizations to make data-driven decisions, enhance forecasting accuracy, and respond dynamically to the complexities of the modern supply chain. Use cases of ML in the supply chain include predictive analytics, Reduces Cost and Response Times, Warehouse Management, Streamlining Production Planning and Reduction in Forecast Errors.
Linear Programming and PuLP
In this blog, we will introduce a technique utilizing Linear Programming for optimizing supply chain processes. Linear programming involves creating a model on Continuous variables. It is an optimization method that utilises a mathematical model with linear relationships as its fundamental requirements. Simply, the main objective of linear programming is to maximize or minimize the numerical value.
Here we will be using the Pulp library of Python. Pulp is a modelling framework in python for Linear Programming problems. Before going to the problem, let me introduce you to the basics of the PuLP library and how to use it. It is widely used in optimization problems. It involves mainly 5 steps.
Common modelling process for Pulp
Consider a simple scenario: you own a bakery specializing in two types of cakes. The challenge at hand involves scheduling bakery resources for the upcoming 30 days. These resources include one oven, two bakers, and one packer. Notably, the packer is available for work on 22 out of the next 30 days. Each cake type requires different resource allocations, as outlined below: Cake A necessitates 0.5 days in the oven, 1 day of baking, and 1 day of packing. On the other hand, Cake B requires 1 day in the oven, 2.5 days of baking, and 2 days of packing. The profitability of Cake A is $20, while Cake B yields a profit of $40. This scheduling problem aims to maximize profit under the given constraints.
- Initialize Model
First we need to install PuLP. Next, initialize the model using the
LpProblem() function. model=LpProblem("Maximise profit", LpMaximize)Opt for LpMaximize since our goal is to maximize profitability.
- Define Decision Variables
Next we define decision variables using the
LpVariable() function. LpVariable(name, lowBound ,upBound, cat). Name is the name of the variable used .Here it is A and B , name of bakers. Then we need to set lower and upperBounds of variables. Cat is a category of variable like integer, Binary or Continuous.
- Define Objective Function
Here our objective is to know how many of each type of cake we should make to maximize the profit. So our equation will be like this.
profit= 20*A + 40*B- Define Constraints
From the resource schedules we need to make contains . Here it should be like this
The number of days the oven used for both bakes should not exceed 30 days(0.5A+1B<=30). For bakers the total number of days should not exceed 60 days. (1A+2.5 B <=60). For packing workers available for 22 days so it should not exceed 22 days(1A +2B<=22).
In our example, we are currently working with two variables, namely A and B. However, in real-world scenarios, the number of variables may be more extensive. To streamline the definition of both the objective function and constraints, we employ the
lpSum() function, which effectively sums a list of linear expressions.- Solve Model
Solve the model using
model.solve() function.For further reference you can follow this documentation on PuLP : https://coin-or.github.io/pulp/.
Hope you get a basic understanding of PuLP and it is used in optimization problems.
Next we are going to solve an optimization problem using PuLP.
Model implementation
Problem Statement :
Optimise the transportation process from five manufacturing plants (M1, M2, M3, M4, M5) to 10 customer locations(C1-C10) by determining the optimal allocation of supply. Considering distribution costs, maximum capacities for each manufacturing plant, and demand for each customer location, the goal is to minimise transportation costs. Determine the optimal quantity each manufacturing plant supplies to each customer location, ensuring overall efficiency in the supply chain.
Now let’s check our dataset.
Cost Table , Demand Table, and Capacity Table



As outlined in the problem statement, our objective is to optimize the transportation process.
As we discussed earlier we need to initialize model
Define decision variables and objective function. Here we are using the
lpSum() functionNext we need to define constraints.
The last step is solving the model. After solving the model we can print the result as shown in below code .

As evident in the screenshot provided, the model status indicates "optimal." This signifies that we have achieved an optimal model. Let us discuss what are other possible status to the solution.
Not Solved : The status prior to solving the problem
Optimal : An optimal solution has been found
Infeasible : There are no feasible solutions
Unbounded : The object function is not bounded, maximizing or minimizing the objective will tend towards infinity
Undefined : The optimal solution may exist but may not have been found.
As outlined in the problem statement, we optimized the transportation process.
Now let’s explore some benefits of supply chain optimization.
Benefits of supply chain optimization
- Cost Reduction: Optimization helps in identifying inefficiencies, reducing excess inventory, and minimizing transportation costs, ultimately leading to overall cost savings.
- Improved Efficiency: utilizing resources more effectively lead to increased operational efficiency throughout the supply chain.
- Enhanced Customer Satisfaction: By optimizing processes, businesses can improve delivery times, reduce stockouts, and ensure that products are available when and where customers need them, resulting in higher customer satisfaction.
- Better Decision-Making: Supply chain optimization leverages data analytics and modelling tools, providing businesses with actionable insights for more informed decision-making.
- Inventory Management: Optimization helps in maintaining the right level of inventory, preventing overstock or stockouts, and reducing carrying costs.
- Optimal Resource Utilization: By efficiently allocating resources such as production capacity, transportation, and labor, businesses can maximize their utilization and minimize waste.
Supply chain optimization is a crucial strategy for businesses aiming to excel in a dynamic and competitive landscape. It provides advantages that go beyond cost savings, including enhanced customer satisfaction, increased operational efficiency, and heightened overall business resilience. The integration of machine learning emerges not just as a technological advancement but as a transformative catalyst, empowering businesses to navigate uncertainties, make data-driven decisions, and provides new levels of efficiency and adaptability in the pursuit of optimized supply chain processes
I trust you've gained insights into supply chain optimization and how to leverage the PuLP library for streamlined processes. Go and explore the vast area of supply chain optimization using python. Wishing you an enriching learning journey!
BLOGS
You might also like...

Forcast using SARIMAData ScienceE-commerce & Retail+5
Jun 21, 20246 min readRead

Deep learningData Science Deep Learning+4
Predictive Maintenance for Manufacturing
Jun 25, 20248 min readRead

Deep learningData Science Deep Learning+4
Quality Control in Manufacturing
Jun 25, 20246 min readRead

Deep learningData AnalyticsML Infra, Classifiers & RL+4
AI as a Service
Jun 27, 20246 min readRead