JGAP: Java Genetic Algorithms Package (logo)

JGAP References
Download Download
Clover Code Coverage
Major Contributors
Project Details
Interesting Links

#1 Genetic Algorithms
project on Sourceforge


Find JGAP as a reference project
for realizing Genetic Algorithms:


JGAP - Genetic Algorithms Framework

JGAP is a package for implementing a genetic algorithm out of the box. The framework provides methods for evolving solutions to problems similar to genetic mechanisms as they occur in nature.
On the main page there are several use cases given. Examples of genetically evolved solutions include, but are not limited to

  • Painting the Mona Lisa with as few polygons as possible but as much as necessary

  • Evolving an antenna for space ships that receives signals from any direction

  • Ant trail problem: Find a track through a maze that contains food and other supplies

  • Evolve a program with which to control the behaviour of an online robot

  • Determine which coins to use in order to use as few as possible to sum up to a given target amount

  • Find a formula for a given truth table

Elements of genetic algorithms

A genetic algorithm, as in evolution, contains the following parts and strategies:

  • A genotype: the internal representation or encoding of an organism

  • A phenotype: The external (visible) representation of an organism, that is, the bevahiour and the overall structure

  • Chromosomes as carriers of information

  • Genes as almost atomic elements that reside on chromosomes and build them up

  • Mutation: random alterations on genes and chromosomes

  • Crossing over (X-over): Combining two chromosomes so that one sequence of both of them results in a new chromosome containing parts of them

  • Replication is keeping a chromosome as is and passing it to the next generation, either as original or as a copy

  • A fitness function evaluates how fit an individual, consisting of several chromosomes, is in terms of the defined environment

  • A random creation mechanism is used to provide new chromosomes. This is especially needed for the first generation but later on also for future individuals to be created in a random fashion


Not all problems are suited for evolutionary algorithms and genetic programming. In general, a GA is used when the potential solution space seems endless and a brute force method does not help a lot to get a result.
It is vital to have a good fitness function in place that implements a proper ranking and punishes bad individuals appropriately.
The random creation of chromosomes and genes often is not satisfying. You want to constrain how genes are created, but do not want to limit it too much. Trying too often to generate a valid gene may take too much time and reduces the advantages of genetic algorithms. One possible approach to this problem may be the supergenes, which are also contained in JGAP.

Install JGAP in 5 minutes

More information about JGAP

SourceForge Logo