Crossover - n-point crossover operator; puts a part of the second operand into the first operand; can be 1 or 2 points
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 = OpBase->fromXML( $ref3 ); print $op3->asXML(), "\n";
my $indi = new BinaryIndi 10; my $indi2 = $indi->clone(); my $indi3 = $indi->clone(); $op3->apply( $indi2, $indi3 );
Crossover operator for a GA
Creates a new n-point crossover operator, with 2 as the default number of points
Creates a new 1 or 2 point crossover operator. But this is just to have a non-empty chromosome Defaults to 2 point
Sets the instance variables. Takes a ref-to-hash as input
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
Changes the first parent, and returns it.
Prints as XML, following the EvoSpec 0.2 XML specification. Should be called from derived classes, not by itself.
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: 2002/04/23 12:33:47 $ $Header: /cvsroot/opeal/opeal/Crossover.pm,v 1.7 2002/04/23 12:33:47 jmerelo Exp $ $Author: jmerelo $