view release on metacpan or search on metacpan
lib/Algorithm/Evolutionary/Experiment.pm view on Meta::CPAN
use strict; #-*-CPerl-*- -*- hi-lock -*-
use warnings;
use lib qw( ../../../lib );
=head1 NAME
Algorithm::Evolutionary::Experiment - Class for setting up an
experiment with algorithms and population
=head1 SYNOPSIS
use Algorithm::Evolutionary::Experiment;
my $popSize = 20;
lib/Algorithm/Evolutionary/Fitness/Any.pm view on Meta::CPAN
use strict; #-*-cperl-*-
use warnings;
use lib qw( ../../../../lib );
=encoding utf8
=head1 NAME
Algorithm::Evolutionary::Fitness::Any - Façade for any function so that it can be used as fitness
=head1 SYNOPSIS
use Algorithm::Evolutionary::Utils qw( string_decode )
lib/Algorithm/Evolutionary/Fitness/Base.pm view on Meta::CPAN
use strict; #-*-cperl-*-
use warnings;
use lib qw( ../../../../lib );
=head1 NAME
Algorithm::Evolutionary::Fitness::Base - Base class for fitness functions
=head1 SYNOPSIS
Shouldn't be used directly, it's an abstract class whose siblings are
used to implement fitness functions.
lib/Algorithm/Evolutionary/Fitness/ECC.pm view on Meta::CPAN
use strict; # -*- cperl -*-
use warnings;
use lib qw( ../../../../lib );
=head1 NAME
Algorithm::Evolutionary::Fitness::ECC - Error Correcting codes problem generator
=head1 SYNOPSIS
my $number_of_codewords = 10;
my $min_distance = 1;
my $p_peaks = Algorithm::Evolutionary::Fitness::ECC->new( $number_of_codewords, $min_distance );
lib/Algorithm/Evolutionary/Fitness/ECC.pm view on Meta::CPAN
=head1 METHODS
=cut
package Algorithm::Evolutionary::Fitness::ECC;
our ($VERSION) = ( '$Revision: 3.2 $ ' =~ / (\d+\.\d+)/ ) ;
use Carp qw(croak);
use lib qw(../../.. ../.. ..);
use base qw(Algorithm::Evolutionary::Fitness::String);
use Algorithm::Evolutionary::Utils qw(hamming);
=head2 new
Creates a new instance of the problem, with the said number of bits and peaks
=cut
lib/Algorithm/Evolutionary/Fitness/Knapsack.pm view on Meta::CPAN
use strict; # -*- cperl -*-
use warnings;
use lib qw( ../../../../lib );
=head1 NAME
Algorithm::Evolutionary::Fitness::Knapsack - Fitness function for the knapsack problem
=head1 SYNOPSIS
my $n_max=100; #Max. number of elements to choose
my $capacity=286; #Max. Capacity of the knapsack
my $rho=5.0625; #Penalty coeficient
lib/Algorithm/Evolutionary/Fitness/MMDP.pm view on Meta::CPAN
use strict;
use warnings;
use lib qw( ../../../../lib );
=head1 NAME
Algorithm::Evolutionary::Fitness::MMDP - Massively Multimodal Deceptive Problem
=head1 SYNOPSIS
use Algorithm::Evolutionary::Fitness::MMDP;
my @chromosome = "010101101010111111000000"
lib/Algorithm/Evolutionary/Fitness/ONEMAX.pm view on Meta::CPAN
use strict; # -*- cperl -*-
use warnings;
use lib qw( ../../../../lib );
=head1 NAME
Algorithm::Evolutionary::Fitness::ONEMAX - Fitness function for the ONEMAX or count-ones problem
=head1 SYNOPSIS
my $onemax = new Algorithm::Evolutionary::Fitness::Knapsack;
my $string = "1010101010101010";
print $onemax->apply($string);
lib/Algorithm/Evolutionary/Fitness/P_Peaks.pm view on Meta::CPAN
use strict; # -*- cperl -*-
use warnings;
use lib qw( ../../../../lib );
=head1 NAME
Algorithm::Evolutionary::Fitness::P_Peaks - P Peaks problem generator
=head1 SYNOPSIS
my $number_of_peaks = 100;
my $number_of_bits = 32;
my $p_peaks = Algorithm::Evolutionary::Fitness::P_Peaks->new( $number_of_peaks, $number_of_bits );
lib/Algorithm/Evolutionary/Fitness/P_Peaks.pm view on Meta::CPAN
=cut
package Algorithm::Evolutionary::Fitness::P_Peaks;
our $VERSION = '3.4';
use String::Random;
use Carp;
use lib qw(../../.. ../.. ..);
use base qw(Algorithm::Evolutionary::Fitness::String);
use Algorithm::Evolutionary::Utils qw(hamming);
=head2 new( $peaks, $bits )
Creates a new instance of the problem, with the said number of bits
and peaks.
=cut
lib/Algorithm/Evolutionary/Fitness/Rastrigin.pm view on Meta::CPAN
use strict; # -*- cperl -*-
use warnings;
use lib qw( ../../../../lib );
=head1 NAME
Algorithm::Evolutionary::Fitness::Rastrigin - Implementation of Rastrigin's function
=head1 SYNOPSIS
my $n_dimensions=2; #Max. number of elements to choose
my $rastrigin = Algorithm::Evolutionary::Fitness::Rastrigin->new( $n_dimensions );
lib/Algorithm/Evolutionary/Fitness/Royal_Road.pm view on Meta::CPAN
use strict;
use warnings;
use lib qw( ../../../../lib );
=head1 NAME
Algorithm::Evolutionary::Fitness::Royal_Road - Mitchell's Royal Road function
=head1 SYNOPSIS
my $block_size = 4;
my $rr = Algorithm::Evolutionary::Fitness::Royal_Road->new( $block_size );
lib/Algorithm/Evolutionary/Fitness/String.pm view on Meta::CPAN
use strict; # -*- cperl -*-
use warnings;
use lib qw( ../../../../lib );
=head1 NAME
Algorithm::Evolutionary::Fitness::String - Base class for string-based fitness functors
=head1 SYNOPSIS
package My::Own::Fitness;
use base 'Algorithm::Evolutionary::Fitness::String'; #Mainly for deriving
lib/Algorithm/Evolutionary/Fitness/Trap.pm view on Meta::CPAN
package Algorithm::Evolutionary::Fitness::Trap; # -*- cperl -*-
use strict;
use warnings;
use Carp qw(croak);
our $VERSION = '3.2';
use lib qw(../../.. ../.. .. ../../../../lib);
use base qw(Algorithm::Evolutionary::Fitness::String);
=head1 NAME
Algorithm::Evolutionary::Fitness::Trap - 'Trap' fitness function for evolutionary algorithms
=head1 SYNOPSIS
lib/Algorithm/Evolutionary/Fitness/ZDT1.pm view on Meta::CPAN
use strict; # -*- cperl -*-
use warnings;
use lib qw( ../../../../lib );
=head1 NAME
Algorithm::Evolutionary::Fitness::ZDT1 - Zitzler-Deb-Thiele #1 Multiobjective test function
=head1 SYNOPSIS
my $number_of_bits = 5;
my $z = Algorithm::Evolutionary::Fitness::ZDT1->new( $number_of_bits);
my $string = "10101"x30;
lib/Algorithm/Evolutionary/Fitness/ZDT1.pm view on Meta::CPAN
=head1 METHODS
=cut
package Algorithm::Evolutionary::Fitness::ZDT1;
our $VERSION = sprintf "%d.%03d", q$Revision: 3.1 $ =~ /(\d+)\.(\d+)/g;
use Carp qw(croak);
use lib qw(../../.. ../.. ..);
use base qw(Algorithm::Evolutionary::Fitness::String);
use Algorithm::Evolutionary::Utils qw(decode_string);
use constant { M => 30,
NINE => 9 };
=head2 new
Creates a new instance of the problem, with the said number of bits and peaks
lib/Algorithm/Evolutionary/Fitness/wP_Peaks.pm view on Meta::CPAN
use strict;
use warnings;
use lib qw( ../../../../lib );
=head1 NAME
Algorithm::Evolutionary::Fitness::wP_Peaks - wP Peaks problem generator - weighted version of P_Peaks
=head1 SYNOPSIS
my $number_of_bits = 32;
my @weights = (1);
for (my $i = 0; $i < 99; $i ++ ) {
lib/Algorithm/Evolutionary/Individual/Base.pm view on Meta::CPAN
use strict; #-*-cperl,hi-lock,auto-fill-*-
use warnings;
use lib qw( ../../../../lib );
=head1 NAME
Algorithm::Evolutionary::Individual::Base - Base class for chromosomes that knows how to build them, and has some helper methods.
=head1 SYNOPSIS
use Algorithm::Evolutionary::Individual::Base;
my $indi = Algorithm::Evolutionary::Individual::Base->fromParam( $param_hashref ); #From parametric description
lib/Algorithm/Evolutionary/Individual/Bit_Vector.pm view on Meta::CPAN
use strict; #-*-cperl-*-
use warnings;
use lib qw(../../../../lib);
=head1 NAME
Algorithm::Evolutionary::Individual::Bit_Vector - Classic bitstring individual for evolutionary computation;
usually called chromosome, and using a different implementation from Algorithm::Evolutionary::Individual::BitString
=head1 SYNOPSIS
use Algorithm::Evolutionary::Individual::BitVector;
lib/Algorithm/Evolutionary/Individual/String.pm view on Meta::CPAN
use strict;
use warnings;
use lib qw(../../../lib);
=encoding utf8
=head1 NAME
Algorithm::Evolutionary::Individual::String - A character string to be evolved. Useful mainly in word games
=head1 SYNOPSIS
use Algorithm::Evolutionary::Individual::String;
lib/Algorithm/Evolutionary/Op/Animated_GIF_Output.pm view on Meta::CPAN
package Algorithm::Evolutionary::Op::Animated_GIF_Output;
use lib qw( ../../../../lib
../../../lib
../../../../../../Algorithm-Evolutionary/lib ../Algorithm-Evolutionary/lib ); #For development and perl syntax mode
use warnings;
use strict;
use Carp;
our $VERSION = sprintf "%d.%03d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/g;
use base 'Algorithm::Evolutionary::Op::Base';
lib/Algorithm/Evolutionary/Op/ArithCrossover.pm view on Meta::CPAN
use strict;
use warnings;
use lib qw(../../..);
=head1 NAME
Algorithm::Evolutionary::Op::ArithCrossover - Arithmetic crossover operator; performs the average of the n parents crossed
=head1 SYNOPSIS
my $xmlStr6=<<EOC; #Create it from XML
<op name='ArithCrossover' type='binary' rate='1' />
lib/Algorithm/Evolutionary/Op/Base.pm view on Meta::CPAN
all the rest. An operator is any object with the "apply" method,
which does things to individuals or populations. It is intendedly
quite general so that any genetic or population operator can fit in.
=head1 METHODS
=cut
package Algorithm::Evolutionary::Op::Base;
use lib qw( ../.. ../../.. );
use Memoize;
memoize('arity'); #To speed up this frequent computation
use B::Deparse; #For serializing code
use Algorithm::Evolutionary::Utils qw(parse_xml);
use Carp;
our ($VERSION) = ( '$Revision: 3.3 $ ' =~ / (\d+\.\d+)/ ) ;
our %parameters;
lib/Algorithm/Evolutionary/Op/Bitflip.pm view on Meta::CPAN
use strict; #-*-cperl-*-
use warnings;
use lib qw( ../../lib ../../../lib ../../../../lib);
=head1 NAME
Algorithm::Evolutionary::Op::Bitflip - Bit-flip mutation
=head1 SYNOPSIS
my $op = new Algorithm::Evolutionary::Op::Bitflip 2; #Create from scratch with default rate
=head1 Base Class
lib/Algorithm/Evolutionary/Op/Breeder.pm view on Meta::CPAN
=head1 DESCRIPTION
Breeder part of the evolutionary algorithm; takes a population and returns another created from the first
=head1 METHODS
=cut
package Algorithm::Evolutionary::Op::Breeder;
use lib qw(../../..);
our $VERSION = '1.4';
use Carp;
use base 'Algorithm::Evolutionary::Op::Base';
use Algorithm::Evolutionary qw(Wheel
Op::Tournament_Selection);
lib/Algorithm/Evolutionary/Op/Breeder_Diverser.pm view on Meta::CPAN
in the pool. In that sense it "diverses", tries to diversify the
population. In general, it works better in environments where high
diversity is needed (like, for instance, in L<Algorithm::MasterMind>.
=head1 METHODS
=cut
package Algorithm::Evolutionary::Op::Breeder_Diverser;
use lib qw(../../..);
our ($VERSION) = ( '$Revision: 1.7 $ ' =~ / (\d+\.\d+)/ ) ;
use Carp;
use base 'Algorithm::Evolutionary::Op::Base';
use Algorithm::Evolutionary qw(Wheel
Op::Tournament_Selection);
lib/Algorithm/Evolutionary/Op/CX.pm view on Meta::CPAN
use strict;
use warnings;
use lib qw( ../../../../lib ); # mainly to avoid syntax errors when saving
=head1 NAME
Algorithm::Evolutionary::Op::CX (Cycle crossover) - 2-point crossover operator; Builds offspring in such a way
that each gene comes from one of the parents. Preserves the absolute position of the elements
in the parent sequence
=head1 SYNOPSIS
my $op4 = new Algorithm::Evolutionary::Op::CX 3;
lib/Algorithm/Evolutionary/Op/CanonicalGA.pm view on Meta::CPAN
The first operator should be unary (a la mutation) and the second
binary (a la crossover) they will be applied in turn to couples of the
population.
=head1 METHODS
=cut
package Algorithm::Evolutionary::Op::CanonicalGA;
use lib qw(../../..);
our $VERSION = '3.6';
use Carp;
use Algorithm::Evolutionary qw(Wheel
Op::Bitflip
Op::QuadXOver );
use base 'Algorithm::Evolutionary::Op::Easy';
lib/Algorithm/Evolutionary/Op/Canonical_GA_NN.pm view on Meta::CPAN
This is a fast version of the canonical GA, useful for large
populations, since it avoids the expensive rank operation. Roulette
wheel selection, still, is kind of slow.
=head1 METHODS
=cut
package Algorithm::Evolutionary::Op::Canonical_GA_NN;
use lib qw(../../..);
our $VERSION = "3.6";
use Carp;
use Algorithm::Evolutionary qw(Wheel
Op::Bitflip
Op::QuadXOver );
use base 'Algorithm::Evolutionary::Op::Easy';
lib/Algorithm/Evolutionary/Op/Combined.pm view on Meta::CPAN
"mutation" and a single "crossover" operator. If you want to combine
several (like above, mutation and permutation), each one with its own
rate, you have to give them a façade like this one.
=head1 METHODS
=cut
package Algorithm::Evolutionary::Op::Combined;
use lib qw(../../..);
our $VERSION = '1.2';
use Algorithm::Evolutionary::Wheel;
use Carp;
use base 'Algorithm::Evolutionary::Op::Base';
#Class-wide constants
our $APPLIESTO = 'Algorithm::Evolutionary::Individual::String';
lib/Algorithm/Evolutionary/Op/Creator.pm view on Meta::CPAN
=head1 DESCRIPTION
Base class for operators applied to Individuals and Populations and all the rest
=head1 METHODS
=cut
package Algorithm::Evolutionary::Op::Creator;
use lib qw( ../.. ../../.. );
use base 'Algorithm::Evolutionary::Individual::Base';
use Carp;
our ($VERSION) = ( '$Revision: 3.1 $ ' =~ / (\d+\.\d+)/ ) ;
=head2 new( $number_of_individuals, $class_to_generate, $options_hash )
Takes a hash with specific parameters for each subclass, creates the
lib/Algorithm/Evolutionary/Op/Crossover.pm view on Meta::CPAN
(L<Algorithm::Evolutionary::Individual::BitString|Individual::BitString>). Crossover
for L<Algorithm::Evolutionary::Individual::Vector|Individual::Vector>
would be L<Algorithm::Evolutionary::Op::VectorCrossover|Op::VectorCrossover>
=head1 METHODS
=cut
package Algorithm::Evolutionary::Op::Crossover;
use lib qw(../../..);
our $VERSION = sprintf "%d.%03d", q$Revision: 3.2 $ =~ /(\d+)\.(\d+)/g; # Hack for avoiding version mismatch
use Clone qw(clone);
use Carp;
use base 'Algorithm::Evolutionary::Op::Base';
#Class-wide constants
our $APPLIESTO = 'Algorithm::Evolutionary::Individual::String';
lib/Algorithm/Evolutionary/Op/EDA_step.pm view on Meta::CPAN
Estimation of Distribution Algorithms shun operators and instead try
to model the distribution of "good" solutions in the population. This
version corresponds to the most basic one.
=head1 METHODS
=cut
package Algorithm::Evolutionary::Op::EDA_step;
use lib qw(../../..);
our ($VERSION) = ( '$Revision: 1.5 $ ' =~ / (\d+\.\d+)/ ) ;
use Carp;
use base 'Algorithm::Evolutionary::Op::Base';
use Algorithm::Evolutionary qw(Hash_Wheel Individual::String);
# Class-wide constants