Changed all variables named howmany into combien (French for how many)

because of a silly problem on Solaris (howmany seems to be some macro???)
This commit is contained in:
evomarc 2001-04-11 12:01:51 +00:00
commit 64990a1ac4
3 changed files with 22 additions and 23 deletions

View file

@ -55,18 +55,18 @@ class eoInitFixedLength: public eoInit<EOT>
typedef typename EOT::AtomType AtomType;
eoInitFixedLength(unsigned _howmany, eoRndGenerator<AtomType>& _generator)
: howmany(_howmany), generator(_generator) {}
eoInitFixedLength(unsigned _combien, eoRndGenerator<AtomType>& _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<AtomType> generator;
};
@ -87,8 +87,7 @@ class eoInitVariableLength: public eoInit<EOT>
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();
}

View file

@ -56,7 +56,7 @@ template <class EOT> class eoElitism : public eoMerge<EOT>
{
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<EOT>& _pop, eoPop<EOT>& _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<const EOT*> 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;
};
/**

View file

@ -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;
};