/* Test of exp Can we recover 2*exp(x) without exp? * Let's start with no noise: 2*exp(A) approx 0.1 Compare with the noise-free: Picat> X=2*exp(1) X = 5.43656365691809 * A little harder problem: 2*exp(A)+frand()/10 - 0.5 approx = 0.1 [program = exp(x) - 1 + exp(x) + 1.069799168533553 / 2,res = 4.971463241184867,count = 1] [program = exp(x) * 2 - 8 / 17.973083014587445,res = 4.991453600201222,count = 1] Compare with the noise-free Picat> X=2*exp(1) - 0.5 X = 4.93656365691809 * without exp: approx=0.1 stop_criteria=generations num_gens=1800 gen = 1786 (time: 102.540s) results_best = [[5601176.18397971894592,(16.761058958601694 + x) * x * (x * ((x - -5.901666109404371) * x))]] gen = 1306 (time: 68.462s) results_best = [[5137271.251957050524652,(x * (x / (9 / x)) - x) * (x * (x - 9 / cos(-3.990855116392883)) * x + x)]] adding pow_mod2 and sum_i gen = 1097 (time: 58.426s) results_best = [[2442900.649097330868244,pow_mod2(4,sum_i(5,x)) * sqrt(sum_i(10.79655345100749,x))]] gen = 1081 (time: 69.869s) results_best = [[254374.002386659121839,x / 1.069799168533553 * (sum_i(9,sum_i(10.79655345100749,x) * x) + x)]] Cf exp_formula_no_exp.conf */ import util. data(eureqa_test,Data,Vars,Unknown,Ops,Constants,MaxSize,Params) :- Data = [ [[A],B] : _ in 1..20, A = frand(-15,15), B=2*exp(A)+frand()/10], % Data = [ [[A],B] : _ in 1..20, A = frand(-15,15), B=2*exp(A)+frand()/10 - 0.5], Ops = [+,/,-,*,sin,cos,sqrt,log,pow_mod2,sum_i], Constants = 0..10 ++ [frand(-20,20) : _ in 1..10], Vars = ['x'], Unknown = [1], MaxSize = 51, Params = new_map([ approx=0.1, show_best=1, stop_criteria=generations, num_gens=1800 ]).