Algorithm-Evolutionary
view release on metacpan or search on metacpan
lib/Algorithm/Evolutionary/Op/Breeder.pm view on Meta::CPAN
push( @rates, $_->{'rate'});
}
my $opWheel = new Algorithm::Evolutionary::Wheel @rates;
my @new_population;
for ( my $i = 0; $i < $output_size; $i++ ) {
my @offspring;
my $selectedOp = $ops[ $opWheel->spin()];
for ( my $j = 0; $j < $selectedOp->arity(); $j ++ ) {
my $chosen = $genitors[ rand( @genitors )];
# print "Elegido ", $chosen->asString(), "\n";
push( @offspring, $chosen->clone() );
}
my $mutante = $selectedOp->apply( @offspring );
push( @new_population, $mutante );
}
return \@new_population;
}
=head1 SEE ALSO
lib/Algorithm/Evolutionary/Op/GeneralGeneration.pm view on Meta::CPAN
my $opWheel = new Algorithm::Evolutionary::Wheel @rates;
my @newpop;
my $pringaos = @$pop * $self->{'_replacementRate'} ;
for ( my $i = 0; $i < $pringaos; $i++ ) {
my @offspring;
my $selectedOp = $ops[ $opWheel->spin()];
# print $selectedOp->asXML;
for ( my $j = 0; $j < $selectedOp->arity(); $j ++ ) {
my $chosen = $genitors[ rand( @genitors )];
# print "Elegido ", $chosen->asString(), "\n";
push( @offspring, $chosen->clone() );
}
my $mutante = $selectedOp->apply( @offspring );
push( @newpop, $mutante );
}
#Eliminate and substitute
splice( @$pop, -$pringaos );
for ( @newpop ) {
$_->evaluate( $eval );
lib/Algorithm/Evolutionary/Op/Generation_Skeleton.pm view on Meta::CPAN
my $opWheel = new Algorithm::Evolutionary::Wheel @rates;
my @newpop;
my $pringaos = @$pop * $self->{'_replacementRate'} ;
for ( my $i = 0; $i < $pringaos; $i++ ) {
my @offspring;
my $selectedOp = $ops[ $opWheel->spin()];
# print $selectedOp->asXML;
for ( my $j = 0; $j < $selectedOp->arity(); $j ++ ) {
my $chosen = $genitors[ rand( @genitors )];
# print "Elegido ", $chosen->asString(), "\n";
push( @offspring, $chosen->clone() );
}
my $mutante = $selectedOp->apply( @offspring );
push( @newpop, $mutante );
}
my $eval = $self->{'_eval'};
map( $_->evaluate( $eval), @newpop );
#Eliminate and substitute
( run in 1.330 second using v1.01-cache-2.11-cpan-5735350b133 )