Index of /galib-2.3/examples
GAlib: examples
Here is what each one of the examples does:
- ex1
- Fill a 2DBinaryStringChromosome with alternating 0s and 1s using a
SimpleGA.
- ex2
- Generate a sequence of random numbers, then use a Bin2DecChromosome
and SimpleGA to try and match the sequence. This example shows how
to use the user-data member of genomes in objective functions.
- ex3
- Read a 2D pattern from a data file then try to match the pattern using
a 2DBinaryStringChromosome and a SimpleGA. This example also shows
how to use command-line arguments to set the GA parameters.
- ex4
- Fill a 3DBinaryStringChromosome with alternating 0s and 1s using a
SteadyStateGA.
- ex5
- This example shows how to build a composite genome (a cell?) using
a 2DBinaryStringGenome and a Bin2DecGenome. The header file
defines the composite chromosome. The genome member functions are
the defaults included in the GA library. The objective is to match a
pattern and sequence of numbers (read in from a data file) using
a GA with overlapping populations.
- ex6
- Grow a GATreeChromosome using a SteadyStateGA. This example
illustrates the use of specialized methods to override the default
initialization method and to specialize the output from a tree. It
also shows how to use templatized genome classes. The objective
function in this example tries to grow the tree as large as possible.
- ex7
- Identical in function to example 3, this example shows how to use the
increment operator (++), completion measure, and other member functions
of the GA. It uses a GA with overlapping populations rather than the
non-overlapping GA in example 3 and illustrates the use of many of the
GA member functions.
- ex8
- Grow a GAListChromosome using a GA with overlapping populations.
This also example contains source code for doing initialization of
List genomes.
- ex9
- Find the maximum value of a continuous function in two variables. This
example uses a GABin2DecGenome and simple GA. It also illustrates
how to use the GASigmaTruncationScaling object (rather than the default
linear scaling). Sigma truncation is particularly useful for
objective functions that return negative values.
- ex10
- Find the maximum value of a continuous, periodic function. This
example illustrates the use of sharing to do speciation. It defines
a sample distance function (one that does the distance measure based
on the genotype, the other based on phenotype). It uses a binary-
to-decimal genome to represent the function values.
- ex11
- Generate a sequence of descending numbers using an order-based list.
This example illustrates the use of a GAListGenome as an
order-based chromosome. It contains a custom initializer and shows
how to use this custom initializer in the List genome.
- ex12
- Alphabetize a sequence of characters. Similar to example 11, this
example illustrates the use of the GAStringChromosome (rather than a
list) as an order-based chromosome.
- ex13
- This program runs a GA-within-GA. The outer level GA tries to
match the pattern read in from a file. The inner GA tries to match
a sequence of randomly generated numbers (the sequence is generated
at the beginning of the program's execution). The inner level GA is
run only when the outer GA reaches a threshhold objective score.
- ex14
- Another illustration of how to use composite chromosomes. In this
example, the composite chromosome contains a user-specifiable number
of lists. Each list behaves differently and is not affected by
mutations, crossovers, or initializations of the other lists.
- ex15
- The completion function of a GA determines when it is "done". This
example uses the convergence to tell when the GA has reached the
optimum (the default completion measure is number-of-generations).
It uses a binary-to-decimal genome and tries to match a sequence of
randomly generated numbers.
- ex16
- Tree chromosomes can contain any kind of object in the nodes. This
example shows how to put a point object into the nodes of a tree to
represent a 3D plant. The objective function tries to maximize the
size of the plant.
- ex17
- Array chromsomes can be used when you need tri-valued alleles. This
example uses a 2D array with trinary alleles.
- ex18
- Same as example 3, but this one lets you specify which type of GA you
want to use to solve the problem. You can use steady state, simple,
or incremental just by specifying one of them on the command line.
- ex19
- The 5 DeJong test problems.
- ex20
- Holland's royal road function. This example computes Holland's 1993
ICGA version of the Royal Road problem. Holland posed this problem as
a challenge to test the performance of genetic algorithms and
challenged other GA users to match or beat his performance.
- gnu
- This directory contains the code for an example that uses the BitString
object from the GNU class library. The example illustrates how to
incorporate an existing object (in this case the BitString) into a
GAlib Genome type. The gnu directory contains the source code needed
for the BitString object (taken from the GNU library) plus the two
files (bitstr.h and bitstr.C) needed to define the new genome type and
the example file that runs the GA (gnuex.C).
mbwall@mit.edu, 21 September 1995