Need multiple best solutions

Hi, I’m currently trying to create a way to end up with 5 best DIFFERENT solutions throughout the iteration process.
Is this a feasible way of achieving it?
I’m currently adding a solutionchecker to know if solutions are the same, but is there a more native way to do it through JSprit?

I have added an IterationsEndListener

    `algorithm.addListener(new IterationEndsListener() {
            @Override
            public void informIterationEnds(int i, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> iterationSolutions) {
                VehicleRoutingProblemSolution iterationSolution = Solutions.bestOf(iterationSolutions);
                if(iterationSolution != null && !alternativeExists(iterationSolution))
                        if(MAX_ALTERNATIVES > alternatives.size()) {
                            alternatives.add(iterationSolution);
                        } else {
                            alternatives.add(iterationSolution);
                            alternatives.sort(solutionComparator);
                            alternatives.remove(alternatives.size() - 1);
                        }
            }
        });`

and something of a checker for same solutions

`    private boolean alternativeExists(VehicleRoutingProblemSolution newSolution) {
        int index = 0;
        int checker;
        for(VehicleRoutingProblemSolution oldSolution : alternatives) {
            checker = 0;
            if(oldSolution.getCost() == newSolution.getCost()) {
                System.out.println("same cost");
                checker++;
            }
            if(oldSolution.getUnassignedJobs().size() == newSolution.getUnassignedJobs().size()
                    && oldSolution.getUnassignedJobs().containsAll(newSolution.getUnassignedJobs())) {
                System.out.println("same unassigned jobs");
                checker++;
            }
            if(oldSolution.getRoutes().size() == newSolution.getRoutes().size() &&
                    oldSolution.getRoutes().containsAll(newSolution.getRoutes())) {
                System.out.println("same routes");
                checker++;
            }
            System.err.println("[" + index + "] " + checker);
            if(checker == 3)
                return true;
            index ++;
        }
        return false;
    }
`

Hello there

Sorry to dig this old topic out, but I am also interested in this approach: keep the 10 best (and different) solutions.

I retrieved your code, which seem to work quite well, but I’m not sure it is the best way to go.
Has Jsprit a best (or native) way to keep these solutions?

Thanks