The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

    Algorithm::Evolutionary::Op::CanonicalGA - Canonical Genetic Algorithm, with any representation
                 

SYNOPSIS

  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] );

Base Class

Algorithm::Evolutionary::Op::Base

DESCRIPTION

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.

METHODS

new

Creates an algorithm, with the usual operators. Includes a default mutation and crossover, in case they are not passed as parameters

apply

Applies 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.

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: 2005/11/14 12:55:07 $ 
  $Header: /cvsroot/opeal/opeal/Algorithm/Evolutionary/Op/CanonicalGA.pm,v 1.1 2005/11/14 12:55:07 jmerelo Exp $ 
  $Author: jmerelo $ 
  $Revision: 1.1 $
  $Name $