Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Algorithm::EvolutionarUserpContributed)Algorithm::Evolutionary::Op::Breeder(3)

NAME
       Algorithm::Evolutionary::Op::Breeder - Even more	customizable single
       generation for an evolutionary algorithm.

SYNOPSIS
	   use Algorithm::Evolutionary qw( Individual::BitString
	   Op::Mutation	Op::Crossover
	   Op::RouletteWheel
	   Op::Breeder);

	   use Algorithm::Evolutionary::Utils qw(average);

	   my @pop;
	   my $number_of_bits =	20;
	   my $population_size = 20;
	   my $replacement_rate	= 0.5;
	   for ( 1..$population_size ) {
	     my	$indi =	new Algorithm::Evolutionary::Individual::BitString $number_of_bits ; #Creates random individual
	     $indi->evaluate( $onemax );
	     push( @pop, $indi );
	   }

	   my $m =  new	Algorithm::Evolutionary::Op::Mutation 0.5;
	   my $c = new Algorithm::Evolutionary::Op::Crossover; #Classical 2-point crossover

	   my $selector	= new Algorithm::Evolutionary::Op::RouletteWheel $population_size; #One	of the possible	selectors

	   my $generation =
	     new Algorithm::Evolutionary::Op::Breeder( $selector, [$m, $c] );

	   my @sortPop = sort {	$b->Fitness() <=> $a->Fitness()	} @pop;
	   my $bestIndi	= $sortPop[0];
	   my $previous_average	= average( \@sortPop );
	   $generation->apply( \@sortPop );

Base Class
       Algorithm::Evolutionary::Op::Base

DESCRIPTION
       Breeder part of the evolutionary	algorithm; takes a population and
       returns another created from the	first

METHODS
   new(	$ref_to_operator_array[, $selector = new
       Algorithm::Evolutionary::Op::Tournament_Selection 2 ] )
       Creates a breeder, with a selector and array of operators

   apply( $population[,	$how_many || $population_size] )
       Applies the algorithm to	the population,	which should have been
       evaluated first;	checks that it receives	a ref-to-array as input,
       croaks if it does not.

       Returns a sorted, culled, evaluated population for next generation.

SEE ALSO
       More or less in the same	ballpark, alternatives to this one

       o   Algorithm::Evolutionary::Op::GeneralGeneration

       o   Algorithm::Evolutionary::Op::Breeder_Diverser

       o   Algorithm::Evolutionary::Op::Generation_Skeleton does have a
	   incompatible	interface

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

perl v5.32.1			  2014-Algorithm::Evolutionary::Op::Breeder(3)

NAME | SYNOPSIS | Base Class | DESCRIPTION | METHODS | SEE ALSO | Copyright

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Algorithm::Evolutionary::Op::Breeder&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help