Minor changes to make it run under Visual Studio 6.0

This commit is contained in:
okoenig 2003-04-03 09:23:52 +00:00
commit ce04cca4b9
2 changed files with 22 additions and 19 deletions

View file

@ -103,11 +103,11 @@ eoCheckPoint<EOT>& do_make_checkpoint_assembled(eoParser& _parser, eoState& _sta
// best vals // best vals
std::vector<eoBestFitnessStat<EOT>* > bestvals( nTerms ); std::vector<eoBestFitnessStat<EOT>* > bestvals( nTerms );
for (unsigned i=0; i < nTerms; ++i){ for (unsigned j=0; j < nTerms; ++j){
std::string descr = fitness_descriptions[i] + " of best ind."; std::string descr = fitness_descriptions[j] + " of best ind.";
bestvals[i] = new eoBestFitnessStat<EOT>(i, descr); bestvals[j] = new eoBestFitnessStat<EOT>(j, descr);
_state.storeFunctor( bestvals[i] ); _state.storeFunctor( bestvals[j] );
checkpoint->add( *bestvals[i] ); checkpoint->add( *bestvals[j] );
} }
// STDOUT // STDOUT
@ -123,8 +123,8 @@ eoCheckPoint<EOT>& do_make_checkpoint_assembled(eoParser& _parser, eoState& _sta
monitor->add( *bestvals[0] ); monitor->add( *bestvals[0] );
// Add all average vals // Add all average vals
for (unsigned i=0; i < nTerms; ++i) for (unsigned l=0; l < nTerms; ++l)
monitor->add( *avgvals[i] ); monitor->add( *avgvals[l] );
// GNUPLOT // GNUPLOT
// ------- // -------
@ -145,14 +145,14 @@ eoCheckPoint<EOT>& do_make_checkpoint_assembled(eoParser& _parser, eoState& _sta
checkpoint->add(*fitSnapshot); checkpoint->add(*fitSnapshot);
std::vector<eoGnuplot1DMonitor*> gnumonitors(nTerms, NULL ); std::vector<eoGnuplot1DMonitor*> gnumonitors(nTerms, NULL );
for (unsigned i=0; i < nTerms; ++i){ for (unsigned k=0; k < nTerms; ++k){
stmp = dirName + "/gnuplot_" + fitness_descriptions[i] + ".xg"; stmp = dirName + "/gnuplot_" + fitness_descriptions[k] + ".xg";
gnumonitors[i] = new eoGnuplot1DMonitor(stmp,true); gnumonitors[k] = new eoGnuplot1DMonitor(stmp,true);
_state.storeFunctor(gnumonitors[i]); _state.storeFunctor(gnumonitors[k]);
checkpoint->add(*gnumonitors[i]); checkpoint->add(*gnumonitors[k]);
gnumonitors[i]->add(*generationCounter); gnumonitors[k]->add(*generationCounter);
gnumonitors[i]->add(*bestvals[i]); gnumonitors[k]->add(*bestvals[k]);
gnumonitors[i]->add(*avgvals[i]); gnumonitors[k]->add(*avgvals[k]);
} }
} }

View file

@ -341,10 +341,13 @@ public :
: eoStat<EOT, Fitness>(Fitness(), _description) {} : eoStat<EOT, Fitness>(Fitness(), _description) {}
eoBestFitnessStat(unsigned _whichTerm, std::string _description = "Best ") eoBestFitnessStat(unsigned _whichTerm, std::string _description = "Best ")
: eoStat<EOT, Fitness>(Fitness(), _description), whichFitnessTerm(_whichTerm) {} : eoStat<EOT, Fitness>(Fitness(), _description), whichFitnessTerm(_whichTerm) {}
void operator()(const eoPop<EOT>& _pop) void operator()(const eoPop<EOT>& _pop){
{ #ifdef _MSC_VER
doit(_pop, Fitness()); doit(_pop, EOT::Fitness() ); // specializations for scalar and std::vector
#else
doit(_pop, typename EOT::Fitness()); // specializations for scalar and std::vector
#endif
} }
private : private :