From 86c7c8fe958caed3a08f2caa3f1c68a9f9a41619 Mon Sep 17 00:00:00 2001 From: evomarc Date: Fri, 2 Aug 2002 07:40:47 +0000 Subject: [PATCH] Removed some multiple declaraions inside for loops that MSVC++ doesn't like --- eo/src/eoNDSorting.h | 18 ++++++++++-------- eo/src/utils/eoCheckPoint.h | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/eo/src/eoNDSorting.h b/eo/src/eoNDSorting.h index a0f72656..e8562194 100644 --- a/eo/src/eoNDSorting.h +++ b/eo/src/eoNDSorting.h @@ -89,12 +89,13 @@ private : }; void one_objective(const eoPop& _pop) - { + { + unsigned i; eoPop tmp_pop; tmp_pop.resize(_pop.size()); // copy pop to dummy population (only need the fitnesses) - for (unsigned i = 0; i < _pop.size(); ++i) + for (i = 0; i < _pop.size(); ++i) { tmp_pop[i].fitness(_pop[i].fitness()); tmp_pop[i].index = i; @@ -104,7 +105,7 @@ private : tmp_pop.sort(); // - for (unsigned i = 0; i < _pop.size(); ++i) + for (i = 0; i < _pop.size(); ++i) { value()[tmp_pop[i].index] = _pop.size() - i; // set rank } @@ -131,13 +132,14 @@ private : */ void two_objectives(const eoPop& _pop) - { + { + unsigned i; typedef typename EOT::Fitness::fitness_traits traits; assert(traits::nObjectives() == 2); vector sort1(_pop.size()); // index into population sorted on first objective - for (unsigned i = 0; i < _pop.size(); ++i) + for (i = 0; i < _pop.size(); ++i) { sort1[i] = i; } @@ -149,7 +151,7 @@ private : unsigned last_front = 0; double max1 = -1e+20; - for (unsigned i = 0; i < _pop.size(); ++i) + for (i = 0; i < _pop.size(); ++i) { max1 = max(max1, _pop[i].fitness()[1]); } @@ -162,7 +164,7 @@ private : vector > fronts(_pop.size()); // to store indices into the front - for (unsigned i = 0; i < _pop.size(); ++i) + for (i = 0; i < _pop.size(); ++i) { unsigned index = sort1[i]; @@ -204,7 +206,7 @@ private : // ok, and finally the niche penalty - for (unsigned i = 0; i < fronts.size(); ++i) + for (i = 0; i < fronts.size(); ++i) { if (fronts[i].size() == 0) continue; diff --git a/eo/src/utils/eoCheckPoint.h b/eo/src/utils/eoCheckPoint.h index 1117d706..729a0c74 100644 --- a/eo/src/utils/eoCheckPoint.h +++ b/eo/src/utils/eoCheckPoint.h @@ -97,7 +97,7 @@ bool eoCheckPoint::operator()(const eoPop& _pop) (*monitors[i])(); bool bContinue = true; - for (unsigned i = 0; i < continuators.size(); ++i) + for (i = 0; i < continuators.size(); ++i) if ( !(*continuators[i])(_pop) ) bContinue = false;