Evocosm - A C++ Framework for Evolutionary Computing

Main Index

Created by Scott Robert Ladd at Coyote Gulch Productions.


libevocosm::evoreal Class Reference

Tools for evolving real numbers. More...

#include <evoreal.h>

Inheritance diagram for libevocosm::evoreal:

libevocosm::globals List of all members.

Public Member Functions


Detailed Description

The majority of genetic algorithms work on pure bit strings, converting those strings to the desired types for fitness testing. In Lawrence Davis' book "Handbook of Genetic Algorithms," he transforms a 44-bit string into two floating point values via a series of operations. I've seen similar techniques elsewhere, and I find them a bit cumbersome.

In the purest sense, a GA should have no knowledge of the format of the data it is modifying; however, natural chromosomes do encode some structure in their sequence; for example, crossover appears to take place in specific positions along the chromosome. And while mutation doesn't care about a chromosome's structure, it does affect that structure. In context of a computer program, the structure of a chromosome isn't so important as the ability to logically modify its bits through crossover and mutation.

I built tools for the mutation and crossover of encoded floating-point values of types float and double. The code that follows assumes we are working with 32-bit floats and 64-bit IEEE-754 doubles, which, in my experience, the norm for many C and C++ compilers. Yes, I'm aware of the VAX and other systems; this code is explicitly non-portable outside implementations of IEC 60559/IEEE-754.


Constructor & Destructor Documentation

libevocosm::evoreal::evoreal float  a_sign_weight = 5.0F,
float  a_exponent_weight = 5.0F,
float  a_mantissa_weight = 90.0F
 

Creates a new evoreal object based on a set of weights that define the chance of mutation in various components of a floating-point value. The default weights have worked well in a variety of applications, but are (of course) settable for specific application and experimentation.

Each weight is a percentage of the total of all three weights; for example, if the three weights add to 100 (as they do by efault), and a_sign_weight is 12, the chance of a mutation in the sign bit is 12%. The default weights were chosen based on experience in using these tools in a variety of applications.

Parameters:
a_sign_weight - Weight assigned to changes in sign
a_exponent_weight - Weight assigned to changes in the exponent
a_mantissa_weight - Weight assigned to changes in the mantissa

libevocosm::evoreal::evoreal evoreal a_source  ) 
 

Creates a new evoreal with the same states as an existing one.

Parameters:
a_source - The source object


Member Function Documentation

double libevocosm::evoreal::crossover double  a_d1,
double  a_d2
 

Creates a new double by combining two values through a real-specialized form of crossover.

Parameters:
a_d1 - First parent number
a_d2 - Second parent number
Returns:
A combination of the two arguments

float libevocosm::evoreal::crossover float  a_f1,
float  a_f2
 

Creates a new float by combining two values through a real-specialized form of crossover.

Parameters:
a_f1 - First parent number
a_f2 - Second parent number
Returns:
A combination of the two arguments

double libevocosm::evoreal::mutate double  a_d  ) 
 

Returns a new float that is a mutated version of the argument.

Parameters:
a_d - Number to be cloned; the result is then mutated
Returns:
A clone of a_d that has bene mutated

float libevocosm::evoreal::mutate float  a_f  ) 
 

Returns a new float that is a mutated version of the argument.

Parameters:
a_f - Number to be cloned; the result is then mutated
Returns:
A clone of a_f that has bene mutated

evoreal& libevocosm::evoreal::operator= evoreal a_source  ) 
 

Assigns the state of one evoreal to another.

Parameters:
a_source - The source object


The documentation for this class was generated from the following file:

© 1996-2005 Scott Robert Ladd. All rights reserved.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.