IndiBase - Base class for chromosomes; knows how to build them, and has
               some helper methods.


  my $xmlStr="<indi type='BinaryIndi'><atom>1</atom><atom>0</atom><atom>1</atom><atom>0</atom></indi>";
  my $ref = XMLin($xmlStr);
  my $binIndi2 = IndiBase->fromXML( $ref ); #From XML fragment
  print $binIndi2->asXML();
  my $indi = IndiBase->fromParam( $ref->{initial}{section}{indi}{param} ); #From parametric description
  $binIndi2->Fitness( 3.5 ); #Sets or gets fitness
  print $binIndi2->Fitness();
  my $emptyIndi = new IndiBase;


Base class for individuals in evolutionary computation algorithms


Creates a new IndiBase of the required class, with a fitness, and sets fitnes to undef


Takes a definition in the shape <indi><atom>....</indi><fitness></fitness></indi> and turns it into a bitstring, if it knows how to do it. The definition must have been processed using XML::Simple

This function needs to know about all available classes. Right now it is done harwired, but in the future, classes should answer to messages from this


Takes an array of params that describe the individual, and build it, with random initial values.

Params have this shape: <param name='type' value='VectorIndi' /> <param name='length' value='2' /> <param name='range' start='0' end='1' />

The 'type' will show the class of the individuals that are going to be created, and the rest will be type-specific, and left to the particular object to interpret.


Prints it as XML. The caller must close the tags.


Sets or gets the value of an atom. Each individual is divided in atoms, which can be accessed sequentially. If that does not apply, Atom can simply return the whole individual


Sets or gets fitness


Sets or gets the chromosome itself, that is, the data structure evolved. Since each derived class has its own data structure, and its own name, it's left to them to return it

Known subclasses


  This file is released under the GPL. See the LICENSE file included in this distribution,
  or go to
  CVS Info: $Date: 2001/11/27 13:22:58 $ 
  $Header: /cvsroot/opeal/opeal/,v 1.7 2001/11/27 13:22:58 jmerelo Exp $ 
  $Author: jmerelo $ 
  $Revision: 1.7 $

``The plain truth'';