J. J. Merelo-Guervós > Algorithm-Evolutionary-0.78_2 > Algorithm::Evolutionary::Fitness::Any

Download:
Algorithm-Evolutionary-0.78_2.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 3.001   Source   Latest Release: Algorithm-Evolutionary-0.79_2

NAME ^

Algorithm::Evolutionary::Fitness::Any - Façade for any function to look like fitness

SYNOPSIS ^

   use Algorithm::Evolutionary::Utils qw( string_decode )

   sub squares {
     my $chrom = shift;
     my @values = string_decode( $chrom, 10, -1, 1 );
     return $values[0] * $values[1];
   }

   my $any_eval = new Algorithm::Evolutionary::Fitness::Any \&squares;

DESCRIPTION ^

Turns any subroutine or closure into a fitness function. Useful mainly if you want results cached; it's not really needed otherwise.

METHODS ^

new( $function )

Assigns default variables

apply( $individual )

Applies the instantiated problem to a chromosome. Actually it is a wrapper around _apply

_apply( $individual )

This is the one that really does the stuff. It applies the defined function to each individual

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: 2009/07/24 10:25:49 $ 
  $Header: /cvsroot/opeal/Algorithm-Evolutionary/lib/Algorithm/Evolutionary/Fitness/Any.pm,v 3.1 2009/07/24 10:25:49 jmerelo Exp $ 
  $Author: jmerelo $ 
  $Revision: 3.1 $
syntax highlighting: