Answers.Body: <p>I have not touched Obj-C, but I've played with evolution in PHP, which wasn't designed for that at all. If a slow script language on my 10-year old desktop PC can do it, Obj-C should be able to handle that.</p>
  
  <p>Some tricks:</p>
  
  <ol>
  <li>This is a game, so - I assume - you've disabled all the graphics. A headless program is ideal for training. Waste no CPU cycles on stuff you don't need!</li>
  <li>Use more threads/instances. Threads around the number of cores should be ideal.</li>
  <li>Watch out for memory leaks! Even languages with GC can have problems with this when used in a wrong way. But you'll need to fix these bugs anyway. You can monitor memory consumption when you run it, and if it increases more-or-less steadily, that's a problem. There are various tools against memleaks under different systems/languages, I guess Obj-C has something similar. (these tools log every allocation and release, and list everything at exit that's left)</li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-02T09:30:13.337Z
Answers.Text: Thank you sharing your experience :-)
  
  1) Yes, this has been done. I think I will go even farther by making it a pure console program with some scheduling to come over the repeated crash issues
  
  2) Not sure I have control on the cores. I think the Xcode simulator has full control on it and optimizes their use. 
  
  3) Indeed, the garbage collector is not efficient at all. and the program was quickly leaking. Using manual @autorlease allow me to contain the memory usage to 1-5 Gb
Answers.UserDisplayName: Carrier Battles
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-26T11:58:47.247Z
Answers.LastActivityDate: 2019-02-26T11:58:47.247Z
Answers.UserDisplayName: Nyos
Body: <p>I have a complex wargame already developed in a aging Objective-C and I would like to improve the AI</p>
  
  <p>I have built the logic for self-play, fitness evaluation and evolution
  The hard-time is the ability to run a lot of experiences of self-play with limited ressources (single Mac). Time is a factor but also memory. I am facing some random crashed after a given number of games</p>
  
  <p><strong>I was wondering</strong> 
  - if people have faced the same issues with a large number of runs with objective-C 
  - if other people have tried to use Genetic Programming or Reinforcement Learning with Objective-C or C#</p>
  
Tags: <game-ai><genetic-programming>
Title: Genetic programming with Objective-C
UserDisplayName: Carrier Battles
ThreadText: # Genetic programming with Objective-C
  
  (Asked by: username_0 on 2019-02-24)
  
  I have a complex wargame already developed in a aging Objective-C and I would like to improve the AI
  
  I have built the logic for self-play, fitness evaluation and evolution
  The hard-time is the ability to run a lot of experiences of self-play with limited ressources (single Mac). Time is a factor but also memory. I am facing some random crashed after a given number of games
  
  **I was wondering**
  - if people have faced the same issues with a large number of runs with objective-C
  - if other people have tried to use Genetic Programming or Reinforcement Learning with Objective-C or C#
  
  **Tags:** game-ai, genetic-programming
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-02-26. Score: 2
  
  I have not touched Obj-C, but I've played with evolution in PHP, which wasn't designed for that at all. If a slow script language on my 10-year old desktop PC can do it, Obj-C should be able to handle that.
  
  Some tricks:
  
  1. This is a game, so - I assume - you've disabled all the graphics. A headless program is ideal for training. Waste no CPU cycles on stuff you don't need!
  2. Use more threads/instances. Threads around the number of cores should be ideal.
  3. Watch out for memory leaks! Even languages with GC can have problems with this when used in a wrong way. But you'll need to fix these bugs anyway. You can monitor memory consumption when you run it, and if it increases more-or-less steadily, that's a problem. There are various tools against memleaks under different systems/languages, I guess Obj-C has something similar. (these tools log every allocation and release, and list everything at exit that's left)
  
  > **Comments:**
  > **username_0**: Thank you sharing your experience :-)  1) Yes, this has been done. I think I will go even farther by making it a pure console program with some scheduling to come over the repeated crash issues  2) Not sure I have control on the cores. I think the Xcode simulator has full control on it and optimizes their use.   3) Indeed, the garbage collector is not efficient at all. and the program was quickly leaking. Using manual @autorlease allow me to contain the memory usage to 1-5 Gb  
  
  ---
  
  