diff --git a/eo/src/eoInit.h b/eo/src/eoInit.h index ac875b24..af0198ee 100644 --- a/eo/src/eoInit.h +++ b/eo/src/eoInit.h @@ -55,18 +55,18 @@ class eoInitFixedLength: public eoInit typedef typename EOT::AtomType AtomType; - eoInitFixedLength(unsigned _howmany, eoRndGenerator& _generator) - : howmany(_howmany), generator(_generator) {} + eoInitFixedLength(unsigned _combien, eoRndGenerator& _generator) + : combien(_combien), generator(_generator) {} void operator()(EOT& chrom) { - chrom.resize(howmany); + chrom.resize(combien); std::generate(chrom.begin(), chrom.end(), generator); chrom.invalidate(); } private : - unsigned howmany; + unsigned combien; /// generic wrapper for eoFunctor (s), to make them have the function-pointer style copy semantics eoSTLF generator; }; @@ -87,8 +87,7 @@ class eoInitVariableLength: public eoInit void operator()(EOT& chrom) { - unsigned howmany = offset + rng.random(extent); - chrom.resize(howmany); + chrom.resize(offset + rng.random(extent)); generate(chrom.begin(), chrom.end(), generator); chrom.invalidate(); } diff --git a/eo/src/eoMerge.h b/eo/src/eoMerge.h index ae8b00be..27e6e49b 100644 --- a/eo/src/eoMerge.h +++ b/eo/src/eoMerge.h @@ -56,7 +56,7 @@ template class eoElitism : public eoMerge { public : eoElitism(double _rate, bool _interpret_as_rate = true): - rate(0), howmany(0) + rate(0), combien(0) { if (_interpret_as_rate) { @@ -68,27 +68,27 @@ public : { if (_rate<0) throw std::logic_error("Negative number of offspring in eoElitism!"); - howmany = (unsigned int)_rate; - if (howmany != _rate) + combien = (unsigned int)_rate; + if (combien != _rate) cout << "Warning: Number of guys to merge in eoElitism was rounded"; } } void operator()(const eoPop& _pop, eoPop& _offspring) { - if ((howmany == 0) && (rate == 0.0)) + if ((combien == 0) && (rate == 0.0)) return; - unsigned howmanyLocal; - if (howmany == 0) // rate is specified - howmanyLocal = (unsigned int) (rate * _pop.size()); + unsigned combienLocal; + if (combien == 0) // rate is specified + combienLocal = (unsigned int) (rate * _pop.size()); else - howmanyLocal = howmany; + combienLocal = combien; - if (howmanyLocal > _pop.size()) + if (combienLocal > _pop.size()) throw std::logic_error("Elite larger than population"); vector result; - _pop.nth_element(howmanyLocal, result); + _pop.nth_element(combienLocal, result); for (size_t i = 0; i < result.size(); ++i) { @@ -98,7 +98,7 @@ public : private : double rate; - unsigned howmany; + unsigned combien; }; /** diff --git a/eo/src/utils/eoHowMany.h b/eo/src/utils/eoHowMany.h index 7776b6c2..fcdce596 100644 --- a/eo/src/utils/eoHowMany.h +++ b/eo/src/utils/eoHowMany.h @@ -40,7 +40,7 @@ class eoHowMany { public: eoHowMany(double _rate, bool _interpret_as_rate = true): - rate(0), howmany(0) + rate(0), combien(0) { if (_interpret_as_rate) { @@ -50,27 +50,27 @@ public: { if (_rate<0) throw std::logic_error("Negative number in eoHowMany!"); - howmany = (unsigned int)_rate; - if (howmany != _rate) + combien = (unsigned int)_rate; + if (combien != _rate) cout << "Warning: Number was rounded in eoHowMany"; } } unsigned int operator()(unsigned int _size) { - if (howmany == 0) + if (combien == 0) { if (rate == 0.0) return 0; else return (unsigned int) (rate * _size); } - return howmany; + return combien; } private : double rate; - unsigned howmany; + unsigned combien; };