EC1: a simple introductory example of Evolutionary Computation


1. General Overview

The Java code in this directory was designed with strong adherence to
the KISS principle: Keep It Simple, Stupid!  The goal was to expose
the basic structure and components of an evolutionary computation
system by taking a simple evolutionary algorithm (EA) and illustrating how
it can be applied to a simple class of problems.  For EC1 the
simple EA is the EV algorithm described in Chapter 1 and the
problems to be solved are simple real-valued parameter optimization
problems.

At the same time the object-oriented features of Java have been
used to expose the generality of the architecture in that other
EAs and other problems can be easily added to EC1.  In fact, EC1
is the basis for the more complex code examples described in later
chapters.

For both portability and simplicity reasons, the initial code examples
are "command line" oriented rather than having a GUI.  This poses a
bit of a problem in that most EC systems are designed with a number of
user-controlled configuration settings.  In EC1 this is done in the
following way: whenever possible reasonable default values have been
chosen that can be overridden by the user in a configuration text
file.  The simple syntax of an EC1 configuration file is dictated by
the Properties class provided by Java and takes the form:
	property_name=property_values
where the actual property names and values are program specific.

For example, a typical EC1 configuration file might be:

  Landscape=RVP Parabola 2 -4.0 6.0 soft - 50.0
  PopSize=10
  Mutation=gaussian 2.0
  SimLimit=1000
  RandSeed=123456789
  Report=full


A full discussion of the meaning of EC1 parameters is provided later in
this document.  For now, it is sufficient to understand how configuration
files are used.  At the command line, EC1 can be invoked in two ways:
	java EC1 config_file_name
or
	java EC1

In the first case, EC1 will read in any parameter settings specified
in the user-specified configuration file.  In the latter case EC1 will
look for a file named ec1.cfg in the current directory and read parameter
setting from it.



2. Code Structure

The file EC1.java contains the top-level main code for EC1.  It looks
for a configuration file as described above, reads a subset of the Landscape
properties information from it, and activates an appropriate "EA application".

The EA_application class is the base class for matching up a
particular EA with a particular class of problems (landscapes), and
for setting up the basic simulation parameters.  In EC1 this is quite
simple since it implements exactly one problem class (real-valued
parameter optimization) and exactly one EA (EV), but sets the stage
for adding other problem classes and EAs.  The file
RvpEA_application.java contains the code for extending (specializing)
the EA_application class to real-valued parameter problems.

The file EA.java defines the base class for all EAs, which is then
specialized in RvpEA.java to the class RvpEA defining EAs for solving
real-valued parameter optimization problems, and specialized again in
RvpEV.java to implement the simple EV algorithm.

The base class for the population maintained by an EA is defined in
Population.java.  The base class for individuals contained in a population
is defined in Individual.java, and the base class for an individual's
genome is defined in Genome.java.  In EC1 there is only one type of
genome supported, namely a vector of real-valued genes.

The base class for problems is defined in Landscape.java, which is then
specialized  in RvpLscape.java to the class RvpLscape (real-valued
parameter landscapes), and specialized again in Parabola.java to parabolic
landscapes.  The code in Parabola.java can be used as a template to easily
add other more interesting landscapes.

Finally, EC_rand.java and Pad.java provide some convenient utility code.


3. EC1 Parameters

The EC1 configuration file discussed earlier is used to modify the
behavior of EC1 from one run to the next.  EC1 uses the Java-provided
Properties class to read in the information in a configuration file.
The Properties class provided the ability to read in lines of the form:
	property_name=property_values
When retrieving information from a file, the Properties class does a
keyword search on the property name, so properties can be specified in
any order in the file, one line per property.

The properties implemented by EC1 are:

  Landscape=<type of landscape> <name of landscape> ...
  PopSize=<population size>
  Mutation=<type of mutation> ...
  SimLimit=<simulation limit specified by # of births>
  RandSeed=<random number seed>
  Report=<type of report>

So, for example, a typical configuration file might be:

  Landscape=RVP Parabola 2 -4.0 6.0 soft - 50.0
  PopSize=10
  Mutation=gaussian 2.0
  SimLimit=1000
  RandSeed=123456789
  Report=full

which specifies the general class of landscape to be RVP (real-valued
parameter), the particular landscape to be of type Parabola, and the
particular parabola to be 2 dimensional with initial lower/upper
bounds on the parameters to be -4.0 and 6.0, that these initial bounds
are soft (not hard) in that an EA is allowed to explore outside them,
that the parabola is inverted (-) and has a maximum value of 50.0.

In addition, a population size of 10 is to be used, the mutation operator
to be used is Gaussian with an average step size of 2.0.  The simulation
is to be run for 1000 births (100 generations), the pseudo-random number
generator is to be initialized used 123456789 is the seed, and a full
report of the simulation is to be generated.

In EC1 there are no other landscape types implemented.  So, the only
variation in configuration files comes from specifying different
numerical values, by choosing between a simple delta mutation operator
and a Gaussian one (discussed in Chapter 1), and/or by choosing a
different report type.

A full report (the default) prints out the kind of information seen in
Chapter 1: after every generation global and local population statistics
are printed along with a dump of the contents of the current population.
Various parts of this voluminous output can be suppressed by selecting
one of the alternative report types:

  Report=local		prints only local population statistics each generation
  Report=global		prints only global population statistics each generation
  Report=bsf		prints only best-so-far statistics each generation
  Report=pop_stats	prints only local population statistics in a format
				easily read by a plotting program.


Another example configuration file is:

  SimLimit=1000
  Mutation=delta 5.0
  Landscape=RVP Parabola 3 -10.0 10.0 hard
  Report=bsf

In this case PopSize and RandSeed are unspecified and default to 10 and
12345, respectively.

Of course, the best way to sort this all out is to read the code, which
is what you are expected to do!

