5/13/2026 at 3:12:58 PM
Although this post discusses Constraint Programming - Satisfiability (CP-SAT) Solvers and Mixed Integer Problem (MIP) Solvers, it does not discuss Metaheuristic Solvers.Metaheuristic solvers are different in that you don't need to model your problem as a mixed integer problem. Instead, all it cares about is having a function that returns something you can compare. This allows you to model your problem however you like. Some metaheurstic techniques include Simulated Annealing, Late Acceptance Local Search, and Tabu Search.
Metaheuristic solvers may not generate optimal solutions (after all, by their nature, they don't know the structure of the problem), but they generate "good enough" and "close to optimal" solutions. Metaheurstic solvers tends to beat MIP and CP-SAT for VRP, whereas MIP and CP-SAT are better for bin packing.
If you want to try using a Metaheuristic solver, I can recommend Timefold, which allows you to define your constraints using your domain objects in an incremental matter (it has SQL/Java-Streams like syntax, which in my opinion, is more readable than formulas) (disclosure: I work for Timefold).
by cchianel
5/13/2026 at 4:40:52 PM
Would be real interested in hearing any known gotchas or best practices that might be less commonly known here. I’m recently been working on a (fairly low set of dimensions) VRP problem for a service, but we need solutions faster than my initial exploration with OR Tools could yield. (Think multiple permutations of a route within a few seconds). I’ve heard Timefold come up before, being able to model via a function is a plus.by ammanley
5/13/2026 at 4:38:58 PM
I met some lovely Timefold folks at the Informs conference, and I appreciate the work you do. Any idea when a port is coming to new languages?by LPisGood
5/13/2026 at 4:59:02 PM
Currently, no language ports of Timefold Solver are planned. Unfortunately, FFI (foreign function interface) have a terrible performance penalty, and since we would be doing multiple FFI calls for moves, it can easily become 100x slower just from FFI overhead.This basically means you have two choices:
1. Translate the constraints from the new language to Java bytecode at runtime. 2. Translate the entire solver to a new language.
We did (1) for a bit for CPython, but since CPython bytecode constantly change and break (and is so poorly documented) it was a nightmare to maintain. You can find a blog post of me explaining it a bit more here: https://timefold.ai/blog/java-vs-python-speed. The CPython port is no longer maintained, and has quite a few missing features.
That being said, we have a wide range of ready made models that you can access via an API, which might fit your use case (you can see a list at https://docs.timefold.ai/).
by cchianel
5/13/2026 at 3:27:19 PM
Interesting! Could you give example of problems you're using this for, to get an idea of where they'd be best suited?by oulipo2
5/13/2026 at 4:38:00 PM
Metaheuristics (for example, genetic algorithms) are applicable for any type of optimization problem, but especially those which are non-linear in nature. Modern mixed integer linear program solvers are impressively good, but the less linear a problem is, the harder it is to model as a MIP.One practical consideration often ignored is difficulty of implementation. To make a MIP model, you only have the tools of linear programming: equations and linear inequalities, like mx >= y. If you want a MIP, you need to write down ALL aspects of your problem as a list of inequalities, which can be difficult for some real world domains. There is a real art to MIP modeling.
On the other hand, metaheuristics are like an interface where you only need to implement a few functions in plain old code and you can get good answers.
It’s not quite that simple, since there is still an art to modeling a problem in a suitable input format for a meta heuristic (for example in genetic algorithm, how do I write my delivery schedule as a genome?), but the upshot is that it doesn’t have to be a mathematically precise formulation to work correctly.
by LPisGood
5/13/2026 at 5:09:10 PM
You can find a list of quickstarts at https://github.com/TimefoldAI/timefold-quickstarts.Examples include:
- School Timetabling
- Employee Scheduling
- Conference Scheduling
- Flight Crew Scheduling
Metaheurstics are also very useful for puzzle games; you can quickly run a metaheuristic to generate a difficult but solvable puzzle in less than a second, while only being about 20 lines of code without libraries (but as your scale increases to hundreds of different pieces, you probably want a library so you can use their incremental calculation).
by cchianel
5/13/2026 at 4:12:46 PM
If I understand them correctly, they're saying to use standard, optimization methods after writing a fitness or evaluation function to score your possible solutions. Which is a normal, non-SAT way of doing optimization.So, you could use it for any application you saw benefit from genetic algorithms, simulated annealing, or tabu search. You can even use those to optimize neural networks without backpropagation and with fewer, local optima. Many papers on this but it's computationally heavier.
by nickpsecurity