#
# Fibonacci with index
#
# See http://en.wikipedia.org/wiki/Fibonacci_number#Closed_form_expression
#
# We try here to get the closed formula:
#    (phi^n - (1-phi)^n)/sqrt(5)
# where phi     = (1+sqrt(5))/2 = ~ 1.61803  (golden ratio)
#       sqrt(5) ~ 2.2361
# 
# Or using floor:
#   floor( (phi^n)/sqrt(5) + 1/2)
# 
# In J (for about 1..30):  ( 13 : '(<. ((phi^y)%s5)+1%2)') i.100x

# Some log:
# Best solution fitness: 85752.33
# Best solution: ((0.6955479784281469 ^ (1.6810859391942417 - ix)) * (0.8876638813288427 ^ (1.9517789254441649 - ix))) + ((sqrt (0.6955479784281469 ^ (0.6955479784281469 - ix))) * ix)
#
# From another run:
# Evolving generation 26630/118800(time from start: 1718,40s)
# Best solution fitness: 58448.07
# Best solution: (n - 7.979326202121674) * ((((9.69855780765146 * (sqrt ((n - 7.979326202121674) / 7.163723661151826))) ^ (n / 8.065133644786775)) + n) + 6.857455090229301)
# Depth of chrom: 8. Number of functions/terminals: 20 (10 functions, 10 terminals)
# Correlation coefficient: 0.9999998263210221
#
# Using the two constants and for n=0..21, a 0-fitness function was created:
# """
# Evolving generation 3450/118800(time from start: 90,61s)
# Best solution fitness: 0.0
# Best solution: floor (((floor ((1.618033988 ^ 3.6349817223309855) ^ (n / 3.6349817223309855))) + (floor 2.236067977)) / 2.236067977)
# Depth of chrom: 6. Number of functions+terminals: 14 (8 functions, 6 terminals)
# """
# It is simplified to this function:
#                                                    (0.2751045470 n)
#                                  floor(5.749978909                )
#

presentation: Fibonacci series, closed form
return_type: DoubleClass
num_input_variables: 1
variable_names: n f
functions: Multiply,Divide,Add,Subtract,Sqrt,Pow,Floor
terminal_range: 0 6
# terminal_wholenumbers: false
terminal_wholenumbers: false
# cheating: declaring sqrt(5) and phi as constants
# constant: 2.236067977
# constant: 1.618033988
max_init_depth: 6
# Eureqa has population size 128
# population_size: 64
population_size: 500
max_crossover_depth: 8
num_evolutions: 118800
max_nodes: 21
# tournament_selector_size: 6
# These mutation_prob and crossover_prob is taken from Eureqa
# mutation_prob: 0.03125
# crossover_prob: 0.75
# mutation_prob: 0.50
# crossover_prob: 0.50
mutation_prob: 0.10
crossover_prob: 0.90
show_progression: true
show_results: true
show_similiar: true
# using hits_criteria here don't "drive" the fitness very much
# hits_criteria: 0.1
# validation_pct: 0.25
# stop_criteria_fitness: 0.0
error_method: meanError
show_results: true
data
1 1
2 1
3 2
4 3
5 5
6 8
7 13
8 21
9 34
10 55
11 89
12 144
13 233
14 377
15 610
16 987
17 1597
18 2584
19 4181
20 6765
21 10946
22 17711
23 28657
24 46368
25 75025
26 121393
27 196418
28 317811
29 514229
30 832040
31 1346269
32 2178309
33 3524578
34 5702887
35 9227465
36 14930352
37 24157817
38 39088169
# 39 63245986
# 40 102334155
# 41 165580141
# 42 267914296
# 43 433494437
# 44 701408733
# 45 1134903170
# 46 1836311903
# 47 2971215073
# 48 4807526976
# 49 7778742049
# 50 12586269025
40 ?
