Base Class

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

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

Prints it

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.