● Solver approaches
Three ways to solve a planning problem.
Routing, rostering and timetabling problems are solved today in three broad ways: mathematical optimization, metaheuristics, and solvers based on AI and reinforcement learning. None of them is best everywhere. This page explains how each one works, where it is strong, where it struggles, and roughly how its running time grows.
This is a simplified overview of well-known, published results, and it may contain mistakes. If you find one, please tell us through the contact page. The message reaches us by email, and we will correct the page.
At a glance
| Aspect | Mathematical optimization | Metaheuristic | AI / RL solver |
|---|---|---|---|
| What you get | The best solution and a proof of it. Stopped early: the best found so far, and a limit on how much better any solution could be (the gap). | A good solution that keeps improving while it runs. No proof and no bound. | A plausible solution almost at once. No proof and no bound. |
| Models it handles | Strongest when the objective and the constraints are linear, or fit the constraint types the solver offers. Other rules must be rewritten into that form. | Any rule that can be computed for a candidate solution: non-linear costs, lookup tables, if-then rules. | The problem it was trained on. A changed rule usually means new training. |
| Infeasible solutions during the search | Pruned. A branch that cannot satisfy the constraints is cut. | Allowed. The search may pass through rule-breaking solutions, at a penalty, to reach better feasible ones. | Mostly blocked by masking invalid next steps. Rules that cannot be checked step by step are hard. |
| Large instances | Time and memory can grow exponentially. Past some size it reaches the time limit with a wide gap, or with no solution. | Degrades gently. Each step is cheap, so a large instance keeps improving. | Fast, but quality drops on sizes and shapes far from the training data. |
| When the problem changes | Edit the model. Rewriting a rule into linear form can be the hard part. | Add a rule or change a weight. The search stays as it is. | Retrain or fine-tune. |
| Cost before the first solve | Modelling. | Modelling, plus moves and tuning (an engine brings these). | Training data or a simulator, and GPU hours to days. |
| Running time | Exponential in the problem size in the worst case. | Whatever budget you set. Scoring one move is usually cheap and nearly independent of the problem size. | About quadratic in the problem size per solution for the common attention models: milliseconds to seconds. |
Mathematical optimization
Mathematical optimization: the best answer, with a proof.
Mathematical optimization, often called exact methods, ends with a proof that no better solution exists. It covers the whole space of solutions without listing them one by one.
How it works
- Branch and bound splits the problem into subproblems (fix a decision one way, then the other), computes for each a bound on the best value it could still reach, and discards every subproblem whose bound is no better than a solution already in hand.1
- In mixed-integer programming the bound comes from the linear relaxation: drop the requirement that variables be whole numbers and solve the linear program that is left. Cutting planes tighten that relaxation.12
- Constraint programming removes from each variable the values that can no longer be part of any solution (constraint propagation), and modern solvers also learn from the dead ends they reach, as SAT solvers do.3
- Dynamic programming solves a problem by building its solutions up from those of smaller ones.4
- Decomposition methods such as column generation split a large model into a master problem and subproblems that are solved in turn.5
Strong at
- Optimality. When it finishes, the answer is the best one, and that is proven.
- A bound even when stopped early: the best solution found, and a limit on how much better any solution could be.
- Linear models. Decades of work on relaxations and cuts make problems with linear objectives and constraints its home ground.
- Declarative modelling: you state the problem, not how to search it.
Weak at
- Rules that are not linear. Much of the pruning depends on linear bounds, so a quadratic cost, a product of two decisions, a step function or a rule given by a table has to be rewritten with extra variables and constraints. That enlarges the model and weakens the bound.
- Size. Time and memory can grow exponentially, and the size at which that happens is hard to predict. A large instance may reach the time limit with a wide gap, or with no solution at all.
- Rule-breaking intermediate solutions. A branch that violates a constraint is cut, so every trade-off you would accept has to be modelled as an explicit penalty.
Running time
- Linear programming is solvable in polynomial time. Integer and constraint programming, on NP-hard problems, are exponential in the worst case: branch and bound may open on the order of 2ⁿ subproblems for n yes/no decisions, and in mixed-integer programming each one costs a linear program. The classic dynamic program for the travelling salesman problem takes O(n² · 2ⁿ).64
- In practice bounds, cuts and learning remove almost all of that tree. That is why very large linear models are solved routinely, and also why two instances of the same size can take a second and a day.
A closer look: CP-SAT
CP-SAT: constraint programming on a SAT solver.
CP-SAT is the solver from Google’s open-source OR-Tools that our benchmarks compare against. It is one mathematical optimization solver, and a good example of how the techniques above are combined.7
How it works
- It is a constraint programming solver built on a SAT solver. Each deduction a constraint makes can be explained as a clause when it is needed (lazy clause generation), so when the search hits a dead end, the SAT engine works out why and learns a clause that keeps it out of the same one.73
- A simplex runs alongside on the linear part of the model, which brings in the tools of mixed-integer programming: relaxation bounds, cuts and presolve.7
- The search is a portfolio: several workers with different strategies run in parallel and share what they find.7
- It works on integers only. Variables and constraint coefficients are whole numbers, so fractional data has to be scaled first.7
Strong at
- Scheduling. Tasks with durations, machines that take one task at a time and resources with limited capacity are built-in constraints, and its authors report hard job-shop and resource-constrained project scheduling instances solved and proven optimal.7
- Problems made of discrete decisions with logical rules between them: rostering, timetabling, assignment and packing.
- Proof. On small and medium instances it often returns the optimum and proves it. It has won gold in the free-search and parallel categories of the MiniZinc Challenge, the yearly competition of constraint solvers, every year from 2018 to 2026, the latest results when this page was written.8
Weak at
- Continuous quantities. With integers only, a model that needs fine fractions or very large coefficients loses precision or grows.
- Rules that are not linear over integers have to be rewritten, as in the rest of this family.
- Large routing problems. The number of orderings grows too fast; OR-Tools itself ships a separate routing solver based on local search for them.
- Large instances under a time limit. The worst case is exponential, as for every method of this family, so a large instance can end with a wide gap or with no solution.
Running time
- Exponential in the worst case. In practice clause learning, the linear relaxation and presolve cut most of the search away, and the parallel workers add speed on a multi-core machine.
Metaheuristics
Metaheuristics: a good answer for any rule, within the time you give.
A metaheuristic proves nothing. It starts from a complete solution and keeps improving it for as long as you let it run.
How it works
- A move changes a small part of the solution: give one visit to another vehicle, swap two shifts. The search scores the result, and an acceptance rule decides whether to keep it.
- The rules differ in how they leave a local optimum. Simulated annealing accepts a worse solution with a probability that falls over time, tabu search forbids undoing recent moves, and late acceptance compares with the score from some steps ago.91011
- Large neighbourhood search removes a chunk of the solution and rebuilds it, and its adaptive form learns during the run which ways of removing and rebuilding pay off. Population methods such as genetic algorithms recombine several solutions.1213
Strong at
- Any rule you can compute. The search only needs a score for a candidate solution, so non-linear costs, piecewise fees, lookup tables and if-then rules go in as they are.
- Passing through infeasible solutions. A broken rule can be a heavy penalty instead of a wall, which lets the search cross a rule-breaking region to reach feasible solutions that small feasible steps do not connect.
- Large instances. With incremental scoring a move costs in proportion to what it changes, not to the size of the problem. A bigger instance needs more steps, but the search keeps improving instead of failing.
- A time budget. There is a usable solution early and a better one later, so it fits a fixed number of seconds.
Weak at
- No proof and no bound. You cannot tell how far the answer is from the best possible one.
- Variation. Two runs with different random seeds give different answers.
- Design and tuning. Moves, acceptance and their parameters have to suit the problem family; a poor neighbourhood stalls in a local optimum.
- Small, cleanly linear problems, where mathematical optimization usually returns a proven optimum sooner.
Running time
- There is no finishing time, only the budget you set. What matters is the cost of one step: scoring a move incrementally typically takes O(1) to O(k) for a move that touches k elements.
- Scanning a whole neighbourhood, such as every 2-opt exchange on a route of n stops, is O(n²), and is usually cut to about O(n) by looking only at near neighbours. Building a first solution greedily is typically O(n²) or less. Quality improves fast at first and then levels off.
AI / RL solvers
AI and RL solvers: an answer in milliseconds, for the problem they were trained on.
Here a neural network is trained to produce solutions. Reinforcement learning is the usual way to train it, because it needs no solved examples: the model proposes solutions, sees what they cost, and adjusts.14
How it works
- Construction. The model builds a solution step by step (choose the next stop, then the next), or predicts in one pass which pieces belong to a good solution and leaves the assembly to a simple search. Pointer networks, the attention model and POMO are the landmarks.151617
- Improvement. The model starts from a complete solution and learns which change to make next: a learned local search, or a learned remove-and-rebuild.1819
- Inside a classical solver. A third line keeps the mathematical optimization solver or the heuristic and learns one of its decisions, such as which variable to branch on.2021
Strong at
- Speed at solve time. A construction model returns a plausible solution in milliseconds to seconds, and a GPU solves thousands of instances in one batch.
- Repeated, similar problems. When the same kind of instance arrives again and again, the search effort is paid once, in training.
- Trading time for quality cheaply: sample many solutions and keep the best.
Weak at
- Instances unlike the training data. A model is good on what it has seen. Sizes, layouts or demand patterns far from the training distribution lower the quality, often sharply.22
- A changed problem. A new constraint or a different objective usually means changing the training environment and training again. Constraints are mostly enforced by masking invalid next steps, which is awkward for rules that cannot be checked step by step.
- Training cost: GPU hours to days, and a generator of realistic instances.
- Guarantees. There is no proof of optimality and no bound. On the standard routing benchmarks the reference results still come from classical heuristics and mathematical optimization, and learned solvers are reported by their gap to them. Improvement models narrow that gap by spending more time, which gives back part of the speed advantage.23
Running time
- For the common attention-based models, encoding an instance of n nodes costs O(n²) time and memory per layer, and building a solution takes n steps of O(n) each. One solution is therefore about O(n²), and sampling k solutions multiplies that by k.16
- An improvement model pays one network evaluation per step, for hundreds to thousands of steps. Training is the expensive part: typically millions of generated instances.
To try these methods: RL4CO ↗, an open-source (MIT) library from the AI4CO research community, implements the main construction and improvement methods on common problems behind one interface, and its paper compares them on equal terms.23
Which one, when
No method is best on every problem.
That is what the “no free lunch” theorem says about search in general, and it matches practice: the right choice depends on the rules, the size and what you need from the answer.24
| If | Then |
|---|---|
| You need a proof, or a guaranteed gap; the rules are linear or nearly so; the instance is small to medium. | Mathematical optimization. |
| The rules are many, non-linear or change often; the instances are large; a good answer is needed within a fixed time. | A metaheuristic. |
| Thousands of similar instances must be answered in milliseconds, the problem definition is stable, and training (and retraining) is affordable. | An AI / RL solver, usually with a classical method behind it. |
They are often combined
- Mathematical optimization inside a metaheuristic: large neighbourhood search can rebuild the part it removed with a mathematical optimization solver.12
- A heuristic inside mathematical optimization: these solvers run heuristics to find good solutions early, which sharpens their pruning.
- A learned model beside either: it can propose a starting solution, or pick the next move or the next branch.2021
Where optimaru stands
The open-source engine is a metaheuristic. The Enterprise edition combines several approaches.
The engine builds a first solution with construction heuristics, then runs local search under one of seven acceptance rules, on incremental score calculation. In most use cases the default rule is late acceptance, and adaptive ruin and recreate runs alongside it.
Each rule is a constraint plugin with a weight and a level, and its cost can be raised to a power, so a non-linear rule needs no reformulation. Hard rules may be broken while the search runs: the hard level is compared before everything else, so the search works on those violations first.
It gives no proof of optimality. That is why the benchmarks put it next to a mathematical optimization solver (OR-Tools CP-SAT) on the planning problems, with the same instances and the same time budget, and show the rows where that solver is ahead.
The Enterprise edition, the optimaru API, does not rely on one approach. Next to the same metaheuristic engine it runs mathematical optimization models of the same problems: they take the same input and the same choice of rules, solve each job side by side, and the engine's own scoring compares their answers, so the best one comes back in the same result format. When a mathematical model proves its answer optimal, the rest stop early.
See the benchmarks About the Enterprise editionReferences
The text above is our own summary. These papers and pages are the sources.
- A. H. Land, A. G. Doig. An automatic method of solving discrete programming problems. Econometrica 28(3), 1960. doi.org/10.2307/1910129 ↗
- G. Dantzig, R. Fulkerson, S. Johnson. Solution of a large-scale traveling-salesman problem. Journal of the Operations Research Society of America 2(4), 1954. doi.org/10.1287/opre.2.4.393 ↗
- O. Ohrimenko, P. J. Stuckey, M. Codish. Propagation via lazy clause generation. Constraints 14(3), 2009. doi.org/10.1007/s10601-008-9064-x ↗
- M. Held, R. M. Karp. A dynamic programming approach to sequencing problems. Journal of the Society for Industrial and Applied Mathematics 10(1), 1962. doi.org/10.1137/0110015 ↗
- G. B. Dantzig, P. Wolfe. Decomposition principle for linear programs. Operations Research 8(1), 1960. doi.org/10.1287/opre.8.1.101 ↗
- N. Karmarkar. A new polynomial-time algorithm for linear programming. Combinatorica 4(4), 1984. doi.org/10.1007/BF02579150 ↗
- L. Perron, F. Didier, S. Gay. The CP-SAT-LP solver. 29th International Conference on Principles and Practice of Constraint Programming (CP 2023), LIPIcs 280, 2023. doi.org/10.4230/LIPIcs.CP.2023.3 ↗
- MiniZinc Challenge. Results of the yearly competition of constraint solvers, 2018–2026 (read in November 2026). www.minizinc.org/challenge/ ↗
- S. Kirkpatrick, C. D. Gelatt, M. P. Vecchi. Optimization by simulated annealing. Science 220(4598), 1983. doi.org/10.1126/science.220.4598.671 ↗
- F. Glover. Future paths for integer programming and links to artificial intelligence. Computers & Operations Research 13(5), 1986. doi.org/10.1016/0305-0548(86)90048-1 ↗
- E. K. Burke, Y. Bykov. The late acceptance hill-climbing heuristic. European Journal of Operational Research 258(1), 2017. doi.org/10.1016/j.ejor.2016.07.012 ↗
- P. Shaw. Using constraint programming and local search methods to solve vehicle routing problems. Principles and Practice of Constraint Programming (CP98), 1998. doi.org/10.1007/3-540-49481-2_30 ↗
- S. Ropke, D. Pisinger. An adaptive large neighborhood search heuristic for the pickup and delivery problem with time windows. Transportation Science 40(4), 2006. doi.org/10.1287/trsc.1050.0135 ↗
- I. Bello, H. Pham, Q. V. Le, M. Norouzi, S. Bengio. Neural combinatorial optimization with reinforcement learning. arXiv:1611.09940, 2016. arxiv.org/abs/1611.09940 ↗
- O. Vinyals, M. Fortunato, N. Jaitly. Pointer networks. Advances in Neural Information Processing Systems 28, 2015. arxiv.org/abs/1506.03134 ↗
- W. Kool, H. van Hoof, M. Welling. Attention, learn to solve routing problems! International Conference on Learning Representations, 2019. arxiv.org/abs/1803.08475 ↗
- Y.-D. Kwon, J. Choo, B. Kim, I. Yoon, Y. Gwon, S. Min. POMO: Policy optimization with multiple optima for reinforcement learning. Advances in Neural Information Processing Systems 33, 2020. arxiv.org/abs/2010.16011 ↗
- X. Chen, Y. Tian. Learning to perform local rewriting for combinatorial optimization. Advances in Neural Information Processing Systems 32, 2019. arxiv.org/abs/1810.00337 ↗
- Y. Wu, W. Song, Z. Cao, J. Zhang, A. Lim. Learning improvement heuristics for solving routing problems. IEEE Transactions on Neural Networks and Learning Systems 33(9), 2022. arxiv.org/abs/1912.05784 ↗
- M. Gasse, D. Chételat, N. Ferroni, L. Charlin, A. Lodi. Exact combinatorial optimization with graph convolutional neural networks. Advances in Neural Information Processing Systems 32, 2019. arxiv.org/abs/1906.01629 ↗
- Y. Bengio, A. Lodi, A. Prouvost. Machine learning for combinatorial optimization: a methodological tour d’horizon. European Journal of Operational Research 290(2), 2021. doi.org/10.1016/j.ejor.2020.07.063 ↗
- C. K. Joshi, Q. Cappart, L.-M. Rousseau, T. Laurent. Learning the travelling salesperson problem requires rethinking generalization. Constraints 27(1–2), 2022. doi.org/10.1007/s10601-022-09327-y ↗
- F. Berto, C. Hua, J. Park, et al. RL4CO: an extensive reinforcement learning for combinatorial optimization benchmark. arXiv:2306.17100, 2023. arxiv.org/abs/2306.17100 ↗
- D. H. Wolpert, W. G. Macready. No free lunch theorems for optimization. IEEE Transactions on Evolutionary Computation 1(1), 1997. doi.org/10.1109/4235.585893 ↗