
Algorithm::Evolutionary::Op::ChangeLengthMutation - Increases/decreases by one the length of the string

my $xmlStr2=<<EOC; <op name='ChangeLengthMutation' type='unary' rate='0.5' /> EOC my $ref2 = XMLin($xmlStr2); my $op2 = Algorithm::Evolutionary::Op::Base->fromXML( $ref2 ); print $op2->asXML(), "\n*Arity ", $op->arity(), "\n"; my $op = new Algorithm::Evolutionary::Op::ChangeLengthMutation 1, 0.5, 0.5; #Create from scratch

Algorithm::Evolutionary::Op::Base

Increases or decreases the length of a string, by adding a random element, or eliminating it.

Creates a new operator. It is called with 3 arguments: the rate it's going to be applied, and the probability of adding and substracting an element from the string each time it's applied. Rates default to one.
Creates a new operator. It is called with 3 arguments: the rate it's going to be applied, and the probability of adding and substracting an element from the string each time it's applied. Rates default to one.
This is the function that does the stuff. The probability of adding and subsctracting are normalized. Depending on a random draw, a random char is added to the string (at the end) or eliminated from a random position within the string.

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/02/04 20:43:14 $ $Header: /cvsroot/opeal/Algorithm-Evolutionary/lib/Algorithm/Evolutionary/Op/ChangeLengthMutation.pm,v 2.1 2009/02/04 20:43:14 jmerelo Exp $ $Author: jmerelo $ $Revision: 2.1 $ $Name $