Branch Coverage

blib/lib/AI/ParticleSwarmOptimization.pm
Criterion Covered Total %
branch 51 72 70.8


line true false branch
31 5 15 if (defined $params{-'fitFunc'})
33 1 4 if ('ARRAY' eq ref $params{-'fitFunc'}) { }
42 2 2 if defined $params{-'dimensions'} and defined $$self{'dimensions'} and $params{-'dimensions'} != $$self{'dimensions'}
68 2 18 if exists $params{-'dimensions'} and $params{-'dimensions'} <= 0
71 0 18 if (defined $$self{'verbose'} and 'ARRAY' eq ref $$self{'verbose'})
84 13 5 if defined $$self{'dimensions'}
86 13 5 if defined $$self{'numParticles'}
92 3 15 unless defined $$self{'posMax'}
93 3 15 unless defined $$self{'posMin'}
106 0 10 unless $$self{'fitFunc'} and 'CODE' eq ref $$self{'fitFunc'}
108 0 10 unless $$self{'dimensions'} and $$self{'dimensions'} >= 1
112 1 9 exists $$self{'randSeed'} ? :
133 2 8 unless $$self{'posMax'} > $$self{'posMin'}
147 1 0 unless $$self{'prtcls'}
166 0 0 if $prtcl >= $$self{'numParticles'}
206 0 99 $$self{'randStartVelocity'} ? :
215 39 0 unless (defined $$prtcl{'bestFit'})
236 0 300 if defined $self->_moveParticles($iter)
239 0 300 unless $$self{'exitPlateau'} and defined $$self{'bestBest'}
241 261 39 if ($iter >= $$self{'exitPlateauBurnin'} - $$self{'exitPlateauWindow'})
244 201 60 if defined $$self{'bestBestByIter'}[$i]
250 100 200 if $iter <= $$self{'exitPlateauBurnin'}
258 1 199 if $mean == $current
268 0 300 if $$self{'verbose'} & 4
276 1986 7014 if ($self->_betterFit($fit, $$prtcl{'bestFit'}))
281 0 9000 if defined $$self{'exitFit'} and $fit < $$self{'exitFit'}
282 9000 0 unless $$self{'verbose'} & 12
284 0 0 if $$self{'verbose'} >= 2
288 0 0 if $$self{'verbose'} & 8
304 1901 85 unless $self->_betterFit($fit, $$self{'bestBest'})
306 0 85 if ($$self{'verbose'} & 1)
348 0 9000 if (not $vel or $$self{'stallSpeed'} and $vel <= $$self{'stallSpeed'})
350 0 0 if $$self{'verbose'} & 2
364 130 26969 if ($$prtcl{'nextPos'}[$d] < $$self{'posMin'}) { }
96 26873 elsif ($$prtcl{'nextPos'}[$d] > $$self{'posMax'}) { }
391 20673 24327 if (not defined $bestNFitness or $$self{'prtcls'}[$prtclNIndex]{'bestFit'} < $bestNFitness)