/* Multiplexer-3 (if then else) 1 address + 2^1 data = 3 See John R. Koza Genetic Programming - On the programming of computers by means of natural selection" (i.e. his first GP book) This is the same as (boolean) IfElse: If(A0) then (D1) else(D0) Solutions: maxCount = 3 code = if_then_else(A == 1, B,C) = [[[0,0,0],0],[[0,0,1],1],[[0,1,0],0],[[0,1,1],1],[[1,0,0],0],[[1,0,1],0],[[1,1,0],1]] = [[1,1,1] = 1] maxCount = 5 code = (C + (A * (B - C))) = [[[0,0,0],0],[[0,0,1],1],[[0,1,0],0],[[0,1,1],1],[[1,0,0],0],[[1,0,1],0],[[1,1,0],1]] = [[1,1,1] = 1] Cf http://hakank.org/jgap/multiplexer_3.conf */ data(if_then_else,Data,Vars,Unknown,Ops,Constants,MaxC) :- Data = [ [[0,0,0],0], [[0,0,1],1], [[0,1,0],0], [[0,1,1],1], [[1,0,0],0], [[1,0,1],0], [[1,1,0],1], [[1,1,1],1] ], Unknown = [1,1,1], Vars = ["A","B","C"], Ops = new_map([infix=["+","-","*"] , user3=["if_then_else"] , conditions=["=="] ]), Constants = 1..1, MaxC = 5.