/* From Eureqa list """ x y 1 5 2 4 3 3 4 2 5 1 6 12 7 14 8 16 9 18 It couldn't solve it. The right answer is y = less(x, 6)*(6-1) + not(less(x, 6) * 2 * x This is really y = if ( x < 6) then (6-1) else (2 * 6) [hakank: It should be y = if ( x < 6) then (6-x) else (2 * x) ] """ * Simpler variant: maxCount = 4 code = (X * if_then_else(X < 6, 1,2)) = [[[1],1],[[2],2],[[3],3],[[4],4],[[5],5],[[6],12],[[7],14],[[8],16],[[9],18]] = [[10] = 20] * Harder (original) problem: maxCount = 5 code = if_then_else(X < 6, (6 - X),(X * 2)) = [[[1],5],[[2],4],[[3],3],[[4],2],[[5],1],[[6],12],[[7],14],[[8],16],[[9],18]] = [[10] = 20] c Cf if_then_else_test.conf */ % % First a simpler version: % maxCount = 4 % % code = (X * if_then_else(X < 6, 1,2)) = [[[1],1],[[2],2],[[3],3],[[4],4],[[5],5],[[6],12],[[7],14],[[8],16],[[9],18]] = [[10] = 20] % data(if_then_else2,Data,Vars,Unknown,Ops,Constants,MaxC) :- println("\n\nSimpler problem"), Data = [ [[1],1], [[2],2], [[3],3], [[4],4], [[5],5], [[6],12], [[7],14], [[8],16], [[9],18] ], Unknown = [10], Vars = ["X"], % get_global_map().put("debug",true), Ops = new_map([infix=["*","<","-"] % ,"\\/"] , user3=["if_then_else"] , conditions=["<"] ]), Constants = [0,1,2,6], MaxC = 4. % This is the original problem data(if_then_else2,Data,Vars,Unknown,Ops,Constants,MaxC) :- println("\n\nHarder problem"), Data = [ [[1],5], [[2],4], [[3],3], [[4],2], [[5],1], [[6],12], [[7],14], [[8],16], [[9],18] ], Unknown = [10], Vars = ["X"], % get_global_map().put("debug",true), Ops = new_map([infix=["*","<","-"] % ,"\\/"] , user3=["if_then_else"] , conditions=["<"] ]), Constants = [0,1,2,6], MaxC = 8.