BinaryIndi - Classic bitstring individual for evolutionary computation; usually called I<chromosome>
my $indi = new BinaryIndi 10 ; # Build random bitstring with length 10 # Each element in the range 0 .. 1
my $indi3 = new BinaryIndi; $indi3->set( length => 20 ); #Sets values, but does not build the string
$indi3->randomize(); #Creates a random bitstring with length as above
print $indi3->Atom( 7 ); #Returns the value of the 7th character $indi3->Atom( 3 ) = '2.35'; #Sets the value
$indi3->addAtom( 1 ); #Adds a new character to the bitstring at the end
my $indi4 = BinaryIndi->fromString( '10110101'); #Creates an individual from that string
my $indi5 = $indi4->clone(); #Creates a copy of the individual
print $indi3->asString(); #Prints the individual print $indi3->asXML() #Prints it as XML. See
Bitstring Individual for ao GA
Creates a new random bitstring individual, with fixed initial length, and uniform distribution of bits.
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: 2001/11/27 13:22:58 $ $Header: /cvsroot/opeal/opeal/BinaryIndi.pm,v 1.7 2001/11/27 13:22:58 jmerelo Exp $ $Author: jmerelo $ $Revision: 1.7 $ =cut