From e9b0d90aae698b17ba6979fe4bdc54c6991ed2ef Mon Sep 17 00:00:00 2001 From: LPTK Date: Thu, 18 Jul 2013 16:13:55 +0200 Subject: [PATCH] Removed calls to the monitors in the init function of moCheckpoint --- mo/src/continuator/moCheckpoint.h | 17 +++++++++++++---- mo/test/t-moCheckpoint.cpp | 10 +++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/mo/src/continuator/moCheckpoint.h b/mo/src/continuator/moCheckpoint.h index 37b5cd610..950b96fa0 100644 --- a/mo/src/continuator/moCheckpoint.h +++ b/mo/src/continuator/moCheckpoint.h @@ -107,14 +107,23 @@ public : virtual void init(EOT& _sol) { for (unsigned i = 0; i < stats.size(); ++i) stats[i]->init(_sol); - counter=1; - + counter = 1; + for (unsigned i = 0; i < moupdaters.size(); ++i) moupdaters[i]->init(); - + + //for (unsigned i = 0; i < updaters.size(); ++i) + // updaters[i]->init(); + + /* + * Removed because there was no reason for it to be done here + * It caused premature monitoring of eoParams with uninitialized values + * (eoUpdater's don't have a init function) + * for (unsigned int i = 0; i < monitors.size(); ++i) (*monitors[i])(); - + */ + for (unsigned i = 0; i < continuators.size(); ++i) continuators[i]->init(_sol); } diff --git a/mo/test/t-moCheckpoint.cpp b/mo/test/t-moCheckpoint.cpp index e080b9a7b..75ae10a6e 100644 --- a/mo/test/t-moCheckpoint.cpp +++ b/mo/test/t-moCheckpoint.cpp @@ -78,14 +78,14 @@ int main() { test1.init(s); test1(s); - assert(a==3 && b==16 && c==12 && d==49); + assert(a==3 && b==16 && c==11 && d==48); assert(stat.value()[0]); assert(stat.value()[1]); assert(!stat.value()[2]); assert(stat.value().fitness()==17); test1(s); - assert(a==4 && b==17 && c==13 && d==50); + assert(a==4 && b==17 && c==12 && d==49); assert(stat.value()[0]); assert(stat.value()[1]); assert(!stat.value()[2]); @@ -95,7 +95,7 @@ int main() { test2.init(s); test2(s); - assert(a==5 && b==18 && c==15 && d==52); + assert(a==5 && b==18 && c==13 && d==50); assert(stat.value()[0]); assert(stat.value()[1]); assert(!stat.value()[2]); @@ -110,9 +110,9 @@ int main() { assert(stat.value().fitness()==6); test1.lastCall(s); - assert(a==9 && b==22 && c==19 && d==56); + assert(a==9 && b==22 && c==17 && d==54); test2.lastCall(s); - assert(a==10 && b==23 && c==20 && d==57); + assert(a==10 && b==23 && c==18 && d==55); assert(test1.className()=="moCheckpoint"); std::cout << "[t-moCheckpoint] => OK" << std::endl;