* eoTimedMonitor.h (eoTimedMonitor::seconds): Make unsigned.

* eoRNG.cpp, eoRNG.h (K, M, N): Declare static and initialize in cpp.

* t-eoGenOp.cpp (init): Do not add std::ends to end of string, as this
results in escape-codes (^@) to be printed at runtime and is not
necessary anyway.

* test/t-eoSymreg.cpp (SymregNode::operator()): Initialize r1 and r2 to
avoid compiler warnings.
This commit is contained in:
kuepper 2006-12-02 10:18:57 +00:00
commit 7baf7cb799
6 changed files with 114 additions and 84 deletions

View file

@ -35,16 +35,15 @@
struct Dummy : public EO<double>
{
typedef double Type;
Dummy(std::string _s="") : s(_s) {}
Dummy(std::string _s="") : s(_s) {}
void printOn(std::ostream & _os) const
{
EO<double>::printOn(_os);
_os << " - " << s ;
}
void printOn(std::ostream & _os) const
{
EO<double>::printOn(_os);
_os << " - " << s ;
}
std::string s;
std::string s;
};
typedef Dummy EOT;
@ -180,18 +179,18 @@ void init(eoPop<Dummy> & _pop, unsigned _pSize)
for (unsigned i=0; i<_pSize; i++)
{
std::ostringstream os;
os << i << std::ends;
_pop[i] = Dummy(os.str());
_pop[i].fitness(i);
os << i;
_pop[i] = Dummy(os.str());
_pop[i].fitness(i);
}
}
// ok, now for the real work
int the_main(int argc, char **argv)
{
eoParser parser(argc, argv);
eoValueParam<unsigned int> parentSizeParam = parser.createParam(unsigned(10), "parentSize", "Parent size",'P');
eoParser parser(argc, argv);
eoValueParam<unsigned int> parentSizeParam(
parser.createParam(unsigned(10), "parentSize", "Parent size",'P'));
pSize = parentSizeParam.value(); // global variable
eoValueParam<uint32_t> seedParam(time(0), "seed", "Random number seed", 'S');
@ -269,7 +268,7 @@ int the_main(int argc, char **argv)
init(pop, pSize);
// sort pop so seqPopulator is identical to SelectPopulator(SequentialSelect)
pop.sort();
std::cout << "Population initiale\n" << pop << std::endl;
std::cout << "Population initiale" << std::endl << pop << std::endl;
// To simulate SGA: first a prop between quadOp and quadClone
eoProportionalOp<EOT> pSGAOp;