* indentations + whitespace cleanup

This commit is contained in:
Caner Candan 2011-05-05 16:54:00 +02:00
commit 56c6edab04
285 changed files with 6068 additions and 6223 deletions

View file

@ -28,26 +28,26 @@
#include <eoDistribution.h>
/**
* Distribution Class for PBIL algorithm
* Distribution Class for PBIL algorithm
* (Population-Based Incremental Learning, Baluja and Caruana 96)
*
* It encodes a univariate distribution on the space of bitstrings,
* i.e. one probability for each bit to be one
*
* It is an eoValueParam<std::vector<double> > :
* It is an eoValueParam<std::vector<double> > :
* the std::vector<double> stores the probabilities that each bit is 1
*
* It is still pure virtual, as the update method needs to be specified
*/
template <class EOT>
class eoPBILDistrib : public eoDistribution<EOT>,
public eoValueParam<std::vector<double> >
class eoPBILDistrib : public eoDistribution<EOT>,
public eoValueParam<std::vector<double> >
{
public:
/** Ctor with size of genomes, and update parameters */
eoPBILDistrib(unsigned _genomeSize) :
eoDistribution<EOT>(),
eoDistribution<EOT>(),
eoValueParam<std::vector<double> >(std::vector<double>(_genomeSize, 0.5), "Distribution"),
genomeSize(_genomeSize)
{}
@ -55,10 +55,10 @@ public:
/** the randomizer of indis */
virtual void operator()(EOT & _eo)
{
_eo.resize(genomeSize); // just in case
_eo.resize(genomeSize); // just in case
for (unsigned i=0; i<genomeSize; i++)
_eo[i] = eo::rng.flip(value()[i]);
_eo.invalidate(); // DO NOT FORGET!!!
_eo.invalidate(); // DO NOT FORGET!!!
}
/** Accessor to the genome size */
@ -70,22 +70,22 @@ public:
os << value().size() << ' ';
for (unsigned i=0; i<value().size(); i++)
os << value()[i] << ' ';
}
}
/** reading...*/
virtual void readFrom(std::istream& is)
{
unsigned sz;
is >> sz;
value().resize(sz);
unsigned i;
for (i = 0; i < sz; ++i)
{
double atom;
is >> atom;
value()[i] = atom;
double atom;
is >> atom;
value()[i] = atom;
}
}