News

日本語 · English · 中文

[Guest Contribution]: Comparing the Effectiveness and Limitations of Preprocessing in 40-Person Shift Optimization with PuLP

Python’s PuLP was used to compare a preprocessed approach with a standard simplex solver on a shift optimization problem for 40 people over 31 days, across 30 runs. The preprocessed method averaged 3.24 seconds, while the standard simplex solver averaged 4.82 seconds; both achieved a 100% optimal solution rate. However, the conclusion is that in typical real-world scenarios, the standard PuLP alone is sufficient when the difference is only a few seconds.

Introduction

Hello! In the context of business process efficiency and automation, "mathematical optimization" is frequently used. Among these, "PuLP" is well-known as a library that allows you to easily solve mixed-integer programming problems in Python.

This time, we focused on the common practical issue of "complex shift scheduling problems," expanding the scale from 20 and 30 people to 40 people over 31 days (a total of 1,240 cells). We imposed rules such as a 50% ratio of new employees, night shift restrictions, dependent slots, and requested days off to verify how far a classical solver could handle the load. Additionally, we investigated how much faster the process would become by introducing a method of "navigating the solver with smart preprocessing (a form of scoring) beforehand."


Verification Approach

Instead of simply feeding all conditions directly into PuLP to solve ("No-navigation standalone"), this time we tested a hybrid approach that inserts a preprocessing layer. This layer intelligently calculates the "probability (score) that each staff member should enter a specific slot" based on conditions and past data beforehand.

Through this preprocessing, we provide the solver's objective function with a powerful "cheat sheet" instructing it to "prioritize exploring here." We overcame errors and adjustments caused by large-scale data to build a practical environment.


📊 40-Person Scale, 30 Matches

Here are the results of pitting "Navigation-enabled PuLP" (with preprocessing clearing the fog) against "Standalone PuLP" (without hints) across 30 matches while varying the conditions (combinations of requested days off and budget limits).

Question 02 ➔ 🟢 Navigation-enabled PuLP: 3.60s (Optimal) | 🔴 Standalone No-navigation: 5.56s (Optimal)
Question 05 ➔ 🟢 Navigation-enabled PuLP: 2.59s (Optimal) | 🔴 Standalone No-navigation: 5.53s (Optimal)
...
Question 30 ➔ 🟢 Navigation-enabled PuLP: 3.18s (Optimal) | 🔴 Standalone No-navigation: 5.15s (Optimal)

================================================================================
🏆 Final Summary Results (40-person store, 30-match result)
================================================================================
🟢 Navigation-enabled PuLP (with preprocessing) Average calculation time : 3.2402 seconds (Optimal rate: 100.0%)
🔴 Standalone PuLP (no navigation)       Average calculation time: 4.8236 seconds (Optimal rate: 100.0%)
================================================================================

As a result, in every problem, the approach with preprocessing cleanly outperformed the no-navigation standalone method, achieving an average lead of approximately 1.5 seconds and a 100% optimal solution (Optimal) achievement rate!


🤔 Realistic Conclusion: Is "Advanced Preprocessing or Specialized Technology" Really Necessary for Shift Management?

The advantage of speed improvement through preprocessing was clearly visible in the data. However, we then encountered one stark reality.

"If the difference is just a few seconds, wouldn't standalone PuLP without any tricks be sufficient for practical levels?"

Current PC specifications and the free classical solvers running behind PuLP (such as CBC) are extremely capable. For small-to-medium enterprises or general store operations (involving dozens of part-time workers), even if the rules are complex, running classical mathematical optimization directly yields a practical shift schedule within seconds, or at most minutes.

After verifying this through trial and error, our realistic conclusion is that there is "almost no need" to spend time building complex preprocessing pipelines for shift creation in typical work environments ("simple classical methods suffice"). Opportunities where advanced technology is truly required may be more limited than we imagine.

Such issues might be limited to larger-scale problems and large corporations.


Closing Remarks

The approach of devising preprocessing to guide the solver's search showed both engineering romance and tangible effects.

While we verified this using shift optimization as the theme, there exist even larger and more complex "final boss" problems in the world that classical solvers cannot solve even after running for hours (such as airline schedules for thousands of people, ultra-large-scale logistics networks, semiconductor wiring design, etc.).

Moving forward, I will continue to seek out fields where "truly advanced technology is required, beyond what simple classical power can handle," and if necessary, I would like to take on new challenges. However, regarding the verification of shift optimization, I consider this a fully satisfactory conclusion for now!

This article was translated from the Japanese original. 日本語で読む

← Latest articles