JGAP Frequently Asked Questions

[JGAP Home]


The following is a brief collection of questions and answers that come up periodically on the JGAP mailing lists. If you have suggestions for additional questions, please feel free to post them to the jgap-users mailing list!

WordPress Hosting
  1. After running an example, the following error appears (parts of the output omitted here for brevity):
    Exception in thread "main" java.lang.UnsupportedClassVersionError: <classname> (Unsupported major.minor version 49.0)

    It seems you have the wrong Java version installed. JGAP is currently compiled with Java 6. Please install Java 6. In case you have it already installed, please check that this installation is used and not a different one. You could do this by typing the following on the command line: java -version

  2. Is there a way to create a fitness function that can evaluate all of the Chromosomes in a population at once?

    Yes, a bulk fitness-function can be used. The bulk fitness function is passed all of the Chromosomes in a population at once, and then is responsible for evaluating each of those Chromosomes and setting their fitness values. This can be especially useful when you want to evaluate Chromosomes in relationship to each other (rather than in isolation of each other), or if you want to make use of an external service to actually perform the evaluation.

    For more information on bulk fitness-functions, please see the javadocs for the org.jgap.BulkFitnessFunction class.

  3. Does JGAP support real-valued fitness values or alleles?

    Yes, double typed fitness values have been introduced with release 1.1. Before that the type was int.

  4. How can I select the top n performers of a population?

    During evolution, to select the best performing chromosomes for the next generation, use the org.jgap.impl.BestChromosomesSelector. See org.jgap.impl.DefaultConfiguration for an example.

    To select the top n performers after evolution, you could use Genotype.getPopulation.toChromosomes(). After that, sort the returned array of chromosomes via Arrays.sort(chromosomesArrayFromPopulation, yourComparator). yourComparator sorts the array of chromosomes by the fitness value of each chromosome.

  5. How do I know when my GA application is 'finished'?

    There are many possible criteria for stopping an algorithm from continued evolution, including

    The first criteria is easy, just write: Genotype.evolve(numEvolutions);
    Please notice: You can also use the evolve method without any parameter. In that case, only one evolution is executed. This makes sense if you build a loop around this statement and check for any criteria to exit evolution yourself.

    For the other two, check out the IEvolutionMonitor implementations FitnessImprovementMonitor, TimedMonitor and ChainedMonitors to use with a call like Genotype.evolve(monitor);

  6. Does JGAP support multiple threads?

    JGAP does support multi-threaded computation, see the example in package examples.simpleBooleanThreaded. The main class to start there is SimpleExample.

  7. I notice that sometimes the fittest chromosome doesn't get selected for the next generation. What's up with that?

    Natural selection in JGAP is statistical, so chromosomes that are more fit have a better statistical chance of being selected over chromosomes that are less fit, but it's not guaranteed. This is much like nature, where even the fittest of us can sometimes be unlucky!

    Incidentally, JGAP is designed to be very pluggable, and it's possible for you to write your own natural selector and plug it into JGAP in place of the default version, if that better suits your needs.

  8. Why aren't the chromosomes in my population ever candidates for natural selection?

    This should not happen if you properly use a NaturalSelector resp. if this selector is implemented correctly. The reproduction operator is deprecated in newer JGAP versions due to performance reasons and due to the fact that the current architecture delivers such functionality itself.

    Has anyone used JGAP in combination with the JOONE neural networks package?

    Yes, as a matter of a fact there is a whole open-source project dedicated to integration of JGAP with JOONE! You can find out more about the JOONEGAP project on their homepage.

    Additionally (among others), there is a dissertation about Genetic Algorithms playing together with Neural Nets to play Backgammon!

  9. I have a problem executing commands under Linux!

    Maybe you have used the backslash in path specifications (or you did not adapt  a batch file given with JGAP for execution under Microsoft Windows). The Backslash is mainly used under Windows. Please use the simple slash under Linux and similar operating systems.>
    Please also consider changing the delimiter semicolon to a double colon!

  10. What is the difference between Genetic Algorithms and Genetic Programming?

    Instead of giving a complex answer, we advice you to check out the Mona Lisa Painting Problem. It is implemented with GA as well as with GP. The GA version is in package examples.monalisa, the GP version in package examples.gp.monalisa.

  11. Does JGAP support elitism?

    Yes: Elitism is preferring to select the fitter individuums for the next generation. One implementation can be found with class org.jgap.impl.BestChromosomesSelector. Another selection operator is WeightedRouletteSelector in the same package.

  12. Why are genetic operators executed more often than expected?

    One may expect the mutation operator, e.g.,  to be executed N x M  times, with N = number of individuals and M the number of evolutions. In JGAP, the real number of mutations may be higher. The reason for that will be documents here soon. It has to do with runtime optimization.


[JGAP Home]
SourceForge Logo