The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

    Algorithm::Evolutionary::Op::Crossover - n-point crossover operator; puts a part of the second operand
                into the first operand; can be 1 or 2 points
                 

SYNOPSIS

  my $xmlStr3=<<EOC;
  <op name='Crossover' type='binary' rate='1'>
    <param name='numPoints' value='3' /> #Max is 2, anyways
  </op>
  EOC
  my $ref3 = XMLin($xmlStr3);

  my $op3 = Algorithm::Evolutionary::Op::Base->fromXML( $ref3 );
  print $op3->asXML(), "\n";

  my $indi = new Algorithm::Evolutionary::Individual::BitString 10;
  my $indi2 = $indi->clone();
  my $indi3 = $indi->clone();
  $op3->apply( $indi2, $indi3 );

  my $op4 = new Algorithm::Evolutionary::Op::Crossover 3; #Crossover with 3 crossover points

Base Class

Algorithm::Evolutionary::Op::Base

DESCRIPTION

Crossover operator for a GA

METHODS

new

Creates a new n-point crossover operator, with 2 as the default number of points

create

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

apply

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

Changes the first parent, and returns it.

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: 2003/02/27 08:03:09 $ 
  $Header: /cvsroot/opeal/opeal/Algorithm/Evolutionary/Op/Crossover.pm,v 1.7 2003/02/27 08:03:09 jmerelo Exp $ 
  $Author: jmerelo $ 
  $Revision: 1.7 $
  $Name $