rubyneat 0.3.5.alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. checksums.yaml +7 -0
  2. data/.directory +4 -0
  3. data/.gitignore.orig +20 -0
  4. data/.idea/.name +1 -0
  5. data/.idea/.rakeTasks +7 -0
  6. data/.idea/dictionaries/trader.xml +3 -0
  7. data/.idea/encodings.xml +5 -0
  8. data/.idea/misc.xml +5 -0
  9. data/.idea/modules.xml +9 -0
  10. data/.idea/rubyneat.iml +197 -0
  11. data/.idea/runConfigurations/invpend_neat.xml +26 -0
  12. data/.idea/runConfigurations/sigdebug_neat.xml +24 -0
  13. data/.idea/runConfigurations/xor_neat.xml +26 -0
  14. data/.idea/runConfigurations/xordebug_neat.xml +24 -0
  15. data/.idea/runConfigurations/xorsin_neat.xml +24 -0
  16. data/.idea/scopes/scope_settings.xml +5 -0
  17. data/.idea/vcs.xml +7 -0
  18. data/.idea/workspace.xml +1124 -0
  19. data/.semver +5 -0
  20. data/.yardoc/checksums +11 -0
  21. data/.yardoc/object_types +0 -0
  22. data/.yardoc/objects/root.dat +0 -0
  23. data/.yardoc/proxy_types +0 -0
  24. data/Gemfile +32 -0
  25. data/Gemfile.lock +135 -0
  26. data/Gemfile.lock.orig +147 -0
  27. data/Guardfile +8 -0
  28. data/Rakefile +61 -0
  29. data/bin/neat +83 -0
  30. data/config/application.rb +5 -0
  31. data/doc/ControllerPoint.html +125 -0
  32. data/doc/CuteA.html +286 -0
  33. data/doc/CuteB.html +297 -0
  34. data/doc/DSL.html +883 -0
  35. data/doc/NEAT/BasicNeuronTypes/BiasNeuron.html +518 -0
  36. data/doc/NEAT/BasicNeuronTypes/CosineNeuron.html +274 -0
  37. data/doc/NEAT/BasicNeuronTypes/InputNeuron.html +366 -0
  38. data/doc/NEAT/BasicNeuronTypes/SigmoidNeuron.html +275 -0
  39. data/doc/NEAT/BasicNeuronTypes/SineNeuron.html +274 -0
  40. data/doc/NEAT/BasicNeuronTypes/TanhNeuron.html +274 -0
  41. data/doc/NEAT/BasicNeuronTypes.html +136 -0
  42. data/doc/NEAT/Controller/NeatSettings.html +3985 -0
  43. data/doc/NEAT/Controller.html +2490 -0
  44. data/doc/NEAT/Critter/Genotype/Gene.html +979 -0
  45. data/doc/NEAT/Critter/Genotype.html +1601 -0
  46. data/doc/NEAT/Critter/Phenotype.html +603 -0
  47. data/doc/NEAT/Critter.html +1037 -0
  48. data/doc/NEAT/DSL.html +1255 -0
  49. data/doc/NEAT/Evaluator.html +420 -0
  50. data/doc/NEAT/Evolver/CritterOp.html +551 -0
  51. data/doc/NEAT/Evolver.html +602 -0
  52. data/doc/NEAT/Expressor.html +327 -0
  53. data/doc/NEAT/Graph/DependencyResolver.html +478 -0
  54. data/doc/NEAT/Graph/GraphException.html +123 -0
  55. data/doc/NEAT/Graph.html +402 -0
  56. data/doc/NEAT/NeatException.html +123 -0
  57. data/doc/NEAT/NeatOb.html +567 -0
  58. data/doc/NEAT/Neuron.html +1067 -0
  59. data/doc/NEAT/Operator.html +162 -0
  60. data/doc/NEAT/Population.html +1961 -0
  61. data/doc/NEAT/Trait.html +169 -0
  62. data/doc/NEAT.html +588 -0
  63. data/doc/_index.html +373 -0
  64. data/doc/class_list.html +54 -0
  65. data/doc/css/common.css +1 -0
  66. data/doc/css/full_list.css +57 -0
  67. data/doc/css/style.css +339 -0
  68. data/doc/file_list.html +53 -0
  69. data/doc/frames.html +26 -0
  70. data/doc/index.html +373 -0
  71. data/doc/js/app.js +219 -0
  72. data/doc/js/full_list.js +178 -0
  73. data/doc/js/jquery.js +4 -0
  74. data/doc/method_list.html +1415 -0
  75. data/doc/top-level-namespace.html +164 -0
  76. data/foo/foo_aquarium_example.rb +38 -0
  77. data/foo/foo_gosu.rb +99 -0
  78. data/foo/foo_rubygoo.rb +104 -0
  79. data/foo/foo_sdl.rb +34 -0
  80. data/foo/icon.png +0 -0
  81. data/lib/rubyneat/critter.rb +374 -0
  82. data/lib/rubyneat/default_neat.rb +10 -0
  83. data/lib/rubyneat/dsl.rb +130 -0
  84. data/lib/rubyneat/evaluator.rb +51 -0
  85. data/lib/rubyneat/evolver.rb +315 -0
  86. data/lib/rubyneat/expressor.rb +110 -0
  87. data/lib/rubyneat/graph.rb +95 -0
  88. data/lib/rubyneat/neuron.rb +152 -0
  89. data/lib/rubyneat/population.rb +227 -0
  90. data/lib/rubyneat/rubyneat.rb +429 -0
  91. data/lib/rubyneat.rb +8 -0
  92. data/neater/invpend_neat.rb +150 -0
  93. data/neater/rnlib/inverted_pendulum.rb +380 -0
  94. data/neater/rnlib/xor.rb +10 -0
  95. data/neater/sigdebug_neat.rb +136 -0
  96. data/neater/xor_neat.rb +137 -0
  97. data/neater/xoranalog_neat.rb +138 -0
  98. data/neater/xorsin_neat.rb +143 -0
  99. data/projectFilesBackup/.idea/rubyneat.iml +180 -0
  100. data/public/.directory +4 -0
  101. data/public/background.png +0 -0
  102. data/public/background.xcf +0 -0
  103. data/public/cart.png +0 -0
  104. data/public/cart.xcf +0 -0
  105. data/public/metalpoles_molton_ball_l.jpg +0 -0
  106. data/public/old_background.png +0 -0
  107. data/public/pointer.png +0 -0
  108. data/public/pointer.xcf +0 -0
  109. data/public/pole.kra +0 -0
  110. data/public/pole.png +0 -0
  111. data/public/pole.xcf +0 -0
  112. data/public/wheel-of-year-stone-DD-131-WOYS.jpg +0 -0
  113. data/public/wheel.png +0 -0
  114. data/public/wheel.xcf +0 -0
  115. data/public/wood-planks-texture.jpg +0 -0
  116. data/rdoc/ControllerPoint.html +116 -0
  117. data/rdoc/CuteA.html +177 -0
  118. data/rdoc/CuteB.html +178 -0
  119. data/rdoc/DSLSetup.html +177 -0
  120. data/rdoc/GameTestWindow.html +242 -0
  121. data/rdoc/GameWindow.html +292 -0
  122. data/rdoc/Gemfile.html +215 -0
  123. data/rdoc/Gemfile_lock.html +327 -0
  124. data/rdoc/GraphTest.html +210 -0
  125. data/rdoc/Guardfile.html +198 -0
  126. data/rdoc/InvertedPendulum/Cart.html +668 -0
  127. data/rdoc/InvertedPendulum/DSL.html +259 -0
  128. data/rdoc/InvertedPendulum/InvPendWindow.html +402 -0
  129. data/rdoc/InvertedPendulum.html +198 -0
  130. data/rdoc/Logger.html +98 -0
  131. data/rdoc/NEAT/BasicNeuronTypes/BiasNeuron.html +265 -0
  132. data/rdoc/NEAT/BasicNeuronTypes/CosineNeuron.html +162 -0
  133. data/rdoc/NEAT/BasicNeuronTypes/InputNeuron.html +206 -0
  134. data/rdoc/NEAT/BasicNeuronTypes/SigmoidNeuron.html +162 -0
  135. data/rdoc/NEAT/BasicNeuronTypes/SineNeuron.html +162 -0
  136. data/rdoc/NEAT/BasicNeuronTypes/TanhNeuron.html +161 -0
  137. data/rdoc/NEAT/BasicNeuronTypes.html +107 -0
  138. data/rdoc/NEAT/Controller/NeatSettings.html +880 -0
  139. data/rdoc/NEAT/Controller.html +729 -0
  140. data/rdoc/NEAT/Critter/Genotype/Gene.html +457 -0
  141. data/rdoc/NEAT/Critter/Genotype.html +735 -0
  142. data/rdoc/NEAT/Critter/Phenotype.html +330 -0
  143. data/rdoc/NEAT/Critter.html +489 -0
  144. data/rdoc/NEAT/DSL.html +729 -0
  145. data/rdoc/NEAT/Evaluator.html +256 -0
  146. data/rdoc/NEAT/Evolver/CritterOp.html +349 -0
  147. data/rdoc/NEAT/Evolver.html +891 -0
  148. data/rdoc/NEAT/Expressor.html +402 -0
  149. data/rdoc/NEAT/Graph/DependencyResolver.html +291 -0
  150. data/rdoc/NEAT/Graph/GraphException.html +105 -0
  151. data/rdoc/NEAT/Graph.html +263 -0
  152. data/rdoc/NEAT/NeatException.html +105 -0
  153. data/rdoc/NEAT/NeatOb.html +325 -0
  154. data/rdoc/NEAT/Neuron.html +481 -0
  155. data/rdoc/NEAT/Operator.html +109 -0
  156. data/rdoc/NEAT/Population.html +935 -0
  157. data/rdoc/NEAT/Trait.html +117 -0
  158. data/rdoc/NEAT.html +422 -0
  159. data/rdoc/Object.html +384 -0
  160. data/rdoc/Phi.html +98 -0
  161. data/rdoc/Player.html +383 -0
  162. data/rdoc/Rakefile.html +254 -0
  163. data/rdoc/RubyNEAT/Application.html +105 -0
  164. data/rdoc/RubyNEAT.html +98 -0
  165. data/rdoc/SDL/Event2.html +98 -0
  166. data/rdoc/SDL.html +98 -0
  167. data/rdoc/Vector.html +195 -0
  168. data/rdoc/created.rid +125 -0
  169. data/rdoc/doc/ControllerPoint_html.html +299 -0
  170. data/rdoc/doc/CuteA_html.html +438 -0
  171. data/rdoc/doc/CuteB_html.html +436 -0
  172. data/rdoc/doc/DSL_html.html +992 -0
  173. data/rdoc/doc/NEAT/BasicNeuronTypes/BiasNeuron_html.html +617 -0
  174. data/rdoc/doc/NEAT/BasicNeuronTypes/CosineNeuron_html.html +413 -0
  175. data/rdoc/doc/NEAT/BasicNeuronTypes/InputNeuron_html.html +498 -0
  176. data/rdoc/doc/NEAT/BasicNeuronTypes/SigmoidNeuron_html.html +413 -0
  177. data/rdoc/doc/NEAT/BasicNeuronTypes/SineNeuron_html.html +413 -0
  178. data/rdoc/doc/NEAT/BasicNeuronTypes/TanhNeuron_html.html +412 -0
  179. data/rdoc/doc/NEAT/BasicNeuronTypes_html.html +310 -0
  180. data/rdoc/doc/NEAT/Controller/NeatSettings_html.html +3324 -0
  181. data/rdoc/doc/NEAT/Controller_html.html +2212 -0
  182. data/rdoc/doc/NEAT/Critter/Genotype/Gene_html.html +997 -0
  183. data/rdoc/doc/NEAT/Critter/Genotype_html.html +1556 -0
  184. data/rdoc/doc/NEAT/Critter/Phenotype_html.html +687 -0
  185. data/rdoc/doc/NEAT/Critter_html.html +1037 -0
  186. data/rdoc/doc/NEAT/DSL_html.html +1349 -0
  187. data/rdoc/doc/NEAT/Evaluator_html.html +556 -0
  188. data/rdoc/doc/NEAT/Evolver/CritterOp_html.html +690 -0
  189. data/rdoc/doc/NEAT/Evolver_html.html +677 -0
  190. data/rdoc/doc/NEAT/Expressor_html.html +468 -0
  191. data/rdoc/doc/NEAT/Graph/DependencyResolver_html.html +598 -0
  192. data/rdoc/doc/NEAT/Graph/GraphException_html.html +299 -0
  193. data/rdoc/doc/NEAT/Graph_html.html +527 -0
  194. data/rdoc/doc/NEAT/NeatException_html.html +299 -0
  195. data/rdoc/doc/NEAT/NeatOb_html.html +671 -0
  196. data/rdoc/doc/NEAT/Neuron_html.html +1095 -0
  197. data/rdoc/doc/NEAT/Operator_html.html +337 -0
  198. data/rdoc/doc/NEAT/Population_html.html +1795 -0
  199. data/rdoc/doc/NEAT/Trait_html.html +344 -0
  200. data/rdoc/doc/NEAT_html.html +736 -0
  201. data/rdoc/doc/_index_html.html +559 -0
  202. data/rdoc/doc/class_list_html.html +369 -0
  203. data/rdoc/doc/css/common_css.html +188 -0
  204. data/rdoc/doc/css/full_list_css.html +243 -0
  205. data/rdoc/doc/css/style_css.html +530 -0
  206. data/rdoc/doc/file_list_html.html +240 -0
  207. data/rdoc/doc/frames_html.html +217 -0
  208. data/rdoc/doc/index_html.html +559 -0
  209. data/rdoc/doc/js/app_js.html +423 -0
  210. data/rdoc/doc/js/full_list_js.html +372 -0
  211. data/rdoc/doc/js/jquery_js.html +1536 -0
  212. data/rdoc/doc/method_list_html.html +1375 -0
  213. data/rdoc/doc/top-level-namespace_html.html +317 -0
  214. data/rdoc/fonts/Lato-Light.ttf +0 -0
  215. data/rdoc/fonts/Lato-LightItalic.ttf +0 -0
  216. data/rdoc/fonts/Lato-Regular.ttf +0 -0
  217. data/rdoc/fonts/Lato-RegularItalic.ttf +0 -0
  218. data/rdoc/fonts/SourceCodePro-Bold.ttf +0 -0
  219. data/rdoc/fonts/SourceCodePro-Regular.ttf +0 -0
  220. data/rdoc/fonts.css +167 -0
  221. data/rdoc/images/add.png +0 -0
  222. data/rdoc/images/arrow_up.png +0 -0
  223. data/rdoc/images/brick.png +0 -0
  224. data/rdoc/images/brick_link.png +0 -0
  225. data/rdoc/images/bug.png +0 -0
  226. data/rdoc/images/bullet_black.png +0 -0
  227. data/rdoc/images/bullet_toggle_minus.png +0 -0
  228. data/rdoc/images/bullet_toggle_plus.png +0 -0
  229. data/rdoc/images/date.png +0 -0
  230. data/rdoc/images/delete.png +0 -0
  231. data/rdoc/images/find.png +0 -0
  232. data/rdoc/images/loadingAnimation.gif +0 -0
  233. data/rdoc/images/macFFBgHack.png +0 -0
  234. data/rdoc/images/package.png +0 -0
  235. data/rdoc/images/page_green.png +0 -0
  236. data/rdoc/images/page_white_text.png +0 -0
  237. data/rdoc/images/page_white_width.png +0 -0
  238. data/rdoc/images/plugin.png +0 -0
  239. data/rdoc/images/ruby.png +0 -0
  240. data/rdoc/images/tag_blue.png +0 -0
  241. data/rdoc/images/tag_green.png +0 -0
  242. data/rdoc/images/transparent.png +0 -0
  243. data/rdoc/images/wrench.png +0 -0
  244. data/rdoc/images/wrench_orange.png +0 -0
  245. data/rdoc/images/zoom.png +0 -0
  246. data/rdoc/index.html +282 -0
  247. data/rdoc/js/darkfish.js +140 -0
  248. data/rdoc/js/jquery.js +18 -0
  249. data/rdoc/js/navigation.js +142 -0
  250. data/rdoc/js/search.js +109 -0
  251. data/rdoc/js/search_index.js +1 -0
  252. data/rdoc/js/searcher.js +228 -0
  253. data/rdoc/rdoc.css +580 -0
  254. data/rdoc/rubyneat_gemspec.html +387 -0
  255. data/rdoc/table_of_contents.html +2502 -0
  256. data/rdoc/xordebug_log.html +170598 -0
  257. data/rdoc/xorsin_log.html +22569 -0
  258. data/rubyneat.gemspec +347 -0
  259. data/rubyneat.gemspec.orig +375 -0
  260. data/spec/lib/rubyneat/rubyneat_spec.rb +132 -0
  261. metadata +555 -0
@@ -0,0 +1,1961 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: NEAT::Population
8
+
9
+ &mdash; Documentation by YARD 0.8.7.4
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../';
20
+ framesUrl = "../frames.html#!NEAT/Population.html";
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../_index.html">Index (P)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../NEAT.html" title="NEAT (module)">NEAT</a></span></span>
36
+ &raquo;
37
+ <span class="title">Population</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: NEAT::Population
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName"><span class='object_link'><a href="NeatOb.html" title="NEAT::NeatOb (class)">NeatOb</a></span></span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next"><span class='object_link'><a href="NeatOb.html" title="NEAT::NeatOb (class)">NeatOb</a></span></li>
82
+
83
+ <li class="next">NEAT::Population</li>
84
+
85
+ </ul>
86
+ <a href="#" class="inheritanceTree">show all</a>
87
+
88
+ </dd>
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+ <dt class="r2 last">Defined in:</dt>
99
+ <dd class="r2 last">lib/rubyneat/population.rb</dd>
100
+
101
+ </dl>
102
+ <div class="clear"></div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+
107
+ <h1 id="label-Population+of+NEAT+Critters.">Population of NEAT Critters.</h1>
108
+
109
+ <p>The Population In ourselves we have the pool of neurons the critters all
110
+ use. the pool of neurons are indirects, of course, as during phenotype
111
+ expression, all the phenotypes shall be created individually.</p>
112
+
113
+
114
+ </div>
115
+ </div>
116
+ <div class="tags">
117
+
118
+
119
+ </div>
120
+
121
+
122
+
123
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
124
+ <ul class="summary">
125
+
126
+ <li class="public ">
127
+ <span class="summary_signature">
128
+
129
+ <a href="#critters-instance_method" title="#critters (instance method)">- (Object) <strong>critters</strong> </a>
130
+
131
+
132
+
133
+ </span>
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+ <span class="summary_desc"><div class='inline'>
147
+ <p>list of critter in this population.</p>
148
+ </div></span>
149
+
150
+ </li>
151
+
152
+
153
+ <li class="public ">
154
+ <span class="summary_signature">
155
+
156
+ <a href="#fitness-instance_method" title="#fitness (instance method)">- (Object) <strong>fitness</strong> </a>
157
+
158
+
159
+
160
+ </span>
161
+
162
+
163
+
164
+
165
+ <span class="note title readonly">readonly</span>
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+ <span class="summary_desc"><div class='inline'>
176
+ <p>Overall population fitness and novelty.</p>
177
+ </div></span>
178
+
179
+ </li>
180
+
181
+
182
+ <li class="public ">
183
+ <span class="summary_signature">
184
+
185
+ <a href="#hidden_neurons-instance_method" title="#hidden_neurons (instance method)">- (Object) <strong>hidden_neurons</strong> </a>
186
+
187
+
188
+
189
+ </span>
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+ <span class="summary_desc"><div class='inline'>
203
+ <p>List of possible neuron classes for hidden neurons.</p>
204
+ </div></span>
205
+
206
+ </li>
207
+
208
+
209
+ <li class="public ">
210
+ <span class="summary_signature">
211
+
212
+ <a href="#input_neurons-instance_method" title="#input_neurons (instance method)">- (Object) <strong>input_neurons</strong> </a>
213
+
214
+
215
+
216
+ </span>
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+ <span class="summary_desc"><div class='inline'>
230
+ <p>Ordered list or hash of input neuron classes (all critters generated here
231
+ shall have this).</p>
232
+ </div></span>
233
+
234
+ </li>
235
+
236
+
237
+ <li class="public ">
238
+ <span class="summary_signature">
239
+
240
+ <a href="#novelty-instance_method" title="#novelty (instance method)">- (Object) <strong>novelty</strong> </a>
241
+
242
+
243
+
244
+ </span>
245
+
246
+
247
+
248
+
249
+ <span class="note title readonly">readonly</span>
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+ <span class="summary_desc"><div class='inline'>
260
+ <p>Overall population fitness and novelty.</p>
261
+ </div></span>
262
+
263
+ </li>
264
+
265
+
266
+ <li class="public ">
267
+ <span class="summary_signature">
268
+
269
+ <a href="#output_neurons-instance_method" title="#output_neurons (instance method)">- (Object) <strong>output_neurons</strong> </a>
270
+
271
+
272
+
273
+ </span>
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+ <span class="summary_desc"><div class='inline'>
287
+ <p>Ordered list or hash of output neuron classes (all critters generated here
288
+ shall have this).</p>
289
+ </div></span>
290
+
291
+ </li>
292
+
293
+
294
+ <li class="public ">
295
+ <span class="summary_signature">
296
+
297
+ <a href="#species-instance_method" title="#species (instance method)">- (Object) <strong>species</strong> </a>
298
+
299
+
300
+
301
+ </span>
302
+
303
+
304
+
305
+
306
+ <span class="note title readonly">readonly</span>
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+ <span class="summary_desc"><div class='inline'>
317
+ <p>Hash list of species lists.</p>
318
+ </div></span>
319
+
320
+ </li>
321
+
322
+
323
+ <li class="public ">
324
+ <span class="summary_signature">
325
+
326
+ <a href="#traits-instance_method" title="#traits (instance method)">- (Object) <strong>traits</strong> </a>
327
+
328
+
329
+
330
+ </span>
331
+
332
+
333
+
334
+
335
+
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+ <span class="summary_desc"><div class='inline'>
344
+ <p>Returns the value of attribute traits.</p>
345
+ </div></span>
346
+
347
+ </li>
348
+
349
+
350
+ </ul>
351
+
352
+
353
+
354
+
355
+
356
+ <h3 class="inherited">Attributes inherited from <span class='object_link'><a href="NeatOb.html" title="NEAT::NeatOb (class)">NeatOb</a></span></h3>
357
+ <p class="inherited"><span class='object_link'><a href="NeatOb.html#controller-instance_method" title="NEAT::NeatOb#controller (method)">#controller</a></span>, <span class='object_link'><a href="NeatOb.html#name-instance_method" title="NEAT::NeatOb#name (method)">#name</a></span></p>
358
+
359
+
360
+
361
+ <h2>
362
+ Class Method Summary
363
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
364
+ </h2>
365
+
366
+ <ul class="summary">
367
+
368
+ <li class="public ">
369
+ <span class="summary_signature">
370
+
371
+ <a href="#compactify%21-class_method" title="compactify! (class method)">+ (Object) <strong>compactify!</strong>(parm) </a>
372
+
373
+
374
+
375
+ </span>
376
+
377
+
378
+
379
+
380
+
381
+
382
+
383
+
384
+
385
+ <span class="summary_desc"><div class='inline'></div></span>
386
+
387
+ </li>
388
+
389
+
390
+ <li class="public ">
391
+ <span class="summary_signature">
392
+
393
+ <a href="#evaluate%21-class_method" title="evaluate! (class method)">+ (Object) <strong>evaluate!</strong> </a>
394
+
395
+
396
+
397
+ </span>
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+
407
+ <span class="summary_desc"><div class='inline'></div></span>
408
+
409
+ </li>
410
+
411
+
412
+ <li class="public ">
413
+ <span class="summary_signature">
414
+
415
+ <a href="#member%3F-class_method" title="member? (class method)">+ (Boolean) <strong>member?</strong>(crit) </a>
416
+
417
+
418
+
419
+ </span>
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+
429
+ <span class="summary_desc"><div class='inline'>
430
+ <p>lists keyed by representative critter.</p>
431
+ </div></span>
432
+
433
+ </li>
434
+
435
+
436
+ </ul>
437
+
438
+ <h2>
439
+ Instance Method Summary
440
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
441
+ </h2>
442
+
443
+ <ul class="summary">
444
+
445
+ <li class="public ">
446
+ <span class="summary_signature">
447
+
448
+ <a href="#analyze%21-instance_method" title="#analyze! (instance method)">- (Object) <strong>analyze!</strong> </a>
449
+
450
+
451
+
452
+ </span>
453
+
454
+
455
+
456
+
457
+
458
+
459
+
460
+
461
+
462
+ <span class="summary_desc"><div class='inline'>
463
+ <p>Alalyze evaluation results.</p>
464
+ </div></span>
465
+
466
+ </li>
467
+
468
+
469
+ <li class="public ">
470
+ <span class="summary_signature">
471
+
472
+ <a href="#best_critter-instance_method" title="#best_critter (instance method)">- (Object) <strong>best_critter</strong> </a>
473
+
474
+
475
+
476
+ </span>
477
+
478
+
479
+
480
+
481
+
482
+
483
+
484
+
485
+
486
+ <span class="summary_desc"><div class='inline'>
487
+ <p>The “best critter” is the critter with the lowest (closet to zero) fitness
488
+ rating.</p>
489
+ </div></span>
490
+
491
+ </li>
492
+
493
+
494
+ <li class="public ">
495
+ <span class="summary_signature">
496
+
497
+ <a href="#dump_s-instance_method" title="#dump_s (instance method)">- (Object) <strong>dump_s</strong> </a>
498
+
499
+
500
+
501
+ </span>
502
+
503
+
504
+
505
+
506
+
507
+
508
+
509
+
510
+
511
+ <span class="summary_desc"><div class='inline'></div></span>
512
+
513
+ </li>
514
+
515
+
516
+ <li class="public ">
517
+ <span class="summary_signature">
518
+
519
+ <a href="#evaluate%21-instance_method" title="#evaluate! (instance method)">- (Object) <strong>evaluate!</strong> </a>
520
+
521
+
522
+
523
+ </span>
524
+
525
+
526
+
527
+
528
+
529
+
530
+
531
+
532
+
533
+ <span class="summary_desc"><div class='inline'>
534
+ <p>Called for each sequence.</p>
535
+ </div></span>
536
+
537
+ </li>
538
+
539
+
540
+ <li class="public ">
541
+ <span class="summary_signature">
542
+
543
+ <a href="#evolve-instance_method" title="#evolve (instance method)">- (Object) <strong>evolve</strong> </a>
544
+
545
+
546
+
547
+ </span>
548
+
549
+
550
+
551
+
552
+
553
+
554
+
555
+
556
+
557
+ <span class="summary_desc"><div class='inline'>
558
+ <p>Call this after evaluation.</p>
559
+ </div></span>
560
+
561
+ </li>
562
+
563
+
564
+ <li class="public ">
565
+ <span class="summary_signature">
566
+
567
+ <a href="#express%21-instance_method" title="#express! (instance method)">- (Object) <strong>express!</strong> </a>
568
+
569
+
570
+
571
+ </span>
572
+
573
+
574
+
575
+
576
+
577
+
578
+
579
+
580
+
581
+ <span class="summary_desc"><div class='inline'>
582
+ <p>Express the entire population.</p>
583
+ </div></span>
584
+
585
+ </li>
586
+
587
+
588
+ <li class="public ">
589
+ <span class="summary_signature">
590
+
591
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Population) <strong>initialize</strong>(c, &amp;block) </a>
592
+
593
+
594
+
595
+ </span>
596
+
597
+
598
+ <span class="note title constructor">constructor</span>
599
+
600
+
601
+
602
+
603
+
604
+
605
+
606
+
607
+ <span class="summary_desc"><div class='inline'>
608
+ <p>Create initial (ramdom) population of critters.</p>
609
+ </div></span>
610
+
611
+ </li>
612
+
613
+
614
+ <li class="public ">
615
+ <span class="summary_signature">
616
+
617
+ <a href="#initialize_for_recurrence%21-instance_method" title="#initialize_for_recurrence! (instance method)">- (Object) <strong>initialize_for_recurrence!</strong> </a>
618
+
619
+
620
+
621
+ </span>
622
+
623
+
624
+
625
+
626
+
627
+
628
+
629
+
630
+
631
+ <span class="summary_desc"><div class='inline'>
632
+ <p>Make sure all critters are reset and prepared for recurrent network
633
+ evaluation.</p>
634
+ </div></span>
635
+
636
+ </li>
637
+
638
+
639
+ <li class="public ">
640
+ <span class="summary_signature">
641
+
642
+ <a href="#mutate%21-instance_method" title="#mutate! (instance method)">- (Object) <strong>mutate!</strong> </a>
643
+
644
+
645
+
646
+ </span>
647
+
648
+
649
+
650
+
651
+
652
+
653
+
654
+
655
+
656
+ <span class="summary_desc"><div class='inline'>
657
+ <p>Mutate the genes and neurons.</p>
658
+ </div></span>
659
+
660
+ </li>
661
+
662
+
663
+ <li class="public ">
664
+ <span class="summary_signature">
665
+
666
+ <a href="#report-instance_method" title="#report (instance method)">- (Object) <strong>report</strong> </a>
667
+
668
+
669
+
670
+ </span>
671
+
672
+
673
+
674
+
675
+
676
+
677
+
678
+
679
+
680
+ <span class="summary_desc"><div class='inline'>
681
+ <h2 id="label-Generate+a+report+on+the+state+of+this+population.">Generate a report on the state of this population.</h2>
682
+ </div></span>
683
+
684
+ </li>
685
+
686
+
687
+ <li class="public ">
688
+ <span class="summary_signature">
689
+
690
+ <a href="#speciate%21-instance_method" title="#speciate! (instance method)">- (Object) <strong>speciate!</strong> </a>
691
+
692
+
693
+
694
+ </span>
695
+
696
+
697
+
698
+
699
+
700
+
701
+
702
+
703
+
704
+ <span class="summary_desc"><div class='inline'>
705
+ <p>Group critters into species Note that the @species objects have useful
706
+ singleton methods: * @species.member? – checks all of the lists for
707
+ membership, not just the hash * @<a href="crit">species</a>.fitness –
708
+ fitness of the entire species.</p>
709
+ </div></span>
710
+
711
+ </li>
712
+
713
+
714
+ <li class="public ">
715
+ <span class="summary_signature">
716
+
717
+ <a href="#worst_critter-instance_method" title="#worst_critter (instance method)">- (Object) <strong>worst_critter</strong> </a>
718
+
719
+
720
+
721
+ </span>
722
+
723
+
724
+
725
+
726
+
727
+
728
+
729
+
730
+
731
+ <span class="summary_desc"><div class='inline'>
732
+ <p>The “worst critter” is the critter with the highest (away from zero)
733
+ fitness rating.</p>
734
+ </div></span>
735
+
736
+ </li>
737
+
738
+
739
+ </ul>
740
+
741
+
742
+
743
+
744
+
745
+
746
+
747
+
748
+
749
+
750
+
751
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="NeatOb.html" title="NEAT::NeatOb (class)">NeatOb</a></span></h3>
752
+ <p class="inherited"><span class='object_link'><a href="NeatOb.html#log-instance_method" title="NEAT::NeatOb#log (method)">#log</a></span>, <span class='object_link'><a href="NeatOb.html#log-class_method" title="NEAT::NeatOb.log (method)">log</a></span>, <span class='object_link'><a href="NeatOb.html#to_s-instance_method" title="NEAT::NeatOb#to_s (method)">#to_s</a></span></p>
753
+
754
+ <div id="constructor_details" class="method_details_list">
755
+ <h2>Constructor Details</h2>
756
+
757
+ <div class="method_details first">
758
+ <h3 class="signature first" id="initialize-instance_method">
759
+
760
+ - (<tt><span class='object_link'><a href="" title="NEAT::Population (class)">Population</a></span></tt>) <strong>initialize</strong>(c, &amp;block)
761
+
762
+
763
+
764
+
765
+
766
+ </h3><div class="docstring">
767
+ <div class="discussion">
768
+
769
+ <p>Create initial (ramdom) population of critters</p>
770
+
771
+
772
+ </div>
773
+ </div>
774
+ <div class="tags">
775
+
776
+
777
+ </div><table class="source_code">
778
+ <tr>
779
+ <td>
780
+ <pre class="lines">
781
+
782
+
783
+ 37
784
+ 38
785
+ 39
786
+ 40
787
+ 41
788
+ 42
789
+ 43
790
+ 44
791
+ 45
792
+ 46
793
+ 47
794
+ 48
795
+ 49
796
+ 50</pre>
797
+ </td>
798
+ <td>
799
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 37</span>
800
+
801
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_c'>c</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
802
+ <span class='kw'>super</span>
803
+ <span class='ivar'>@input_neurons</span> <span class='op'>=</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_neural_inputs'>neural_inputs</span><span class='period'>.</span><span class='id identifier rubyid_clone'>clone</span>
804
+ <span class='ivar'>@output_neurons</span> <span class='op'>=</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_neural_outputs'>neural_outputs</span><span class='period'>.</span><span class='id identifier rubyid_clone'>clone</span>
805
+ <span class='ivar'>@hidden_neurons</span> <span class='op'>=</span> <span class='kw'>unless</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_neural_hidden'>neural_hidden</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
806
+ <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_neural_hidden'>neural_hidden</span>
807
+ <span class='kw'>else</span>
808
+ <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_neuron_catalog'>neuron_catalog</span><span class='period'>.</span><span class='id identifier rubyid_keep_if'>keep_if</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span> <span class='kw'>not</span> <span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_input?'>input?</span><span class='rbrace'>}</span>
809
+ <span class='kw'>end</span>
810
+ <span class='ivar'>@critters</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='int'>0</span> <span class='op'>...</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_parms'>parms</span><span class='period'>.</span><span class='id identifier rubyid_start_population_size'>start_population_size</span> <span class='op'>||</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_parms'>parms</span><span class='period'>.</span><span class='id identifier rubyid_population_size'>population_size</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span>
811
+ <span class='const'>Critter</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
812
+ <span class='kw'>end</span>
813
+ <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
814
+ <span class='kw'>end</span></pre>
815
+ </td>
816
+ </tr>
817
+ </table>
818
+ </div>
819
+
820
+ </div>
821
+
822
+ <div id="instance_attr_details" class="attr_details">
823
+ <h2>Instance Attribute Details</h2>
824
+
825
+
826
+ <span id="critters=-instance_method"></span>
827
+ <div class="method_details first">
828
+ <h3 class="signature first" id="critters-instance_method">
829
+
830
+ - (<tt>Object</tt>) <strong>critters</strong>
831
+
832
+
833
+
834
+
835
+
836
+ </h3><div class="docstring">
837
+ <div class="discussion">
838
+
839
+ <p>list of critter in this population</p>
840
+
841
+
842
+ </div>
843
+ </div>
844
+ <div class="tags">
845
+
846
+
847
+ </div><table class="source_code">
848
+ <tr>
849
+ <td>
850
+ <pre class="lines">
851
+
852
+
853
+ 25
854
+ 26
855
+ 27</pre>
856
+ </td>
857
+ <td>
858
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 25</span>
859
+
860
+ <span class='kw'>def</span> <span class='id identifier rubyid_critters'>critters</span>
861
+ <span class='ivar'>@critters</span>
862
+ <span class='kw'>end</span></pre>
863
+ </td>
864
+ </tr>
865
+ </table>
866
+ </div>
867
+
868
+
869
+ <span id=""></span>
870
+ <div class="method_details ">
871
+ <h3 class="signature " id="fitness-instance_method">
872
+
873
+ - (<tt>Object</tt>) <strong>fitness</strong> <span class="extras">(readonly)</span>
874
+
875
+
876
+
877
+
878
+
879
+ </h3><div class="docstring">
880
+ <div class="discussion">
881
+
882
+ <p>Overall population fitness and novelty</p>
883
+
884
+
885
+ </div>
886
+ </div>
887
+ <div class="tags">
888
+
889
+
890
+ </div><table class="source_code">
891
+ <tr>
892
+ <td>
893
+ <pre class="lines">
894
+
895
+
896
+ 28
897
+ 29
898
+ 30</pre>
899
+ </td>
900
+ <td>
901
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 28</span>
902
+
903
+ <span class='kw'>def</span> <span class='id identifier rubyid_fitness'>fitness</span>
904
+ <span class='ivar'>@fitness</span>
905
+ <span class='kw'>end</span></pre>
906
+ </td>
907
+ </tr>
908
+ </table>
909
+ </div>
910
+
911
+
912
+ <span id="hidden_neurons=-instance_method"></span>
913
+ <div class="method_details ">
914
+ <h3 class="signature " id="hidden_neurons-instance_method">
915
+
916
+ - (<tt>Object</tt>) <strong>hidden_neurons</strong>
917
+
918
+
919
+
920
+
921
+
922
+ </h3><div class="docstring">
923
+ <div class="discussion">
924
+
925
+ <p>List of possible neuron classes for hidden neurons.</p>
926
+
927
+
928
+ </div>
929
+ </div>
930
+ <div class="tags">
931
+
932
+
933
+ </div><table class="source_code">
934
+ <tr>
935
+ <td>
936
+ <pre class="lines">
937
+
938
+
939
+ 16
940
+ 17
941
+ 18</pre>
942
+ </td>
943
+ <td>
944
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 16</span>
945
+
946
+ <span class='kw'>def</span> <span class='id identifier rubyid_hidden_neurons'>hidden_neurons</span>
947
+ <span class='ivar'>@hidden_neurons</span>
948
+ <span class='kw'>end</span></pre>
949
+ </td>
950
+ </tr>
951
+ </table>
952
+ </div>
953
+
954
+
955
+ <span id="input_neurons=-instance_method"></span>
956
+ <div class="method_details ">
957
+ <h3 class="signature " id="input_neurons-instance_method">
958
+
959
+ - (<tt>Object</tt>) <strong>input_neurons</strong>
960
+
961
+
962
+
963
+
964
+
965
+ </h3><div class="docstring">
966
+ <div class="discussion">
967
+
968
+ <p>Ordered list or hash of input neuron classes (all critters generated here
969
+ shall have this)</p>
970
+
971
+
972
+ </div>
973
+ </div>
974
+ <div class="tags">
975
+
976
+
977
+ </div><table class="source_code">
978
+ <tr>
979
+ <td>
980
+ <pre class="lines">
981
+
982
+
983
+ 13
984
+ 14
985
+ 15</pre>
986
+ </td>
987
+ <td>
988
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 13</span>
989
+
990
+ <span class='kw'>def</span> <span class='id identifier rubyid_input_neurons'>input_neurons</span>
991
+ <span class='ivar'>@input_neurons</span>
992
+ <span class='kw'>end</span></pre>
993
+ </td>
994
+ </tr>
995
+ </table>
996
+ </div>
997
+
998
+
999
+ <span id=""></span>
1000
+ <div class="method_details ">
1001
+ <h3 class="signature " id="novelty-instance_method">
1002
+
1003
+ - (<tt>Object</tt>) <strong>novelty</strong> <span class="extras">(readonly)</span>
1004
+
1005
+
1006
+
1007
+
1008
+
1009
+ </h3><div class="docstring">
1010
+ <div class="discussion">
1011
+
1012
+ <p>Overall population fitness and novelty</p>
1013
+
1014
+
1015
+ </div>
1016
+ </div>
1017
+ <div class="tags">
1018
+
1019
+
1020
+ </div><table class="source_code">
1021
+ <tr>
1022
+ <td>
1023
+ <pre class="lines">
1024
+
1025
+
1026
+ 28
1027
+ 29
1028
+ 30</pre>
1029
+ </td>
1030
+ <td>
1031
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 28</span>
1032
+
1033
+ <span class='kw'>def</span> <span class='id identifier rubyid_novelty'>novelty</span>
1034
+ <span class='ivar'>@novelty</span>
1035
+ <span class='kw'>end</span></pre>
1036
+ </td>
1037
+ </tr>
1038
+ </table>
1039
+ </div>
1040
+
1041
+
1042
+ <span id="output_neurons=-instance_method"></span>
1043
+ <div class="method_details ">
1044
+ <h3 class="signature " id="output_neurons-instance_method">
1045
+
1046
+ - (<tt>Object</tt>) <strong>output_neurons</strong>
1047
+
1048
+
1049
+
1050
+
1051
+
1052
+ </h3><div class="docstring">
1053
+ <div class="discussion">
1054
+
1055
+ <p>Ordered list or hash of output neuron classes (all critters generated here
1056
+ shall have this)</p>
1057
+
1058
+
1059
+ </div>
1060
+ </div>
1061
+ <div class="tags">
1062
+
1063
+
1064
+ </div><table class="source_code">
1065
+ <tr>
1066
+ <td>
1067
+ <pre class="lines">
1068
+
1069
+
1070
+ 20
1071
+ 21
1072
+ 22</pre>
1073
+ </td>
1074
+ <td>
1075
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 20</span>
1076
+
1077
+ <span class='kw'>def</span> <span class='id identifier rubyid_output_neurons'>output_neurons</span>
1078
+ <span class='ivar'>@output_neurons</span>
1079
+ <span class='kw'>end</span></pre>
1080
+ </td>
1081
+ </tr>
1082
+ </table>
1083
+ </div>
1084
+
1085
+
1086
+ <span id=""></span>
1087
+ <div class="method_details ">
1088
+ <h3 class="signature " id="species-instance_method">
1089
+
1090
+ - (<tt>Object</tt>) <strong>species</strong> <span class="extras">(readonly)</span>
1091
+
1092
+
1093
+
1094
+
1095
+
1096
+ </h3><div class="docstring">
1097
+ <div class="discussion">
1098
+
1099
+ <p>Hash list of species lists</p>
1100
+
1101
+
1102
+ </div>
1103
+ </div>
1104
+ <div class="tags">
1105
+
1106
+
1107
+ </div><table class="source_code">
1108
+ <tr>
1109
+ <td>
1110
+ <pre class="lines">
1111
+
1112
+
1113
+ 31
1114
+ 32
1115
+ 33</pre>
1116
+ </td>
1117
+ <td>
1118
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 31</span>
1119
+
1120
+ <span class='kw'>def</span> <span class='id identifier rubyid_species'>species</span>
1121
+ <span class='ivar'>@species</span>
1122
+ <span class='kw'>end</span></pre>
1123
+ </td>
1124
+ </tr>
1125
+ </table>
1126
+ </div>
1127
+
1128
+
1129
+ <span id="traits=-instance_method"></span>
1130
+ <div class="method_details ">
1131
+ <h3 class="signature " id="traits-instance_method">
1132
+
1133
+ - (<tt>Object</tt>) <strong>traits</strong>
1134
+
1135
+
1136
+
1137
+
1138
+
1139
+ </h3><div class="docstring">
1140
+ <div class="discussion">
1141
+
1142
+ <p>Returns the value of attribute traits</p>
1143
+
1144
+
1145
+ </div>
1146
+ </div>
1147
+ <div class="tags">
1148
+
1149
+
1150
+ </div><table class="source_code">
1151
+ <tr>
1152
+ <td>
1153
+ <pre class="lines">
1154
+
1155
+
1156
+ 22
1157
+ 23
1158
+ 24</pre>
1159
+ </td>
1160
+ <td>
1161
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 22</span>
1162
+
1163
+ <span class='kw'>def</span> <span class='id identifier rubyid_traits'>traits</span>
1164
+ <span class='ivar'>@traits</span>
1165
+ <span class='kw'>end</span></pre>
1166
+ </td>
1167
+ </tr>
1168
+ </table>
1169
+ </div>
1170
+
1171
+ </div>
1172
+
1173
+
1174
+ <div id="class_method_details" class="method_details_list">
1175
+ <h2>Class Method Details</h2>
1176
+
1177
+
1178
+ <div class="method_details first">
1179
+ <h3 class="signature first" id="compactify!-class_method">
1180
+
1181
+ + (<tt>Object</tt>) <strong>compactify!</strong>(parm)
1182
+
1183
+
1184
+
1185
+
1186
+
1187
+ </h3><table class="source_code">
1188
+ <tr>
1189
+ <td>
1190
+ <pre class="lines">
1191
+
1192
+
1193
+ 102
1194
+ 103
1195
+ 104
1196
+ 105
1197
+ 106
1198
+ 107
1199
+ 108
1200
+ 109
1201
+ 110
1202
+ 111
1203
+ 112
1204
+ 113
1205
+ 114
1206
+ 115
1207
+ 116
1208
+ 117
1209
+ 118
1210
+ 119
1211
+ 120</pre>
1212
+ </td>
1213
+ <td>
1214
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 102</span>
1215
+
1216
+ <span class='kw'>def</span> <span class='ivar'>@species</span><span class='period'>.</span><span class='id identifier rubyid_compactify!'>compactify!</span><span class='lparen'>(</span><span class='id identifier rubyid_parm'>parm</span><span class='rparen'>)</span>
1217
+ <span class='id identifier rubyid_mutt'>mutt</span> <span class='op'>=</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='symbol'>:mutt</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_splist'>splist</span><span class='op'>|</span> <span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_splist'>splist</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_splist'>splist</span><span class='op'>|</span>
1218
+ <span class='id identifier rubyid_splist'>splist</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>&gt;=</span> <span class='id identifier rubyid_parm'>parm</span><span class='period'>.</span><span class='id identifier rubyid_smallest_species'>smallest_species</span>
1219
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_splist'>splist</span><span class='op'>|</span>
1220
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_k'>k</span>
1221
+ <span class='id identifier rubyid_splist'>splist</span>
1222
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span>
1223
+
1224
+ <span class='comment'># FIXME this code is not dry!!!!
1225
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_mutt'>mutt</span><span class='period'>.</span><span class='id identifier rubyid_fitness='>fitness=</span><span class='lparen'>(</span><span class='id identifier rubyid_fit'>fit</span><span class='rparen'>)</span>
1226
+ <span class='ivar'>@fitness</span> <span class='op'>=</span> <span class='id identifier rubyid_fit'>fit</span>
1227
+ <span class='kw'>end</span>
1228
+
1229
+ <span class='kw'>def</span> <span class='id identifier rubyid_mutt'>mutt</span><span class='period'>.</span><span class='id identifier rubyid_fitness'>fitness</span>
1230
+ <span class='ivar'>@fitness</span>
1231
+ <span class='kw'>end</span>
1232
+
1233
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='symbol'>:mutt</span> <span class='kw'>if</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='symbol'>:mutt</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
1234
+ <span class='kw'>end</span></pre>
1235
+ </td>
1236
+ </tr>
1237
+ </table>
1238
+ </div>
1239
+
1240
+ <div class="method_details ">
1241
+ <h3 class="signature " id="evaluate!-class_method">
1242
+
1243
+ + (<tt>Object</tt>) <strong>evaluate!</strong>
1244
+
1245
+
1246
+
1247
+
1248
+
1249
+ </h3><table class="source_code">
1250
+ <tr>
1251
+ <td>
1252
+ <pre class="lines">
1253
+
1254
+
1255
+ 96
1256
+ 97
1257
+ 98
1258
+ 99
1259
+ 100</pre>
1260
+ </td>
1261
+ <td>
1262
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 96</span>
1263
+
1264
+ <span class='kw'>def</span> <span class='ivar'>@species</span><span class='period'>.</span><span class='id identifier rubyid_evaluate!'>evaluate!</span>
1265
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_sp'>sp</span><span class='op'>|</span>
1266
+ <span class='id identifier rubyid_sp'>sp</span><span class='period'>.</span><span class='id identifier rubyid_fitness'>fitness</span> <span class='op'>=</span> <span class='id identifier rubyid_sp'>sp</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_crit'>crit</span><span class='op'>|</span> <span class='id identifier rubyid_crit'>crit</span><span class='period'>.</span><span class='id identifier rubyid_fitness'>fitness</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span><span class='id identifier rubyid_b'>b</span><span class='op'>|</span> <span class='id identifier rubyid_a'>a</span><span class='op'>+</span><span class='id identifier rubyid_b'>b</span><span class='rbrace'>}</span> <span class='op'>/</span> <span class='id identifier rubyid_sp'>sp</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
1267
+ <span class='kw'>end</span>
1268
+ <span class='kw'>end</span></pre>
1269
+ </td>
1270
+ </tr>
1271
+ </table>
1272
+ </div>
1273
+
1274
+ <div class="method_details ">
1275
+ <h3 class="signature " id="member?-class_method">
1276
+
1277
+ + (<tt>Boolean</tt>) <strong>member?</strong>(crit)
1278
+
1279
+
1280
+
1281
+
1282
+
1283
+ </h3><div class="docstring">
1284
+ <div class="discussion">
1285
+
1286
+ <p>lists keyed by representative critter</p>
1287
+
1288
+
1289
+ </div>
1290
+ </div>
1291
+ <div class="tags">
1292
+
1293
+ <p class="tag_title">Returns:</p>
1294
+ <ul class="return">
1295
+
1296
+ <li>
1297
+
1298
+
1299
+ <span class='type'>(<tt>Boolean</tt>)</span>
1300
+
1301
+
1302
+
1303
+ </li>
1304
+
1305
+ </ul>
1306
+
1307
+ </div><table class="source_code">
1308
+ <tr>
1309
+ <td>
1310
+ <pre class="lines">
1311
+
1312
+
1313
+ 92
1314
+ 93
1315
+ 94</pre>
1316
+ </td>
1317
+ <td>
1318
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 92</span>
1319
+
1320
+ <span class='kw'>def</span> <span class='ivar'>@species</span><span class='period'>.</span><span class='id identifier rubyid_member?'>member?</span><span class='lparen'>(</span><span class='id identifier rubyid_crit'>crit</span><span class='rparen'>)</span>
1321
+ <span class='kw'>super</span><span class='period'>.</span><span class='id identifier rubyid_member?'>member?</span><span class='lparen'>(</span><span class='id identifier rubyid_crit'>crit</span><span class='rparen'>)</span> <span class='kw'>or</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_li'>li</span><span class='op'>|</span> <span class='id identifier rubyid_li'>li</span><span class='period'>.</span><span class='id identifier rubyid_member?'>member?</span> <span class='id identifier rubyid_crit'>crit</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_t1'>t1</span><span class='comma'>,</span> <span class='id identifier rubyid_t2'>t2</span><span class='op'>|</span> <span class='id identifier rubyid_t1'>t1</span> <span class='kw'>or</span> <span class='id identifier rubyid_t2'>t2</span> <span class='rbrace'>}</span>
1322
+ <span class='kw'>end</span></pre>
1323
+ </td>
1324
+ </tr>
1325
+ </table>
1326
+ </div>
1327
+
1328
+ </div>
1329
+
1330
+ <div id="instance_method_details" class="method_details_list">
1331
+ <h2>Instance Method Details</h2>
1332
+
1333
+
1334
+ <div class="method_details first">
1335
+ <h3 class="signature first" id="analyze!-instance_method">
1336
+
1337
+ - (<tt>Object</tt>) <strong>analyze!</strong>
1338
+
1339
+
1340
+
1341
+
1342
+
1343
+ </h3><div class="docstring">
1344
+ <div class="discussion">
1345
+
1346
+ <p>Alalyze evaluation results.</p>
1347
+
1348
+
1349
+ </div>
1350
+ </div>
1351
+ <div class="tags">
1352
+
1353
+
1354
+ </div><table class="source_code">
1355
+ <tr>
1356
+ <td>
1357
+ <pre class="lines">
1358
+
1359
+
1360
+ 74
1361
+ 75
1362
+ 76</pre>
1363
+ </td>
1364
+ <td>
1365
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 74</span>
1366
+
1367
+ <span class='kw'>def</span> <span class='id identifier rubyid_analyze!'>analyze!</span>
1368
+ <span class='ivar'>@critters</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_critter'>critter</span><span class='op'>|</span> <span class='ivar'>@controller</span><span class='period'>.</span><span class='id identifier rubyid_evaluator'>evaluator</span><span class='period'>.</span><span class='id identifier rubyid_analyze_for_fitness!'>analyze_for_fitness!</span> <span class='id identifier rubyid_critter'>critter</span> <span class='rbrace'>}</span>
1369
+ <span class='kw'>end</span></pre>
1370
+ </td>
1371
+ </tr>
1372
+ </table>
1373
+ </div>
1374
+
1375
+ <div class="method_details ">
1376
+ <h3 class="signature " id="best_critter-instance_method">
1377
+
1378
+ - (<tt>Object</tt>) <strong>best_critter</strong>
1379
+
1380
+
1381
+
1382
+
1383
+
1384
+ </h3><div class="docstring">
1385
+ <div class="discussion">
1386
+
1387
+ <p>The “best critter” is the critter with the lowest (closet to zero) fitness
1388
+ rating.</p>
1389
+
1390
+
1391
+ </div>
1392
+ </div>
1393
+ <div class="tags">
1394
+
1395
+
1396
+ </div><table class="source_code">
1397
+ <tr>
1398
+ <td>
1399
+ <pre class="lines">
1400
+
1401
+
1402
+ 176
1403
+ 177
1404
+ 178
1405
+ 179
1406
+ 180
1407
+ 181
1408
+ 182</pre>
1409
+ </td>
1410
+ <td>
1411
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 176</span>
1412
+
1413
+ <span class='kw'>def</span> <span class='id identifier rubyid_best_critter'>best_critter</span>
1414
+ <span class='kw'>unless</span> <span class='ivar'>@controller</span><span class='period'>.</span><span class='id identifier rubyid_compare_func'>compare_func</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
1415
+ <span class='ivar'>@critters</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span> <span class='id identifier rubyid_b'>b</span><span class='op'>|</span> <span class='ivar'>@controller</span><span class='period'>.</span><span class='id identifier rubyid_compare_func'>compare_func</span><span class='period'>.</span><span class='lparen'>(</span><span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_fitness'>fitness</span><span class='comma'>,</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_fitness'>fitness</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1416
+ <span class='kw'>else</span>
1417
+ <span class='ivar'>@critters</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span> <span class='id identifier rubyid_b'>b</span><span class='op'>|</span> <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_fitness'>fitness</span> <span class='op'>&lt;=&gt;</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_fitness'>fitness</span><span class='rbrace'>}</span>
1418
+ <span class='kw'>end</span>
1419
+ <span class='kw'>end</span></pre>
1420
+ </td>
1421
+ </tr>
1422
+ </table>
1423
+ </div>
1424
+
1425
+ <div class="method_details ">
1426
+ <h3 class="signature " id="dump_s-instance_method">
1427
+
1428
+ - (<tt>Object</tt>) <strong>dump_s</strong>
1429
+
1430
+
1431
+
1432
+
1433
+
1434
+ </h3><table class="source_code">
1435
+ <tr>
1436
+ <td>
1437
+ <pre class="lines">
1438
+
1439
+
1440
+ 194
1441
+ 195
1442
+ 196</pre>
1443
+ </td>
1444
+ <td>
1445
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 194</span>
1446
+
1447
+ <span class='kw'>def</span> <span class='id identifier rubyid_dump_s'>dump_s</span>
1448
+ <span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\npopulation:\n</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@critters</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_crit'>crit</span><span class='op'>|</span> <span class='id identifier rubyid_crit'>crit</span><span class='period'>.</span><span class='id identifier rubyid_dump_s'>dump_s</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1449
+ <span class='kw'>end</span></pre>
1450
+ </td>
1451
+ </tr>
1452
+ </table>
1453
+ </div>
1454
+
1455
+ <div class="method_details ">
1456
+ <h3 class="signature " id="evaluate!-instance_method">
1457
+
1458
+ - (<tt>Object</tt>) <strong>evaluate!</strong>
1459
+
1460
+
1461
+
1462
+
1463
+
1464
+ </h3><div class="docstring">
1465
+ <div class="discussion">
1466
+
1467
+ <p>Called for each sequence.</p>
1468
+
1469
+
1470
+ </div>
1471
+ </div>
1472
+ <div class="tags">
1473
+
1474
+
1475
+ </div><table class="source_code">
1476
+ <tr>
1477
+ <td>
1478
+ <pre class="lines">
1479
+
1480
+
1481
+ 69
1482
+ 70
1483
+ 71</pre>
1484
+ </td>
1485
+ <td>
1486
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 69</span>
1487
+
1488
+ <span class='kw'>def</span> <span class='id identifier rubyid_evaluate!'>evaluate!</span>
1489
+ <span class='ivar'>@critters</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_critter'>critter</span><span class='op'>|</span> <span class='id identifier rubyid_critter'>critter</span><span class='period'>.</span><span class='id identifier rubyid_evaluate!'>evaluate!</span> <span class='rbrace'>}</span>
1490
+ <span class='kw'>end</span></pre>
1491
+ </td>
1492
+ </tr>
1493
+ </table>
1494
+ </div>
1495
+
1496
+ <div class="method_details ">
1497
+ <h3 class="signature " id="evolve-instance_method">
1498
+
1499
+ - (<tt>Object</tt>) <strong>evolve</strong>
1500
+
1501
+
1502
+
1503
+
1504
+
1505
+ </h3><div class="docstring">
1506
+ <div class="discussion">
1507
+
1508
+ <p>Call this after evaluation. Returns a newly-evolved population.</p>
1509
+
1510
+
1511
+ </div>
1512
+ </div>
1513
+ <div class="tags">
1514
+
1515
+
1516
+ </div><table class="source_code">
1517
+ <tr>
1518
+ <td>
1519
+ <pre class="lines">
1520
+
1521
+
1522
+ 80
1523
+ 81
1524
+ 82</pre>
1525
+ </td>
1526
+ <td>
1527
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 80</span>
1528
+
1529
+ <span class='kw'>def</span> <span class='id identifier rubyid_evolve'>evolve</span>
1530
+ <span class='ivar'>@controller</span><span class='period'>.</span><span class='id identifier rubyid_evolver'>evolver</span><span class='period'>.</span><span class='id identifier rubyid_evolve'>evolve</span> <span class='kw'>self</span>
1531
+ <span class='kw'>end</span></pre>
1532
+ </td>
1533
+ </tr>
1534
+ </table>
1535
+ </div>
1536
+
1537
+ <div class="method_details ">
1538
+ <h3 class="signature " id="express!-instance_method">
1539
+
1540
+ - (<tt>Object</tt>) <strong>express!</strong>
1541
+
1542
+
1543
+
1544
+
1545
+
1546
+ </h3><div class="docstring">
1547
+ <div class="discussion">
1548
+
1549
+ <p>Express the entire population.</p>
1550
+
1551
+
1552
+ </div>
1553
+ </div>
1554
+ <div class="tags">
1555
+
1556
+
1557
+ </div><table class="source_code">
1558
+ <tr>
1559
+ <td>
1560
+ <pre class="lines">
1561
+
1562
+
1563
+ 64
1564
+ 65
1565
+ 66</pre>
1566
+ </td>
1567
+ <td>
1568
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 64</span>
1569
+
1570
+ <span class='kw'>def</span> <span class='id identifier rubyid_express!'>express!</span>
1571
+ <span class='ivar'>@critters</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_critter'>critter</span><span class='op'>|</span> <span class='id identifier rubyid_critter'>critter</span><span class='period'>.</span><span class='id identifier rubyid_express!'>express!</span> <span class='rbrace'>}</span>
1572
+ <span class='kw'>end</span></pre>
1573
+ </td>
1574
+ </tr>
1575
+ </table>
1576
+ </div>
1577
+
1578
+ <div class="method_details ">
1579
+ <h3 class="signature " id="initialize_for_recurrence!-instance_method">
1580
+
1581
+ - (<tt>Object</tt>) <strong>initialize_for_recurrence!</strong>
1582
+
1583
+
1584
+
1585
+
1586
+
1587
+ </h3><div class="docstring">
1588
+ <div class="discussion">
1589
+
1590
+ <p>Make sure all critters are reset and prepared for recurrent network
1591
+ evaluation.</p>
1592
+
1593
+
1594
+ </div>
1595
+ </div>
1596
+ <div class="tags">
1597
+
1598
+
1599
+ </div><table class="source_code">
1600
+ <tr>
1601
+ <td>
1602
+ <pre class="lines">
1603
+
1604
+
1605
+ 54
1606
+ 55
1607
+ 56</pre>
1608
+ </td>
1609
+ <td>
1610
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 54</span>
1611
+
1612
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize_for_recurrence!'>initialize_for_recurrence!</span>
1613
+ <span class='ivar'>@critters</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_crit'>crit</span><span class='op'>|</span> <span class='id identifier rubyid_crit'>crit</span><span class='period'>.</span><span class='id identifier rubyid_initialize_neurons!'>initialize_neurons!</span><span class='rbrace'>}</span>
1614
+ <span class='kw'>end</span></pre>
1615
+ </td>
1616
+ </tr>
1617
+ </table>
1618
+ </div>
1619
+
1620
+ <div class="method_details ">
1621
+ <h3 class="signature " id="mutate!-instance_method">
1622
+
1623
+ - (<tt>Object</tt>) <strong>mutate!</strong>
1624
+
1625
+
1626
+
1627
+
1628
+
1629
+ </h3><div class="docstring">
1630
+ <div class="discussion">
1631
+
1632
+ <p>Mutate the genes and neurons.</p>
1633
+
1634
+
1635
+ </div>
1636
+ </div>
1637
+ <div class="tags">
1638
+
1639
+
1640
+ </div><table class="source_code">
1641
+ <tr>
1642
+ <td>
1643
+ <pre class="lines">
1644
+
1645
+
1646
+ 59
1647
+ 60
1648
+ 61</pre>
1649
+ </td>
1650
+ <td>
1651
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 59</span>
1652
+
1653
+ <span class='kw'>def</span> <span class='id identifier rubyid_mutate!'>mutate!</span>
1654
+ <span class='ivar'>@controller</span><span class='period'>.</span><span class='id identifier rubyid_evolver'>evolver</span><span class='period'>.</span><span class='id identifier rubyid_mutate!'>mutate!</span> <span class='kw'>self</span>
1655
+ <span class='kw'>end</span></pre>
1656
+ </td>
1657
+ </tr>
1658
+ </table>
1659
+ </div>
1660
+
1661
+ <div class="method_details ">
1662
+ <h3 class="signature " id="report-instance_method">
1663
+
1664
+ - (<tt>Object</tt>) <strong>report</strong>
1665
+
1666
+
1667
+
1668
+
1669
+
1670
+ </h3><div class="docstring">
1671
+ <div class="discussion">
1672
+
1673
+ <h2 id="label-Generate+a+report+on+the+state+of+this+population.">Generate a report on the state of this population.</h2>
1674
+
1675
+
1676
+ </div>
1677
+ </div>
1678
+ <div class="tags">
1679
+
1680
+
1681
+ </div><table class="source_code">
1682
+ <tr>
1683
+ <td>
1684
+ <pre class="lines">
1685
+
1686
+
1687
+ 165
1688
+ 166
1689
+ 167
1690
+ 168
1691
+ 169
1692
+ 170
1693
+ 171
1694
+ 172</pre>
1695
+ </td>
1696
+ <td>
1697
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 165</span>
1698
+
1699
+ <span class='kw'>def</span> <span class='id identifier rubyid_report'>report</span>
1700
+ <span class='lbrace'>{</span>
1701
+ <span class='label'>fitness:</span> <span class='id identifier rubyid_report_fitness'>report_fitness</span><span class='comma'>,</span>
1702
+ <span class='label'>fitness_species:</span> <span class='id identifier rubyid_report_fitness_species'>report_fitness_species</span><span class='comma'>,</span>
1703
+ <span class='label'>best_critter:</span> <span class='id identifier rubyid_report_best_fit'>report_best_fit</span><span class='comma'>,</span>
1704
+ <span class='label'>worst_critter:</span> <span class='id identifier rubyid_report_worst_fit'>report_worst_fit</span><span class='comma'>,</span>
1705
+ <span class='rbrace'>}</span>
1706
+ <span class='kw'>end</span></pre>
1707
+ </td>
1708
+ </tr>
1709
+ </table>
1710
+ </div>
1711
+
1712
+ <div class="method_details ">
1713
+ <h3 class="signature " id="speciate!-instance_method">
1714
+
1715
+ - (<tt>Object</tt>) <strong>speciate!</strong>
1716
+
1717
+
1718
+
1719
+
1720
+
1721
+ </h3><div class="docstring">
1722
+ <div class="discussion">
1723
+
1724
+ <p>Group critters into species Note that the @species objects have useful
1725
+ singleton methods:</p>
1726
+ <ul><li>
1727
+ <p>@species.member? – checks all of the lists for membership, not just the
1728
+ hash</p>
1729
+ </li><li>
1730
+ <p>@<a href="crit">species</a>.fitness – fitness of the entire species</p>
1731
+ </li></ul>
1732
+
1733
+
1734
+ </div>
1735
+ </div>
1736
+ <div class="tags">
1737
+
1738
+
1739
+ </div><table class="source_code">
1740
+ <tr>
1741
+ <td>
1742
+ <pre class="lines">
1743
+
1744
+
1745
+ 89
1746
+ 90
1747
+ 91
1748
+ 92
1749
+ 93
1750
+ 94
1751
+ 95
1752
+ 96
1753
+ 97
1754
+ 98
1755
+ 99
1756
+ 100
1757
+ 101
1758
+ 102
1759
+ 103
1760
+ 104
1761
+ 105
1762
+ 106
1763
+ 107
1764
+ 108
1765
+ 109
1766
+ 110
1767
+ 111
1768
+ 112
1769
+ 113
1770
+ 114
1771
+ 115
1772
+ 116
1773
+ 117
1774
+ 118
1775
+ 119
1776
+ 120
1777
+ 121
1778
+ 122
1779
+ 123
1780
+ 124
1781
+ 125
1782
+ 126
1783
+ 127
1784
+ 128
1785
+ 129
1786
+ 130
1787
+ 131
1788
+ 132
1789
+ 133
1790
+ 134
1791
+ 135
1792
+ 136
1793
+ 137
1794
+ 138
1795
+ 139
1796
+ 140
1797
+ 141
1798
+ 142
1799
+ 143
1800
+ 144
1801
+ 145
1802
+ 146
1803
+ 147
1804
+ 148
1805
+ 149
1806
+ 150
1807
+ 151
1808
+ 152
1809
+ 153
1810
+ 154
1811
+ 155
1812
+ 156
1813
+ 157
1814
+ 158
1815
+ 159
1816
+ 160
1817
+ 161</pre>
1818
+ </td>
1819
+ <td>
1820
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 89</span>
1821
+
1822
+ <span class='kw'>def</span> <span class='id identifier rubyid_speciate!'>speciate!</span>
1823
+ <span class='comment'># We blow away existing species and create our own member? function
1824
+ </span> <span class='ivar'>@species</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='comment'># lists keyed by representative critter
1825
+ </span> <span class='kw'>def</span> <span class='ivar'>@species</span><span class='period'>.</span><span class='id identifier rubyid_member?'>member?</span><span class='lparen'>(</span><span class='id identifier rubyid_crit'>crit</span><span class='rparen'>)</span>
1826
+ <span class='kw'>super</span><span class='period'>.</span><span class='id identifier rubyid_member?'>member?</span><span class='lparen'>(</span><span class='id identifier rubyid_crit'>crit</span><span class='rparen'>)</span> <span class='kw'>or</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_li'>li</span><span class='op'>|</span> <span class='id identifier rubyid_li'>li</span><span class='period'>.</span><span class='id identifier rubyid_member?'>member?</span> <span class='id identifier rubyid_crit'>crit</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_t1'>t1</span><span class='comma'>,</span> <span class='id identifier rubyid_t2'>t2</span><span class='op'>|</span> <span class='id identifier rubyid_t1'>t1</span> <span class='kw'>or</span> <span class='id identifier rubyid_t2'>t2</span> <span class='rbrace'>}</span>
1827
+ <span class='kw'>end</span>
1828
+
1829
+ <span class='kw'>def</span> <span class='ivar'>@species</span><span class='period'>.</span><span class='id identifier rubyid_evaluate!'>evaluate!</span>
1830
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_sp'>sp</span><span class='op'>|</span>
1831
+ <span class='id identifier rubyid_sp'>sp</span><span class='period'>.</span><span class='id identifier rubyid_fitness'>fitness</span> <span class='op'>=</span> <span class='id identifier rubyid_sp'>sp</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_crit'>crit</span><span class='op'>|</span> <span class='id identifier rubyid_crit'>crit</span><span class='period'>.</span><span class='id identifier rubyid_fitness'>fitness</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span><span class='id identifier rubyid_b'>b</span><span class='op'>|</span> <span class='id identifier rubyid_a'>a</span><span class='op'>+</span><span class='id identifier rubyid_b'>b</span><span class='rbrace'>}</span> <span class='op'>/</span> <span class='id identifier rubyid_sp'>sp</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
1832
+ <span class='kw'>end</span>
1833
+ <span class='kw'>end</span>
1834
+
1835
+ <span class='kw'>def</span> <span class='ivar'>@species</span><span class='period'>.</span><span class='id identifier rubyid_compactify!'>compactify!</span><span class='lparen'>(</span><span class='id identifier rubyid_parm'>parm</span><span class='rparen'>)</span>
1836
+ <span class='id identifier rubyid_mutt'>mutt</span> <span class='op'>=</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='symbol'>:mutt</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_splist'>splist</span><span class='op'>|</span> <span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_splist'>splist</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_splist'>splist</span><span class='op'>|</span>
1837
+ <span class='id identifier rubyid_splist'>splist</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>&gt;=</span> <span class='id identifier rubyid_parm'>parm</span><span class='period'>.</span><span class='id identifier rubyid_smallest_species'>smallest_species</span>
1838
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_splist'>splist</span><span class='op'>|</span>
1839
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_k'>k</span>
1840
+ <span class='id identifier rubyid_splist'>splist</span>
1841
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span>
1842
+
1843
+ <span class='comment'># FIXME this code is not dry!!!!
1844
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_mutt'>mutt</span><span class='period'>.</span><span class='id identifier rubyid_fitness='>fitness=</span><span class='lparen'>(</span><span class='id identifier rubyid_fit'>fit</span><span class='rparen'>)</span>
1845
+ <span class='ivar'>@fitness</span> <span class='op'>=</span> <span class='id identifier rubyid_fit'>fit</span>
1846
+ <span class='kw'>end</span>
1847
+
1848
+ <span class='kw'>def</span> <span class='id identifier rubyid_mutt'>mutt</span><span class='period'>.</span><span class='id identifier rubyid_fitness'>fitness</span>
1849
+ <span class='ivar'>@fitness</span>
1850
+ <span class='kw'>end</span>
1851
+
1852
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='symbol'>:mutt</span> <span class='kw'>if</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='symbol'>:mutt</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
1853
+ <span class='kw'>end</span>
1854
+
1855
+ <span class='comment'># Some convience parms
1856
+ </span> <span class='id identifier rubyid_parm'>parm</span> <span class='op'>=</span> <span class='ivar'>@controller</span><span class='period'>.</span><span class='id identifier rubyid_parms'>parms</span>
1857
+
1858
+ <span class='comment'># And so now we iterate...
1859
+ </span> <span class='ivar'>@critters</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_crit'>crit</span><span class='op'>|</span>
1860
+ <span class='id identifier rubyid_wearein'>wearein</span> <span class='op'>=</span> <span class='kw'>false</span>
1861
+ <span class='ivar'>@species</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_ck'>ck</span><span class='comma'>,</span> <span class='id identifier rubyid_list'>list</span><span class='op'>|</span>
1862
+ <span class='id identifier rubyid_delta'>delta</span> <span class='op'>=</span> <span class='id identifier rubyid_crit'>crit</span><span class='period'>.</span><span class='id identifier rubyid_compare'>compare</span><span class='lparen'>(</span><span class='id identifier rubyid_ck'>ck</span><span class='rparen'>)</span>
1863
+ <span class='comment'>#log.debug { &quot;delta for #{crit} and #{ck} is #{delta}&quot; }
1864
+ </span> <span class='kw'>if</span> <span class='id identifier rubyid_delta'>delta</span> <span class='op'>&lt;</span> <span class='id identifier rubyid_parm'>parm</span><span class='period'>.</span><span class='id identifier rubyid_compatibility_threshold'>compatibility_threshold</span>
1865
+ <span class='id identifier rubyid_list'>list</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_crit'>crit</span>
1866
+ <span class='id identifier rubyid_wearein'>wearein</span> <span class='op'>=</span> <span class='kw'>true</span>
1867
+ <span class='kw'>break</span>
1868
+ <span class='kw'>end</span>
1869
+ <span class='kw'>end</span>
1870
+
1871
+ <span class='comment'># New species?
1872
+ </span> <span class='kw'>unless</span> <span class='id identifier rubyid_wearein'>wearein</span>
1873
+ <span class='ivar'>@species</span><span class='lbracket'>[</span><span class='id identifier rubyid_crit'>crit</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_species'>species</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_crit'>crit</span><span class='rbracket'>]</span>
1874
+ <span class='kw'>def</span> <span class='id identifier rubyid_species'>species</span><span class='period'>.</span><span class='id identifier rubyid_fitness='>fitness=</span><span class='lparen'>(</span><span class='id identifier rubyid_fit'>fit</span><span class='rparen'>)</span>
1875
+ <span class='ivar'>@fitness</span> <span class='op'>=</span> <span class='id identifier rubyid_fit'>fit</span>
1876
+ <span class='kw'>end</span>
1877
+ <span class='kw'>def</span> <span class='id identifier rubyid_species'>species</span><span class='period'>.</span><span class='id identifier rubyid_fitness'>fitness</span>
1878
+ <span class='ivar'>@fitness</span>
1879
+ <span class='kw'>end</span>
1880
+ <span class='kw'>end</span>
1881
+ <span class='kw'>end</span>
1882
+
1883
+ <span class='comment'># Compactify the species if less than smallest_species
1884
+ </span> <span class='ivar'>@species</span><span class='period'>.</span><span class='id identifier rubyid_compactify!'>compactify!</span> <span class='id identifier rubyid_parm'>parm</span>
1885
+
1886
+ <span class='comment'># And now we evaluate all species for fitness...
1887
+ </span> <span class='ivar'>@species</span><span class='period'>.</span><span class='id identifier rubyid_evaluate!'>evaluate!</span>
1888
+
1889
+ <span class='comment'># Dump for debugging reasons
1890
+ </span> <span class='ivar'>@species</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_sp'>sp</span><span class='op'>|</span>
1891
+ <span class='id identifier rubyid_log'>log</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>&gt;&gt; Species </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_k'>k</span><span class='embexpr_end'>}</span><span class='tstring_content'> has </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sp'>sp</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'> members with a </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sp'>sp</span><span class='period'>.</span><span class='id identifier rubyid_fitness'>fitness</span><span class='embexpr_end'>}</span><span class='tstring_content'> fitness</span><span class='tstring_end'>&quot;</span></span>
1892
+ <span class='kw'>end</span>
1893
+
1894
+ <span class='kw'>end</span></pre>
1895
+ </td>
1896
+ </tr>
1897
+ </table>
1898
+ </div>
1899
+
1900
+ <div class="method_details ">
1901
+ <h3 class="signature " id="worst_critter-instance_method">
1902
+
1903
+ - (<tt>Object</tt>) <strong>worst_critter</strong>
1904
+
1905
+
1906
+
1907
+
1908
+
1909
+ </h3><div class="docstring">
1910
+ <div class="discussion">
1911
+
1912
+ <p>The “worst critter” is the critter with the highest (away from zero)
1913
+ fitness rating.</p>
1914
+
1915
+
1916
+ </div>
1917
+ </div>
1918
+ <div class="tags">
1919
+
1920
+
1921
+ </div><table class="source_code">
1922
+ <tr>
1923
+ <td>
1924
+ <pre class="lines">
1925
+
1926
+
1927
+ 186
1928
+ 187
1929
+ 188
1930
+ 189
1931
+ 190
1932
+ 191
1933
+ 192</pre>
1934
+ </td>
1935
+ <td>
1936
+ <pre class="code"><span class="info file"># File 'lib/rubyneat/population.rb', line 186</span>
1937
+
1938
+ <span class='kw'>def</span> <span class='id identifier rubyid_worst_critter'>worst_critter</span>
1939
+ <span class='kw'>unless</span> <span class='ivar'>@controller</span><span class='period'>.</span><span class='id identifier rubyid_compare_func'>compare_func</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
1940
+ <span class='ivar'>@critters</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span> <span class='id identifier rubyid_b'>b</span><span class='op'>|</span> <span class='ivar'>@controller</span><span class='period'>.</span><span class='id identifier rubyid_compare_func'>compare_func</span><span class='period'>.</span><span class='lparen'>(</span><span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_fitness'>fitness</span><span class='comma'>,</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_fitness'>fitness</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1941
+ <span class='kw'>else</span>
1942
+ <span class='ivar'>@critters</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span> <span class='id identifier rubyid_b'>b</span><span class='op'>|</span> <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_fitness'>fitness</span> <span class='op'>&lt;=&gt;</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_fitness'>fitness</span><span class='rbrace'>}</span>
1943
+ <span class='kw'>end</span>
1944
+ <span class='kw'>end</span></pre>
1945
+ </td>
1946
+ </tr>
1947
+ </table>
1948
+ </div>
1949
+
1950
+ </div>
1951
+
1952
+ </div>
1953
+
1954
+ <div id="footer">
1955
+ Generated on Sun Apr 13 15:54:03 2014 by
1956
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1957
+ 0.8.7.4 (ruby-2.1.1).
1958
+ </div>
1959
+
1960
+ </body>
1961
+ </html>