To solve a planning or optimization problem, some solvers tend to scale out poorly: As the problem has more variables and more constraints, they use a lot more RAM memory and CPU power. They can hit hardware memory limits at a few thousand variables and few million constraint matches. One way their users typically work around such hardware limits, is to use MapReduce. Let’s see what happens if we MapReduce a planning problem, such as the Traveling Salesman Problem.
The Traveling Salesman Problem (TSP) is a very basic planning problem. Given a list of cities, find the shortest path to visit all cities.
For example, here’s a dataset with 68 cities and its optimal tour with a distance of 674:
The search space of this small dataset has 68! (= 1096) combinations. That’s a lot.
A more realistic planning problem, such vehicle routing, has more constraints (both in number as in complexity), such as: vehicle capacity, vehicle type limitations, time windows, driver limits, etc.
First, we take the problem and split it into n pieces. Usually, n is the number of computer nodes in our system. For visual reasons, we divide it into only 4 pieces:
TSP is easily partitioned because of it only has 1 relevant constraint: find the shortest path.
In a more realistic planning problem, sane partitioning can be hard or even impossible. For example:
In capacitated vehicle routing, no 2 partitions should share the same vehicle. What if we have more partitions than vehicles?
In vehicle routing with time windows, each partition should have enough vehicle time to service each customer and drive to each location. Catch 22: How do we determine the drive time if we don’t know the vehicle routes yet?
Merge the pieces together. To merge 2 pieces together, we remove an arc from each piece and add 2 arcs to connect cities of different pieces:
We do merge several times until all pieces are merged:
There are several ways to merge 2 pieces together. Here we try every combination and take the optimal one. For performance reasons, we might instead connect the 2 closest cities of different pieces with an arc, and then add a correcting arc on the other side (however long that may be).
In a more realistic planning problem, with more complex constraints, merging feasible partial solutions often results into an infeasible solution (with broken hard constraints). Smarter partitioning, which takes all the hard constraints into account, can sometimes solve this…at the expense of more broken soft constraints and a higher maintenance cost.
MapReduce is great approach to handle a query problem (and presumably many other problems). But MapReduce is a terrible approach on a planning or optimization problem. Use the right tool for the job.
Note: We applied MapReduce on the planning problem, not on the optimization algorithm implementation in a Solver, for which it can make sense. For example, in a depth-first search algorithm, MapReduce can make sense to explore the search tree (although the search tree scales exponentially bad which dwarfs any gain of MapReduce).
To solve a big planning problem, use a Solver (such as OptaPlanner, now continued as Timefold) that scales well in memory, so you don’t need to resort to partitioning at the expense of solution quality.
Planned, planning education for real world stuff
Sign up for our monthly newsletter.
Continue reading
Blog
Timefold Solver 2.0 is coming
A major evolution of Timefold Solver arrives in March 2026. Version 2.0 removes legacy APIs, simplifies model development, introduces enterprise license keys, and provides a clear, automated upgrade path. This upgrade is designed for long-term maintainability and faster developer onboarding.
Blog
You Can’t Opt Out of Decisions
Every system makes decisions, even when no one is paying attention. This article explores how everyday heuristics quietly shape outcomes, and why optimization is a way to make those decisions intentional, transparent, and defensible.
Blog
Cooking is an integration project
Successful scheduling optimization is built before the algorithm even starts. With cooking as a clear, practical metaphor, this article shows how preparation, integration, and feedback shape real-world results.