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


Manual Reference Pages  -  ALGORITHM::EVOLUTIONARY::INDIVIDUAL::BIT_VECTOR (3)

.ds Aq ’

NAME



    Algorithm::Evolutionary::Individual::Bit_Vector - Classic bitstring individual for evolutionary computation;
                 usually called chromosome, and using a different implementation from Algorithm::Evolutionary::Individual::BitString



CONTENTS

SYNOPSIS



    use Algorithm::Evolutionary::Individual::BitVector;

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

    my $indi3 = new Algorithm::Evolutionary::Individual::Bit_Vector;
    $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 $indi4 = Algorithm::Evolutionary::Individual::Bit_Vector->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::Bit_Vector, @array;
    print tied( @vector )->asXML();

    print $indi3->asString(); #Prints the individual
    print $indi3->asXML() #Prints it as XML. See L<Algorithm::Evolutionary::XML>
    print $indi3->as_yaml() #Change of convention, I know...



Base Class

Algorithm::Evolutionary::Individual::String

DESCRIPTION

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

METHODS

new( CW$arg )

Creates a new bitstring individual. $arg can be either { length =>
$length} or { string => [binary string] }. With no argument, a
length of 16 is given by default.

    Atom

Sets or gets the value of the n-th character in the string. Counting starts at 0, as usual in Perl arrays.

size()

Returns size in bits

clone()

Clones using native methods. Does not work with general Clone::Fast, since it’s implemented as an XS

as_string()

Overrides the default; prints the binary chromosome

Chrom()

Returns the internal bit_vector

    TIE methods

String implements FETCH, STORE, PUSH and the rest, so an String can be tied to an array and used as such.

    Copyright



  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: 2010/12/19 21:39:12 $
  $Header: /media/Backup/Repos/opeal/opeal/Algorithm-Evolutionary/lib/Algorithm/Evolutionary/Individual/Bit_Vector.pm,v 3.1 2010/12/19 21:39:12 jmerelo Exp $
  $Author: jmerelo $
  $Revision: 3.1 $
  $Name $



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


perl v5.20.3 ALGORITHM::EVOLUTIONARY::INDIVIDUAL::BIT_VECTOR (3) 2014-10-25

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