Search code examples
optaplanner

OptaPlanner - Get n best solutions with equal score


We have a use-case where we need to return the "top-N-best-solutions" for a problem using OptaPlanner. Unlike pareto we are going to compare scores of similar entities. Going through the OptaPlanner docs and other questions here I see that there have been multiple mentions of a "hack" involving BestSolutionRecaller to achieve this behavior in the cases where the "bestSolutionChanged" listener will not be triggered for solutions with equal best scores.

So since it is still not officially supported yet, in the meantime wanted to know if the "hack" is still doable or has that been closed as well ? Is there any other way (a better one) by which we can achieve this result until it is officially supported by OptaPlanner (as part of Pareto scoring or other feature) ?

P.S.: Not sure if the approach involving BestSolutionRecaller is still valid as it was earlier mentioned in the official docs under pareto score support but seems to have been removed lately.

The use case/expectation is exactly similar to this existing question - Get best 3 scores in Optaplanner?


Solution

  • As far as I know, the question and answer you point to is still the status quo.