From dc42894fb7f652f091441182e2a483fc88be2b4f Mon Sep 17 00:00:00 2001 From: cahon Date: Fri, 13 Dec 2002 10:03:47 +0000 Subject: [PATCH] Fixing bug [preserve order of the pop. to evaluate] --- eo/src/paradisEO/comm/eoLocalListener.h | 13 +++++++ eo/src/paradisEO/eval/eoDistPopEvalFunc.h | 43 +++++++++++++---------- 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/eo/src/paradisEO/comm/eoLocalListener.h b/eo/src/paradisEO/comm/eoLocalListener.h index e106e3d0..a0b342d8 100644 --- a/eo/src/paradisEO/comm/eoLocalListener.h +++ b/eo/src/paradisEO/comm/eoLocalListener.h @@ -108,6 +108,19 @@ public : } } + void wait () { + + bool b = false ; + + do { + comm -> Probe (num_id, 0) ; + update () ; + if (! empty ()) + b = true ; + + } while (! b) ; + } + /** String identifier of this algo/agent ? */ diff --git a/eo/src/paradisEO/eval/eoDistPopEvalFunc.h b/eo/src/paradisEO/eval/eoDistPopEvalFunc.h index 4a85af42..93d20cdd 100644 --- a/eo/src/paradisEO/eval/eoDistPopEvalFunc.h +++ b/eo/src/paradisEO/eval/eoDistPopEvalFunc.h @@ -67,7 +67,12 @@ public : // Partitioning ... - int j = 0, l = 0 ; + int j = 0, l = 0 ; + + bool t [listen.size ()] ; + for (int i = 0 ; i < listen.size () ; i ++) + t [i] = false ; + for (int i = 0 ; i < num_eval ; i ++) { eoPop pop ; @@ -84,30 +89,32 @@ public : } eoEOSendMessTo mess (pop) ; - mess (listen [l ++]) ; + mess (listen [l]) ; + t [l ++] = true ; } // On standby of the returns _offspring.clear () ; - while (_offspring.size () != old_size) { - - listen.wait () ; - - for (int i = 0 ; i < listen.size () ; i ++) - if (listen [i].label () == label && ! listen [i].empty ()) { - while (! listen [i].empty ()) { + // while (_offspring.size () != old_size) { + + // listen.wait () ; + + for (int i = 0 ; i < listen.size () ; i ++) + if (t [i]) { + listen [i].wait () ; + //while (! listen [i].empty ()) { - eoPop & pop = listen [i].front () ; - - for (int m = 0 ; m < pop.size () ; m ++) - _offspring.push_back (pop [m]) ; - - listen [i].pop () ; + eoPop & pop = listen [i].front () ; - } - } - } + for (int m = 0 ; m < pop.size () ; m ++) + _offspring.push_back (pop [m]) ; + + listen [i].pop () ; + + //} + //} + } } private :