VectorIndi - Array as an individual for evolutionary computation
my $indi = new VectorIndi 10 ; # Build random vector individual with length 10 # Each element in the range 0 .. 1 my $indi2 = new VectorIndi 20, -5, 5; #Same, with range between -5 and 5
my $indi3 = new VectorIndi; $indi3->set( length => 20, rangestart => -5, rangeend => 5 ); #Sets values, but does not build the array
$indi3->randomize(); #Creates an array using above parameters
print $indi3->Atom( 7 ); #Returns the value of the 7th character $indi3->Atom( 3 ) = '2.35'; #Sets the value
$indi3->addAtom( 7.5 ); #Adds a new component to the array at the end
my $indi4 = VectorIndi->fromString( '3.5,4.5, 0.1, 3.2'); #Parses the comma-separated elements of the string and creates a VectorIndi from them
my $indi5 = $indi4->clone(); #Creates a copy of the individual
print $indi3->asString(); #Prints the individual print $indi3->asXML() #Prints it as XML. See L<XML> for more info on this
Array individual for a EA. Generally used for floating-point arrays
Creates a new random array individual, with fixed initial length, and uniform distribution of values within a range
Sets values of an individual; takes a hash as input
Assigns random values to the elements
Gets or sets the value of an atom
Adds an atom at the end
Returns the number of atoms in the individual
Similar to a copy ctor; creates a bitstring individual from a string composed of stuff separated by a separator
Similar to a copy ctor: creates a new individual from another one
Prints it
Prints it as XML. See the XML OPEAL manual for details.
Sets or gets the array that holds the chromosome. Not very nice, and I would never ever do this in C++
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/VectorIndi.pm,v 1.11 2002/04/23 12:33:47 jmerelo Exp $ $Author: jmerelo $ $Revision: 1.11 $