1
$\begingroup$

So i have been playing around with neat-python. I made a program, applying neat, to play pinball on the Atari 2600. The code for that can be found in the file test2.py here

Now based on that, I would like to do the same, but on a 2 player game. I have already set up the environment to play a 2 player game, which PONG using OpenAI Retro.

What I have no clue how to do, is run 2 nets at the same time, on the same observation. The way that neat-python works, is you get the observation from a single function that goes through each genome and runs the environment.

How would you create 2 eval_genome functions that can take in the same observation real-time? This means that they train based off of the same images and environmenrs.

Help?

$\endgroup$
3
  • $\begingroup$ I'm not sure how to do this as I haven't played with neat-python before but I'm honestly curious, why do you want to do this? To compare the resulting network structures or something else? $\endgroup$ Commented Mar 20, 2019 at 14:01
  • $\begingroup$ I am planning to study the interactions between agents trained together. I want to see if they can develop cooperative behavior. This problem with neat is annoying though... $\endgroup$ Commented Mar 20, 2019 at 16:41
  • $\begingroup$ Does anyone know how to solve this $\endgroup$ Commented Mar 21, 2019 at 16:19

2 Answers 2

0
$\begingroup$

I'm not familiar with neat-python, but I have implemented NEAT to do openai tasks. If there is a class for initializing a population, you could just use that and have 2 objects like population1 and population2 and call them in the same loop.

$\endgroup$
0
$\begingroup$

well if you want to just train genomeN against genomeN-1 then you just need to loop through genomes using indexing and start at 1 so you can always do genome1 = genomes[ix-1] and genome2 = genomes[ix] and then modify your fitness evaluation code to run both at the same time and applies a fitness function to each. Also maybe you iterate by twos so that you only eval each net once.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .