TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Supply Chain Process Scheduling with Python

8 min readMay 24, 2024

--

A Gantt chart showing the sequence of production tasks for different products on three machines over 13 minutes. The chart displays three products: a dress, a handbag, and a belt. Each product is processed at different times on Machine 1, Machine 2, and Machine 3, illustrating the scheduling of tasks to optimize the production flow using Python.
Optimize Warehouse Process Scheduling with Python — (Image by Author)

In my experience, the major challenges faced in distribution centres for luxury brands were related to inbound logistics.

After receiving, items must undergo multiple value-added services to complete the inbound process and be returned to stock.

A flowchart illustrating the inbound process for luxury products, including a dress and a handbag, with steps such as labeling, quality checks, packaging, and anti-theft tagging. The process involves multiple value-added services, each represented by icons for product preparation, quality assurance, and packing. The goal is to reduce bottlenecks and ensure efficient processing.
Example of Value-Added Services Required — (Image by Author)

For instance, a bag imported from France to China requires specific labelling in Mandarin, a set of quality checks, and an anti-theft tag.

These processes can create a bottleneck in the inbound process, which would delay distribution and cause store stock-outs.

As a Data Scientist, how can you use linear programming to reduce bottlenecks and maximize the productivity?

In this article, we will use the job-shop problem to optimize the scheduling of these processes and maximize the overall inbound productivity.

I will present an optimal process scheduling solution using Google OR tools to increase inbound capacity by up to 48%.

📫 For business inquiries, contact me: Samir Saci

Summary 
I. Value-Added Services for Luxury Products
II. Problem Statement of Inbound Process Scheduling
1. Inbound Operations Optimization for Luxury Products
2. Problem Statement: The Job-Shop Problem
III. Conclusion

Value-Added Services for Luxury Products

Most of the reengineering projects I have conducted were for retail, FMCG, or automotive operations to reduce costs by minimizing the use of workforce and equipment.

The first section illustrates “Supply Chain Network Optimization” with a world map showing multiple factories linked by dashed lines, emphasizing the optimization of facility locations to reduce production costs. The second section focuses on the “Last Mile Delivery Problem,” displaying a city map with color-coded delivery routes to minimize driver usage. The third section presents “Warehouse Operators Training,” showing two workflows: trained operators vs. untrained operators.
Examples of reengineering projects for cost reduction [Find more: Link] — (Image by Author)

For luxury brands, the priority was different, considering the value of goods and the demand variability.

Stores teams: “The collection SS2024 needs to be delivered at the stores before the first week of June.”

Logistics teams are pressured to ensure that products are received, prepared and shipped on time to meet stores' demand.

To illustrate this, I will use the real example of a French luxury brand that operates a distribution centre in Shanghai that delivers to 35 stores in China.

A 3D illustration of a warehouse layout featuring workstations, shelving racks, pallets, and forklifts. The workstations are arranged in the middle, with shelves containing boxes in the background. The loading dock area is visible with a truck parked, representing the receiving area for inbound goods. This layout showcases a luxury product warehouse designed for efficient value-added services and stock handling.
Distribution Center of a Luxury Brand — (Image by Author)

This distribution centre receives items (Garments, Bags and Accessories) imported from France for the local market.

A diagram representing two flows in warehouse logistics: Flow 1 (Cross Docking) and Flow 2 (Stock). Flow 1 shows the lead time for items to be cross-docked and quickly dispatched, while Flow 2 highlights the lead time for putting items into stock before being shipped. Each flow is represented with icons showing tasks like scanning, security checks, and time management for both lead times, emphasizing efficiency in processing luxury goods for store delivery.
Products Flows in the Warehouse — (Image by Author)

After reception and value-added services, items can go through two different flows:

  • Cross-docking flow: items are shipped the same day to the stores
    ⌛ KPI: the lead time between reception and shipping
  • Stock flow: items are put away to stock (for several days or weeks) before being ordered, picked and shipped to the stores
    ⌛ KPI: the lead time between reception and putaway

These two indicators have the common problem of depending on the warehouse's Value-Added Services (VAS) capacity.

What are these Value-Added Services?

  • Operation 1 — Anti-theft tag: operators put a self-alarm tag to protect your goods against theft in the store
A white self-alarm anti-theft tag used to protect items from theft in retail stores. The tag is placed on goods and requires removal at the point of sale to prevent alarm activation
Anti-theft tag - (Image by author)
  • Operation 2 — Labelling: operators print labels in the local language and perform label sewing
A close-up of a garment care label with instructions for washing, ironing, and drying the fabric, printed in English. The instructions include symbols for hand washing, avoiding bleach, and no tumble drying.
Example of label — (Image by Author)
  • Operation 3 — Kitting & Repackaging: operators put items in sales packaging and add Gift With Purchase (GWP), individual notes and Certificate of Authenticity
A luxury packaging setup, including a shirt placed in a branded box with an accompanying certificate of authenticity and other small items. This visual represents the kitting and repackaging process for high-end goods in a distribution center. Let me know if you need further adjustments or details!
Example of packing with Gift with purchase and certificate — (CAD Model by Author)

After completing these three steps, the goods can be stored in the stock area or shipped to the stores.

What could go wrong?

If the capacity of the overall process (items/day) is too low, this can quickly become a bottleneck if you face peaks of inbound volumes.

Problem Statement: Warehouse VAS Scheduling

Inbound Operations Optimization for Luxury Products

You are the data science manager in the logistics department of this iconic luxury brand focusing on Fashion, Fragrance and Watches.

The inbound manager of this distribution centre requested your support in reducing the bottlenecks caused by inefficiencies in the VAS scheduling.

Her team receives daily several thousands of prêt-à-porter sets (Ready-to-wear), including:

  • 1 Female dress that requires Labeling and Repacking
  • A Handbag that requires Labeling, Anti-theft tags and Repacking
  • 1 Leather Belt that requires Anti-theft tags, Labeling and Repacking

As they are sold together, these items need to be ready at the same time after going through the following steps:

  • The receiving team unloads pallets from the truck and puts them in the staging area.
A 3D warehouse layout showing the unloading area where pallets are being removed from a truck. The pallets are placed in the staging area after undergoing an anti-theft tagging process by operators using machines.
Unloading and transfer of the pallet to the staging area — (CAD Model by Author)
  • Machine 1 — Anti-theft tag: an operator puts an anti-theft tag on each bag and belt.
A 3D warehouse layout representing the receiving area of a luxury product warehouse. It shows pallets being unloaded from a truck and placed in a staging area. Operators work at different stations, including an anti-theft tagging station where they apply tags to items such as bags and belts. The layout includes designated areas for unloading, tagging, and staging the goods before they move to the next step in the process.
2 workstations where operators put an anti-theft tag on each Handbag and Belt — (CAD Model by Author)
  • Machine 2—Labelling: After printing in a dedicated area, labels are sewn on belts, handbags, and dresses.
A 3D illustration of a warehouse with multiple workstations dedicated to label printing and sewing. Operators are seated at stations sewing labels onto various products like belts, handbags, and dresses. There’s also a dedicated printing area for labels.
4 workstations where operators perform label sewing — (CAD Model by Author)
  • Machine 3 — Kitting & Repackaging: Operators add a certificate of authenticity and perform fine packing for each item.
A 3D illustration of a warehouse showing anti-theft tagging, items move to the labelling area, where operators print and sew labels onto belts, handbags, and dresses. After labelling, items move to the packing area, where they are carefully boxed and prepared for shipping. The diagram also shows the final staging area, where finished products await transportation. The entire layout is optimized for efficiency in the luxury goods supply chain.
4 workstations where operators perform re-packaging — (CAD Model by Author)

After these steps, goods are transferred to a final staging area to wait for shipping (Flow 1) or put away in the stock area (Flow 2).

Objective: Reach maximum productivity of sets assembled per hour (sets/hour).

Problem Statement: The Job-Shop Problem

The Job Shop Scheduling Problem (JSSP) is an NP-hard problem defined by a set of jobs that machines must execute in a specific order for each job.

In our example, we have one job per item in the set, and they can (have) to be performed simultaneously.

Our example with 3 jobs using 3 machines
An example with 3 jobs using 3 machines — (Image by Author)

The table above defines the execution time (min) and machine processing order for each job.

For instance, Job 2 (Handbag) starts with placing Anti-theft Tags using Machine 1 (6 min), followed by Label Sewing using Machine 2 (4 min), and finally ends with Kitting and Packing using Machine 3 (3 min).

We have constraints on how to use machines:

  • The machines can only execute one job at a time.
  • Once started, a machine cannot be interrupted until the assigned job is completed.

The objective is to minimize the makespan, i.e. the total time to complete all jobs.

What is the baseline?

The Naive Solution: 1 job cycle at a time

Job-shop scheduling timeline showing the processing times of three jobs: Job 1 (female dress), Job 2 (handbag), and Job 3 (kitting and packing). Each job is assigned to one of three machines: Machine 1 (anti-theft tagging), Machine 2 (label sewing), and Machine 3 (kitting and packing). The timeline shows the sequence and time duration (in minutes) each job takes on the machines, emphasizing the synchronization needed between different jobs and machines.
First Naive Approach — (Image by Author)

We assume that the VAS team leader organizes the jobs in sequence and avoids performing any job in parallel.

Results

  • Makespan: 30 min
  • Productivity: 2 sets/hour

Comments

This simple approach is the worst in terms of productivity. Because jobs are processed in sequence, machines often stay idle (unused).

Question: What would be the result if we performed jobs in parallel?

The Optimal Solution

This example fits with the Job Shop Scheduling Problem using Google OR-Tools.

OR-Tools is an open-source collection of Google with tools for combinatorial optimization.

The objective is to find the best solution out of many possible solutions.

I have been using it for several case studies.

  • Samir Saci, Design Pathfinding Algorithm using Google AI to Improve Warehouse Productivity
  • Samir Saci, Optimize Workforce Planning using Linear Programming with Python

Let us use this library to find the optimal sequencing to reduce the makespan for this specific set of processes.

🏫 Discover 70+ case studies using data analytics for supply chain sustainability🌳and business optimization 🏪 in this: Cheat Sheet

Optimization of Process Scheduling using Linear Programming

Results: Optimized vs. Naive Solutions

A Gantt chart displaying the processing time (in minutes) for three jobs: a female dress, a handbag, and a belt. Three machines (Machine 1: Anti-theft tag, Machine 2: Label sewing, Machine 3: Kitting and packing) process the jobs in a specific order. Machine 1 processes the handbag, Machine 2 handles the dress and handbag, while Machine 3 handles the belt and handbag.
First Naive Approach — (Image by Author)
A comparison of two Gantt charts showcasing the optimized and naive scheduling solutions for processing three jobs (female dress, handbag, and belt) on three machines (anti-theft tagging, label sewing, and kitting/packing). The charts illustrate the time slots where each machine performs the job with differences in efficiency between the two methods.
Optimized Solution with Google OR-Tools — (Image by Author)

The two graphs above represent the initial solution (Naive Solution: 1 job at a time) and the optimized solution (Parallel Tasking).

Results

  • Total Makespan: 16 min (-47%)
  • Productivity: 3.75 sets/hour (+85%)
  • Idle time per cycle: 18 min (-71.4%)

The results are satisfying.

How to get these results?

Build the optimization model with Python

Initialize your linear programming model

In the list jobs_data, you define each job's operations, including the machine associated with it and the timing.

Initialize variables and create sequences

Add Constraints and Set up the Solver

Solver Optimal Solution

Output

Optimal Schedule Length: 16 min
Machine 1: job_2_1 job_3_2
[0,6] [6,10]
Machine 2: job_3_1 job_1_1 job_2_2
[0,3] [3,7] [7,11]
Machine 3: job_1_2 job_3_3 job_2_3
[7,10] [10,13] [13,16]

Based on this output, we can draw the updated schedule:

Optimized Solution with Google OR-Tools — (Image by Author)

Considering the constraints, this solution minimizes machine idle time and provides the highest productivity (sets/hour).

Conclusion

We increased productivity by +48% by implementing a smart scheduling solution that maximises the resources.

This solution was based on a simple scenario using a single assembly line (1 Machine per Type).

Can we have higher productivity by changing the conditions?

Gantt chart illustrating the improved schedule for processing three jobs (Job 1: Female Dress, Job 2: Handbag, Job 3: Kitting and Packing) across three machines, with additional marked areas indicating machine downtime (highlighted in yellow stripes). Machine 1 handles anti-theft tagging, Machine 2 handles label sewing, and Machine 3 is responsible for kitting and packing. The chart shows how overlapping tasks and minimizing idle times increased productivity by 48% through smart scheduling.
Optimized Solution with idle sequences (yellow) — (Image by Author)

In the chart above, I have highlighted the potential additional jobs we could add during the idle time:

  • Machine 1: 1 sequence of 4 min, which equals the time for Job 3
  • Machine 2: 1 sequence of 4 min, which equals the time for Job 1 & Job 2
  • Machine 3: 2 sequences of 4 min, the time for Jobs 1,2 and 3

Question:

  • What would be the average productivity if we start Jobs of Cycle n+1 during these idle sequences of Cycle n?

Go Beyond

What would impact the overall productivity if we had parallel workstations for label sewing?

A visual representation showing two arrows: a blue arrow labeled “Rate of Arrivals” pointing to the right and a red arrow labeled “Outputs” pointing to the left. This image conceptually highlights the rate at which items arrive at a process compared to the rate at which they are processed and outputted.
Process definition for the Queueing Theory — (Image by Author)

This question can be answered by using the queuing theory.

An illustration of a warehouse floor with several workers stationed along conveyor belts. Boxes are being processed on the conveyor belts, with the workers performing tasks such as scanning and labeling. Shelves filled with boxes are shown in the background, representing inventory storage. This setup reflects a typical assembly line in a distribution center where items are processed and prepared for shipment.
Queueing theory used to design a packing station — (Image by Samir Saci)

Learn more about it in this article,

About Me

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

If you need consulting or advice for your supply chain transformation, please contact me via Logigreen Consulting.

If you are interested in Data Analytics and Supply Chain, have a look at my website.

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

References

  • Google AI, Google OR-Tools Library, Link

--

--

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Written by Samir Saci

Top Supply Chain Analytics Writer — Case studies using Data Science for Supply Chain Sustainability 🌳 and Productivity: https://bit.ly/supply-chain-cheat