Google OR-Tools: The "Not-So-AI" Solution That Actually Works

Michael HoferMichael Hofer
5 min read

I'm probably crazy to write an article in these times that's NOT about the latest and greatest AI technology. But here's the thing... Not everything that's new and hyped up is necessarily the best tool for the job. Here's a perfect example and a brief introduction to a technology that might surprise you. In a later post, I'll show you what the actual solution looks like.

First, let me set up a familiar challenge: One of our clients in the transportation industry needs to schedule their employees across various work duties. This planning is incredibly complex because it doesn't just involve a complicated set of rules – it also has to account for part-time schedules, vacations, holidays, and ideally, employee preferences too. While the planning for core staff is already handled by an expensive industry solution through a very elaborate and costly process, we wanted to test whether it's possible to automate the scheduling for the remaining personnel. This process has fewer rules to follow, but it's still time-consuming and currently done manually.

The brief I received was relatively straightforward: Can we solve this with (Generative) AI? Basically, using a Large Language Model (LLM) that we teach all the rules and other aspects to (which is totally feasible with today's prompt windows – including a complete handbook on how to plan staff assignments), and then ask it to work out an appropriate roster. We could do that. But does it make sense?

Why Generative AI Isn't the Right Hammer for Every Nail

Here's why throwing generative AI at this problem would be like using a Ferrari to deliver pizza – technically possible, but missing the point entirely.

Generative AI excels at creative tasks, language understanding, and pattern recognition from vast datasets. But scheduling optimization? That's a completely different beast. LLMs are probabilistic by nature – they generate responses based on likelihood, not mathematical certainty. When you're planning work schedules, you don't want "probably correct" – you want provably optimal solutions that satisfy hard constraints.

Imagine asking ChatGPT to schedule 30 employees and getting back a response like "Well, I think John could work Tuesday, and maybe Sarah would be okay with the night shift..." That's not scheduling – that's educated guessing with expensive compute costs. Plus, every time you run the same prompt, you might get different results. Try explaining that to your HR department!

The real kicker? Generative AI would burn through computational resources like there's no tomorrow, essentially using a sledgehammer approach to crack a mathematical nut that has elegant, deterministic solutions.

Instead, I did what any sensible solution architect should do first: comprehensive research based on the situation and known parameters (or in trendy new-English: among other things, deep research with my favorite LLM). And wouldn't you know it, pretty quickly it became clear that there are some excellent alternatives out there, since this challenge is absolutely nothing new and there are really good professional (read: expensive) solutions on the market. One stood out from the beginning: Google Operations Research Tools. But what exactly are OR-Tools and what can you use them for?

Google OR-Tools: The Mathematical Powerhouse You've Never Heard Of

Google OR-Tools is open source software for combinatorial optimization, which seeks to find the best solution to a problem out of a very large set of possible solutions. Think of it as a Swiss Army knife for complex mathematical problems that businesses face every day.

Here are the core use cases where OR-Tools absolutely shines:

Vehicle Routing and Logistics: Find optimal routes for vehicle fleets that pick up and deliver packages given constraints (e.g., "this truck can't hold more than 20,000 pounds" or "all deliveries must be made within a two-hour window"). Perfect for delivery companies, field service operations, or any business that moves stuff around. Check out the Vehicle Routing examples and the detailed Vehicle Routing Problem with Time Windows tutorial.

Employee Scheduling: Schedule employees in multiple shifts, subject to a complex set of constraints and staffing requirements. This covers everything from hospital nurse scheduling to retail staff planning, with constraints like "no employee should work two shifts in a row." The Employee Scheduling guide shows exactly how to tackle these problems.

Resource Allocation: Schedule a manufacturing process that involves performing many tasks on a limited set of machines, each of which can do only one task at a time. Whether it's factory equipment, meeting rooms, or server resources – OR-Tools can optimize the allocation. The Scheduling Overview covers various resource allocation scenarios.

Network Flow Problems: Optimize anything that flows through a network – from supply chain logistics to data routing in telecommunications.

The beauty of OR-Tools lies in its mathematical rigor. It doesn't guess or approximate – it finds provably optimal solutions using techniques like constraint programming, linear programming, and advanced heuristics. The CP-SAT solver has consistently won the Minizinc challenge the last few years, which is basically the Olympics for constraint solvers.

Want to dive deeper? The OR-Tools Examples page has tons of practical tutorials and even Google Colab notebooks you can run directly in your browser. Plus, the Getting Started guide works with Python, .NET, Java, and C++ – so no matter your tech stack, you're covered.

So are Google OR-Tools actually AI, and do I get to add another AI project to my resume? Of course not. But it shows that there's actually a very fine line between what's commonly seen or sold as "AI." Because let's be honest – what we consider "intelligence" is ultimately a gigantic computational model that searches for the needle in the haystack with virtually unlimited resources – often hundreds of times per prompt, back and forth. Meanwhile, Google OR-Tools calmly schedules 30 employees for a month across 175 work assignments on my somewhat aging laptop in 12 seconds. Optimized, naturally, so that each employee gets roughly equal assignment time. So – actually "artificial intelligence" too, right?

In the next blog post, I'll share some examples of how this can be implemented.

0
Subscribe to my newsletter

Read articles from Michael Hofer directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Michael Hofer
Michael Hofer