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.
- checksums.yaml +4 -4
- data/.semver +1 -1
- data/Gemfile +19 -19
- data/Gemfile.lock +39 -33
- data/README.md +66 -0
- data/Rakefile +19 -2
- data/bin/neat +4 -60
- data/lib/rubyneat/cli.rb +5 -0
- data/lib/rubyneat/cli/generate.rb +131 -0
- data/lib/rubyneat/cli/main.rb +54 -0
- data/lib/rubyneat/cli/templates/generate/Gemfile.tt +17 -0
- data/lib/rubyneat/cli/templates/generate/README.md.tt +1 -0
- data/lib/rubyneat/cli/templates/generate/bin/neat.tt +14 -0
- data/{neater/xor_neat.rb → lib/rubyneat/cli/templates/generate/neater.tt} +7 -22
- data/rubyneat.gemspec +73 -297
- data/rubyneat.gemspec.orig +384 -0
- metadata +76 -292
- data/.idea/.name +0 -1
- data/.idea/.rakeTasks +0 -7
- data/.idea/dictionaries/trader.xml +0 -3
- data/.idea/encodings.xml +0 -5
- data/.idea/misc.xml +0 -5
- data/.idea/modules.xml +0 -9
- data/.idea/rubyneat.iml +0 -198
- data/.idea/runConfigurations/invpend_neat.xml +0 -26
- data/.idea/runConfigurations/sigdebug_neat.xml +0 -24
- data/.idea/runConfigurations/xor_neat.xml +0 -26
- data/.idea/runConfigurations/xordebug_neat.xml +0 -24
- data/.idea/runConfigurations/xorsin_neat.xml +0 -24
- data/.idea/scopes/scope_settings.xml +0 -5
- data/.idea/vcs.xml +0 -7
- data/.idea/workspace.xml +0 -1151
- data/.yardoc/checksums +0 -11
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/Guardfile +0 -8
- data/doc/ControllerPoint.html +0 -125
- data/doc/CuteA.html +0 -286
- data/doc/CuteB.html +0 -297
- data/doc/DSL.html +0 -883
- data/doc/NEAT.html +0 -588
- data/doc/NEAT/BasicNeuronTypes.html +0 -136
- data/doc/NEAT/BasicNeuronTypes/BiasNeuron.html +0 -518
- data/doc/NEAT/BasicNeuronTypes/CosineNeuron.html +0 -274
- data/doc/NEAT/BasicNeuronTypes/InputNeuron.html +0 -366
- data/doc/NEAT/BasicNeuronTypes/SigmoidNeuron.html +0 -275
- data/doc/NEAT/BasicNeuronTypes/SineNeuron.html +0 -274
- data/doc/NEAT/BasicNeuronTypes/TanhNeuron.html +0 -274
- data/doc/NEAT/Controller.html +0 -2490
- data/doc/NEAT/Controller/NeatSettings.html +0 -3985
- data/doc/NEAT/Critter.html +0 -1037
- data/doc/NEAT/Critter/Genotype.html +0 -1601
- data/doc/NEAT/Critter/Genotype/Gene.html +0 -979
- data/doc/NEAT/Critter/Phenotype.html +0 -603
- data/doc/NEAT/DSL.html +0 -1255
- data/doc/NEAT/Evaluator.html +0 -420
- data/doc/NEAT/Evolver.html +0 -602
- data/doc/NEAT/Evolver/CritterOp.html +0 -551
- data/doc/NEAT/Expressor.html +0 -327
- data/doc/NEAT/Graph.html +0 -402
- data/doc/NEAT/Graph/DependencyResolver.html +0 -478
- data/doc/NEAT/Graph/GraphException.html +0 -123
- data/doc/NEAT/NeatException.html +0 -123
- data/doc/NEAT/NeatOb.html +0 -567
- data/doc/NEAT/Neuron.html +0 -1067
- data/doc/NEAT/Operator.html +0 -162
- data/doc/NEAT/Population.html +0 -1961
- data/doc/NEAT/Trait.html +0 -169
- data/doc/_index.html +0 -373
- data/doc/class_list.html +0 -54
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -57
- data/doc/css/style.css +0 -339
- data/doc/file_list.html +0 -53
- data/doc/frames.html +0 -26
- data/doc/index.html +0 -373
- data/doc/js/app.js +0 -219
- data/doc/js/full_list.js +0 -178
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -1415
- data/doc/top-level-namespace.html +0 -164
- data/foo/foo_aquarium_example.rb +0 -38
- data/foo/foo_gosu.rb +0 -99
- data/foo/foo_rubygoo.rb +0 -104
- data/foo/foo_sdl.rb +0 -34
- data/foo/icon.png +0 -0
- data/neater/invpend_neat.rb +0 -150
- data/neater/rnlib/inverted_pendulum.rb +0 -380
- data/neater/rnlib/xor.rb +0 -10
- data/neater/sigdebug_neat.rb +0 -136
- data/neater/xoranalog_neat.rb +0 -138
- data/neater/xorsin_neat.rb +0 -143
- data/projectFilesBackup/.idea/rubyneat.iml +0 -180
- data/public/.directory +0 -4
- data/public/background.png +0 -0
- data/public/background.xcf +0 -0
- data/public/cart.png +0 -0
- data/public/cart.xcf +0 -0
- data/public/metalpoles_molton_ball_l.jpg +0 -0
- data/public/old_background.png +0 -0
- data/public/pointer.png +0 -0
- data/public/pointer.xcf +0 -0
- data/public/pole.kra +0 -0
- data/public/pole.png +0 -0
- data/public/pole.xcf +0 -0
- data/public/wheel-of-year-stone-DD-131-WOYS.jpg +0 -0
- data/public/wheel.png +0 -0
- data/public/wheel.xcf +0 -0
- data/public/wood-planks-texture.jpg +0 -0
- data/rdoc/ControllerPoint.html +0 -116
- data/rdoc/CuteA.html +0 -177
- data/rdoc/CuteB.html +0 -178
- data/rdoc/DSLSetup.html +0 -177
- data/rdoc/GameTestWindow.html +0 -242
- data/rdoc/GameWindow.html +0 -292
- data/rdoc/Gemfile.html +0 -215
- data/rdoc/Gemfile_lock.html +0 -327
- data/rdoc/GraphTest.html +0 -210
- data/rdoc/Guardfile.html +0 -198
- data/rdoc/InvertedPendulum.html +0 -198
- data/rdoc/InvertedPendulum/Cart.html +0 -668
- data/rdoc/InvertedPendulum/DSL.html +0 -259
- data/rdoc/InvertedPendulum/InvPendWindow.html +0 -402
- data/rdoc/Logger.html +0 -98
- data/rdoc/NEAT.html +0 -422
- data/rdoc/NEAT/BasicNeuronTypes.html +0 -107
- data/rdoc/NEAT/BasicNeuronTypes/BiasNeuron.html +0 -265
- data/rdoc/NEAT/BasicNeuronTypes/CosineNeuron.html +0 -162
- data/rdoc/NEAT/BasicNeuronTypes/InputNeuron.html +0 -206
- data/rdoc/NEAT/BasicNeuronTypes/SigmoidNeuron.html +0 -162
- data/rdoc/NEAT/BasicNeuronTypes/SineNeuron.html +0 -162
- data/rdoc/NEAT/BasicNeuronTypes/TanhNeuron.html +0 -161
- data/rdoc/NEAT/Controller.html +0 -729
- data/rdoc/NEAT/Controller/NeatSettings.html +0 -880
- data/rdoc/NEAT/Critter.html +0 -489
- data/rdoc/NEAT/Critter/Genotype.html +0 -735
- data/rdoc/NEAT/Critter/Genotype/Gene.html +0 -457
- data/rdoc/NEAT/Critter/Phenotype.html +0 -330
- data/rdoc/NEAT/DSL.html +0 -729
- data/rdoc/NEAT/Evaluator.html +0 -256
- data/rdoc/NEAT/Evolver.html +0 -891
- data/rdoc/NEAT/Evolver/CritterOp.html +0 -349
- data/rdoc/NEAT/Expressor.html +0 -402
- data/rdoc/NEAT/Graph.html +0 -263
- data/rdoc/NEAT/Graph/DependencyResolver.html +0 -291
- data/rdoc/NEAT/Graph/GraphException.html +0 -105
- data/rdoc/NEAT/NeatException.html +0 -105
- data/rdoc/NEAT/NeatOb.html +0 -325
- data/rdoc/NEAT/Neuron.html +0 -481
- data/rdoc/NEAT/Operator.html +0 -109
- data/rdoc/NEAT/Population.html +0 -935
- data/rdoc/NEAT/Trait.html +0 -117
- data/rdoc/Object.html +0 -384
- data/rdoc/Phi.html +0 -98
- data/rdoc/Player.html +0 -383
- data/rdoc/Rakefile.html +0 -254
- data/rdoc/RubyNEAT.html +0 -98
- data/rdoc/RubyNEAT/Application.html +0 -105
- data/rdoc/SDL.html +0 -98
- data/rdoc/SDL/Event2.html +0 -98
- data/rdoc/Vector.html +0 -195
- data/rdoc/created.rid +0 -125
- data/rdoc/doc/ControllerPoint_html.html +0 -299
- data/rdoc/doc/CuteA_html.html +0 -438
- data/rdoc/doc/CuteB_html.html +0 -436
- data/rdoc/doc/DSL_html.html +0 -992
- data/rdoc/doc/NEAT/BasicNeuronTypes/BiasNeuron_html.html +0 -617
- data/rdoc/doc/NEAT/BasicNeuronTypes/CosineNeuron_html.html +0 -413
- data/rdoc/doc/NEAT/BasicNeuronTypes/InputNeuron_html.html +0 -498
- data/rdoc/doc/NEAT/BasicNeuronTypes/SigmoidNeuron_html.html +0 -413
- data/rdoc/doc/NEAT/BasicNeuronTypes/SineNeuron_html.html +0 -413
- data/rdoc/doc/NEAT/BasicNeuronTypes/TanhNeuron_html.html +0 -412
- data/rdoc/doc/NEAT/BasicNeuronTypes_html.html +0 -310
- data/rdoc/doc/NEAT/Controller/NeatSettings_html.html +0 -3324
- data/rdoc/doc/NEAT/Controller_html.html +0 -2212
- data/rdoc/doc/NEAT/Critter/Genotype/Gene_html.html +0 -997
- data/rdoc/doc/NEAT/Critter/Genotype_html.html +0 -1556
- data/rdoc/doc/NEAT/Critter/Phenotype_html.html +0 -687
- data/rdoc/doc/NEAT/Critter_html.html +0 -1037
- data/rdoc/doc/NEAT/DSL_html.html +0 -1349
- data/rdoc/doc/NEAT/Evaluator_html.html +0 -556
- data/rdoc/doc/NEAT/Evolver/CritterOp_html.html +0 -690
- data/rdoc/doc/NEAT/Evolver_html.html +0 -677
- data/rdoc/doc/NEAT/Expressor_html.html +0 -468
- data/rdoc/doc/NEAT/Graph/DependencyResolver_html.html +0 -598
- data/rdoc/doc/NEAT/Graph/GraphException_html.html +0 -299
- data/rdoc/doc/NEAT/Graph_html.html +0 -527
- data/rdoc/doc/NEAT/NeatException_html.html +0 -299
- data/rdoc/doc/NEAT/NeatOb_html.html +0 -671
- data/rdoc/doc/NEAT/Neuron_html.html +0 -1095
- data/rdoc/doc/NEAT/Operator_html.html +0 -337
- data/rdoc/doc/NEAT/Population_html.html +0 -1795
- data/rdoc/doc/NEAT/Trait_html.html +0 -344
- data/rdoc/doc/NEAT_html.html +0 -736
- data/rdoc/doc/_index_html.html +0 -559
- data/rdoc/doc/class_list_html.html +0 -369
- data/rdoc/doc/css/common_css.html +0 -188
- data/rdoc/doc/css/full_list_css.html +0 -243
- data/rdoc/doc/css/style_css.html +0 -530
- data/rdoc/doc/file_list_html.html +0 -240
- data/rdoc/doc/frames_html.html +0 -217
- data/rdoc/doc/index_html.html +0 -559
- data/rdoc/doc/js/app_js.html +0 -423
- data/rdoc/doc/js/full_list_js.html +0 -372
- data/rdoc/doc/js/jquery_js.html +0 -1536
- data/rdoc/doc/method_list_html.html +0 -1375
- data/rdoc/doc/top-level-namespace_html.html +0 -317
- data/rdoc/fonts.css +0 -167
- data/rdoc/fonts/Lato-Light.ttf +0 -0
- data/rdoc/fonts/Lato-LightItalic.ttf +0 -0
- data/rdoc/fonts/Lato-Regular.ttf +0 -0
- data/rdoc/fonts/Lato-RegularItalic.ttf +0 -0
- data/rdoc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/rdoc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/rdoc/images/add.png +0 -0
- data/rdoc/images/arrow_up.png +0 -0
- data/rdoc/images/brick.png +0 -0
- data/rdoc/images/brick_link.png +0 -0
- data/rdoc/images/bug.png +0 -0
- data/rdoc/images/bullet_black.png +0 -0
- data/rdoc/images/bullet_toggle_minus.png +0 -0
- data/rdoc/images/bullet_toggle_plus.png +0 -0
- data/rdoc/images/date.png +0 -0
- data/rdoc/images/delete.png +0 -0
- data/rdoc/images/find.png +0 -0
- data/rdoc/images/loadingAnimation.gif +0 -0
- data/rdoc/images/macFFBgHack.png +0 -0
- data/rdoc/images/package.png +0 -0
- data/rdoc/images/page_green.png +0 -0
- data/rdoc/images/page_white_text.png +0 -0
- data/rdoc/images/page_white_width.png +0 -0
- data/rdoc/images/plugin.png +0 -0
- data/rdoc/images/ruby.png +0 -0
- data/rdoc/images/tag_blue.png +0 -0
- data/rdoc/images/tag_green.png +0 -0
- data/rdoc/images/transparent.png +0 -0
- data/rdoc/images/wrench.png +0 -0
- data/rdoc/images/wrench_orange.png +0 -0
- data/rdoc/images/zoom.png +0 -0
- data/rdoc/index.html +0 -282
- data/rdoc/js/darkfish.js +0 -140
- data/rdoc/js/jquery.js +0 -18
- data/rdoc/js/navigation.js +0 -142
- data/rdoc/js/search.js +0 -109
- data/rdoc/js/search_index.js +0 -1
- data/rdoc/js/searcher.js +0 -228
- data/rdoc/rdoc.css +0 -580
- data/rdoc/rubyneat_gemspec.html +0 -387
- data/rdoc/table_of_contents.html +0 -2502
- data/rdoc/xordebug_log.html +0 -170598
- data/rdoc/xorsin_log.html +0 -22569
data/doc/NEAT/Operator.html
DELETED
@@ -1,162 +0,0 @@
|
|
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::Operator
|
8
|
-
|
9
|
-
— 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/Operator.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 (O)</a> »
|
35
|
-
<span class='title'><span class='object_link'><a href="../NEAT.html" title="NEAT (module)">NEAT</a></span></span>
|
36
|
-
»
|
37
|
-
<span class="title">Operator</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::Operator
|
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::Operator</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/rubyneat.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-Base+class+of+operators+in+RubyNEAT%2C">Base class of operators in RubyNEAT,</h1>
|
108
|
-
|
109
|
-
<p>Such as Evolver, etc.</p>
|
110
|
-
|
111
|
-
|
112
|
-
</div>
|
113
|
-
</div>
|
114
|
-
<div class="tags">
|
115
|
-
|
116
|
-
|
117
|
-
</div><div id="subclasses">
|
118
|
-
<h2>Direct Known Subclasses</h2>
|
119
|
-
<p class="children"><span class='object_link'><a href="Evaluator.html" title="NEAT::Evaluator (class)">Evaluator</a></span>, <span class='object_link'><a href="Evolver.html" title="NEAT::Evolver (class)">Evolver</a></span>, <span class='object_link'><a href="Expressor.html" title="NEAT::Expressor (class)">Expressor</a></span></p>
|
120
|
-
</div>
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
<h2>Instance Attribute Summary</h2>
|
128
|
-
|
129
|
-
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="NeatOb.html" title="NEAT::NeatOb (class)">NeatOb</a></span></h3>
|
130
|
-
<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>
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
<h2>Method Summary</h2>
|
141
|
-
|
142
|
-
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="NeatOb.html" title="NEAT::NeatOb (class)">NeatOb</a></span></h3>
|
143
|
-
<p class="inherited"><span class='object_link'><a href="NeatOb.html#initialize-instance_method" title="NEAT::NeatOb#initialize (method)">#initialize</a></span>, <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>
|
144
|
-
|
145
|
-
<div id="constructor_details" class="method_details_list">
|
146
|
-
<h2>Constructor Details</h2>
|
147
|
-
|
148
|
-
<p class="notice">This class inherits a constructor from <span class='object_link'><a href="NeatOb.html#initialize-instance_method" title="NEAT::NeatOb#initialize (method)">NEAT::NeatOb</a></span></p>
|
149
|
-
|
150
|
-
</div>
|
151
|
-
|
152
|
-
|
153
|
-
</div>
|
154
|
-
|
155
|
-
<div id="footer">
|
156
|
-
Generated on Sun Apr 13 15:54:02 2014 by
|
157
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
158
|
-
0.8.7.4 (ruby-2.1.1).
|
159
|
-
</div>
|
160
|
-
|
161
|
-
</body>
|
162
|
-
</html>
|
data/doc/NEAT/Population.html
DELETED
@@ -1,1961 +0,0 @@
|
|
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
|
-
— 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> »
|
35
|
-
<span class='title'><span class='object_link'><a href="../NEAT.html" title="NEAT (module)">NEAT</a></span></span>
|
36
|
-
»
|
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, &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, &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'>&</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'>>=</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'><=></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'>"</span><span class='tstring_content'>\npopulation:\n</span><span class='tstring_end'>"</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'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</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'>>=</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 { "delta for #{crit} and #{ck} is #{delta}" }
|
1864
|
-
</span> <span class='kw'>if</span> <span class='id identifier rubyid_delta'>delta</span> <span class='op'><</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'><<</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'>"</span><span class='tstring_content'>>> 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'>"</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'><=></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>
|