« lib/Algorithm/Evolutionary/Op/Permutation.pm
↑ Summary
lib/Algorithm/Evolutionary/Op/QuadXOver.pm »
| 1 | package Algorithm::Evolutionary::Op::Population_Output; | ||
| 2 | |||
| 3 | 1 | ▶ | use lib qw( ../../../../../../Algorithm-Evolutionary/lib ../Algorithm-Evolutionary/lib ); #For development and perl syntax mode |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | our $VERSION = sprintf "%d.%03d", q$Revision: 3.1 $ =~ /(\d+)\.(\d+)/g; | ||
| 10 | |||
| 11 | 1 | ▶ | use base 'Algorithm::Evolutionary::Op::Base'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | sub new { | ||
| 14 | my $class = shift; | ||
| 15 | my $hash = { printer => shift || | ||
| 16 | sub { my $member = shift; | ||
| 17 | print $member->as_string, "\n"; } | ||
| 18 | }; | ||
| 19 | my $self = Algorithm::Evolutionary::Op::Base::new( __PACKAGE__, 1, $hash ); | ||
| 20 | return $self; | ||
| 21 | } | ||
| 22 | |||
| 23 | sub apply { | ||
| 24 | my $self = shift; | ||
| 25 | my $population_hashref=shift; | ||
| 26 | for my $p (@$population_hashref) { | ||
| 27 | $self->{'_printer'}->($p); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | "No man is an island" ; # Magic true value required at end of module | ||
| 32 | __END__ | ||