cpuoptaplannerhardware-accelerationtimefold

Optaplanner - does processor impacts the compute time


We are using Optaplanner in a project for 4-5 years now. As the business requirements grow we added a more and more rules. But now we are at a point where it takes around 10 days to generate an acceptable result on our server. We have already tried to optimize the rules, the source code, etc. with little positive impact. That means we decided to try running the projet and generate a planning with another computer (on the cloud), we picked a VM with significative better hardware (CPU wise). We measured that a lot more solution are processed per seconds (which is good), yet, the best scores does not seem to really outperform over time compared to our server... So in the end, we are kind of wondering if the CPU (when using decent ones) really matter? If so, what specifications should we looking for when picking a CPU to run an Optaplanner Solver ?

Note, we are at V8.x of optaplanner, we plan to migrate to v9.x.


Solution

  • CPU power makes massive impact on the performance of OptaPlanner (or Timefold), as the workload is entirely CPU-bound. To be successful, you need to look at as much of the search space as possible, and with a more powerful CPU, you'll get the same amount of work done more quickly.

    (If you're purely after CPU power, you may be interested in hearing that Timefold is significantly faster than OptaPlanner by default.)

    However, CPU performance is not the full picture. If your solution contains score traps, for example, the solver will never find better solution, no matter how hard it tries, or for how long. If you believe you hit the point of diminishing returns on CPU power, start looking for problems in your constraints.

    Is there enough moves, and is there enough move diversity, to allow the solver to escape from local optima? Are there score traps in your constraints? I can not answer those questions for you. But they would be the questions I'd invest into finding the answers to.

    In fact, we have an entire chapter in our documentation to deal with the issue of getting better results out of the solver.