/* 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) ] """ The simple version: X * (5 < X) + X = 20 X + X * (5 < X) = 20 X + (5 < X) * X = 20 if_then_else(5 < X,X + X,(if_then_else(X,X,X) < 10) * X) = 20 The original version: Found in generation 479: [program = if_then_else(5 < X,2 * (X - 0),6 - X),res = 20,count = 1] gen = 57: [program = if_then_else(5 < X,X + X,6 - X),res = 20,count = 1] gen = 421 [program = if_then_else(5 < X,if_then_else(X,X > X,X) + X,6 - X),res = 20,count = 1] */ data(if_then_else2,Data,Vars,Unknown,Ops,Constants,MaxSize,Params) :- % Simple version % Data = [ % [[1],1], % [[2],2], % [[3],3], % [[4],4], % [[5],5], % [[6],12], % [[7],14], % [[8],16], % [[9],18] % ], % Original Data = [ [[1],5], [[2],4], [[3],3], [[4],2], [[5],1], [[6],12], [[7],14], [[8],16], [[9],18] ], Unknown = [10], Vars = ['X'], Ops = [*,+,-,if_then_else,<,<=,>,>=], Constants = 0..10, Params = new_map(), MaxSize = 18.