colgreen / sharpneat

SharpNEAT - Evolution of Neural Networks. A C# .NET Framework.
https://sharpneat.sourceforge.io/
Other
380 stars 97 forks source link

How can I set up genome vs genome competitive evaluation/evolutionary algorithm? #56

Closed travis-leith closed 2 years ago

travis-leith commented 2 years ago

I am new to this repo, so please forgive my lack of understanding. Looking through the samples, they all appear to be experiments whereby a genome can be evaluated on it's own. But what if the genome is designed to play some 2 (or n) player competitive game? In this case, each evaluation would involve 2 (or n) genomes. Is this repo suitable for setting up such experiments? Any advice would be appreciated.

tlemo commented 2 years ago

Hi @travis-leith, I realize this may not answer your immediate question, but completive/relative fitness evaluation is something I'm also interested in. One solution I used in a different neuroevolution project is to define domain-specific fitness evaluation at population level instead at individual genotype: https://tlemo.github.io/darwin/classdarwin_1_1_domain.html.

I'm not suggesting that this is the best solution or that SharpNEAT should do something similar. I'd be curious to hear other ideas too.

colgreen commented 2 years ago

Yes, it's possible. When setting up a new problem task you need to supply an implementation of IGenomeListEvaluator<TGenome>. It's just that the problem tasks provided by default are all performing evaluation of single genomes in isolation, and so the implementation used if one that loops over the genomes and evaluates them individually. But it is possible to plug in an IGenomeListEvaluator<TGenome> that operates on the whole population, e.g. perhaps by running a sort of tournament approach, perhaps by getting genomes to play each other in mini leagues (as per the world cup), and then taking the top genomes from each league to the next tier of the tournament.

I actually wrote some code to do something like this many years ago (although a bit more complex) to evolve tic-tac-toe players.

travis-leith commented 2 years ago

Thanks @colgreen.