10.9. Using a Custom Termination, MoveSelector, EntitySelector, ValueSelector or Acceptor
You can plug in a custom Termination, MoveSelector, EntitySelector, ValueSelector or Acceptor by extending the abstract class and also the related *Config class.
For example, to use a custom MoveSelector, extend the AbstractMoveSelector class, extend the MoveSelectorConfig class and configure it in the solver configuration.
It’s not possible to inject a Termination, … instance directly (to avoid extending a Config class too) because:
-
A
SolverFactorycan build multipleSolverinstances, which each require a distinctTermination, … instance. -
A solver configuration needs to be serializable to and from XML. This makes benchmarking with
PlannerBenchmarkparticularly easy because you can configure differentSolvervariants in XML. -
A
Configclass is often easier and clearer to configure. For example:TerminationConfigtranslatesminutesSpentLimitandsecondsSpentLimitintotimeMillisSpentLimit.
If you build a better implementation that’s not domain specific, consider contributing it back as a pull request on GitHub: we’ll optimize it and take it along in future refactorings.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.