blib/lib/Algorithm/Evolutionary/Op/LinearFreezer.pm untested

filter: Statementstmt 0.0% 0 / 27 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 39 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
apply
2.0
BEGIN
2.0
CRAP 2.0
1 package Algorithm::Evolutionary::Op::LinearFreezer;
2  
3 use lib qw(../../..);
4  
5 use strict;
6 use warnings;
7  
8 =head1 NAME
9  
10 Algorithm::Evolutionary::Op::LinearFreezer - Used by Simulated Annealing algorithms, reduces temperature lineally.
11  
12 =head1 SYNOPSIS
13  
14 my $freezer = new Algorithm::Evolutionary::Op::LinearFreezer( $minTemp );
15  
16 =head1 Base Class
17  
18 L<Algorithm::Evolutionary::Op::Base|Algorithm::Evolutionary::Op::Base>
19  
20 =head1 METHODS
21  
22 =cut
23  
24  
25  
26 our ($VERSION) = ( '$Revision: 3.1 $ ' =~ / (\d+\.\d+)/ );
27  
28 use Carp;
29 use base 'Algorithm::Evolutionary::Op::Base';
30  
31 =head2 new ([ $initial_temperature = 0.2] )
32  
33 Creates a new linear freezer.
34  
35 =cut
36  
37 sub new {
38 my $class = shift;
39 my $self = {};
40 $self->{'_initTemp'} = shift || 0.2 ;
41 $self->{'_n'} = 0 ;
42  
43 bless $self, $class;
44 return $self;
45 }
46  
47 =head2 apply( $temperature )
48  
49 Applies freezing schedule to the temperature; returns new temperature
50  
51 =cut
52  
53 sub apply ($$) {
54 my $self = shift;
55 my $t = shift;
56  
57 $t = ($self->{'_initTemp'}) / ( 1 + $self->{_n} ) ;
58 $self->{'_n'}++ ;
59  
60 return $t;
61 }
62  
63 =head1 Copyright
64
65 This file is released under the GPL. See the LICENSE file included in this distribution,
66 or go to http://www.fsf.org/licenses/gpl.txt
67  
68 CVS Info: $Date: 2012/07/08 10:38:52 $
69 $Header: /media/Backup/Repos/opeal/opeal/Algorithm-Evolutionary/lib/Algorithm/Evolutionary/Op/LinearFreezer.pm,v 3.1 2012/07/08 10:38:52 jmerelo Exp $
70 $Author: jmerelo $
71 $Revision: 3.1 $
72 $Name $
73  
74 =cut