Back to Joe's Java Index Back to Joe's Java Index.

Genetic Search Package


This library is provided as free software under the terms of the Library General Public License.

I have written a Java class package for experimenting with a Genetic Algorithm for numerical optimization. I have attempted to make the package as flexible as possible. For those of you who don't know, a genetic search algorithm (GSA) is a program that mimics (simulates) the process of evolution (simulated evolution) in order to optimize a numerical problem (such as an engineering design problem). In short, the program creates a "population" of designs with the design variables in each "organism" set to random initial values. Each organism (potential design solution) is evaluated for fitness (relative goodness of the design solutions). Then the organisms are "mated" using mating probabilities that are proportional to the fitness of a particular design solution. In the mating process, genetic crossover is performed. Characteristics of one organism are interchanged in random ways with those of another organism to produce a child organism (new design solution) that has characteristics of each parent. Mutations (random changes) to the design variables are also performed. The characteristics of the most fit organisms (designs) tend to be passed on to the next generation. As a result, each generation of designs builds on the successes of past generations to approach a global optimum design. The GSA does not guarantee a global optimum solution, but makes finding one likely for many problems.

My solution to the genetic search algorithm is designed such that the type of genetic encoding that you use is quickly and easily changeable. You can simply create your own encoding technique using the Chromosome interface provided, then create an Organism type that uses your new encoding. Everything else can remain unchanged.

I provide an overall GeneticSearch object that implements the basic GSA. The methods used by this object are very simple. The population size remains constant and is completely replaced with the child organisms on each generation, organisms are allowed to mate more than once per generation and the most fit organism is carried on to the next generation unaltered by either mating or mutation. The methods used by this object can be easily overridden to accommodate any GSA algorithm you want to implement.

If you know of a better way to solve this programming design problem, please let me know. Also, if you happen to extend my Genetic Search classes, I'd love to hear about it. What techniques are you working with, what process are you using, etc?

If you download my package and use it. Let me know what you think.

My Genetic Search package can be downloaded by clicking here:, Version: June 21, 2002.

Version history .

Need help?

Created: June 10, 1998
Modified: February 23, 2002