Hey currently I'm implementing an island model (parallel) genetic algorithm for solving task scheduling problem in C#, and I need some help.There are a number of populations each of which is processed by a single thread running a genetic algorithm independently, and it's required that after a certain number of generations passed in each population, the algorithms stopped processing for a moment so that the populations exchanged some of their individuals, and when it's done the populations continued evolving. I'm unsure how to implement this in C#, which classes to use etc
Here's what I've been able to come up with so far:
http://pastebin.com/taqbdV72But not any thread waits for all the others as I want them to... My (not working) solution is that there is a list of ManualResetEvent objects, each corresponding to a single thread (or a copy of GA), and when it's time for the populations to exchange some of their individuals, a thread, when it has reached this point, says to the other threads it is ready to proceed and waits for the other threads to come up, and when they're all done, the migration routine is performed (I haven't implemented this one yet), but they are not running synchronously after all, as I have already stated.
Could you please look a the code above, starting from line 241, and say what is incorrect there, and how I could fix this? Or should I go with another approach for island GA implementation (in case of C#)? Please note that it's not all the code there is to it.