NAME

    OpBase - Base class for OPEAL operators; operators are any object with the "apply"
             method, which does things to individuals or populations.


SYNOPSIS

    my $op = new OpBase; #Creates empty op, with rate
    my $xmlStr=<<EOC;
    <op name='Mutation' type='unary' rate='2'>
      <param name='probability' value='0.5' />
    </op>
    EOC
    my $ref = XMLin($xmlStr);
    my $op = OpBase->fromXML( $ref ); #Takes a hash of parsed XML and turns it into an operator
    print $op->asXML(); #print its back in XML shape
    print $op->rate();  #application rate; relative number of times it must be applied
    print "Yes" if $op->check( 'BinaryIndi' ); #Prints Yes, it can be applied to BinaryIndi
    print $op->arity(); #Prints 1, number of operands it can be applied to


DESCRIPTION

Base class for operators applied to Individuals and Populations and all the rest

AUTOLOAD

Automatically define accesors for instance variables

new

Takes a hash with specific parameters for each subclass, creates the object, and leaves subclass-specific assignments to subclasses

fromXML

Takes a definition in the shape <op></op> and turns it into an object, if it knows how to do it. The definition must have been processed using XML::Simple.

It parses the common part of the operator, and leaves specific parameters for the subclass via the ``set'' method.

asXML

Prints as XML, following the EvoSpec 0.2 XML specification. Should be called from derived classes, not by itself.

rate

Gets or sets the rate of application of the operator

check

Check if the object the operator is applied to has the correct type

arity

Returns the arity, ie, the number of individuals it can be applied to

set

Default method; does not do anything; it is there to avoid errors


Known subclasses


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/02/14 08:51:17 $ 
  $Header: /cvsroot/opeal/opeal/OpBase.pm,v 1.13 2002/02/14 08:51:17 jmerelo Exp $ 
  $Author: jmerelo $ 
  $Revision: 1.13 $