WoLfulus
WoLfulus

Reputation: 1977

Genetic Algorithm with Top N solutions

Basically I need to find the top N solutions of a genetic algorithm using Java (the solutions with the highest scores). I'm using the Jenetics library for the genetic algorithm, but I can't find how I'll be able to get those results without hacking the library's source code.

I can use another library if anyone knows a better one that has good documentation/examples.

Upvotes: -1

Views: 222

Answers (2)

brain
brain

Reputation: 5546

You can get all the solutions by calling getPopulation() and then you can sort them by the fitness function by calling sort() and then just iterate through the first N solutions.

Upvotes: 3

user2298337
user2298337

Reputation:

As all metaheuristics, genetic algorithms do not guarantee optimal solutions or provide any estimate of how good your solution is in comparison to the optimal solution. Therefore, I do not see a way to find the top N solutions using genetic algorithms.

Upvotes: 0

Related Questions