title: Code generation by genetic algorithms
body: <p>Evolutionary programming seems to be a great way to solve many optimization problems. The idea is very easy and the implementation does not make problems.</p>
  
  <p>I was wondering if there is any way to evolutionarily create a program in ruby/python script (or any other language)?</p>
  
  <p>The idea is simple:</p>
  
  <ol>
  <li>Create a population of programs</li>
  <li>Perform genetic operations (roulette-wheel selection or any other selection), create new programs with inheritance from best programs, etc.</li>
  <li>Loop point 2 until program that will satisfy our condition is found</li>
  </ol>
  
  <p>But there are still few problems:</p>
  
  <ol>
  <li>How will chromosomes be represented? For example, should one cell of chromosome be one line of code?</li>
  <li>How will chromosomes be generated? If they will be lines of code, how do we generate them to ensure that they are syntactically correct, etc.?</li>
  </ol>
  
  <p>Example of a program that could be generated:</p>
  
  <p>Create script that takes N numbers as input and returns their mean as output.</p>
  
  <p>If there were any attempts to create such algorithms I'll be glad to see any links/sources.</p>