Answers.Body: <p>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 <code>population1</code> and <code>population2</code> and call them in the same loop.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-13T04:21:08.383Z
Answers.LastActivityDate: 2019-08-13T04:21:08.383Z
Answers.UserDisplayName: Terry T.
Answers.Body: <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-12T22:05:31.317Z
Answers.LastActivityDate: 2020-02-10T15:23:01.273Z
Answers.LastEditDate: 2020-02-10T15:23:01.273Z
Answers.UserDisplayName: nickw
Body: <p>So i have been playing around with <code>neat-python</code>. I made a program, applying neat, to play pinball on the Atari 2600. The code for that can be found in the file <code>test2.py</code> <a href="https://github.com/niallmandal/atari_pinball_tutorial" rel="nofollow noreferrer">here</a></p>
  
  <p>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. </p>
  
  <p>What I have no clue how to do, is run 2 nets at the same time, on the same observation. The way that <code>neat-python</code> works, is you get the observation from a single function that goes through each genome and runs the environment.</p>
  
  <p>How would you create 2 <code>eval_genome</code> functions that can take in the same observation real-time? This means that they train based off of the same images and environmenrs.</p>
  
  <p>Help?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-20T14:01:03.800Z
Comments.Text: 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?
Comments.UserDisplayName: Jaden Travnik
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-20T16:41:48.870Z
Comments.Text: 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...
Comments.UserDisplayName: niallmandal
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-21T16:19:44.443Z
Comments.Text: Does anyone know how to solve this
Comments.UserDisplayName: niallmandal
Tags: <deep-learning><reinforcement-learning><python><neat><open-ai>
Title: Running 2 NEAT nets on the same observations
UserDisplayName: niallmandal
ThreadText: # Running 2 NEAT nets on the same observations
  
  (Asked by: username_0 on 2019-03-20)
  
  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](https://github.com/niallmandal/atari_pinball_tutorial)
  
  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?
  
  **Tags:** deep-learning, reinforcement-learning, python, neat, open-ai
  > **Comments:**
  > **username_1**: 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?  
  > **username_0**: 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...  
  > **username_0**: Does anyone know how to solve this  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2019-08-13. Score: 0
  
  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.
  
  
  ---
  
  ### Answer by username_3 on 2019-09-12. Score: 0
  
  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.
  
  
  ---
  
  