Cooperative Co-evolutionary GA Model

41 views
Skip to first unread message

l.al...@gmail.com

unread,
May 16, 2015, 7:20:27 AM5/16/15
to watch...@googlegroups.com

I am trying to implement a cooperative co-evolutionary GA based model where I have two populations with different data types and they should interact with each other to produce a better result after each generation. I am using the Watchmaker framework to do this. I have built the first population and I am trying now to add the second population. I am not sure how to do this. I could not find any class or method that support adding a second population. All what I have found is the Package org.uncommons.watchmaker.framework.islands class that Manages parallel evolution across multiple EvolutionEngines (islands) with periodic migration between them. I am not sure if this could help me, but from what I have understood that this class support populations with similar data types.

Can any one help me with this issue? Is there any way to implement a coevolutionary GA Model using the watchmaker framework? I have done a huge work and I don't want to change the framework if there is any possible way to do it in this framework.

Klaas Hölscher

unread,
May 17, 2015, 7:52:30 AM5/17/15
to watch...@googlegroups.com
Hey,

of course its possible, albeit island evolution serves a different purpose. I take that if you say that your two populations use different data types, you have to use two different evaluators anyway.
You coud set up a GeneralEvolutionEngine ( see http://watchmaker.uncommons.org/api/org/uncommons/watchmaker/framework/GenerationalEvolutionEngine.html ) for each population, and use nextEvolutionStep() for each GeneralEvolutionEngine. As this function performs just one step and returns the List of evaluated candidates, you are free to mingle (manually...:) ) with the lists that contain your two populations.

regards,
Klaas

2015-05-16 0:54 GMT+02:00 <l.al...@gmail.com>:

I am trying to implement a cooperative co-evolutionary GA based model where I have two populations with different data types and they should interact with each other to produce a better result after each generation. I am using the Watchmaker framework to do this. I have built the first population and I am trying now to add the second population. I am not sure how to do this. I could not find any class or method that support adding a second population. All what I have found is the Package org.uncommons.watchmaker.framework.islands class that Manages parallel evolution across multiple EvolutionEngines (islands) with periodic migration between them. I am not sure if this could help me, but from what I have understood that this class support populations with similar data types.

Can any one help me with this issue? Is there any way to implement a coevolutionary GA Model using the watchmaker framework? I have done a huge work and I don't want to change the framework if there is any possible way to do it in this framework.

--
You received this message because you are subscribed to the Google Groups "Watchmaker Framework for Evolutionary Computation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to watchmaker+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

l.al...@gmail.com

unread,
May 17, 2015, 10:58:02 AM5/17/15
to watch...@googlegroups.com
Thank you so much for your helpful response.

I just want to make sure that my understanding is correct about the nextEvolutionStep() method:
Does it return the population after doing one evolution process including the operations that are specified (ex:crossover and mutation)?

I am a beginner in using this framework so, I am wondering if there is any implemented example that uses the GenerationalEvolutionEngine and/or the nextEvolutionStep() method that I can look at to understand the process? 

Klaas Hölscher

unread,
May 17, 2015, 4:49:16 PM5/17/15
to watch...@googlegroups.com
Hey,

nextEvolutionStep does
1) stash away fittest individuals if elitecount >0
2) Create new population from input population via your created selector and fitness evaluator. Population size = input - elite
3) apply mutation&crossover to new population
4) add elite individuals back into population and evaluate all individuals, so you get back a list of all individuals with fitness score.
(I think you have to sort them yourself after step 4 with nextEvolutionStep, not sure about that. Usually your engine would take care of that)

See 

l.al...@gmail.com

unread,
May 18, 2015, 5:04:52 AM5/18/15
to watch...@googlegroups.com
Thank you so much. It was a relief knowing that the Watchmaker is capable of handling co-evolution models. I am currently trying to find any implemented or explained example that may help me in understanding where exactly to call the method:

if my GenerationalEvolutionEngine object is declared in the main as follows:

EvolutionEngine<int[]> engine = new GenerationalEvolutionEngine <int[]>( factory, pipeline, new CEvaluator(), new RoulettWheelSelection(), new MersenneTwisterRNG());

where exactly I should call the nextEvolutionStep()?

 and how to make the first population that called the method interact with the second population?

I apologize if my questions are basics but as I mentioned before I am a beginner.

Thanks in advance,

Daniel Dyer

unread,
May 18, 2015, 5:26:43 AM5/18/15
to watch...@googlegroups.com
On Mon, 18 May 2015, at 10:04 AM, l.al...@gmail.com wrote:
Thank you so much. It was a relief knowing that the Watchmaker is capable of handling co-evolution models. I am currently trying to find any implemented or explained example that may help me in understanding where exactly to call the method:
 
if my GenerationalEvolutionEngine object is declared in the main as follows:
 
EvolutionEngine<int[]> engine = new GenerationalEvolutionEngine <int[]>( factory, pipeline, new CEvaluator(), new RoulettWheelSelection(), new MersenneTwisterRNG());
 
where exactly I should call the nextEvolutionStep()?
 
You don't call this method yourself, it is called by the framework. The idea is to create a sub-class of GenerationalEvolutionEngine and over-ride this method (making sure to call super.nextEvolutionStep()) and then do what you need to before it returns since at this point you will have access to all members of the population and their fitness scores. You would need to come up with a mechanism for communicating between separate instances of your sub-class (it's probably sufficient to set each up with a reference to the other in the constructor so they can invoke methods on each other). You may need to use something like a CountDownLatch if you want to wait for each evolution engine to complete its current generation before executing your logic.
 
 and how to make the first population that called the method interact with the second population?
 
I apologize if my questions are basics but as I mentioned before I am a beginner.
 
Thanks in advance,
 
An alternative approach would be to use an EvolutionObserver so that each engine gets automatically notified at the end of each generation on the other engine. Currently this will only work if you can do what you need using only the fittest member of the other population. If you need the entire population this would require a change to the framework. This is a change that has been suggested before and I'm not against it in principle, I just haven't spent much time on this project recently.
 
Dan.
 
--
Daniel Dyer

l.al...@gmail.com

unread,
May 29, 2015, 5:29:10 PM5/29/15
to watch...@googlegroups.com
I greatly appreciate your clarification. I still have some points that I would like to know. 

Let's assume that I have created a sub-class of GenerationalEvolutionEngine and over-ride the nextEvolutionStep() method and in the first line of the nextEvolutionStep() method, I called the super.nextEvolutionStep(evaluatedPopulation, eliteCount, rng)); . 

From what I have understood, calling the super would return the population after evolving one generation. My question is where exactly the returned population is saved. If my declaration and initialization in the main is as follows:

EvolutionEngine<int[]> engine = new SubClassGenerationalEvolutionEngine <int[]>( factory, pipeline, new CEvaluator(), new RoulettWheelSelection(), new MersenneTwisterRNG()); 

such that the SubClassGenerationalEvolutionEngine is the sub-class that I have created of GenerationalEvolutionEngine.

Would it be returned and saved in engine after each generation or would it be returned to update the  factory ? 


My second question is: If I have created this sub-class and over-ridden the nextEvolutionStep() method, do  I still need to call the engine.evolvepopulation() method in my main or should I use a loop to perform the next iteration? 

My last question is: After each generation, can I make other things such as updating other parts in my code ,not part of but related to the Evolution engine [such as public variables in my code], ? if yes, what is the way to do that?

I am asking these questions because I am not really sure how does the nextEvolutionStep() method work and weather am I able to apply some functions after each generation or not.

Thank you for your help and I apologize for asking too many questions.

Klaas Hölscher

unread,
Jun 7, 2015, 7:57:08 AM6/7/15
to watch...@googlegroups.com
Hey,

just to add a bit:

From what I have understood, calling the super would return the population after evolving one generation. My question is where exactly the returned population is saved.

If you follow Dans advice to let the framework handle the workflow (you should do this!): Your SubClassGenerationalEvolutionEngine.nextEvolutionStep() just returns it.

See https://github.com/JohannesBuchner/ska-SchedEng/blob/master/src/main/java/local/radioschedulers/alg/ga/watchmaker/PopulationEvolutionEngine.java for a really random example of a extended GenerationalEvolutionEngine with overwritten nextEvolutionStep().

Your code (evaluating/modifying both populations) would be after super.nextEvolutionStep() and before the return(). Also your latch would have to be implemented here to "synchronize" both engines


My second question is: If I have created this sub-class and over-ridden the nextEvolutionStep() method, do  I still need to call the engine.evolvepopulation() method in my main or should I use a loop to perform the next iteration? 

Yes, using the evolvepopulation() is pretty convenient. My suggestion to do it manually with a loop is not really needed.

 
regards,
Klaas

 






--
Reply all
Reply to author
Forward
0 new messages