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 testing Genetic Algorithms:



JGAP (pronounced "jay-gap") is a Genetic Algorithms and Genetic Programming component provided as a Java framework. It provides basic genetic mechanisms that can be easily used to apply evolutionary principles to problem solutions. See the examples for a demonstration or watch out the graphical tree that can be created with JGAP for found solutions of genetically evolved programs. A Genetic Algorithm is a powerful means to solve problems with a huge solution space having limited time and CPU power.

JGAP was designed to be very easy to use "out of the box", while also designed to be highly modular so that more adventurous users can easily plug-in custom genetic operators like mutation or crossing over and other sub-components.

Documentation,  quality and stability of code are the top concerns when developing JGAP. You find really a lot of unit tests packaged with JGAP (> 1400), extensive Javadocs, and quite a lot of examples. Compare JGAP with other projects! Feedback is always welcome.

Install JGAP in 5 minutes

Join the JGAP Grid!


Genetic algorithms (GAs) are evolutionary algorithms that use the principle of natural selection to evolve a set of solutions toward an optimum solution. As nature uses random mechanisms to generate new populations so does JGAP in Java. GAs are not only quite  powerful, but are also very easy to use as most of the work can be encapsulated into a single component, requiring users only to define a fitness function that is used to determine how "good" a particular random solution is relative to other solutions.

Genetic Programs (GP) enhance GAs and are a more sophisticated problem solver. The population now consists of different elements as with a genetic algorithm. These genetic programs allow to breed dynamic programs instead of static chromosomes. Simply run an example such as examples.gp.Fibonacci, examples.gp.anttrail.AntTrailProblem, examples.gp.monalisa.gui.GeneticDrawingApp or see the GP documentation to get behind the scenes. it is vital to understand what a population is and what mutation does to it! Especially the selection of chromosomes through a fitness function is sort of different in GPs as full programs have to be evaluated in order to determine their fitness value.

A complex example evolves a Robocode, that is a platform for simulating competing robots. With genetic optimizations, capable robot code is generated.JGAP writes complete full-blown Java code just by evolution!


The latest release of JGAP is version 3.6.2, result of many years of personal investment and dedication to Genetic Algorithms and Genetic Programming. A big thank you to all contributors, may it be developers or users giving feedback! In the CVS you very often find updated and enhanced code before a new release is published. Be aware that JGAP is a very alive project from which you can expect a lot of releases to come.

Please see the Downloads section for more information on each of the releases, including the current version, as well as any release notes that accompany each version.


The following introductory documents are available to help you get started with JGAP:

In addition, Javadocs are available online for the following versions of JGAP:

If you need require individual information about extended or complicated questions, please think about donating something (see top of page on the left). You will get first class personal service via email.


If you run into any issues or bugs, or just have a question, please try posting a message to the moderated jgap-users mailing list at jgap-users@lists.sourceforge.net (please notice that moderator approval is necessary). Or you can drop us a note on the JGAP developers mailing list at jgap-devl@lists.sourceforge.net which is also moderated.


There are three public mailing lists that pertain to JGAP:

  • Public announcements concerning JGAP, including any new release announcements, are made on the jgap-announce mailing list.
  • Users of JGAP are encouraged to ask questions, make suggestions, or participate in general discussion of JGAP on the jgap-users mailing list.
  • Discussion amongst the JGAP developers concerning future and in-progress development of JGAP occurs on the jgap-devl mailing list.

If you would like to subscribe to any of these lists, or browse the archives, please visit the JGAP mailing list manager.

For searching posts in lists, maybe the external Nabble forum is sufficient (this forum is not under control of the JGAP team).


JGAP is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. Instead, you could choose to use the Mozilla Public License to use JGAP in commercial applications without the need of publishing your source code or make it reverse engineerable (as is required with the GNU License). For using the MPL you have to donate at least 50 Euros to JGAP. Maybe you would like to browser further information about using JGAP commercially.

JGAP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above mentioned GNU Lesser Public License and the Mozilla Public License for more details. But we offer really a lot of unit tests which help assure a very high probability for  a correct piece of software!


Robocode is an online platform that gives you an API to create your own robots. These robots can fight against each other. There is a highscore table, so try to rank higher than other robots. With RobocodeJGAP you can evolve Robocode robots with the help of GA & GP. JGAP evolved the code for the robots. What you get is a working Java program, evolved by JGAP! Sounds amazing? Yes it is!


Thank you for your interest in JGAP. We are very interested in any feedback you might have, including details of how you're using JGAP, what you like about it, and what you think needs improvement. You can leave this feedback on the user's mailing list at jgap-users <at> lists.sourceforge.net or, if you prefer to keep these details private, you can email the JGAP project administrator at jgap <at> doktor-meffert.de. The more feedback we get, the more we can improve JGAP to better meet the needs of our users. Thanks for your support!


If you're interested in the latest, bleeding-edge JGAP code, it can be found in the CVS repository hosted on Sourceforge. It goes without saying that this code is not considered to be stable and may be buggier than usual. If you're really unlucky, it may not even compile. However, it may also be the case that some particular feature or bug-fix that you require has not yet been included in a public release and therefore only exists in the CVS repository. Or, maybe you just want to follow our progress ;-) This is evolution in the code, mutation at it's best.

The following options are available for accessing the code in the CVS repository:

SourceForge Logo