Next: Creating chromosomes
Up: Doing GAs with
Previous: Doing GAs with
GAGS is a C++ class library designed to make
programming a Genetic Algorithm (GA) [Heitköeter and Beasley, 1996] easy, and at the same time, flexible enough to be
added new objects, which are treated in the same way as native
operators. As many other class libraries, GAGS includes:
-
Chromosomes, which are the basic building blocks of a genetic algorithms.
Chromosomes are bit strings, and have a variable length.
- Genetic operators, which are not part of the chromosome class, but
are outside it; this way, operators are not reduced to mutation and crossover:
there are 9 predefined genetic operators: bit-flip mutation, crossover
(uniform, 1 and n-point, and gene-boundary respecting), creep (change gene
value by 1), remove/reinsert, transpose (permute genes), and kill, remove,
and randomAdd, which alter the length of the chromosome. New operators
can be added and used in the same way as the predefined. Operators can
be applied blindly, or to a certain part of a chromosome.
- Views, which represent the chromome and are used to
evaluate and print it; views are objects used to watch the chromosome as
a float or int array or whatever is needed to evaluate it.
- Population, which includes a list of chromosomes to be evaluated,
sorts them when they are; includes operators for generational replacement,
and a list of genetic operators together with their rates; the number of
chromosomes, the list of operators and their rates can be changed in
runtime.
- The evaluation or fitness function can be any C or C++ function, and it
can return any class or type; thus, fitness is not reduced to a floating
point number: it can be an array or any other user-defined type; the only
requirement is that it has ordering operators defined.
The second and last feature set it apart from other GA class
libraries, like Matthew's GAlib [Wall, 1995] and TOLKIEN
[Tang, 1994]. At the same time, it lacks some features like an user
interface and provision for more than one kind of chromosomes.
In this tutorial we will see the way a genetic algorithm is
programmed using these building blocks. We will take a bottom-up
approach, starting by a chromosome, and building up from there.
Next: Creating chromosomes
Up: Doing GAs with
Previous: Doing GAs with
J.J. Merelo Guervos
Fri Aug 22 12:58:28 MDT 1997