dLife Home Page

Package dlife.ga

Classes and interfaces that support the creation of genetic algorithms.

See:
          Description

Interface Summary
BatchFitnessFunction Interface that is implemented to produce a FitnessFunction that is applied to all of the Individuals in the Population in a single call.
CrossoverOperator Interface for classes used to crossover two Individuals.
FitnessFunction A tag interface for all types of FitnessFunctions.
FitnessScaler Interface that specifies the method that must be implemented by any class that will perform fitness scaling.
IndividualFitnessFunction Interface that is implemented to produce a FitnessFunction that is applied to each Individual in the Population in turn.
MutationOperator Interface for classes used to apply mutation operations to Individuals.
ParentSelector This interface defines the method that must be implemented by any class that will be used to select parents for reproduction.
 

Class Summary
AveFitnessTracker A PopulationStatTracker that reports the average fitness of the Population at a specified inteval.
BitGene A Gene that consists of a single bit.
ConstantFitnessFunction A FitnessFunction that returns a constant value.
DoubleGene A gene based on an underlying double value.
FixedRateMutation Mutation operator that mutates the Gene's of an Individual at a fixed rate.
FixedSizePopulation A Population with a fixed number of Individuals.
Gene An abstract base class extended by all types of Genes.
Individual This class represents an individual in an evolving population.
IntegerGene A gene based on an underlying long value.
MaxFitnessTracker A PopulationStatTracker that reports the maximum fitness of the Population at a specified inteval.
MinFitnessTracker A PopulationStatTracker that reports the minimum fitness of the Population at a specified inteval.
OnePointCrossover An implementation of one point crossover.
Population Abstract base class for a Population of Individuals.
PopulationStatTracker This interface defines the methods that must be implemented by objects that are used to track the statistics of a Population during evolution.
RouletteWheel An implementation of weighted roulette wheel selection.
ShiftMinToN A FitnessScaler that will shift the fitness value of each Individual in the population by a constant amount such that the minimum fitness Individual in the Population has a fitness of N.
TournamentSelector A ParentSelector that uses tournament selection to pick a parent.
 

Exception Summary
UnrecognizedFitnessFunctionTypeException Thrown by the Population class if the FitnessFunction used to create the Population is not a recognized sub-type of FitnessFunction.
 

Package dlife.ga Description

Classes and interfaces that support the creation of genetic algorithms. This package provides classes that are sufficient for many basic genetic algorithms applications. It has also been designed so that it can be easily extended for more advanced applications. The text below describes the overall structure of the dlife.ga package and how its classes and interfaces interact. The examples.dlife.ga.maxones package contains a working example that uses the dlife.ga package.

Overview:

The core of the dlife.ga package is formed by three main classes:

The operators that a Population will use for selection and reproduction are defined by four interfaces:

The function that a Population will use to assign fitness to each of the Individual is defined by the FitnessFunction interface. Typically each genetic algorithm application will provide an implementation of the FitnessFunction interface, which assigns fitness based on a metric relevant to the target problem. There are two types of FitnessFunctions that can be used:

A Population can be configured to report statistics about the ongoing evolution by the addition of PopulationStatTrackers. The dlife.ga package provides several implementations of the PopulationStatTracker interface:

Typical Application:

A typical use of the dlife.ga package will consist of the following steps:

  1. Construct and exemplar Individual that has the desired type and number of Genes.
  2. Define the MutationOperator and CrossoverOperator to be used for reproduction.
  3. Define the ParentSelector to be used for picking parents
  4. Define the FitnessFunction for the problem. This typically involves writing a new class that implements either the IndividualFitnessFunction or the BatchFitnessFunction interface.
  5. Construct a Population using the exemplar Individual, the reproductive operators, the selection mechanism and the fitness function.
  6. Add PopulationStatTrackers to the Population to report the desired statistical information during evolution.
  7. Run the evolution by invoking the Population.nextGeneration() method once for each generation.


dLife Home Page