# 
# https://www.facebook.com/Lustify/posts/1319105168505523
#  1 + 4 = 5
#  2 + 5 = 12
#  3 + 6 = 21
#  5 + 8 = ??
#
# Cf facebook_puzzle.conf
# 
# This use a different representation where the previous
# line is also included.
#
# Found programs::
# * V4 + (V3 + V5)
#   5 + (21 + 8) = 34
#
# * (V5 + V4) + (V5 * V1)
#   (5+8)+(3*8) = 37
#
# * (V5 * V4) + V4
#   (8 * 5) + 5 = 45
# 
presentation: Puzzle
# return_type:IntegerClass
# num_input_variables: 5
# output_variable:1
# variable_names: a b c x y z
functions: Multiply,Add,Divide,Subtract,Pow
# functions: Multiply,Add,Divide,Subtract
# functions: Multiply,Add,Subtract
# This give "(a*b) + a"
# functions: Add,Multiply
# functions: Add,Pow
# functions: ForLoopD
# functions: Add,ForLoopD
# functions: Add,ForXLoop,SubProgram
# functions: Add,LoopD
# functions: Multiply,Divide,Add,Subtract,Modulo,GreaterThan,LesserThan,IfElse,If,Equals,And,Or,Not,Xor
# functions: Add,Modulo,SubProgram,Tupel,Argument,StoreTerminal
# functions: Add,Modulo
# functions: Add,Multiply,SubProgram,Tupel,Argument,StoreTerminal
# functions: Multiply,Divide,Subtract,Modulo,GreaterThan,LesserThan,IfElse,If,Equals,ForXLoop,Increment,ForLoop,Loop,Pop,Push,And,Or,Not,Xor,SubProgram,Tupel,Argument,StoreTerminal
# functions: Multiply,Divide,Add,Subtract,LoopD
# functions: Add,Multiply,ForXLoop,ForLoop,Loop,SubProgram,Tupel,Argument,StoreTerminal
# functions: Add,GreaterThan,LesserThan,IfElse,If,Equals,ForXLoop,Increment,ForLoop,Loop,Pop,Push,And,Or,Not,Xor,SubProgram,Tupel,Argument,StoreTerminal
# adf_arity: 3
# adf_type: integer
# adf_functions: Multiply,Add
# adf_functions: IfElse,If,Equals,ForXLoop,Increment,ForLoop,Loop,Pop,Push,And,Or,Not,Xor,SubProgram,Tupel,Argument,StoreTerminal
terminal_range: -100 100
# terminal_wholenumbers: true
max_init_depth: 8
population_size: 1000
max_crossover_depth: 8
num_evolutions: 1000
# max_nodes: 51
max_nodes: 21
mutation_prob: 0.15
crossover_prob: 0.9
# crossover_prob: 0.96
show_similiar: true
# show_population: true
show_results: true
# stop_criteria_fitness: 0
data
0 0 0  1 4 5
1 4 5  2 5 12
2 5 12 3 6 21
3 6 21 5 8 ?

# Force solutions
# 3 6 21 5 8 45
# 3 6 21 5 8 34
# 3 6 21 5 8 37
# 3 6 21 5 8 111
# 3 6 21 5 8 21
# 3 6 21 5 8 3

# Test with Picat:
# For 111:
# Picat> V1=3,V2=6,V3=21,V4=5,V5=8,X = (((V5 * V4) + V4) - V3) + (V4 * (((V5 * V4) - (V5 / V4)) - V3))
# X = 111.0
