NAME

     Tree - Array as an individual for evolutionary computation


SYNOPSIS

    use Algorithm::Evolutionary::Individual::Tree;
    #Hash with primitives, arity, and range for constants that multiply it
    my $primitives = { sum => [2, -1, 1],
                                   multiply => [2, -1, 1],
                                   substract => [2, -1, 1],
                                   divide => [2, -1, 1],
                                   x => [0, -10, 10],
                                   y => [0, -10, 10] };
    my $indi = new Algorithm::Evolutionary::Individual::Tree $primitives, 5 ; # Build random tree with knwo primitives
                                           # and depth up to 5
    my $indi5 = $indi->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


Base Class

Algorithm::Evolutionary::Individual::Tree


DESCRIPTION

Array individual for a genetic programming. Uses Direct Acyclic graphs as representation for trees, which is very convenient.


METHODS

new

Creates a new tree

set

Sets values of an individual; takes a hash as input

randomize

Assigns random values to the elements

fromString

Similar to a copy ctor; creates a bitstring individual from a string composed of stuff separated by a separator

clone

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

asString

Prints it

asXML

Prints it as XML. It prints the tree as String, which does not mean you will be able to get it back from this form. It's done just for compatibity, reading from this format will be available. In the future.

lolprint

Print the list of lists that composes the tree, using prefix notation

growSubTree

Grows a random tree, with primitives as indicated, and a certain depth. Depth defaults to 4


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: 2002/06/19 12:36:57 $ 
  $Header: /cvsroot/opeal/opeal/Algorithm/Evolutionary/Individual/Tree.pm,v 1.4 2002/06/19 12:36:57 jmerelo Exp $ 
  $Author: jmerelo $ 
  $Revision: 1.4 $
  $Name $