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$

bumped to the homepage by Community 2 days ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

  • $\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$ – Jaden Travnik Mar 20 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$ – niallmandal Mar 20 at 16:41
  • $\begingroup$ Does anyone know how to solve this $\endgroup$ – niallmandal Mar 21 at 16:19
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$

will 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$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.