Search code examples
optaplannertimefold

Creating a new SolverManager for each user request to enable timeout configuration


We have modelled a VRP with Optaplanner. One requirement is that API users should have the ability to configure timeouts for the solver.

The documentations of both Optaplanner and Timefold suggest using a config template and adjusting that during runtime to create a new SolverFactory for each request. That currently would not be a problem. However, since we like the feature of SolverManager to provide continuous feedback to the user, I would like to know if there is an approach or "best practice" here to adjust the termination configuration of a SolverManager.

If we would create a new SolverManager from an adjusted SolverConfig for each request, wouldn't that kind of defy the some of the intentions of this class?

Side question: It seems timefold hasn't made any changes in that area (configuration per user request). Are there any changes planned here?


Solution

  • To answer the larger question first - there is no way to have a different termination for different jobs in the same SolverManager instance, created from a single SolverConfig. And you are right that this sort-of negates the benefits of SolverManager in this case; we simply didn't anticipate that people would do this.

    That said, I think this is a completely valid feature request; one which we have already discussed internally. We generally don't make commitments as to what feature will show up in Timefold Solver and when, but this feature would certainly be useful.