Fixing bug [preserve order of the pop. to evaluate]

This commit is contained in:
cahon 2002-12-13 10:03:47 +00:00
commit dc42894fb7
2 changed files with 38 additions and 18 deletions

View file

@ -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 ? String identifier of this algo/agent ?
*/ */

View file

@ -68,6 +68,11 @@ public :
// Partitioning ... // 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 ++) { for (int i = 0 ; i < num_eval ; i ++) {
eoPop <EOT> pop ; eoPop <EOT> pop ;
@ -84,30 +89,32 @@ public :
} }
eoEOSendMessTo <EOT> mess (pop) ; eoEOSendMessTo <EOT> mess (pop) ;
mess (listen [l ++]) ; mess (listen [l]) ;
t [l ++] = true ;
} }
// On standby of the returns // On standby of the returns
_offspring.clear () ; _offspring.clear () ;
while (_offspring.size () != old_size) { // while (_offspring.size () != old_size) {
listen.wait () ; // listen.wait () ;
for (int i = 0 ; i < listen.size () ; i ++) for (int i = 0 ; i < listen.size () ; i ++)
if (listen [i].label () == label && ! listen [i].empty ()) { if (t [i]) {
while (! listen [i].empty ()) { listen [i].wait () ;
//while (! listen [i].empty ()) {
eoPop <EOT> & pop = listen [i].front () ; eoPop <EOT> & pop = listen [i].front () ;
for (int m = 0 ; m < pop.size () ; m ++) for (int m = 0 ; m < pop.size () ; m ++)
_offspring.push_back (pop [m]) ; _offspring.push_back (pop [m]) ;
listen [i].pop () ; listen [i].pop () ;
} //}
} //}
} }
} }
private : private :