ML Use case: Leveraging ML for Efficient Vendor Selection: Streamlining the Procurement Process
When I was working on the shop floor as a maintenance engineer, vendor selection was a constant challenge. My manager always insisted on ordering specific parts from designated vendors. This directive would change after every audit, which occurred every six months to a year. Each audit brought a new list of preferred vendors, and I often found myself wondering about the criteria behind these decisions.
Later, I was introduced to the vendor selection process and began to understand the parameters that influenced these decisions. Factors such as price, quality, lead time, reliability, and even the vendors' historical performance all played a crucial role. Additionally, compliance with industry standards and audit outcomes could significantly impact the choice of vendors.
However, manually evaluating and balancing these parameters for every procurement cycle was time-consuming and prone to human error. This complexity underscored the need for a more streamlined and data-driven approach to vendor selection.
Let me share an example to illustrate this point. Suppose I need to buy a part from 10 different vendors. All vendors offer the part at the same price, and each has provided the maximum number of parts they can supply per week. If I know the total number of parts I need, I can easily determine which vendors can fulfill the requirement by comparing their weekly capacities.
As an example:
From the above data, I can easily determine that to fulfill 8,000 parts over 10 days, I need the following combination to get all the parts delivered on time:
This straightforward example shows how manual calculations can help.
Now, let's consider another crucial parameter: the on-time delivery rate (%). This parameter reflects a vendor's reliability in delivering parts within the agreed timeframe. Incorporating this parameter adds another layer of complexity to the selection process.
Strategy to Meet the 8000 Parts Requirement:
These vendors have high on-time delivery rates and collectively can meet the 8000 parts requirement. Here's the breakdown:
But what if we add even more parameters to the mix? Consider the following additional parameters:
Considering these parameters, the complexity increases significantly.
To address this complexity, we can leverage machine learning algorithms. In this article as to create the demo I used RandomForestRegressor to design a scoring system for these vendors. This algorithm is particularly well-suited for this task because it can handle multiple input variables and is robust against overfitting, providing reliable predictions.
I have provided the code at the end of the article and it shows three sets of vendors to full fill the requirement.
Here’s how this process improves consistency and reliability in a make-to-stock scenario:
By integrating data from the ERP system, the AI model continuously learns from real-time delivery data. This ensures that the model adapts to any changes in vendor performance and maintains high accuracy in its predictions.
To illustrate this process, I have created a demo in Python. This demo showcases how the AI model predicts the best vendor combination and adapts based on real-time data. Here’s the script used in the demo:
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestRegressor
from sklearn.pipeline import Pipeline
from scipy.optimize import linprog
import joblib
# Mockup data
data = {
'Vendor ID': ['V001', 'V007', 'V005', 'V009', 'V002', 'V006', 'V008', 'V003', 'V010', 'V004'],
'On-time Delivery Rate': [95, 93, 92, 90, 90, 88, 87, 85, 85, 80],
'Average Lead Time': [5, 5, 4, 7, 7, 7, 6, 6, 8, 8],
'Quality Score': [9.0, 9.3, 9.5, 8.9, 8.5, 8.8, 8.7, 9.2, 8.2, 8.0],
'Historical Performance': [92, 90, 95, 89, 88, 87, 84, 85, 82, 80],
'Max Delivery Capacity': [3000, 3150, 3750, 3000, 2250, 2400, 2850, 2700, 2550, 3300],
'Expedited Shipping Cost': [50, 55, 60, 50, 40, 50, 45, 45, 55, 55]
}
# Convert to DataFrame
df = pd.DataFrame(data)
# Feature and target variable selection
X = df[['On-time Delivery Rate', 'Average Lead Time', 'Quality Score', 'Historical Performance', 'Max Delivery Capacity', 'Expedited Shipping Cost']]
y = df['Max Delivery Capacity'] # Assuming we want to maximize the delivery capacity
# Define a pipeline with preprocessing and model
pipeline = Pipeline([
('scaler', StandardScaler()),
('model', RandomForestRegressor(n_estimators=100, random_state=42))
])
# Fit the model
pipeline.fit (X, y)
# Predict scores for each vendor
df['Score'] = pipeline.predict(X)
# Sort vendors by the predicted score
sorted_vendors = df.sort_values(by='Score', ascending=False)
print(sorted_vendors)
# Save the trained model
joblib.dump(pipeline, 'vendor_selection_model.joblib')
领英推荐
Output:
import joblib
# Load the model
loaded_pipeline = joblib.load('vendor_selection_model.joblib')
# Use the loaded model to predict scores
df['Score'] = loaded_pipeline.predict(X)
# Continue with the optimization as before
# Define a function to run the optimization and get selected vendors
def optimize_vendors(df, required_quantity):
# Define the coefficients of the objective function (negative because we are maximizing)
c = -df['Score'].values
# Define the constraints (sum of parts must be at least required_quantity)
A = [df['Max Delivery Capacity'].values]
b = [required_quantity]
# Define bounds for each vendor (0 or 1, since we can either select a vendor or not)
x_bounds = [(0, 1) for _ in range(len(df))]
# Solve the linear programming problem using the HiGHS solver
result = linprog(c, A_ub=A, b_ub=b, bounds=x_bounds, method='highs')
if result.success:
# Get the selected vendors
selected_vendors = df[result.x > 0.5]
return selected_vendors
else:
return None
# Required quantity
required_quantity = 8000
# Get the first best combination
first_combination = optimize_vendors(df, required_quantity)
if first_combination is not None:
first_shipping_cost = first_combination['Expedited Shipping Cost'].sum()
first_max_lead_time = first_combination['Average Lead Time'].max()
print("First Best Combination:")
print(first_combination)
print(f"Total Expedited Shipping Cost: ${first_shipping_cost}")
print(f"Total Delivery Time: {first_max_lead_time} days")
# Exclude the selected vendors and find the next best combination
second_df = df[~df['Vendor ID'].isin(first_combination['Vendor ID'])]
second_combination = optimize_vendors(second_df, required_quantity)
if second_combination is not None:
second_shipping_cost = second_combination['Expedited Shipping Cost'].sum()
second_max_lead_time = second_combination['Average Lead Time'].max()
print("\nSecond Best Combination:")
print(second_combination)
print(f"Total Expedited Shipping Cost: ${second_shipping_cost}")
print(f"Total Delivery Time: {second_max_lead_time} days")
# Exclude the selected vendors from both the first and second combinations and find the third best combination
third_df = df[~df['Vendor ID'].isin(first_combination['Vendor ID'].tolist() + second_combination['Vendor ID'].tolist())]
third_combination = optimize_vendors(third_df, required_quantity)
if third_combination is not None:
third_shipping_cost = third_combination['Expedited Shipping Cost'].sum()
third_max_lead_time = third_combination['Average Lead Time'].max()
print("\nThird Best Combination:")
print(third_combination)
print(f"Total Expedited Shipping Cost: ${third_shipping_cost}")
print(f"Total Delivery Time: {third_max_lead_time} days")
Output:
By leveraging AI and machine learning, companies can automate the vendor selection process, reduce human error, and make more informed, data-driven decisions that optimize their procurement strategy.
Customer-Focused | Process & Data centric | Project Coach & Data Translator | Lifetime Learner : Enterprise Business Process owner & Business Technology Implementation Expert
5 个月Very good work Pradeep. You can also include diversity, sustanability and retraining the model realtime.
Insightful approach leveraging technology to streamline decision-making processes.
Optimist | Founder | Seeking Strategic Partners
6 个月Great example to illustrate the point! I’m envisioning many use cases beyond material management/procurement as I apply this to the DTC delivery game. Good stuff!