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::STRING (3)

.ds Aq ’

NAME



    Algorithm::Evolutionary::Individual::String - A character string to be evolved. Useful mainly in word games



CONTENTS

SYNOPSIS



    use Algorithm::Evolutionary::Individual::String;

    my $indi = new Algorithm::Evolutionary::Individual::String [a..z], 10;
                                   # Build random bitstring with length 10

    my $indi3 = new Algorithm::Evolutionary::Individual::String;
    $indi3->set( { length => 20,
                   chars => [A..Z] } );   #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, Q );       #Sets the value

    $indi3->addAtom( K ); #Adds a new character to the bitstring at the end

    my $indi4 = Algorithm::Evolutionary::Individual::String->fromString( esto es un string);   #Creates an individual from that string

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

    my @array = qw( a x q W z n\k:~); #Tie a String individual
    tie my @vector, Algorithm::Evolutionary::Individual::String, @array;
   
    print $indi3->as_string(); #Prints the individual



Base Class

Algorithm::Evolutionary::Individual::Base

DESCRIPTION

String Individual for a evolutionary algorithm. Contains methods to handle strings easily. It is also TIEd so that strings can be handled as arrays.

METHODS

    MY_OPERATORS

Known operators that act on this subroutine. Probably will be deprecated, so don’t rely on it

    new

Creates a new random string, with fixed initial length, and uniform distribution of characters along the character class that is defined. However, this character class is just used to generate new individuals and in mutation operators, and the validity is not enforced unless the client class does it

    randomize

Assigns random values to the elements

    addAtom

Adds an atom at the end

    fromString

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

    from_string

Similar to a copy ctor; creates a bitstring individual from a string.

    clone

Similar to a copy ctor: creates a new individual from another one

    asString

Returns the individual as a string with the fitness as a suffix.

    Atom

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

    TIE methods

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

size()

Returns length of the string that stores the info; overloads abstract base method.

as_string()



    Returns the string used as internal representation



    Chrom

Sets or gets the variable that holds the chromosome. Not very nice, and I would never ever do this in C++

Known subclasses

o Algorithm::Evolutionary::Individual::BitString

    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



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


perl v5.20.3 ALGORITHM::EVOLUTIONARY::INDIVIDUAL::STRING (3) 2014-10-31

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