Using Artificial Intelligence to Write Self-Modifying/Improving Programs http://www.primaryobjects.com/2013/01/27/using-artificial-in...
Using Artificial Intelligence to Write Self-Modifying/Improving Programs http://www.primaryobjects.com/2013/01/27/using-artificial-in...
The outputs are like this for some not-so-easy targets:
Op nodes ['ADD', 'ADD', 'MUL'] EXPR: ['ADD[ni_99](ADD[ni_49](I__7[ni_43](), ADD[ni_19](I__8[ni_66](), ADD[ni_79](GET_CONST_3[ni_25](), I__9[ni_71]()))), I__1[ni_61]())', 'ADD[ni_13](I__6[ni_17](), ADD[ni_49](I__7[ni_43](), ADD[ni_19](I__8[ni_66](), ADD[ni_79](GET_CONST_3[ni_25](), I__9[ni_71]()))))', 'MUL[ni_68](GET_CONST_8[ni_73](), FLOAT[ni_42](I__1[ni_91]()))']
With genetic programming (using an AST), it can solve complex equations:
However, this simple equation i.e. correct answer "(a + b + c - d) / e" could be evolved and will result into either of these (depends on my luck maybe)
Case1: ((int)((b+((c-d)+a))/e)&(int)((b+((c-d)+a))/e))
Case2:
((((int)a&(int)(((((((mod(e,a)c)/e)(((((int)(d-a)&(int)b)+e)/a)/e))/((((int)e&(int)c)+e)+(c+(e/a))))c)/e)e))/((((int)e&(int)c)+e)+((b/e)+(e/e))))+(((((((((mod(e,a)c)/e)(((((int)(d-e)&(int)b)+e)/a)/e))/((((int)e&(int)c)+e)+((b/e)+(e/e))))c)/e) <..........10383 characters here.........> ))))))/e))/((((int)e&(int)c)+e)+(((d-e)/e)+((d/b)/e))))+(((mod(e,a)/e)+(b/e))+(((c/b)+((d+b)/e))/e)))))))))
The GP output (case 1 and 2) above was generated with a tweaked version of https://github.com/rogeralsing/go-genetic-math