/* Data from Roger Johansson https://rogerjohansson.blog/2008/02/07/genetic-programming-math/ Should be (-1.7 + (( y + -0.35) * (x+x))) * +,-,*,/ with 1000 generations gen = 1354 (time: 46.355s) results_best = [[0.968827867912514,(Y + Y + -2.222252891968122 + 4.116473579367844 - 2.68229594811904) * X - 2.830992237586059 * 0.539699557954306]] stop_criteria 'generatios' reached gen = 824 (time: 27.476s) results_best = [[1.7505583236167,2.68229594811904 / -2.222252891968122 - X / (Y + Y) + (X + (-1.64777244285111 + Y + X) * Y)]] stop_criteria 'generatios' reached gen = 1286 (time: 43.920s) results_best = [[0.606039620038817,(Y + -1.64777244285111 + Y) * X + (X + ((X - X) * 2.984400334760733 - 3.401877171547095 * 0.539699557954306))]] stop_criteria 'generatios' reached * +,-,*,/,exp,log,pow2,pow3 with 1000 generations gen = 1667 (time: 52.310s) results_best = [[2.580983762339366,(Y + Y) * X - (X + log(exp(Y) * 2.68229594811904) / (Y * X))]] stop_criteria 'generatios' reached gen = 1661 (time: 50.977s) results_best = [[2.295227279787577,Y * (Y + X) - (log(pow3(Y)) - (-1.64777244285111 - 0.539699557954306))]] stop_criteria 'generatios' reached Cf number_puzzle2.conf */ import util. data(number_puzzle2,Data,Vars,Unknown,Ops,Constants,MaxSize,Params) :- Data = [ [[A,B],C] : [A,B,C] in chunks_of([ 2,2,4.9, 1,2,1.6, 3,1,2.2, 1,1,-0.4, 10,10,191.3 ],3)], Unknown = [3,1], Vars = ['X','Y'], % Ops = [+,-,*,/], Ops = [+,-,*,/,exp,log,pow2,pow3], Constants = [frand(-5,5) : _ in 1..10], MaxSize = 11, Params = new_map([approx=0.01, init_size=1000, num_gens=1800, stop_criteria=generatios ]).