A few changes for MSVC++ compatibility
This commit is contained in:
parent
019c8cd3e3
commit
42a2a4f69e
3 changed files with 10 additions and 8 deletions
|
|
@ -56,13 +56,14 @@ public :
|
|||
*/
|
||||
virtual void operator()(const eoPop<EOT>& _pop)
|
||||
{
|
||||
unsigned i;
|
||||
if (!boolOpt) // take the local best
|
||||
theBest = _pop.best_element();
|
||||
unsigned int pSize = _pop.size();
|
||||
distToBest.value().resize(pSize);
|
||||
fitnesses.value().resize(pSize);
|
||||
double sumFit = 0.0, sumDist = 0.0;
|
||||
for (unsigned i=0; i<pSize; i++)
|
||||
for (i=0; i<pSize; i++)
|
||||
{
|
||||
sumDist += (distToBest.value()[i] = dist(_pop[i], theBest));
|
||||
sumFit += (fitnesses.value()[i] = _pop[i].fitness());
|
||||
|
|
@ -72,7 +73,7 @@ public :
|
|||
double avgFit = sumFit/pSize;
|
||||
sumDist = sumFit = 0.0;
|
||||
double num = 0.0;
|
||||
for (unsigned i=0; i<pSize; i++)
|
||||
for (i=0; i<pSize; i++)
|
||||
{
|
||||
double devDist = distToBest.value()[i] - avgDist ;
|
||||
double devFit = fitnesses.value()[i] - avgFit ;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#ifndef _eoTimeCounter_h
|
||||
#define _eoTimeCounter_h
|
||||
|
||||
#include <sys/times.h>
|
||||
#include <time.h>
|
||||
#include <utils/eoStat.h>
|
||||
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ public:
|
|||
virtual void operator()()
|
||||
{
|
||||
// ask for system time
|
||||
times(&tmsStruct);
|
||||
utime = clock();
|
||||
// if (firstTime) /* first generation */
|
||||
// {
|
||||
// firstTime=false;
|
||||
|
|
@ -53,13 +53,13 @@ public:
|
|||
// }
|
||||
// store elapsed user time
|
||||
// value(tmsStruct.tms_utime - firstUtime);
|
||||
value()=double(tmsStruct.tms_utime)/100;
|
||||
value()=double(utime)/CLOCKS_PER_SEC;
|
||||
}
|
||||
|
||||
private:
|
||||
// bool firstTime;
|
||||
// clock_t firstUtime;
|
||||
struct tms tmsStruct; // stores time
|
||||
clock_t utime;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#ifndef _eoUpdater_h
|
||||
#define _eoUpdater_h
|
||||
|
||||
#include <string>
|
||||
#include <eoFunctor.h>
|
||||
#include <utils/eoState.h>
|
||||
#include <utils/eoParam.h>
|
||||
|
|
@ -69,13 +70,13 @@ class eoIncrementorParam : public eoUpdater, public eoValueParam<T>
|
|||
{
|
||||
public :
|
||||
/** Default Ctor : a name and optionally an increment*/
|
||||
eoIncrementorParam(string _name, T _stepsize = 1) :
|
||||
eoIncrementorParam( std::string _name, T _stepsize = 1) :
|
||||
eoValueParam<T>(T(0), _name), stepsize(_stepsize) {}
|
||||
|
||||
/** Ctor with a name and non-zero initial value
|
||||
* and mandatory stepSize to remove ambiguity
|
||||
*/
|
||||
eoIncrementorParam(string _name, T _countValue, T _stepsize) :
|
||||
eoIncrementorParam( std::string _name, T _countValue, T _stepsize) :
|
||||
eoValueParam<T>(_countValue, _name), stepsize(_stepsize) {}
|
||||
|
||||
/** Simply increments */
|
||||
|
|
|
|||
Reference in a new issue