/* A puzzle. From http://gottwurfelt.wordpress.com/2012/02/22/a-puzzle/ http://gottwurfelt.wordpress.com/2012/02/24/an-answer-to-a-puzzle/ and http://www.hakank.org/picat/a_puzzle.pi This is probably futile for Symbolic Regression since the solution is to assign each digit to a specific value and then sum these values. (It's easy to solve it with constraint modelling, see a_puzzle.pi.) The best before I interrupted the program after 2h32min is: gen = 34382 (time: 8468.344s) results_best = [[9,if_then_else(9 + D == 5 * if_then_else(B,8,if_then_else(0 - A - 4,B,A)) == B != 4 * (A - A mod 8) * 6,if_then_else(C,1,5),3 * (6 == A))],[11,if_then_else(9 + D == 5 * if_then_else(B,8,if_then_else(0 - A - 4,B,A)) == B != 4 * (A - A mod 8) * 6,if_then_else(C,1,5),2 * (6 == B))],[11,if_then_else(9 + D == 5 * if_then_else(B,8,if_then_else(0 - A - 4,B,A)) == B != 4 * (A - A mod 8) * 6,if_then_else(C,1,5),(B == 6) * D)],[11,if_then_else(9 + D == 5 * if_then_else(B,8,if_then_else(0 - A - 4,B,A)) == B != 4 * (A - A mod 8) * 6,if_then_else(C,6 != 7,4),2 * (6 == B))],[11,if_then_else(9 + D == 5 * if_then_else(B,8,if_then_else(0 - A - 4,B,A)) == B != 4 * (A - A mod 8) * 6,if_then_else(C,6 != 7,4),(B == 6) * D)],[11,if_then_else(9 + D == 5 * if_then_else(B,8,if_then_else(0 - A - 4,B,A)) == B != 4 * (A - A mod 8) * 6,if_then_else(C,if_then_else(5,B - D,2 != C),if_then_else(7,0,4)),2 * (6 == B))],[11,if_then_else(9 + D == 5 * if_then_else(B,8,if_then_else(0 - A - 4,B,A)) == B != 4 * (A - A mod 8) * 6,if_then_else(C,if_then_else(5,B - D,2 != C),if_then_else(7,0,4)),(B == 6) * D)],[12,if_then_else(9 + D == 5 * if_then_else(B,8,if_then_else(0 - A - 4,B,A)) == B != 4 * (A - A mod 8) * 6,if_then_else(C,0,5),2 * (6 == B))],[12,if_then_else(9 + D == 5 * if_then_else(B,8,if_then_else(0 - A - 4,B,A)) == B != 4 * (A - A mod 8) * 6,if_then_else(C,0,5),(B == 6) * D)],[12,if_then_else(9 + D == 5 * if_then_else(B,8,if_then_else(0 - A - 4,B,A)) == B != 4 * (A - A mod 8) * 6,if_then_else(C,1,5),(8 == B) * 3)]] See a_puzzle.conf */ import util. data(a_puzzle,Data,Vars,Unknown,Ops,Constants,MaxSize,Params) :- Data = [ [[A,B,C,D], E] : [A,B,C,D,E] in chunks_of([ 8,8,0,9,6, 7,1,1,1,0, 2,1,7,2,0, 6,6,6,6,4, 1,1,1,1,0, 3,2,1,3,0, 7,6,6,2,2, 9,3,1,2,1, 0,0,0,0,4, 2,2,2,2,0, 3,3,3,3,0, 5,5,5,5,0, 8,1,9,3,3, 8,0,9,6,5, 7,7,7,7,0, 9,9,9,9,4, 7,7,5,6,1, 6,8,5,5,3, 9,8,8,1,5, 5,5,3,1,0 ],5)], Vars = ['A','B','C','D'], Unknown = [2,5,8,1], Ops = [+,*,/,-,mod,if_then_else,==,!=], Constants = 0..9, Params = new_map(), MaxSize = 51.