GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Algorithm::Evolutionary::Individual::BitString(3) User Contributed Perl Documentation Algorithm::Evolutionary::Individual::BitString(3)

Algorithm::Evolutionary::Individual::BitString - Classic bitstring individual for evolutionary computation; usually called chromosome

    use Algorithm::Evolutionary::Individual::BitString;

    my $indi = new Algorithm::Evolutionary::Individual::BitString 10 ; # Build random bitstring with length 10
                                   # Each element in the range 0 .. 1

    my $indi3 = new Algorithm::Evolutionary::Individual::BitString;
    $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 ) = 1;       #Sets the value

    $indi3->addAtom( 1 ); #Adds a new character to the bitstring at the end
    my $size = $indi3->size(); #Common interface to all individuals, should return 21

    my $indi4 = Algorithm::Evolutionary::Individual::BitString->fromString( '10110101');   #Creates an individual from that string

    my $indi5 = $indi4->clone(); #Creates a copy of the individual

    my @array = qw( 0 1 0 1 0 0 1 ); #Create a tied array
    tie my @vector, 'Algorithm::Evolutionary::Individual::BitString', @array;

    print $indi3->asString(); #Prints the individual
    print $indi3->as_yaml() #Change of convention, I know...

    my $gene_size = 5;
    my $min = -1;
    my $range = 2;
    my @decoded_vector = $indi3->decode( $gene_size, $min, $range);

Algorithm::Evolutionary::Individual::String

Bitstring Individual for a Genetic Algorithm. Used, for instance, in a canonical GA

Creates a new random bitstring individual, with fixed initial length, and uniform distribution of bits. Options as in Algorithm::Evolutionary::Individual::String

Similar to a copy ctor; creates a bitstring individual from a string. Will be deprecated soon

Sets values of an individual; takes a hash as input. Keys are prepended an underscore and turn into instance variables

Decodes to a vector, each one of whose components ranges between $min and $max. Returns that vector
  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
2021-03-29 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.