EvolvingObjects
t-eo.cpp

EO is the base class for objects with a fitness. Those evolvable objects are the subjects of evolution. EOs have only got a fitness, which at the same time needs to be only an object with the operation less than (<) defined. Fitness says how good is the object; evolution or change of these objects is left to the genetic operators.

A fitness less than another means a worse fitness, in whatever the context; thus, fitness is always maximized; although it can be minimized with a proper definition of the < operator.

A fitness can be invalid if undefined, trying to read an invalid fitness will raise an error. Evolutionary Operators that effectively modify EO objects must invalidate them.

The fitness object must have, besides an void ctor, a copy ctor.

#include <eo>

typedef EO<float> Chrom;

int main()
{
  Chrom chrom1, chrom2;

  // EO objects can be printed with stream operators
  std::cout << "chrom1 = " << chrom1 << std::endl
            << "chrom2 = " << chrom2 << std::endl;

  return 0;
}
 All Classes Namespaces Files Functions Variables Typedefs Friends