lib/Algorithm/Evolutionary/Op/Selector.pm

filter: Statementstmt 100% 12 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 16 / 16 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Algorithm/Evolutionary/Op/RouletteWheel.pm ↑ Summary lib/Algorithm/Evolutionary/Op/String_Mutation.pm »
1 1 ▶use strict; #-*-cperl-*-
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
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<Algorithm::Evolutionary::Op::Base|Algorithm::Evolutionary::Op::Base>
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 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 our ($VERSION) = ( '$Revision: 3.0 $ ' =~ / (\d+\.\d+)/ ) ;
30  
31 1 ▶use base 'Algorithm::Evolutionary::Op::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
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<Algorithm::Evolutionary::Op::TournamentSelect>
70  
71 =item *
72  
73 L<Algorithm::Evolutionary::Op::RouletteWheel>
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: /media/Backup/Repos/opeal/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";
« lib/Algorithm/Evolutionary/Op/RouletteWheel.pm ↑ Summary lib/Algorithm/Evolutionary/Op/String_Mutation.pm »