29 Mar 2021 11:30:17 UTC
- Distribution: Algorithm-Evolutionary
- Module version: 3.6
- Source (raw)
- Browse (raw)
- How to Contribute
- Repository (git clone)
- Issues (0)
- Testers (64 / 0 / 0)
- KwaliteeBus factor: 1
- License: open_source
- Activity24 month
- Download (97.19KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:1 non-PAUSE userJMERELO J. J. Merelo-Guervósand 1 contributors
- JJ Merelo <jj /at/ merelo.net>
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- Base Class
- SEE ALSO
Algorithm::Evolutionary::Op::CanonicalGA - Canonical Genetic Algorithm, with any representation
# Straightforward instance, with all defaults (except for fitness function) my $algo = new Algorithm::Evolutionary::Op::CanonicalGA( $eval ); #Define an easy single-generation algorithm with predefined mutation and crossover my $m = new Algorithm::Evolutionary::Op::Bitflip; #Changes a single bit my $c = new Algorithm::Evolutionary::Op::QuadXOver; #Classical 2-point crossover my $generation = new Algorithm::Evolutionary::Op::CanonicalGA( $rr, 0.2, [$m, $c] );
The canonical classical genetic algorithm evolves a population of bitstrings until they reach the optimum fitness. It performs mutation on the bitstrings by flipping a single bit, crossover interchanges a part of the two parents.
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.
Creates an algorithm, with the usual operators. Includes a default mutation and crossover, in case they are not passed as parameters. The first element in the array ref should be an unary, and the second a binary operator.
Applies a single generation of the algorithm to the population; checks that it receives a ref-to-array as input, croaks if it does not. Returns a sorted, culled, evaluated population for next generation.
Probably you will also be able to find a canonical-genetic-algorithm.pl example within this bundle. Check it out for usage examples
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
Module Install Instructions
To install Algorithm::Evolutionary, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Algorithm::Evolutionary
For more information on module installation, please visit the detailed CPAN module installation guide.