++ed by:
EGOR

1 PAUSE user
1 non-PAUSE user.

J. J. Merelo-Guervós
and 1 contributors

NAME

Algorithm::Evolutionary::Experiment - Class for setting up an experiment with algorithms and population

SYNOPSIS

  use Algorithm::Evolutionary::Experiment;
  my $popSize = 20;
  my $indiType = 'BitString';
  my $indiSize = 64;
  
  #Algorithm might be anything of type Op
  my $ex = new Algorithm::Evolutionary::Experiment $popSize, $indiType, $indiSize, $algorithm; 

DESCRIPTION

This class contains (as instance variables) an algorithm and a population, and applies one to the other. Can be serialized using XML, and can read an XML description of the experiment.

METHODS

new( $pop_size, $type_of_individual, $individual_size )

Creates a new experiment. An Experiment has two parts: the population and the algorithm. The population is created from a set of parameters: popSize, indiType and indiSize, and an array of algorithms that will be applied sequentially. Alternatively, if only operators are passed as an argument, it is understood as an array of algorithms (including, probably, initialization of the population).

fromXML

Creates a new experiment, same as before, but with an XML specification. An example of it follows:

 <ea xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation='ea-alpha.xsd'
    version='0.2'>

  <initial>
    <pop size='20'>
       <section name='indi'> 
          <param name='type' value='BitString' /> 
          <param name='length' value='64' />
       </section>
    </pop>

    <op name='Easy'  type='unary'>
        <param name='selrate' value='0.4' />
        <param name='maxgen' value='100' />
        <code type='eval' language='perl'>
          <src><![CDATA[ #source goes here ]]>
          </src>
        </code>
        <op name='GaussianMutation' type='unary' rate='1'>
                <param name='avg' value='0' />
                        <param name='stddev' value='0.1' />
        </op>
        <op name='VectorCrossover' type='binary' rate='1'>
                <param name='numpoints' value='1' />
        </op>
    </op>
    
    
  </initial>

 </ea>
 

This is an alternative constructor. Takes a well-formed string with the XML spec, which should have been done according to EvoSpec 0.3, or the same string processed with XML::Parser::EasyTree, and returns a built experiment

go

Applies the different operators in the order that they appear; returns the population as a ref-to-array.

asXML

Opposite of fromXML; serializes the object in XML. First the operators, and then the population

SEE ALSO

Algorithm::Evolutionary::Run , another option for setting up experiments, which is the one you should rather use, as XML support is going to be deprecated (some day).

Copyright

  This file is released under the GPL. See the LICENSE file included in this distribution,
  or go to http://www.fsf.org/licenses/gpl.txt

  CVS Info: $Date: 2012/07/11 06:14:51 $ 
  $Header: /media/Backup/Repos/opeal/opeal/Algorithm-Evolutionary/lib/Algorithm/Evolutionary/Experiment.pm,v 3.3 2012/07/11 06:14:51 jmerelo Exp $ 
  $Author: jmerelo $ 
  $Revision: 3.3 $