Algorithm::Evolutionary::Fitness::String - Base class for string-based fitness functors
use base 'Algorithm::Evolutionary::Fitness::String'; #Mainly for deriving
my $evaluator = new My::Own::Fitness;
my $cache_hits = $evaluator->cached_evals();
Base class for fitness functions applied to string-based chromosomes; extracts common code, and saves time. Provides a hash called %cache to be used as a, well, cache for evaluations. Assumes it's using the _str instance variable of the chromosome
Initializes the cache
Applies the instantiated problem to a chromosome, delegating to a specific function
This one applies the function to the string. Should be overloaded
Returns the number of keys in the evaluation cache, which can be compared to the total number of evaluations to find the cache hit rate.
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
To install Algorithm::Evolutionary, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.