Back to Blog
EngineeringJanuary 20, 2025·8 min read

Why We Use Google OR-Tools Instead of 'AI' for Scheduling

Most scheduling tools use heuristics and call it AI. We use constraint programming — and the difference matters when you have 200 drivers and 40 constraints.

Most scheduling tools that call themselves "AI-powered" are using heuristics — greedy algorithms, genetic algorithms, or simple rule engines dressed up with marketing language. They produce good enough schedules, but they can't tell you whether a better schedule exists, and they can't guarantee that hard constraints are never violated.

When you're scheduling 200 drivers with payroll period limits, team-based slot restrictions, locked assignments, and historical hours to account for — "good enough" isn't good enough.

Why Constraint Programming

We use Google OR-Tools CP-SAT (Constraint Programming - Satisfiability). It's the same engine used in logistics optimization at companies like Google and UPS. The key difference:

  • Heuristics find a good solution quickly
  • Constraint programming finds the optimal solution, or proves that no feasible solution exists

For workforce scheduling, this matters enormously. If your constraints make a schedule impossible, OR-Tools tells you exactly why — not just "schedule generation failed."

How the Solver Works

The solver models scheduling as a constraint satisfaction problem with three components:

  • Decision variables: For each (employee, date, slot) combination, a boolean variable — 1 if assigned, 0 if not.
  • Hard constraints: Demand coverage, max weekly hours, payroll period limits, no overlapping shifts, team-based slot filtering.
  • Soft constraints: Employee day preferences (minimize violations).

The solver explores the solution space and finds the assignment that satisfies all hard constraints while minimizing soft constraint violations. If no feasible solution exists, it returns a clear error explaining which constraint is infeasible.

Natural Language Constraint Parsing

One of our most-used features is natural language constraint parsing. Instead of configuring a complex UI, managers type plain English:

"No driver should work more than 40 hours per payroll period"

Our AWS Bedrock integration parses this into a structured constraint object:

{
  "type": "MAX_PAYROLL_PERIOD_HOURS",
  "parameters": { "max_hours": 40 },
  "priority": "HARD"
}

This gets fed directly to the OR-Tools model as a hard constraint. We support 6 constraint types including weekly hours, payroll period hours, max shifts per period, consecutive hours, day preferences, and performance-based exclusions.

Handling Infeasibility

One of the most valuable things OR-Tools gives us is clear infeasibility detection. When a schedule can't be built — because demand exceeds available employees, or constraints are too tight — the solver returns a specific error:

"Forecast demand cannot be met: date 2025-01-20 requires 8 employees but only 6 employees are available for this shift slot."

This is infinitely more useful than a generic failure message. Managers know exactly what to fix.

Auto Re-optimization on Decline

When an employee declines a shift or doesn't respond to the voice confirmation, the solver re-runs automatically for that day. It finds the best available replacement given all constraints — without any manager intervention. The replacement employee receives their own confirmation request immediately.

The Result

Schedules that are mathematically optimal, generated in seconds, with clear error messages when constraints can't be satisfied. That's what real scheduling software looks like.

Want to see this in action?

Book a 30-minute demo and we'll walk you through exactly how Sluble works for your team.

Book a Demo