Algorithm::Evolutionary::Fitness::Trap - 'Trap' fitness function for evolutionary algorithms
my $number_of_bits = 5;
my $a = $number_of_bits -1; # Usual default values follow
my $b = $number_of_bits;
my $z = $number_of_bits -1;
my $trap = Algorithm::Evolutionary::Fitness::Trap->new( $number_of_bits, $a, $b, $z );
Trap function act as "yucky" or deceptive for evolutionary algorithms; they "trap" population into going to easier, but local, optima.
Creates a new instance of the problem, with the said number of bits and traps. Uses default values from $number_of_bits if needed
Applies the instantiated problem to a chromosome
Computes the value of the trap function on the $string. Optimum is number_of_blocs * $b (by default, $b = $l or number of ones)
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::Fitness, 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.