J. J. Merelo-Guervós > Algorithm-Evolutionary > Algorithm::Evolutionary::Op::Gene_Boundary_Crossover

Download:
Algorithm-Evolutionary-0.71.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 3.0   Source  

NAME ^

Algorithm::Evolutionary::Op::Gene_Boundary_Crossover - n-point crossover operator that restricts crossing point to gene boundaries

SYNOPSIS ^

  #Create from XML description using EvoSpec
  my $xmlStr3=<<EOC;
  <op name='Gene_Boundary_Crossover' type='binary' rate='1'>
    <param name='numPoints' value='3' /> #Max is 2, anyways
  </op>
  EOC
  my $op3 = Algorithm::Evolutionary::Op::Base->fromXML( $xmlStr3 );
  print $op3->asXML(), "\n";

  #Apply to 2 Individuals of the String class
  my $indi = new Algorithm::Evolutionary::Individual::BitString 10;
  my $indi2 = $indi->clone();
  my $indi3 = $indi->clone();
  my $offspring = $op3->apply( $indi2, $indi3 ); #$indi2 == $offspring

  #Initialize using OO interface
  my $op4 = new Algorithm::Evolutionary::Op::Gene_Boundary_Crossover 3; #Gene_Boundary_Crossover with 3 crossover points

Base Class ^

Algorithm::Evolutionary::Op::Base

DESCRIPTION ^

Crossover operator for a Individuals of type Algorithm::Evolutionary::Individual::String and their descendants (Algorithm::Evolutionary::Individual::BitString). Crossover for Algorithm::Evolutionary::Individual::Vector would be Algorithm::Evolutionary::Op::VectorCrossover

METHODS ^

new( [$options_hash] [, $operation_priority] )

Creates a new n-point crossover operator, with 2 as the default number of points, that is, the default would be my $options_hash = { numPoints => 2 }; my $priority = 1;

create( [$num_points] )

Creates a new 1 or 2 point crossover operator. But this is just to have a non-empty chromosome Defaults to 2 point

apply( $chromsosome_1, $chromosome_2 )

Applies xover operator to a "Chromosome", a string, really. Can be applied only to victims with the _str instance variable; but it checks before application that both operands are of type BitString.

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: 2009/07/24 08:46:59 $ 
  $Header: /cvsroot/opeal/Algorithm-Evolutionary/lib/Algorithm/Evolutionary/Op/Gene_Boundary_Crossover.pm,v 3.0 2009/07/24 08:46:59 jmerelo Exp $ 
  $Author: jmerelo $ 
  $Revision: 3.0 $
  $Name $