rubyneat 0.3.5.alpha.3 → 0.3.5.alpha.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (252) hide show
  1. checksums.yaml +4 -4
  2. data/.semver +1 -1
  3. data/Gemfile +19 -19
  4. data/Gemfile.lock +39 -33
  5. data/README.md +66 -0
  6. data/Rakefile +19 -2
  7. data/bin/neat +4 -60
  8. data/lib/rubyneat/cli.rb +5 -0
  9. data/lib/rubyneat/cli/generate.rb +131 -0
  10. data/lib/rubyneat/cli/main.rb +54 -0
  11. data/lib/rubyneat/cli/templates/generate/Gemfile.tt +17 -0
  12. data/lib/rubyneat/cli/templates/generate/README.md.tt +1 -0
  13. data/lib/rubyneat/cli/templates/generate/bin/neat.tt +14 -0
  14. data/{neater/xor_neat.rb → lib/rubyneat/cli/templates/generate/neater.tt} +7 -22
  15. data/rubyneat.gemspec +73 -297
  16. data/rubyneat.gemspec.orig +384 -0
  17. metadata +76 -292
  18. data/.idea/.name +0 -1
  19. data/.idea/.rakeTasks +0 -7
  20. data/.idea/dictionaries/trader.xml +0 -3
  21. data/.idea/encodings.xml +0 -5
  22. data/.idea/misc.xml +0 -5
  23. data/.idea/modules.xml +0 -9
  24. data/.idea/rubyneat.iml +0 -198
  25. data/.idea/runConfigurations/invpend_neat.xml +0 -26
  26. data/.idea/runConfigurations/sigdebug_neat.xml +0 -24
  27. data/.idea/runConfigurations/xor_neat.xml +0 -26
  28. data/.idea/runConfigurations/xordebug_neat.xml +0 -24
  29. data/.idea/runConfigurations/xorsin_neat.xml +0 -24
  30. data/.idea/scopes/scope_settings.xml +0 -5
  31. data/.idea/vcs.xml +0 -7
  32. data/.idea/workspace.xml +0 -1151
  33. data/.yardoc/checksums +0 -11
  34. data/.yardoc/object_types +0 -0
  35. data/.yardoc/objects/root.dat +0 -0
  36. data/.yardoc/proxy_types +0 -0
  37. data/Guardfile +0 -8
  38. data/doc/ControllerPoint.html +0 -125
  39. data/doc/CuteA.html +0 -286
  40. data/doc/CuteB.html +0 -297
  41. data/doc/DSL.html +0 -883
  42. data/doc/NEAT.html +0 -588
  43. data/doc/NEAT/BasicNeuronTypes.html +0 -136
  44. data/doc/NEAT/BasicNeuronTypes/BiasNeuron.html +0 -518
  45. data/doc/NEAT/BasicNeuronTypes/CosineNeuron.html +0 -274
  46. data/doc/NEAT/BasicNeuronTypes/InputNeuron.html +0 -366
  47. data/doc/NEAT/BasicNeuronTypes/SigmoidNeuron.html +0 -275
  48. data/doc/NEAT/BasicNeuronTypes/SineNeuron.html +0 -274
  49. data/doc/NEAT/BasicNeuronTypes/TanhNeuron.html +0 -274
  50. data/doc/NEAT/Controller.html +0 -2490
  51. data/doc/NEAT/Controller/NeatSettings.html +0 -3985
  52. data/doc/NEAT/Critter.html +0 -1037
  53. data/doc/NEAT/Critter/Genotype.html +0 -1601
  54. data/doc/NEAT/Critter/Genotype/Gene.html +0 -979
  55. data/doc/NEAT/Critter/Phenotype.html +0 -603
  56. data/doc/NEAT/DSL.html +0 -1255
  57. data/doc/NEAT/Evaluator.html +0 -420
  58. data/doc/NEAT/Evolver.html +0 -602
  59. data/doc/NEAT/Evolver/CritterOp.html +0 -551
  60. data/doc/NEAT/Expressor.html +0 -327
  61. data/doc/NEAT/Graph.html +0 -402
  62. data/doc/NEAT/Graph/DependencyResolver.html +0 -478
  63. data/doc/NEAT/Graph/GraphException.html +0 -123
  64. data/doc/NEAT/NeatException.html +0 -123
  65. data/doc/NEAT/NeatOb.html +0 -567
  66. data/doc/NEAT/Neuron.html +0 -1067
  67. data/doc/NEAT/Operator.html +0 -162
  68. data/doc/NEAT/Population.html +0 -1961
  69. data/doc/NEAT/Trait.html +0 -169
  70. data/doc/_index.html +0 -373
  71. data/doc/class_list.html +0 -54
  72. data/doc/css/common.css +0 -1
  73. data/doc/css/full_list.css +0 -57
  74. data/doc/css/style.css +0 -339
  75. data/doc/file_list.html +0 -53
  76. data/doc/frames.html +0 -26
  77. data/doc/index.html +0 -373
  78. data/doc/js/app.js +0 -219
  79. data/doc/js/full_list.js +0 -178
  80. data/doc/js/jquery.js +0 -4
  81. data/doc/method_list.html +0 -1415
  82. data/doc/top-level-namespace.html +0 -164
  83. data/foo/foo_aquarium_example.rb +0 -38
  84. data/foo/foo_gosu.rb +0 -99
  85. data/foo/foo_rubygoo.rb +0 -104
  86. data/foo/foo_sdl.rb +0 -34
  87. data/foo/icon.png +0 -0
  88. data/neater/invpend_neat.rb +0 -150
  89. data/neater/rnlib/inverted_pendulum.rb +0 -380
  90. data/neater/rnlib/xor.rb +0 -10
  91. data/neater/sigdebug_neat.rb +0 -136
  92. data/neater/xoranalog_neat.rb +0 -138
  93. data/neater/xorsin_neat.rb +0 -143
  94. data/projectFilesBackup/.idea/rubyneat.iml +0 -180
  95. data/public/.directory +0 -4
  96. data/public/background.png +0 -0
  97. data/public/background.xcf +0 -0
  98. data/public/cart.png +0 -0
  99. data/public/cart.xcf +0 -0
  100. data/public/metalpoles_molton_ball_l.jpg +0 -0
  101. data/public/old_background.png +0 -0
  102. data/public/pointer.png +0 -0
  103. data/public/pointer.xcf +0 -0
  104. data/public/pole.kra +0 -0
  105. data/public/pole.png +0 -0
  106. data/public/pole.xcf +0 -0
  107. data/public/wheel-of-year-stone-DD-131-WOYS.jpg +0 -0
  108. data/public/wheel.png +0 -0
  109. data/public/wheel.xcf +0 -0
  110. data/public/wood-planks-texture.jpg +0 -0
  111. data/rdoc/ControllerPoint.html +0 -116
  112. data/rdoc/CuteA.html +0 -177
  113. data/rdoc/CuteB.html +0 -178
  114. data/rdoc/DSLSetup.html +0 -177
  115. data/rdoc/GameTestWindow.html +0 -242
  116. data/rdoc/GameWindow.html +0 -292
  117. data/rdoc/Gemfile.html +0 -215
  118. data/rdoc/Gemfile_lock.html +0 -327
  119. data/rdoc/GraphTest.html +0 -210
  120. data/rdoc/Guardfile.html +0 -198
  121. data/rdoc/InvertedPendulum.html +0 -198
  122. data/rdoc/InvertedPendulum/Cart.html +0 -668
  123. data/rdoc/InvertedPendulum/DSL.html +0 -259
  124. data/rdoc/InvertedPendulum/InvPendWindow.html +0 -402
  125. data/rdoc/Logger.html +0 -98
  126. data/rdoc/NEAT.html +0 -422
  127. data/rdoc/NEAT/BasicNeuronTypes.html +0 -107
  128. data/rdoc/NEAT/BasicNeuronTypes/BiasNeuron.html +0 -265
  129. data/rdoc/NEAT/BasicNeuronTypes/CosineNeuron.html +0 -162
  130. data/rdoc/NEAT/BasicNeuronTypes/InputNeuron.html +0 -206
  131. data/rdoc/NEAT/BasicNeuronTypes/SigmoidNeuron.html +0 -162
  132. data/rdoc/NEAT/BasicNeuronTypes/SineNeuron.html +0 -162
  133. data/rdoc/NEAT/BasicNeuronTypes/TanhNeuron.html +0 -161
  134. data/rdoc/NEAT/Controller.html +0 -729
  135. data/rdoc/NEAT/Controller/NeatSettings.html +0 -880
  136. data/rdoc/NEAT/Critter.html +0 -489
  137. data/rdoc/NEAT/Critter/Genotype.html +0 -735
  138. data/rdoc/NEAT/Critter/Genotype/Gene.html +0 -457
  139. data/rdoc/NEAT/Critter/Phenotype.html +0 -330
  140. data/rdoc/NEAT/DSL.html +0 -729
  141. data/rdoc/NEAT/Evaluator.html +0 -256
  142. data/rdoc/NEAT/Evolver.html +0 -891
  143. data/rdoc/NEAT/Evolver/CritterOp.html +0 -349
  144. data/rdoc/NEAT/Expressor.html +0 -402
  145. data/rdoc/NEAT/Graph.html +0 -263
  146. data/rdoc/NEAT/Graph/DependencyResolver.html +0 -291
  147. data/rdoc/NEAT/Graph/GraphException.html +0 -105
  148. data/rdoc/NEAT/NeatException.html +0 -105
  149. data/rdoc/NEAT/NeatOb.html +0 -325
  150. data/rdoc/NEAT/Neuron.html +0 -481
  151. data/rdoc/NEAT/Operator.html +0 -109
  152. data/rdoc/NEAT/Population.html +0 -935
  153. data/rdoc/NEAT/Trait.html +0 -117
  154. data/rdoc/Object.html +0 -384
  155. data/rdoc/Phi.html +0 -98
  156. data/rdoc/Player.html +0 -383
  157. data/rdoc/Rakefile.html +0 -254
  158. data/rdoc/RubyNEAT.html +0 -98
  159. data/rdoc/RubyNEAT/Application.html +0 -105
  160. data/rdoc/SDL.html +0 -98
  161. data/rdoc/SDL/Event2.html +0 -98
  162. data/rdoc/Vector.html +0 -195
  163. data/rdoc/created.rid +0 -125
  164. data/rdoc/doc/ControllerPoint_html.html +0 -299
  165. data/rdoc/doc/CuteA_html.html +0 -438
  166. data/rdoc/doc/CuteB_html.html +0 -436
  167. data/rdoc/doc/DSL_html.html +0 -992
  168. data/rdoc/doc/NEAT/BasicNeuronTypes/BiasNeuron_html.html +0 -617
  169. data/rdoc/doc/NEAT/BasicNeuronTypes/CosineNeuron_html.html +0 -413
  170. data/rdoc/doc/NEAT/BasicNeuronTypes/InputNeuron_html.html +0 -498
  171. data/rdoc/doc/NEAT/BasicNeuronTypes/SigmoidNeuron_html.html +0 -413
  172. data/rdoc/doc/NEAT/BasicNeuronTypes/SineNeuron_html.html +0 -413
  173. data/rdoc/doc/NEAT/BasicNeuronTypes/TanhNeuron_html.html +0 -412
  174. data/rdoc/doc/NEAT/BasicNeuronTypes_html.html +0 -310
  175. data/rdoc/doc/NEAT/Controller/NeatSettings_html.html +0 -3324
  176. data/rdoc/doc/NEAT/Controller_html.html +0 -2212
  177. data/rdoc/doc/NEAT/Critter/Genotype/Gene_html.html +0 -997
  178. data/rdoc/doc/NEAT/Critter/Genotype_html.html +0 -1556
  179. data/rdoc/doc/NEAT/Critter/Phenotype_html.html +0 -687
  180. data/rdoc/doc/NEAT/Critter_html.html +0 -1037
  181. data/rdoc/doc/NEAT/DSL_html.html +0 -1349
  182. data/rdoc/doc/NEAT/Evaluator_html.html +0 -556
  183. data/rdoc/doc/NEAT/Evolver/CritterOp_html.html +0 -690
  184. data/rdoc/doc/NEAT/Evolver_html.html +0 -677
  185. data/rdoc/doc/NEAT/Expressor_html.html +0 -468
  186. data/rdoc/doc/NEAT/Graph/DependencyResolver_html.html +0 -598
  187. data/rdoc/doc/NEAT/Graph/GraphException_html.html +0 -299
  188. data/rdoc/doc/NEAT/Graph_html.html +0 -527
  189. data/rdoc/doc/NEAT/NeatException_html.html +0 -299
  190. data/rdoc/doc/NEAT/NeatOb_html.html +0 -671
  191. data/rdoc/doc/NEAT/Neuron_html.html +0 -1095
  192. data/rdoc/doc/NEAT/Operator_html.html +0 -337
  193. data/rdoc/doc/NEAT/Population_html.html +0 -1795
  194. data/rdoc/doc/NEAT/Trait_html.html +0 -344
  195. data/rdoc/doc/NEAT_html.html +0 -736
  196. data/rdoc/doc/_index_html.html +0 -559
  197. data/rdoc/doc/class_list_html.html +0 -369
  198. data/rdoc/doc/css/common_css.html +0 -188
  199. data/rdoc/doc/css/full_list_css.html +0 -243
  200. data/rdoc/doc/css/style_css.html +0 -530
  201. data/rdoc/doc/file_list_html.html +0 -240
  202. data/rdoc/doc/frames_html.html +0 -217
  203. data/rdoc/doc/index_html.html +0 -559
  204. data/rdoc/doc/js/app_js.html +0 -423
  205. data/rdoc/doc/js/full_list_js.html +0 -372
  206. data/rdoc/doc/js/jquery_js.html +0 -1536
  207. data/rdoc/doc/method_list_html.html +0 -1375
  208. data/rdoc/doc/top-level-namespace_html.html +0 -317
  209. data/rdoc/fonts.css +0 -167
  210. data/rdoc/fonts/Lato-Light.ttf +0 -0
  211. data/rdoc/fonts/Lato-LightItalic.ttf +0 -0
  212. data/rdoc/fonts/Lato-Regular.ttf +0 -0
  213. data/rdoc/fonts/Lato-RegularItalic.ttf +0 -0
  214. data/rdoc/fonts/SourceCodePro-Bold.ttf +0 -0
  215. data/rdoc/fonts/SourceCodePro-Regular.ttf +0 -0
  216. data/rdoc/images/add.png +0 -0
  217. data/rdoc/images/arrow_up.png +0 -0
  218. data/rdoc/images/brick.png +0 -0
  219. data/rdoc/images/brick_link.png +0 -0
  220. data/rdoc/images/bug.png +0 -0
  221. data/rdoc/images/bullet_black.png +0 -0
  222. data/rdoc/images/bullet_toggle_minus.png +0 -0
  223. data/rdoc/images/bullet_toggle_plus.png +0 -0
  224. data/rdoc/images/date.png +0 -0
  225. data/rdoc/images/delete.png +0 -0
  226. data/rdoc/images/find.png +0 -0
  227. data/rdoc/images/loadingAnimation.gif +0 -0
  228. data/rdoc/images/macFFBgHack.png +0 -0
  229. data/rdoc/images/package.png +0 -0
  230. data/rdoc/images/page_green.png +0 -0
  231. data/rdoc/images/page_white_text.png +0 -0
  232. data/rdoc/images/page_white_width.png +0 -0
  233. data/rdoc/images/plugin.png +0 -0
  234. data/rdoc/images/ruby.png +0 -0
  235. data/rdoc/images/tag_blue.png +0 -0
  236. data/rdoc/images/tag_green.png +0 -0
  237. data/rdoc/images/transparent.png +0 -0
  238. data/rdoc/images/wrench.png +0 -0
  239. data/rdoc/images/wrench_orange.png +0 -0
  240. data/rdoc/images/zoom.png +0 -0
  241. data/rdoc/index.html +0 -282
  242. data/rdoc/js/darkfish.js +0 -140
  243. data/rdoc/js/jquery.js +0 -18
  244. data/rdoc/js/navigation.js +0 -142
  245. data/rdoc/js/search.js +0 -109
  246. data/rdoc/js/search_index.js +0 -1
  247. data/rdoc/js/searcher.js +0 -228
  248. data/rdoc/rdoc.css +0 -580
  249. data/rdoc/rubyneat_gemspec.html +0 -387
  250. data/rdoc/table_of_contents.html +0 -2502
  251. data/rdoc/xordebug_log.html +0 -170598
  252. data/rdoc/xorsin_log.html +0 -22569
@@ -1,138 +0,0 @@
1
- #!/usr/bin/env neat
2
- require 'rubyneat/dsl'
3
- require 'xor'
4
-
5
- include NEAT::DSL
6
-
7
- #= TEST FOR RubyNEAT -- Analog Fitness Vector for XOR
8
-
9
- # The number of inputs to the xor function
10
- XOR_INPUTS = 2
11
- XOR_STATES = 2 ** XOR_INPUTS
12
- MAX_FIT = XOR_STATES
13
- ALMOST_FIT = XOR_STATES - 0.3
14
-
15
- # This defines the controller
16
- define "XOR Analog Fitness System" do
17
- # Define the IO neurons
18
- inputs {
19
- cinv = Hash[(1..XOR_INPUTS).map{|i| [("i%s" % i).to_sym, InputNeuron]}]
20
- cinv[:bias] = BiasNeuron
21
- cinv
22
- }
23
- outputs out: TanhNeuron
24
-
25
- # Hidden neuron specification is optional.
26
- # The name given here is largely meaningless, but may be useful as some sort
27
- # of unique flag.
28
- hidden tan: TanhNeuron
29
-
30
- ### Settings
31
- ## General
32
- hash_on_fitness false
33
- start_population_size 30
34
- population_size 30
35
- max_generations 10000
36
- max_population_history 10
37
-
38
- ## Evolver probabilities and SDs
39
- # Perturbations
40
- mutate_perturb_gene_weights_prob 0.10
41
- mutate_perturb_gene_weights_sd 0.50
42
-
43
- # Complete Change of weight
44
- mutate_change_gene_weights_prob 0.05
45
- mutate_change_gene_weights_sd 2.00
46
-
47
-
48
- # Adding new neurons and genes
49
- mutate_add_neuron_prob 0.07
50
- mutate_add_gene_prob 0.20
51
-
52
- # Switching genes on and off
53
- mutate_gene_disable_prob 0.01
54
- mutate_gene_reenable_prob 0.01
55
-
56
- interspecies_mate_rate 0.03
57
- mate_only_prob 0.10 #0.7
58
-
59
- # Mating
60
- survival_threshold 0.20 # top % allowed to mate in a species.
61
- survival_mininum_per_species 4 # for small populations, we need SOMETHING to go on.
62
-
63
- # Fitness costs
64
- fitness_cost_per_neuron 0#.00001
65
- fitness_cost_per_gene 0#.00001
66
-
67
- # Speciation
68
- compatibility_threshold 2.5
69
- disjoint_coefficient 0.6
70
- excess_coefficient 0.6
71
- weight_coefficient 0.2
72
- max_species 20
73
- dropoff_age 15
74
- smallest_species 5
75
-
76
- # Sequencing
77
- start_sequence_at 0
78
- end_sequence_at 2 ** XOR_INPUTS - 1
79
- end
80
-
81
- evolve do
82
- # This query shall return a vector result that will serve
83
- # as the inputs to the critter.
84
- query { |seq|
85
- # We'll use the seq to create the xor sequences via
86
- # the least signficant bits.
87
- condition_boolean_vector (0 ... XOR_INPUTS).map{|i| (seq & (1 << i)) != 0}
88
- }
89
-
90
- # Compare the fitness of two critters. We may choose a different ordering
91
- # here.
92
- compare {|f1, f2| f2 <=> f1 }
93
-
94
- # Here we integrate the cost with the fitness.
95
- cost { |fitvec, cost|
96
- fit = XOR_STATES - fitvec.reduce {|a,r| a+r} - cost
97
- $log.debug ">>>>>>> fitvec #{fitvec} => #{fit}, cost #{cost}"
98
- fit
99
- }
100
-
101
- fitness { |vin, vout, seq|
102
- unless vout == :error
103
- bin = uncondition_boolean_vector vin
104
- bout = uncondition_boolean_vector vout
105
- bactual = [xor(*vin)]
106
- vactual = condition_boolean_vector bactual
107
- #fit = (bout == bactual) ? 0.00 : 1.00
108
- fit = simple_fitness_error(vout, vactual) / 2.0
109
- bfit = (bout == bactual) ? 'T' : 'F'
110
- $log.debug "(%s) Fitness bin=%s, bout=%s, bactual=%s, vout=%s, fit=%6.3f, seq=%s" % [bfit,
111
- bin,
112
- bout,
113
- bactual,
114
- vout,
115
- fit,
116
- seq]
117
- fit
118
- else
119
- $log.debug "Error on #{vin} [#{seq}]"
120
- 1.0
121
- end
122
- }
123
-
124
- stop_on_fitness {|fitness, c|
125
- puts "*** Generation Run #{c.generation_num}, best is #{fitness[:best]} ***\n\n"
126
- fitness[:best] >= ALMOST_FIT
127
- }
128
- end
129
-
130
- report do |rept|
131
- $log.info "REPORT #{rept.to_yaml}"
132
- end
133
-
134
- # The block here is called upon the completion of each generation
135
- run_engine do |c|
136
- $log.info "******** Run of generation %s completed, history count %d ********" %
137
- [c.generation_num, c.population_history.size]
138
- end
@@ -1,143 +0,0 @@
1
- #!/usr/bin/env neat
2
- require 'rubyneat/dsl'
3
- require 'xor'
4
-
5
- include NEAT::DSL
6
-
7
- #= DEBUGGING FOR RubyNEAT using SineNeurons
8
-
9
- # The number of inputs to the xor function
10
- XOR_INPUTS = 2
11
- XOR_STATES = 2 ** XOR_INPUTS
12
- MAX_FIT = XOR_STATES
13
- ALMOST_FIT = (XOR_STATES - 0.5)
14
-
15
- # This defines the controller
16
- define "XOR Sin CPPN Debug System" do
17
- # Define the IO neurons
18
- inputs {
19
- cinv = Hash[(1..XOR_INPUTS).map{|i| [("i%s" % i).to_sym, InputNeuron]}]
20
- cinv[:bias] = BiasNeuron
21
- cinv
22
- }
23
- outputs out: SineNeuron
24
-
25
- # Hidden neuron specification is optional.
26
- # The key names given here is largely meaningless,
27
- # but may be useful as some sort
28
- # of unique flag.
29
- hidden sin: SineNeuron, cos: CosineNeuron, tanh: TanhNeuron
30
-
31
- ### Settings
32
- ## General
33
- hash_on_fitness = false
34
- start_population_size 60
35
- population_size 60
36
- max_generations 10000
37
- max_population_history 10
38
-
39
- ## Evolver probabilities and SDs
40
- # Perturbations
41
- mutate_perturb_gene_weights_prob 0.200
42
- mutate_perturb_gene_weights_sd 0.25
43
-
44
- # Complete Change of weight
45
- mutate_change_gene_weights_prob 0.01
46
- mutate_change_gene_weights_sd 2.00
47
-
48
- # Adding new neurons and genes
49
- mutate_add_neuron_prob 0.20
50
- mutate_add_gene_prob 0.20
51
-
52
- # Switching genes on and off
53
- mutate_gene_disable_prob 0.01
54
- mutate_gene_reenable_prob 0.01
55
-
56
- interspecies_mate_rate 0.03
57
- mate_only_prob 0.05
58
-
59
- # Mating
60
- survival_threshold 0.20 # top % allowed to mate in a species.
61
- survival_mininum_per_species 4 # for small populations, we need SOMETHING to go on.
62
-
63
- # Fitness costs
64
- fitness_cost_per_neuron 0.00001
65
- fitness_cost_per_gene 0.00001
66
-
67
- # Speciation
68
- compatibility_threshold 2.5
69
- disjoint_coefficient 0.6
70
- excess_coefficient 0.6
71
- weight_coefficient 0.2
72
- max_species 20
73
- dropoff_age 15
74
- smallest_species 5
75
-
76
- # Sequencing
77
- start_sequence_at 0
78
- end_sequence_at 2 ** XOR_INPUTS - 1
79
- end
80
-
81
- evolve do
82
- # This query shall return a vector result that will serve
83
- # as the inputs to the critter.
84
- query { |seq| @seq = seq
85
- # We'll use the seq to create the xor sequences via
86
- # the least signficant bits.
87
- condition_boolean_vector (0 ... XOR_INPUTS).map{|i| (seq & (1 << i)) != 0}
88
- }
89
-
90
- # This block is called directly by the neuron through its yield, if given.
91
- # It will be called repeatedly until you return false here.
92
- recurrence { |outvec| false }
93
-
94
- # Compare the fitness of two critters. We may choose a different ordering
95
- # here.
96
- compare {|f1, f2| f2 <=> f1 }
97
-
98
- # Here we integrate the cost with the fitness.
99
- cost { |fitvec, cost|
100
- fit = (XOR_STATES - fitvec.reduce {|a,r| a+r}) - cost # ((rand(5) == 0) ? cost : 0)
101
- $log.debug ">>>>>>> fitvec #{fitvec} => #{fit}, cost #{cost}"
102
- fit
103
- }
104
-
105
- fitness { |vin, vout, seq|
106
- unless vout == :error
107
- bin = uncondition_boolean_vector vin
108
- bout = uncondition_boolean_vector vout
109
- bactual = [xor(*vin)]
110
- vactual = condition_boolean_vector bactual
111
- fit = (bout == bactual) ? 0.00 : 1.00
112
- #simple_fitness_error(vout, vactual.map{|f| f * 0.50 })
113
- bfit = (bout == bactual) ? 'T' : 'F'
114
- $log.debug "(%s) Fitness bin=%s, bout=%s, bactual=%s, vout=%s, fit=%6.3f, seq=%s" % [bfit,
115
- bin,
116
- bout,
117
- bactual,
118
- vout,
119
- fit,
120
- seq]
121
- fit
122
- else
123
- $log.debug "Error on #{vin} [#{seq}]"
124
- 1.00
125
- end
126
- }
127
-
128
- stop_on_fitness {|fitness, c|
129
- puts "*** Generation Run #{c.generation_num}, best is #{fitness[:best]} ***\n\n"
130
- fitness[:best] >= MAX_FIT - 0.5
131
- }
132
- end
133
-
134
- report do |rept|
135
- $log.info "REPORT #{rept.to_yaml}"
136
- end
137
-
138
- # The block here is called upon the completion of each generation
139
- run_engine do |c|
140
- $log.info "******** Run of generation %s completed, history count %d ********" %
141
- [c.generation_num, c.population_history.size]
142
- end
143
-
@@ -1,180 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="RUBY_MODULE" version="4">
3
- <component name="ModuleRunConfigurationManager">
4
- <configuration default="false" name="Run spec 'oread_spec': rubyneat" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
5
- <predefined_log_file id="RUBY_RSPEC" enabled="true" />
6
- <module name="rubyneat" />
7
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
8
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
9
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
10
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
11
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
12
- <envs>
13
- <env name="JRUBY_OPTS" value="-X+O" />
14
- </envs>
15
- <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
16
- <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
17
- <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
18
- <COVERAGE_PATTERN ENABLED="true">
19
- <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
20
- </COVERAGE_PATTERN>
21
- </EXTENSION>
22
- <EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
23
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
24
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/lib/deep_dive/deep_dive_spec.rb" />
25
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
26
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
27
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
28
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
29
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
30
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
31
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
32
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
33
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
34
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
35
- <RunnerSettings RunnerId="RubyDebugRunner" />
36
- <ConfigurationWrapper RunnerId="RubyDebugRunner" />
37
- <method />
38
- </configuration>
39
- <configuration default="false" name="neat" type="RubyRunConfigurationType" factoryName="Ruby">
40
- <module name="rubyneat" />
41
- <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
42
- <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/bin" />
43
- <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
44
- <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
45
- <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
46
- <envs>
47
- <env name="RUBYLIB" value="$MODULE_DIR$/lib:$MODULE_DIR$/neater" />
48
- </envs>
49
- <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
50
- <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
51
- <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
52
- <COVERAGE_PATTERN ENABLED="true">
53
- <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
54
- </COVERAGE_PATTERN>
55
- </EXTENSION>
56
- <EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
57
- <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/bin/neat.rb" />
58
- <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="run xor" />
59
- <RunnerSettings RunnerId="RubyCover" />
60
- <RunnerSettings RunnerId="RubyDebugRunner" />
61
- <RunnerSettings RunnerId="RubyRunner" />
62
- <ConfigurationWrapper RunnerId="RubyCover" />
63
- <ConfigurationWrapper RunnerId="RubyDebugRunner" />
64
- <ConfigurationWrapper RunnerId="RubyRunner" />
65
- <method />
66
- </configuration>
67
- <configuration default="false" name="xor_neat" type="RubyRunConfigurationType" factoryName="Ruby">
68
- <module name="rubyneat" />
69
- <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
70
- <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$" />
71
- <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
72
- <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
73
- <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
74
- <envs />
75
- <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
76
- <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
77
- <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
78
- <COVERAGE_PATTERN ENABLED="true">
79
- <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
80
- </COVERAGE_PATTERN>
81
- </EXTENSION>
82
- <EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
83
- <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/xor_neat.rb" />
84
- <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
85
- <RunnerSettings RunnerId="RubyDebugRunner" />
86
- <RunnerSettings RunnerId="RubyRunner" />
87
- <ConfigurationWrapper RunnerId="RubyDebugRunner" />
88
- <ConfigurationWrapper RunnerId="RubyRunner" />
89
- <method />
90
- </configuration>
91
- <configuration default="false" name="deep_dive" type="RubyRunConfigurationType" factoryName="Ruby" temporary="true">
92
- <module name="rubyneat" />
93
- <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
94
- <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/lib/deep_dive" />
95
- <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
96
- <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
97
- <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
98
- <envs />
99
- <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
100
- <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
101
- <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
102
- <COVERAGE_PATTERN ENABLED="true">
103
- <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
104
- </COVERAGE_PATTERN>
105
- </EXTENSION>
106
- <EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
107
- <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/lib/deep_dive/deep_dive.rb" />
108
- <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
109
- <RunnerSettings RunnerId="RubyDebugRunner" />
110
- <ConfigurationWrapper RunnerId="RubyDebugRunner" />
111
- <method />
112
- </configuration>
113
- </component>
114
- <component name="NewModuleRootManager">
115
- <content url="file://$MODULE_DIR$">
116
- <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
117
- </content>
118
- <orderEntry type="jdk" jdkName="RVM: ruby-2.0.0-p353" jdkType="RUBY_SDK" />
119
- <orderEntry type="sourceFolder" forTests="false" />
120
- <orderEntry type="library" scope="PROVIDED" name="addressable (v2.3.5, RVM: ruby-2.0.0-p353) [gem]" level="application" />
121
- <orderEntry type="library" scope="PROVIDED" name="aquarium (v0.5.1, RVM: ruby-2.0.0-p353) [gem]" level="application" />
122
- <orderEntry type="library" scope="PROVIDED" name="awesome_print (v1.2.0, RVM: ruby-2.0.0-p353) [gem]" level="application" />
123
- <orderEntry type="library" scope="PROVIDED" name="bson (v1.9.2, RVM: ruby-2.0.0-p353) [gem]" level="application" />
124
- <orderEntry type="library" scope="PROVIDED" name="bson_ext (v1.9.2, RVM: ruby-2.0.0-p353) [gem]" level="application" />
125
- <orderEntry type="library" scope="PROVIDED" name="builder (v3.2.2, RVM: ruby-2.0.0-p353) [gem]" level="application" />
126
- <orderEntry type="library" scope="PROVIDED" name="bundler (v1.3.5, RVM: ruby-2.0.0-p353) [gem]" level="application" />
127
- <orderEntry type="library" scope="PROVIDED" name="celluloid (v0.15.2, RVM: ruby-2.0.0-p353) [gem]" level="application" />
128
- <orderEntry type="library" scope="PROVIDED" name="coderay (v1.1.0, RVM: ruby-2.0.0-p353) [gem]" level="application" />
129
- <orderEntry type="library" scope="PROVIDED" name="debase (v0.0.9, RVM: ruby-2.0.0-p353) [gem]" level="application" />
130
- <orderEntry type="library" scope="PROVIDED" name="debugger-ruby_core_source (v1.3.0, RVM: ruby-2.0.0-p353) [gem]" level="application" />
131
- <orderEntry type="library" scope="PROVIDED" name="deep_dive (v0.0.4, RVM: ruby-2.0.0-p353) [gem]" level="application" />
132
- <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, RVM: ruby-2.0.0-p353) [gem]" level="application" />
133
- <orderEntry type="library" scope="PROVIDED" name="distribution (v0.7.0, RVM: ruby-2.0.0-p353) [gem]" level="application" />
134
- <orderEntry type="library" scope="PROVIDED" name="docile (v1.1.1, RVM: ruby-2.0.0-p353) [gem]" level="application" />
135
- <orderEntry type="library" scope="PROVIDED" name="faraday (v0.8.8, RVM: ruby-2.0.0-p353) [gem]" level="application" />
136
- <orderEntry type="library" scope="PROVIDED" name="ffi (v1.9.3, RVM: ruby-2.0.0-p353) [gem]" level="application" />
137
- <orderEntry type="library" scope="PROVIDED" name="formatador (v0.2.4, RVM: ruby-2.0.0-p353) [gem]" level="application" />
138
- <orderEntry type="library" scope="PROVIDED" name="git (v1.2.6, RVM: ruby-2.0.0-p353) [gem]" level="application" />
139
- <orderEntry type="library" scope="PROVIDED" name="github_api (v0.10.1, RVM: ruby-2.0.0-p353) [gem]" level="application" />
140
- <orderEntry type="library" scope="PROVIDED" name="guard (v2.2.5, RVM: ruby-2.0.0-p353) [gem]" level="application" />
141
- <orderEntry type="library" scope="PROVIDED" name="guard-rspec (v4.2.3, RVM: ruby-2.0.0-p353) [gem]" level="application" />
142
- <orderEntry type="library" scope="PROVIDED" name="hashie (v2.0.5, RVM: ruby-2.0.0-p353) [gem]" level="application" />
143
- <orderEntry type="library" scope="PROVIDED" name="highline (v1.6.20, RVM: ruby-2.0.0-p353) [gem]" level="application" />
144
- <orderEntry type="library" scope="PROVIDED" name="httpauth (v0.2.0, RVM: ruby-2.0.0-p353) [gem]" level="application" />
145
- <orderEntry type="library" scope="PROVIDED" name="jeweler (v1.8.8, RVM: ruby-2.0.0-p353) [gem]" level="application" />
146
- <orderEntry type="library" scope="PROVIDED" name="json (v1.8.1, RVM: ruby-2.0.0-p353) [gem]" level="application" />
147
- <orderEntry type="library" scope="PROVIDED" name="jwt (v0.1.8, RVM: ruby-2.0.0-p353) [gem]" level="application" />
148
- <orderEntry type="library" scope="PROVIDED" name="listen (v2.4.0, RVM: ruby-2.0.0-p353) [gem]" level="application" />
149
- <orderEntry type="library" scope="PROVIDED" name="lumberjack (v1.0.4, RVM: ruby-2.0.0-p353) [gem]" level="application" />
150
- <orderEntry type="library" scope="PROVIDED" name="method_source (v0.8.2, RVM: ruby-2.0.0-p353) [gem]" level="application" />
151
- <orderEntry type="library" scope="PROVIDED" name="mongo (v1.9.2, RVM: ruby-2.0.0-p353) [gem]" level="application" />
152
- <orderEntry type="library" scope="PROVIDED" name="multi_json (v1.8.2, RVM: ruby-2.0.0-p353) [gem]" level="application" />
153
- <orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.5.5, RVM: ruby-2.0.0-p353) [gem]" level="application" />
154
- <orderEntry type="library" scope="PROVIDED" name="multipart-post (v1.2.0, RVM: ruby-2.0.0-p353) [gem]" level="application" />
155
- <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.5.10, RVM: ruby-2.0.0-p353) [gem]" level="application" />
156
- <orderEntry type="library" scope="PROVIDED" name="oauth2 (v0.9.2, RVM: ruby-2.0.0-p353) [gem]" level="application" />
157
- <orderEntry type="library" scope="PROVIDED" name="pry (v0.9.12.4, RVM: ruby-2.0.0-p353) [gem]" level="application" />
158
- <orderEntry type="library" scope="PROVIDED" name="rack (v1.5.2, RVM: ruby-2.0.0-p353) [gem]" level="application" />
159
- <orderEntry type="library" scope="PROVIDED" name="rake (v10.1.1, RVM: ruby-2.0.0-p353) [gem]" level="application" />
160
- <orderEntry type="library" scope="PROVIDED" name="rb-fsevent (v0.9.4, RVM: ruby-2.0.0-p353) [gem]" level="application" />
161
- <orderEntry type="library" scope="PROVIDED" name="rb-inotify (v0.9.3, RVM: ruby-2.0.0-p353) [gem]" level="application" />
162
- <orderEntry type="library" scope="PROVIDED" name="rdoc (v4.1.0, RVM: ruby-2.0.0-p353) [gem]" level="application" />
163
- <orderEntry type="library" scope="PROVIDED" name="rspec (v2.14.1, RVM: ruby-2.0.0-p353) [gem]" level="application" />
164
- <orderEntry type="library" scope="PROVIDED" name="rspec-core (v2.14.7, RVM: ruby-2.0.0-p353) [gem]" level="application" />
165
- <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v2.14.4, RVM: ruby-2.0.0-p353) [gem]" level="application" />
166
- <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v2.14.4, RVM: ruby-2.0.0-p353) [gem]" level="application" />
167
- <orderEntry type="library" scope="PROVIDED" name="semver (v1.0.1, RVM: ruby-2.0.0-p353) [gem]" level="application" />
168
- <orderEntry type="library" scope="PROVIDED" name="simplecov (v0.8.2, RVM: ruby-2.0.0-p353) [gem]" level="application" />
169
- <orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.8.0, RVM: ruby-2.0.0-p353) [gem]" level="application" />
170
- <orderEntry type="library" scope="PROVIDED" name="slop (v3.4.7, RVM: ruby-2.0.0-p353) [gem]" level="application" />
171
- <orderEntry type="library" scope="PROVIDED" name="thor (v0.18.1, RVM: ruby-2.0.0-p353) [gem]" level="application" />
172
- <orderEntry type="library" scope="PROVIDED" name="timers (v1.1.0, RVM: ruby-2.0.0-p353) [gem]" level="application" />
173
- <orderEntry type="library" scope="PROVIDED" name="yard (v0.8.7.3, RVM: ruby-2.0.0-p353) [gem]" level="application" />
174
- </component>
175
- <component name="RModuleSettingsStorage">
176
- <LOAD_PATH number="1" string0="$MODULE_DIR$/bin" />
177
- <I18N_FOLDERS number="0" />
178
- </component>
179
- </module>
180
-