File Coverage

lib/Algorithm/Evolutionary/Op/Selector.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1 1     1   6 use strict; #-*-cperl-*-
  1         1  
  1         30  
2 1     1   5 use warnings;
  1         1  
  1         33  
3              
4             =head1 NAME
5              
6             Algorithm::Evolutionary::Op::Selector - Abstract base class for population selectors
7              
8             =head1 SYNOPSIS
9              
10             package My::Selector;
11             use base ' Algorithm::Evolutionary::Op::Selector';
12              
13             =head1 Base Class
14              
15             L
16              
17             =head1 DESCRIPTION
18              
19             Abstract base class for population selectors; defines a few instance
20             variables and interface elements
21              
22             =head1 METHODS
23              
24             =cut
25              
26             package Algorithm::Evolutionary::Op::Selector;
27 1     1   5 use Carp;
  1         1  
  1         93  
28              
29             our ($VERSION) = ( '$Revision: 3.0 $ ' =~ / (\d+\.\d+)/ ) ;
30              
31 1     1   4 use base 'Algorithm::Evolutionary::Op::Base';
  1         2  
  1         156  
32              
33             =head2 new( $output_population_size )
34              
35             Creates a new selector which outputs a fixed amount of
36             individuals. This goes to the base class, since all selectors must
37             know in advance how many they need to generate
38              
39             =cut
40              
41             sub new {
42             my $class = shift;
43             carp "Should be called from subclasses" if ( $class eq __PACKAGE__ );
44             my $self = {};
45             $self->{_outputSize} = shift || croak "I need an output population size";
46             bless $self, $class;
47             return $self;
48             }
49              
50             =head2 apply
51              
52             Applies the tournament selection to a population, returning another of
53             the set size. This is an abstract method that should be implemented by
54             descendants.
55              
56             =cut
57              
58             sub apply (@) {
59             croak "To be redefined by siblings";
60             }
61              
62             =head1 Known descendants
63              
64              
65             =over 4
66              
67             =item *
68              
69             L
70              
71             =item *
72              
73             L
74              
75             =back
76              
77             =head1 Copyright
78            
79             This file is released under the GPL. See the LICENSE file included in this distribution,
80             or go to http://www.fsf.org/licenses/gpl.txt
81              
82             CVS Info: $Date: 2009/07/24 08:46:59 $
83             $Header: /cvsroot/opeal/Algorithm-Evolutionary/lib/Algorithm/Evolutionary/Op/Selector.pm,v 3.0 2009/07/24 08:46:59 jmerelo Exp $
84             $Author: jmerelo $
85              
86             =cut
87              
88             "C'mon Eileen";