Multi-Location Shift & Constraint Optimizer
A mathematical constraint optimization solver formulated in Python using Google OR-Tools CP-SAT. Solves globally optimal weekly staff schedules across 8 retail branches and 12+ employees in under 2 seconds, honoring strict labor law constraints, mandatory rest periods, and shift fairness.
Interactive Sandbox · 100% Mock Data
Simulates the exact production CP-SAT optimization logic using mock store locations and staff profiles. Production database write access is isolated for data protection.
Boba Cafe · OR-Tools Shift Optimizer v2.4 CP-SAT
Streamlit / Python Simulation Environment
Coverage
100%
56 / 56 shifts filled
Feasibility
OPTIMAL
0 Hard Conflicts
Avg Hours/Staff
33.5 h
0 Overtime Hours
Solve Duration
1.42 s
2,016 Boolean Vars
| Branch Location | Mon | Tue | Wed | Thu | Fri | Sat | Sun | Hrs |
|---|
Hard Constraints (Strict Feasibility)
The solver rejects any candidate schedule violating even one hard constraint, guaranteeing legal compliance and complete physical coverage.
-
•
Store Coverage Demand:
Exactly 2 baristas present for morning prep, 3 staff during peak midday rush, and 2 staff for closing reconciliation.
-
•
Mandatory Rest Interval:
Strict minimum of 12 continuous rest hours between shifts. A barista finishing an evening shift at 22:00 cannot open at 08:00.
-
•
Weekly Maximum Hours Cap:
Absolute cap at 40 hours per week per employee, eliminating unwanted overtime expenses and labor law penalties.
-
•
Single Branch Assignment:
No employee can be assigned to multiple branches or conflicting overlapping slots on the same calendar day.
Objective Function & Fairness Optimization
Soft constraints guide the solver toward the highest quality, most equitable schedule through weighted penalty minimization.
-
•
Weekend Fairness Balancing:
Minimizes the variance of Saturday and Sunday shifts across staff, ensuring no team member is disproportionately scheduled on weekends.
-
•
Commute Distance Minimization:
Weights staff-to-branch residential zones so employees are assigned to the closest available retail locations.
-
•
Availability & PTO Respect:
Applies heavy reward bonuses for honoring voluntary shift preferences and pre-approved time-off requests.
-
•
Rapid Tree Traversal:
Google OR-Tools boolean satisfiability tree search finds provably optimal schedule solutions in < 2 seconds.
Production Operations Impact
< 2 sec
Average Solve Time
30+ hrs
Manager Time Saved / Mo
8
Retail Stores Solved
100%
Labor Law Compliance