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
@@ -1,1556 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>Genotype.html - rubyneat 0.3.4</title>
|
8
|
-
|
9
|
-
<link href="../../../fonts.css" rel="stylesheet">
|
10
|
-
<link href="../../../rdoc.css" rel="stylesheet">
|
11
|
-
|
12
|
-
<script type="text/javascript">
|
13
|
-
var rdoc_rel_prefix = "../../../";
|
14
|
-
</script>
|
15
|
-
|
16
|
-
<script src="../../../js/jquery.js"></script>
|
17
|
-
<script src="../../../js/navigation.js"></script>
|
18
|
-
<script src="../../../js/search_index.js"></script>
|
19
|
-
<script src="../../../js/search.js"></script>
|
20
|
-
<script src="../../../js/searcher.js"></script>
|
21
|
-
<script src="../../../js/darkfish.js"></script>
|
22
|
-
|
23
|
-
|
24
|
-
<body id="top" role="document" class="file">
|
25
|
-
<nav role="navigation">
|
26
|
-
<div id="project-navigation">
|
27
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
-
<h2>
|
29
|
-
<a href="../../../index.html" rel="home">Home</a>
|
30
|
-
</h2>
|
31
|
-
|
32
|
-
<div id="table-of-contents-navigation">
|
33
|
-
<a href="../../../table_of_contents.html#pages">Pages</a>
|
34
|
-
<a href="../../../table_of_contents.html#classes">Classes</a>
|
35
|
-
<a href="../../../table_of_contents.html#methods">Methods</a>
|
36
|
-
</div>
|
37
|
-
</div>
|
38
|
-
|
39
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
-
<form action="#" method="get" accept-charset="utf-8">
|
41
|
-
<div id="search-field-wrapper">
|
42
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
-
aria-autocomplete="list" aria-controls="search-results"
|
44
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
-
</div>
|
47
|
-
|
48
|
-
<ul id="search-results" aria-label="Search Results"
|
49
|
-
aria-busy="false" aria-expanded="false"
|
50
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
-
</form>
|
52
|
-
</div>
|
53
|
-
|
54
|
-
</div>
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
<div id="project-metadata">
|
59
|
-
<div id="fileindex-section" class="nav-section">
|
60
|
-
<h3>Pages</h3>
|
61
|
-
|
62
|
-
<ul class="link-list">
|
63
|
-
|
64
|
-
<li><a href="../../../Gemfile.html">Gemfile</a>
|
65
|
-
|
66
|
-
<li><a href="../../../Gemfile_lock.html">Gemfile.lock</a>
|
67
|
-
|
68
|
-
<li><a href="../../../Guardfile.html">Guardfile</a>
|
69
|
-
|
70
|
-
<li><a href="../../../Rakefile.html">Rakefile</a>
|
71
|
-
|
72
|
-
<li><a href="../../../doc/ControllerPoint_html.html">ControllerPoint.html</a>
|
73
|
-
|
74
|
-
<li><a href="../../../doc/CuteA_html.html">CuteA.html</a>
|
75
|
-
|
76
|
-
<li><a href="../../../doc/CuteB_html.html">CuteB.html</a>
|
77
|
-
|
78
|
-
<li><a href="../../../doc/DSL_html.html">DSL.html</a>
|
79
|
-
|
80
|
-
<li><a href="../../../doc/NEAT_html.html">NEAT.html</a>
|
81
|
-
|
82
|
-
<li><a href="../../../doc/NEAT/BasicNeuronTypes_html.html">BasicNeuronTypes.html</a>
|
83
|
-
|
84
|
-
<li><a href="../../../doc/NEAT/BasicNeuronTypes/BiasNeuron_html.html">BiasNeuron.html</a>
|
85
|
-
|
86
|
-
<li><a href="../../../doc/NEAT/BasicNeuronTypes/CosineNeuron_html.html">CosineNeuron.html</a>
|
87
|
-
|
88
|
-
<li><a href="../../../doc/NEAT/BasicNeuronTypes/InputNeuron_html.html">InputNeuron.html</a>
|
89
|
-
|
90
|
-
<li><a href="../../../doc/NEAT/BasicNeuronTypes/SigmoidNeuron_html.html">SigmoidNeuron.html</a>
|
91
|
-
|
92
|
-
<li><a href="../../../doc/NEAT/BasicNeuronTypes/SineNeuron_html.html">SineNeuron.html</a>
|
93
|
-
|
94
|
-
<li><a href="../../../doc/NEAT/BasicNeuronTypes/TanhNeuron_html.html">TanhNeuron.html</a>
|
95
|
-
|
96
|
-
<li><a href="../../../doc/NEAT/Controller_html.html">Controller.html</a>
|
97
|
-
|
98
|
-
<li><a href="../../../doc/NEAT/Controller/NeatSettings_html.html">NeatSettings.html</a>
|
99
|
-
|
100
|
-
<li><a href="../../../doc/NEAT/Critter_html.html">Critter.html</a>
|
101
|
-
|
102
|
-
<li><a href="../../../doc/NEAT/Critter/Genotype_html.html">Genotype.html</a>
|
103
|
-
|
104
|
-
<li><a href="../../../doc/NEAT/Critter/Genotype/Gene_html.html">Gene.html</a>
|
105
|
-
|
106
|
-
<li><a href="../../../doc/NEAT/Critter/Phenotype_html.html">Phenotype.html</a>
|
107
|
-
|
108
|
-
<li><a href="../../../doc/NEAT/DSL_html.html">DSL.html</a>
|
109
|
-
|
110
|
-
<li><a href="../../../doc/NEAT/Evaluator_html.html">Evaluator.html</a>
|
111
|
-
|
112
|
-
<li><a href="../../../doc/NEAT/Evolver_html.html">Evolver.html</a>
|
113
|
-
|
114
|
-
<li><a href="../../../doc/NEAT/Evolver/CritterOp_html.html">CritterOp.html</a>
|
115
|
-
|
116
|
-
<li><a href="../../../doc/NEAT/Expressor_html.html">Expressor.html</a>
|
117
|
-
|
118
|
-
<li><a href="../../../doc/NEAT/Graph_html.html">Graph.html</a>
|
119
|
-
|
120
|
-
<li><a href="../../../doc/NEAT/Graph/DependencyResolver_html.html">DependencyResolver.html</a>
|
121
|
-
|
122
|
-
<li><a href="../../../doc/NEAT/Graph/GraphException_html.html">GraphException.html</a>
|
123
|
-
|
124
|
-
<li><a href="../../../doc/NEAT/NeatException_html.html">NeatException.html</a>
|
125
|
-
|
126
|
-
<li><a href="../../../doc/NEAT/NeatOb_html.html">NeatOb.html</a>
|
127
|
-
|
128
|
-
<li><a href="../../../doc/NEAT/Neuron_html.html">Neuron.html</a>
|
129
|
-
|
130
|
-
<li><a href="../../../doc/NEAT/Operator_html.html">Operator.html</a>
|
131
|
-
|
132
|
-
<li><a href="../../../doc/NEAT/Population_html.html">Population.html</a>
|
133
|
-
|
134
|
-
<li><a href="../../../doc/NEAT/Trait_html.html">Trait.html</a>
|
135
|
-
|
136
|
-
<li><a href="../../../doc/_index_html.html">_index.html</a>
|
137
|
-
|
138
|
-
<li><a href="../../../doc/class_list_html.html">class_list.html</a>
|
139
|
-
|
140
|
-
<li><a href="../../../doc/css/common_css.html">common.css</a>
|
141
|
-
|
142
|
-
<li><a href="../../../doc/css/full_list_css.html">full_list.css</a>
|
143
|
-
|
144
|
-
<li><a href="../../../doc/css/style_css.html">style.css</a>
|
145
|
-
|
146
|
-
<li><a href="../../../doc/file_list_html.html">file_list.html</a>
|
147
|
-
|
148
|
-
<li><a href="../../../doc/frames_html.html">frames.html</a>
|
149
|
-
|
150
|
-
<li><a href="../../../doc/index_html.html">index.html</a>
|
151
|
-
|
152
|
-
<li><a href="../../../doc/js/app_js.html">app.js</a>
|
153
|
-
|
154
|
-
<li><a href="../../../doc/js/full_list_js.html">full_list.js</a>
|
155
|
-
|
156
|
-
<li><a href="../../../doc/js/jquery_js.html">jquery.js</a>
|
157
|
-
|
158
|
-
<li><a href="../../../doc/method_list_html.html">method_list.html</a>
|
159
|
-
|
160
|
-
<li><a href="../../../doc/top-level-namespace_html.html">top-level-namespace.html</a>
|
161
|
-
|
162
|
-
<li><a href="../../../foo_dump_log.html">foo.dump.log</a>
|
163
|
-
|
164
|
-
<li><a href="../../../rubyneat_gemspec.html">rubyneat.gemspec</a>
|
165
|
-
|
166
|
-
<li><a href="../../../xordebug_log.html">xordebug.log</a>
|
167
|
-
|
168
|
-
<li><a href="../../../xorsin_log.html">xorsin.log</a>
|
169
|
-
|
170
|
-
</ul>
|
171
|
-
</div>
|
172
|
-
|
173
|
-
</div>
|
174
|
-
</nav>
|
175
|
-
|
176
|
-
<main role="main" aria-label="Page doc/NEAT/Critter/Genotype.html">
|
177
|
-
|
178
|
-
<p><!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”</p>
|
179
|
-
|
180
|
-
<pre>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></pre>
|
181
|
-
|
182
|
-
<p><html xmlns=“<a
|
183
|
-
href="http://www.w3.org/1999/xhtml">www.w3.org/1999/xhtml</a>”
|
184
|
-
xml:lang=“en” lang=“en”></p>
|
185
|
-
|
186
|
-
<pre><head>
|
187
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></pre>
|
188
|
-
|
189
|
-
<p><title></p>
|
190
|
-
|
191
|
-
<pre>Class: NEAT::Critter::Genotype
|
192
|
-
|
193
|
-
&mdash; Documentation by YARD 0.8.7.3</pre>
|
194
|
-
|
195
|
-
<p></title></p>
|
196
|
-
|
197
|
-
<pre><link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
198
|
-
|
199
|
-
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" /></pre>
|
200
|
-
|
201
|
-
<p><script type=“text/javascript” charset=“utf-8”></p>
|
202
|
-
|
203
|
-
<pre>hasFrames = window.top.frames.main ? true : false;
|
204
|
-
relpath = '../../';
|
205
|
-
framesUrl = "../../frames.html#!" + escape(window.location.href);</pre>
|
206
|
-
|
207
|
-
<p></script></p>
|
208
|
-
|
209
|
-
<pre><script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
210
|
-
|
211
|
-
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
212
|
-
|
213
|
-
</head>
|
214
|
-
<body>
|
215
|
-
<div id="header">
|
216
|
-
<div id="menu">
|
217
|
-
|
218
|
-
<a href="../../_index.html">Index (G)</a> &raquo;
|
219
|
-
<span class='title'><span class='object_link'><a href="../../NEAT.html" title="NEAT (module)">NEAT</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Critter.html" title="NEAT::Critter (class)">Critter</a></span></span>
|
220
|
-
&raquo;
|
221
|
-
<span class="title">Genotype</span>
|
222
|
-
|
223
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div></pre>
|
224
|
-
|
225
|
-
<p></div></p>
|
226
|
-
|
227
|
-
<pre> <div id="search">
|
228
|
-
|
229
|
-
<a class="full_list_link" id="class_list_link"
|
230
|
-
href="../../class_list.html">
|
231
|
-
Class List
|
232
|
-
</a>
|
233
|
-
|
234
|
-
<a class="full_list_link" id="method_list_link"
|
235
|
-
href="../../method_list.html">
|
236
|
-
Method List
|
237
|
-
</a>
|
238
|
-
|
239
|
-
<a class="full_list_link" id="file_list_link"
|
240
|
-
href="../../file_list.html">
|
241
|
-
File List
|
242
|
-
</a></pre>
|
243
|
-
|
244
|
-
<p></div></p>
|
245
|
-
|
246
|
-
<pre> <div class="clear"></div>
|
247
|
-
</div>
|
248
|
-
|
249
|
-
<iframe id="search_frame"></iframe>
|
250
|
-
|
251
|
-
<div id="content"><h1>Class: NEAT::Critter::Genotype</pre>
|
252
|
-
|
253
|
-
<p></h1></p>
|
254
|
-
|
255
|
-
<p><dl class=“box”></p>
|
256
|
-
|
257
|
-
<pre><dt class="r1">Inherits:</dt>
|
258
|
-
<dd class="r1">
|
259
|
-
<span class="inheritName"><span class='object_link'><a href="../NeatOb.html" title="NEAT::NeatOb (class)">NeatOb</a></span></span>
|
260
|
-
|
261
|
-
<ul class="fullTree">
|
262
|
-
<li>Object</li>
|
263
|
-
|
264
|
-
<li class="next"><span class='object_link'><a href="../NeatOb.html" title="NEAT::NeatOb (class)">NeatOb</a></span></li>
|
265
|
-
|
266
|
-
<li class="next">NEAT::Critter::Genotype</li>
|
267
|
-
|
268
|
-
</ul>
|
269
|
-
<a href="#" class="inheritanceTree">show all</a>
|
270
|
-
|
271
|
-
</dd>
|
272
|
-
|
273
|
-
<dt class="r2 last">Defined in:</dt>
|
274
|
-
<dd class="r2 last">lib/rubyneat/critter.rb</dd></pre>
|
275
|
-
|
276
|
-
<p></dl> <div class=“clear”></div></p>
|
277
|
-
|
278
|
-
<p><h2>Overview</h2><div class=“docstring”></p>
|
279
|
-
|
280
|
-
<pre><div class="discussion"></pre>
|
281
|
-
|
282
|
-
<p><h1 id=“label-Genotype+part+of+the+Critter”>Genotype part of the
|
283
|
-
Critter</h1></p>
|
284
|
-
|
285
|
-
<p><p>List of connections, basically.</p></p>
|
286
|
-
|
287
|
-
<p><p>Also, basic phentypic expression (which may be overriden by the
|
288
|
-
expressor)</p></p>
|
289
|
-
|
290
|
-
<p><h1 id=“label-Notes”>Notes</h1></p>
|
291
|
-
|
292
|
-
<p><p>Currently, all lists of neurons and genes are Hashes. The neurons
|
293
|
-
are indexed by their own names, and the genes are indexed by their
|
294
|
-
innovation numbers.</p></p>
|
295
|
-
|
296
|
-
<pre></div></pre>
|
297
|
-
|
298
|
-
<p></div> <div class=“tags”></p>
|
299
|
-
|
300
|
-
<p></div><h2>Defined Under Namespace</h2> <p
|
301
|
-
class=“children”></p>
|
302
|
-
|
303
|
-
<pre><strong class="classes">Classes:</strong> <span class='object_link'><a href="Genotype/Gene.html" title="NEAT::Critter::Genotype::Gene (class)">Gene</a></span></pre>
|
304
|
-
|
305
|
-
<p></p></p>
|
306
|
-
|
307
|
-
<pre><h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
308
|
-
<ul class="summary">
|
309
|
-
|
310
|
-
<li class="public ">
|
311
|
-
<span class="summary_signature">
|
312
|
-
|
313
|
-
<a href="#critter-instance_method" title="#critter (instance method)">- (Object) <strong>critter</strong> </a>
|
314
|
-
|
315
|
-
</span>
|
316
|
-
|
317
|
-
<span class="summary_desc"><div class='inline'></pre>
|
318
|
-
|
319
|
-
<p><p>Critter to which we belong.</p> </div></span></p>
|
320
|
-
|
321
|
-
<p></li></p>
|
322
|
-
|
323
|
-
<pre> <li class="public ">
|
324
|
-
<span class="summary_signature">
|
325
|
-
|
326
|
-
<a href="#dangling_neurons-instance_method" title="#dangling_neurons (instance method)">- (Object) <strong>dangling_neurons</strong> </a>
|
327
|
-
|
328
|
-
(also: #dangling_neurons?)
|
329
|
-
|
330
|
-
</span>
|
331
|
-
|
332
|
-
<span class="summary_desc"><div class='inline'></pre>
|
333
|
-
|
334
|
-
<p><p>This will be set to true if there are dangling neurons.</p>
|
335
|
-
</div></span></p>
|
336
|
-
|
337
|
-
<p></li></p>
|
338
|
-
|
339
|
-
<pre> <li class="public ">
|
340
|
-
<span class="summary_signature">
|
341
|
-
|
342
|
-
<a href="#genes-instance_method" title="#genes (instance method)">- (Object) <strong>genes</strong> </a>
|
343
|
-
|
344
|
-
</span>
|
345
|
-
|
346
|
-
<span class="summary_desc"><div class='inline'></pre>
|
347
|
-
|
348
|
-
<p><p>Genes keyed by innovation numbers.</p>
|
349
|
-
</div></span></p>
|
350
|
-
|
351
|
-
<p></li></p>
|
352
|
-
|
353
|
-
<pre> <li class="public ">
|
354
|
-
<span class="summary_signature">
|
355
|
-
|
356
|
-
<a href="#neural_gene_map-instance_method" title="#neural_gene_map (instance method)">- (Object) <strong>neural_gene_map</strong> </a>
|
357
|
-
|
358
|
-
</span>
|
359
|
-
|
360
|
-
<span class="note title readonly">readonly</span>
|
361
|
-
|
362
|
-
<span class="summary_desc"><div class='inline'></pre>
|
363
|
-
|
364
|
-
<p><p>Map neurons to the genes that marks them as output { oneu_name
|
365
|
-
=&gt; [ gene_1, gene_2,… gene_n], …} Just take the in_neuron name and
|
366
|
-
the weight to do the call to that neuron function with the appropriate
|
367
|
-
weights.</p> </div></span></p>
|
368
|
-
|
369
|
-
<p></li></p>
|
370
|
-
|
371
|
-
<pre> <li class="public ">
|
372
|
-
<span class="summary_signature">
|
373
|
-
|
374
|
-
<a href="#neural_inputs-instance_method" title="#neural_inputs (instance method)">- (Object) <strong>neural_inputs</strong> </a>
|
375
|
-
|
376
|
-
</span>
|
377
|
-
|
378
|
-
<span class="note title readonly">readonly</span>
|
379
|
-
|
380
|
-
<span class="summary_desc"><div class='inline'></pre>
|
381
|
-
|
382
|
-
<p><p>Instantiations of neural inputs and outputs.</p>
|
383
|
-
</div></span></p>
|
384
|
-
|
385
|
-
<p></li></p>
|
386
|
-
|
387
|
-
<pre> <li class="public ">
|
388
|
-
<span class="summary_signature">
|
389
|
-
|
390
|
-
<a href="#neural_outputs-instance_method" title="#neural_outputs (instance method)">- (Object) <strong>neural_outputs</strong> </a>
|
391
|
-
|
392
|
-
</span>
|
393
|
-
|
394
|
-
<span class="note title readonly">readonly</span>
|
395
|
-
|
396
|
-
<span class="summary_desc"><div class='inline'></pre>
|
397
|
-
|
398
|
-
<p><p>Instantiations of neural inputs and outputs.</p>
|
399
|
-
</div></span></p>
|
400
|
-
|
401
|
-
<p></li></p>
|
402
|
-
|
403
|
-
<pre> <li class="public ">
|
404
|
-
<span class="summary_signature">
|
405
|
-
|
406
|
-
<a href="#neurons-instance_method" title="#neurons (instance method)">- (Object) <strong>neurons</strong> </a>
|
407
|
-
|
408
|
-
</span>
|
409
|
-
|
410
|
-
<span class="summary_desc"><div class='inline'></pre>
|
411
|
-
|
412
|
-
<p><p>List of neurons hashed by name.</p>
|
413
|
-
</div></span></p>
|
414
|
-
|
415
|
-
<p></li></p>
|
416
|
-
|
417
|
-
<pre></ul>
|
418
|
-
|
419
|
-
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="../NeatOb.html" title="NEAT::NeatOb (class)">NeatOb</a></span></h3>
|
420
|
-
<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>
|
421
|
-
|
422
|
-
<h2>
|
423
|
-
Instance Method Summary
|
424
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
425
|
-
</h2>
|
426
|
-
|
427
|
-
<ul class="summary">
|
428
|
-
|
429
|
-
<li class="public ">
|
430
|
-
<span class="summary_signature">
|
431
|
-
|
432
|
-
<a href="#add_genes-instance_method" title="#add_genes (instance method)">- (Object) <strong>add_genes</strong>(*genes) </a>
|
433
|
-
|
434
|
-
</span>
|
435
|
-
|
436
|
-
<span class="summary_desc"><div class='inline'></pre>
|
437
|
-
|
438
|
-
<p><p>Genes added here MUST correspond to pre-existing
|
439
|
-
neurons.</p> </div></span></p>
|
440
|
-
|
441
|
-
<p></li></p>
|
442
|
-
|
443
|
-
<pre> <li class="public ">
|
444
|
-
<span class="summary_signature">
|
445
|
-
|
446
|
-
<a href="#add_neurons-instance_method" title="#add_neurons (instance method)">- (Object) <strong>add_neurons</strong>(*neus) </a>
|
447
|
-
|
448
|
-
</span>
|
449
|
-
|
450
|
-
<span class="summary_desc"><div class='inline'></pre>
|
451
|
-
|
452
|
-
<p><p>Add new neurons to the fold.</p> </div></span></p>
|
453
|
-
|
454
|
-
<p></li></p>
|
455
|
-
|
456
|
-
<pre> <li class="public ">
|
457
|
-
<span class="summary_signature">
|
458
|
-
|
459
|
-
<a href="#dump_s-instance_method" title="#dump_s (instance method)">- (Object) <strong>dump_s</strong> </a>
|
460
|
-
|
461
|
-
</span>
|
462
|
-
|
463
|
-
<span class="summary_desc"><div class='inline'></div></span></pre>
|
464
|
-
|
465
|
-
<p></li></p>
|
466
|
-
|
467
|
-
<pre> <li class="public ">
|
468
|
-
<span class="summary_signature">
|
469
|
-
|
470
|
-
<a href="#fitness_cost-instance_method" title="#fitness_cost (instance method)">- (Object) <strong>fitness_cost</strong> </a>
|
471
|
-
|
472
|
-
</span>
|
473
|
-
|
474
|
-
<span class="summary_desc"><div class='inline'></pre>
|
475
|
-
|
476
|
-
<p><p>Calculate the cost of this genotype.</p>
|
477
|
-
</div></span></p>
|
478
|
-
|
479
|
-
<p></li></p>
|
480
|
-
|
481
|
-
<pre> <li class="public ">
|
482
|
-
<span class="summary_signature">
|
483
|
-
|
484
|
-
<a href="#forget%21-instance_method" title="#forget! (instance method)">- (Object) <strong>forget!</strong> </a>
|
485
|
-
|
486
|
-
</span>
|
487
|
-
|
488
|
-
<span class="summary_desc"><div class='inline'></pre>
|
489
|
-
|
490
|
-
<p><p>Make the neurons forget their wiring.</p>
|
491
|
-
</div></span></p>
|
492
|
-
|
493
|
-
<p></li></p>
|
494
|
-
|
495
|
-
<pre> <li class="public ">
|
496
|
-
<span class="summary_signature">
|
497
|
-
|
498
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Genotype) <strong>initialize</strong>(critter, mating = false, &amp;block) </a>
|
499
|
-
|
500
|
-
</span>
|
501
|
-
|
502
|
-
<span class="note title constructor">constructor</span>
|
503
|
-
|
504
|
-
<span class="summary_desc"><div class='inline'></pre>
|
505
|
-
|
506
|
-
<p><p>A new instance of Genotype.</p> </div></span></p>
|
507
|
-
|
508
|
-
<p></li></p>
|
509
|
-
|
510
|
-
<pre> <li class="public ">
|
511
|
-
<span class="summary_signature">
|
512
|
-
|
513
|
-
<a href="#innervate%21-instance_method" title="#innervate! (instance method)">- (Object) <strong>innervate!</strong>(*hneus) </a>
|
514
|
-
|
515
|
-
</span>
|
516
|
-
|
517
|
-
<span class="summary_desc"><div class='inline'></pre>
|
518
|
-
|
519
|
-
<p><p>We take the neural hashes (presumably from other neurons), and
|
520
|
-
innervate them.</p> </div></span></p>
|
521
|
-
|
522
|
-
<p></li></p>
|
523
|
-
|
524
|
-
<pre> <li class="public ">
|
525
|
-
<span class="summary_signature">
|
526
|
-
|
527
|
-
<a href="#neucleate-instance_method" title="#neucleate (instance method)">- (Object) <strong>neucleate</strong>(clean: true, &amp;block) </a>
|
528
|
-
|
529
|
-
</span>
|
530
|
-
|
531
|
-
<span class="summary_desc"><div class='inline'></pre>
|
532
|
-
|
533
|
-
<p><p>We add genes given here to the genome.</p>
|
534
|
-
</div></span></p>
|
535
|
-
|
536
|
-
<p></li></p>
|
537
|
-
|
538
|
-
<pre> <li class="public ">
|
539
|
-
<span class="summary_signature">
|
540
|
-
|
541
|
-
<a href="#nuke_redundancies%21-instance_method" title="#nuke_redundancies! (instance method)">- (Object) <strong>nuke_redundancies!</strong> </a>
|
542
|
-
|
543
|
-
</span>
|
544
|
-
|
545
|
-
<span class="summary_desc"><div class='inline'></pre>
|
546
|
-
|
547
|
-
<p><p>Remove any redundancies in the genome, any genes refering to the
|
548
|
-
same two neurons.</p> </div></span></p>
|
549
|
-
|
550
|
-
<p></li></p>
|
551
|
-
|
552
|
-
<pre> <li class="public ">
|
553
|
-
<span class="summary_signature">
|
554
|
-
|
555
|
-
<a href="#prune%21-instance_method" title="#prune! (instance method)">- (Object) <strong>prune!</strong> </a>
|
556
|
-
|
557
|
-
</span>
|
558
|
-
|
559
|
-
<span class="summary_desc"><div class='inline'></pre>
|
560
|
-
|
561
|
-
<p><p>Go through the list of neurons and drop any neurons not referenced
|
562
|
-
by the genes.</p> </div></span></p>
|
563
|
-
|
564
|
-
<p></li></p>
|
565
|
-
|
566
|
-
<pre> <li class="public ">
|
567
|
-
<span class="summary_signature">
|
568
|
-
|
569
|
-
<a href="#wire%21-instance_method" title="#wire! (instance method)">- (Object) <strong>wire!</strong> </a>
|
570
|
-
|
571
|
-
</span>
|
572
|
-
|
573
|
-
<span class="summary_desc"><div class='inline'></pre>
|
574
|
-
|
575
|
-
<p><p>Wire up the neurons based on the genes.</p>
|
576
|
-
</div></span></p>
|
577
|
-
|
578
|
-
<p></li></p>
|
579
|
-
|
580
|
-
<pre> </ul>
|
581
|
-
|
582
|
-
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="../NeatOb.html" title="NEAT::NeatOb (class)">NeatOb</a></span></h3>
|
583
|
-
<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>
|
584
|
-
|
585
|
-
<div id="constructor_details" class="method_details_list">
|
586
|
-
<h2>Constructor Details</h2>
|
587
|
-
|
588
|
-
<div class="method_details first">
|
589
|
-
<h3 class="signature first" id="initialize-instance_method">
|
590
|
-
|
591
|
-
- (<tt><span class='object_link'><a href="" title="NEAT::Critter::Genotype (class)">Genotype</a></span></tt>) <strong>initialize</strong>(critter, mating = false, &amp;block)</pre>
|
592
|
-
|
593
|
-
<p></h3><div class=“docstring”></p>
|
594
|
-
|
595
|
-
<pre><div class="discussion"></pre>
|
596
|
-
|
597
|
-
<p><p>Returns a new instance of Genotype</p></p>
|
598
|
-
|
599
|
-
<pre></div></pre>
|
600
|
-
|
601
|
-
<p></div> <div class=“tags”></p>
|
602
|
-
|
603
|
-
<p></div><table class=“source_code”></p>
|
604
|
-
|
605
|
-
<pre><tr>
|
606
|
-
<td>
|
607
|
-
<pre class="lines"></pre>
|
608
|
-
|
609
|
-
<p>88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106</pre></p>
|
610
|
-
|
611
|
-
<pre></td>
|
612
|
-
<td>
|
613
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 88</span></pre>
|
614
|
-
|
615
|
-
<p><span class='kw'>def</span> <span class='id
|
616
|
-
identifier rubyid_initialize'>initialize</span><span
|
617
|
-
class='lparen'>(</span><span class='id identifier
|
618
|
-
rubyid_critter'>critter</span><span
|
619
|
-
class='comma'>,</span> <span class='id identifier
|
620
|
-
rubyid_mating'>mating</span> <span
|
621
|
-
class='op'>=</span> <span
|
622
|
-
class='kw'>false</span><span
|
623
|
-
class='comma'>,</span> <span
|
624
|
-
class='op'>&amp;</span><span class='id
|
625
|
-
identifier rubyid_block'>block</span><span
|
626
|
-
class='rparen'>)</span></p>
|
627
|
-
|
628
|
-
<pre><span class='kw'>super</span> <span class='id identifier rubyid_critter'>critter</span><span class='period'>.</span><span class='id identifier rubyid_controller'>controller</span>
|
629
|
-
<span class='ivar'>@critter</span> <span class='op'>=</span> <span class='id identifier rubyid_critter'>critter</span>
|
630
|
-
|
631
|
-
<span class='comment'># Initialize basic structures</pre>
|
632
|
-
|
633
|
-
<p></span> <span class='ivar'>@genes</span>
|
634
|
-
<span class='op'>=</span> <span
|
635
|
-
class='kw'>nil</span></p>
|
636
|
-
|
637
|
-
<pre><span class='ivar'>@neural_inputs</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='lbracket'>[</span><span class='ivar'>@critter</span><span class='period'>.</span><span class='id identifier rubyid_population'>population</span><span class='period'>.</span><span class='id identifier rubyid_input_neurons'>input_neurons</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_sym'>sym</span><span class='comma'>,</span> <span class='id identifier rubyid_ineu'>ineu</span><span class='op'>|</span>
|
638
|
-
<span class='lbracket'>[</span><span class='id identifier rubyid_sym'>sym</span><span class='comma'>,</span> <span class='id identifier rubyid_ineu'>ineu</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@controller</span><span class='comma'>,</span> <span class='id identifier rubyid_sym'>sym</span><span class='rparen'>)</span><span class='rbracket'>]</span>
|
639
|
-
<span class='rbrace'>}</span><span class='rbracket'>]</span>
|
640
|
-
|
641
|
-
<span class='ivar'>@neural_outputs</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='lbracket'>[</span><span class='ivar'>@critter</span><span class='period'>.</span><span class='id identifier rubyid_population'>population</span><span class='period'>.</span><span class='id identifier rubyid_output_neurons'>output_neurons</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_sym'>sym</span><span class='comma'>,</span> <span class='id identifier rubyid_ineu'>ineu</span><span class='op'>|</span>
|
642
|
-
<span class='lbracket'>[</span><span class='id identifier rubyid_sym'>sym</span><span class='comma'>,</span> <span class='id identifier rubyid_ineu'>ineu</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@controller</span><span class='comma'>,</span> <span class='id identifier rubyid_sym'>sym</span><span class='rparen'>)</span><span class='rbracket'>]</span>
|
643
|
-
<span class='rbrace'>}</span><span class='rbracket'>]</span>
|
644
|
-
<span class='ivar'>@neurons</span> <span class='op'>=</span> <span class='ivar'>@neural_inputs</span><span class='period'>.</span><span class='id identifier rubyid_clone'>clone</span> <span class='comment'># this must be a shallow clone!</pre>
|
645
|
-
|
646
|
-
<p></span> <span
|
647
|
-
class='ivar'>@neurons</span><span
|
648
|
-
class='period'>.</span><span class='id identifier
|
649
|
-
rubyid_merge!'>merge!</span> <span
|
650
|
-
class='ivar'>@neural_outputs</span></p>
|
651
|
-
|
652
|
-
<pre><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_gen_initial_genes!'>gen_initial_genes!</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_mating'>mating</span>
|
653
|
-
<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></pre>
|
654
|
-
|
655
|
-
<p><span class='kw'>end</span></pre></p>
|
656
|
-
|
657
|
-
<pre> </td>
|
658
|
-
</tr></pre>
|
659
|
-
|
660
|
-
<p></table> </div></p>
|
661
|
-
|
662
|
-
<p></div></p>
|
663
|
-
|
664
|
-
<pre><div id="instance_attr_details" class="attr_details">
|
665
|
-
<h2>Instance Attribute Details</h2>
|
666
|
-
|
667
|
-
<span id="critter=-instance_method"></span>
|
668
|
-
<div class="method_details first">
|
669
|
-
<h3 class="signature first" id="critter-instance_method">
|
670
|
-
|
671
|
-
- (<tt>Object</tt>) <strong>critter</strong></pre>
|
672
|
-
|
673
|
-
<p></h3><div class=“docstring”></p>
|
674
|
-
|
675
|
-
<pre><div class="discussion"></pre>
|
676
|
-
|
677
|
-
<p><p>Critter to which we belong</p></p>
|
678
|
-
|
679
|
-
<pre></div></pre>
|
680
|
-
|
681
|
-
<p></div> <div class=“tags”></p>
|
682
|
-
|
683
|
-
<p></div><table class=“source_code”></p>
|
684
|
-
|
685
|
-
<pre><tr>
|
686
|
-
<td>
|
687
|
-
<pre class="lines"></pre>
|
688
|
-
|
689
|
-
<p>67 68 69</pre></p>
|
690
|
-
|
691
|
-
<pre></td>
|
692
|
-
<td>
|
693
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 67</span></pre>
|
694
|
-
|
695
|
-
<p><span class='kw'>def</span> <span class='id
|
696
|
-
identifier rubyid_critter'>critter</span></p>
|
697
|
-
|
698
|
-
<pre><span class='ivar'>@critter</span></pre>
|
699
|
-
|
700
|
-
<p><span class='kw'>end</span></pre></p>
|
701
|
-
|
702
|
-
<pre> </td>
|
703
|
-
</tr></pre>
|
704
|
-
|
705
|
-
<p></table> </div></p>
|
706
|
-
|
707
|
-
<pre> <span id="dangling_neurons=-instance_method"></span>
|
708
|
-
<div class="method_details ">
|
709
|
-
<h3 class="signature " id="dangling_neurons-instance_method">
|
710
|
-
|
711
|
-
- (<tt>Object</tt>) <strong>dangling_neurons</strong>
|
712
|
-
|
713
|
-
<span class="aliases">Also known as:
|
714
|
-
<span class="names"><span id='dangling_neurons?-instance_method'>dangling_neurons?</span></span>
|
715
|
-
</span></pre>
|
716
|
-
|
717
|
-
<p></h3><div class=“docstring”></p>
|
718
|
-
|
719
|
-
<pre><div class="discussion"></pre>
|
720
|
-
|
721
|
-
<p><p>This will be set to true if there are dangling neurons.</p></p>
|
722
|
-
|
723
|
-
<pre></div></pre>
|
724
|
-
|
725
|
-
<p></div> <div class=“tags”></p>
|
726
|
-
|
727
|
-
<p></div><table class=“source_code”></p>
|
728
|
-
|
729
|
-
<pre><tr>
|
730
|
-
<td>
|
731
|
-
<pre class="lines"></pre>
|
732
|
-
|
733
|
-
<p>79 80 81</pre></p>
|
734
|
-
|
735
|
-
<pre></td>
|
736
|
-
<td>
|
737
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 79</span></pre>
|
738
|
-
|
739
|
-
<p><span class='kw'>def</span> <span class='id
|
740
|
-
identifier rubyid_dangling_neurons'>dangling_neurons</span></p>
|
741
|
-
|
742
|
-
<pre><span class='ivar'>@dangling_neurons</span></pre>
|
743
|
-
|
744
|
-
<p><span class='kw'>end</span></pre></p>
|
745
|
-
|
746
|
-
<pre> </td>
|
747
|
-
</tr></pre>
|
748
|
-
|
749
|
-
<p></table> </div></p>
|
750
|
-
|
751
|
-
<pre> <span id="genes=-instance_method"></span>
|
752
|
-
<div class="method_details ">
|
753
|
-
<h3 class="signature " id="genes-instance_method">
|
754
|
-
|
755
|
-
- (<tt>Object</tt>) <strong>genes</strong></pre>
|
756
|
-
|
757
|
-
<p></h3><div class=“docstring”></p>
|
758
|
-
|
759
|
-
<pre><div class="discussion"></pre>
|
760
|
-
|
761
|
-
<p><p>Genes keyed by innovation numbers</p></p>
|
762
|
-
|
763
|
-
<pre></div></pre>
|
764
|
-
|
765
|
-
<p></div> <div class=“tags”></p>
|
766
|
-
|
767
|
-
<p></div><table class=“source_code”></p>
|
768
|
-
|
769
|
-
<pre><tr>
|
770
|
-
<td>
|
771
|
-
<pre class="lines"></pre>
|
772
|
-
|
773
|
-
<p>70 71 72</pre></p>
|
774
|
-
|
775
|
-
<pre></td>
|
776
|
-
<td>
|
777
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 70</span></pre>
|
778
|
-
|
779
|
-
<p><span class='kw'>def</span> <span class='id
|
780
|
-
identifier rubyid_genes'>genes</span></p>
|
781
|
-
|
782
|
-
<pre><span class='ivar'>@genes</span></pre>
|
783
|
-
|
784
|
-
<p><span class='kw'>end</span></pre></p>
|
785
|
-
|
786
|
-
<pre> </td>
|
787
|
-
</tr></pre>
|
788
|
-
|
789
|
-
<p></table> </div></p>
|
790
|
-
|
791
|
-
<pre> <span id=""></span>
|
792
|
-
<div class="method_details ">
|
793
|
-
<h3 class="signature " id="neural_gene_map-instance_method">
|
794
|
-
|
795
|
-
- (<tt>Object</tt>) <strong>neural_gene_map</strong> <span class="extras">(readonly)</span></pre>
|
796
|
-
|
797
|
-
<p></h3><div class=“docstring”></p>
|
798
|
-
|
799
|
-
<pre><div class="discussion"></pre>
|
800
|
-
|
801
|
-
<p><p>Map neurons to the genes that marks them as output { oneu_name
|
802
|
-
=&gt; [ gene_1, gene_2,… gene_n], …} Just take the in_neuron name and
|
803
|
-
the weight to do the call to that neuron function with the appropriate
|
804
|
-
weights</p></p>
|
805
|
-
|
806
|
-
<pre></div></pre>
|
807
|
-
|
808
|
-
<p></div> <div class=“tags”></p>
|
809
|
-
|
810
|
-
<p></div><table class=“source_code”></p>
|
811
|
-
|
812
|
-
<pre><tr>
|
813
|
-
<td>
|
814
|
-
<pre class="lines"></pre>
|
815
|
-
|
816
|
-
<p>86 87 88</pre></p>
|
817
|
-
|
818
|
-
<pre></td>
|
819
|
-
<td>
|
820
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 86</span></pre>
|
821
|
-
|
822
|
-
<p><span class='kw'>def</span> <span class='id
|
823
|
-
identifier rubyid_neural_gene_map'>neural_gene_map</span></p>
|
824
|
-
|
825
|
-
<pre><span class='ivar'>@neural_gene_map</span></pre>
|
826
|
-
|
827
|
-
<p><span class='kw'>end</span></pre></p>
|
828
|
-
|
829
|
-
<pre> </td>
|
830
|
-
</tr></pre>
|
831
|
-
|
832
|
-
<p></table> </div></p>
|
833
|
-
|
834
|
-
<pre> <span id=""></span>
|
835
|
-
<div class="method_details ">
|
836
|
-
<h3 class="signature " id="neural_inputs-instance_method">
|
837
|
-
|
838
|
-
- (<tt>Object</tt>) <strong>neural_inputs</strong> <span class="extras">(readonly)</span></pre>
|
839
|
-
|
840
|
-
<p></h3><div class=“docstring”></p>
|
841
|
-
|
842
|
-
<pre><div class="discussion"></pre>
|
843
|
-
|
844
|
-
<p><p>Instantiations of neural inputs and outputs</p></p>
|
845
|
-
|
846
|
-
<pre></div></pre>
|
847
|
-
|
848
|
-
<p></div> <div class=“tags”></p>
|
849
|
-
|
850
|
-
<p></div><table class=“source_code”></p>
|
851
|
-
|
852
|
-
<pre><tr>
|
853
|
-
<td>
|
854
|
-
<pre class="lines"></pre>
|
855
|
-
|
856
|
-
<p>76 77 78</pre></p>
|
857
|
-
|
858
|
-
<pre></td>
|
859
|
-
<td>
|
860
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 76</span></pre>
|
861
|
-
|
862
|
-
<p><span class='kw'>def</span> <span class='id
|
863
|
-
identifier rubyid_neural_inputs'>neural_inputs</span></p>
|
864
|
-
|
865
|
-
<pre><span class='ivar'>@neural_inputs</span></pre>
|
866
|
-
|
867
|
-
<p><span class='kw'>end</span></pre></p>
|
868
|
-
|
869
|
-
<pre> </td>
|
870
|
-
</tr></pre>
|
871
|
-
|
872
|
-
<p></table> </div></p>
|
873
|
-
|
874
|
-
<pre> <span id=""></span>
|
875
|
-
<div class="method_details ">
|
876
|
-
<h3 class="signature " id="neural_outputs-instance_method">
|
877
|
-
|
878
|
-
- (<tt>Object</tt>) <strong>neural_outputs</strong> <span class="extras">(readonly)</span></pre>
|
879
|
-
|
880
|
-
<p></h3><div class=“docstring”></p>
|
881
|
-
|
882
|
-
<pre><div class="discussion"></pre>
|
883
|
-
|
884
|
-
<p><p>Instantiations of neural inputs and outputs</p></p>
|
885
|
-
|
886
|
-
<pre></div></pre>
|
887
|
-
|
888
|
-
<p></div> <div class=“tags”></p>
|
889
|
-
|
890
|
-
<p></div><table class=“source_code”></p>
|
891
|
-
|
892
|
-
<pre><tr>
|
893
|
-
<td>
|
894
|
-
<pre class="lines"></pre>
|
895
|
-
|
896
|
-
<p>76 77 78</pre></p>
|
897
|
-
|
898
|
-
<pre></td>
|
899
|
-
<td>
|
900
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 76</span></pre>
|
901
|
-
|
902
|
-
<p><span class='kw'>def</span> <span class='id
|
903
|
-
identifier rubyid_neural_outputs'>neural_outputs</span></p>
|
904
|
-
|
905
|
-
<pre><span class='ivar'>@neural_outputs</span></pre>
|
906
|
-
|
907
|
-
<p><span class='kw'>end</span></pre></p>
|
908
|
-
|
909
|
-
<pre> </td>
|
910
|
-
</tr></pre>
|
911
|
-
|
912
|
-
<p></table> </div></p>
|
913
|
-
|
914
|
-
<pre> <span id="neurons=-instance_method"></span>
|
915
|
-
<div class="method_details ">
|
916
|
-
<h3 class="signature " id="neurons-instance_method">
|
917
|
-
|
918
|
-
- (<tt>Object</tt>) <strong>neurons</strong></pre>
|
919
|
-
|
920
|
-
<p></h3><div class=“docstring”></p>
|
921
|
-
|
922
|
-
<pre><div class="discussion"></pre>
|
923
|
-
|
924
|
-
<p><p>List of neurons hashed by name</p></p>
|
925
|
-
|
926
|
-
<pre></div></pre>
|
927
|
-
|
928
|
-
<p></div> <div class=“tags”></p>
|
929
|
-
|
930
|
-
<p></div><table class=“source_code”></p>
|
931
|
-
|
932
|
-
<pre><tr>
|
933
|
-
<td>
|
934
|
-
<pre class="lines"></pre>
|
935
|
-
|
936
|
-
<p>73 74 75</pre></p>
|
937
|
-
|
938
|
-
<pre></td>
|
939
|
-
<td>
|
940
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 73</span></pre>
|
941
|
-
|
942
|
-
<p><span class='kw'>def</span> <span class='id
|
943
|
-
identifier rubyid_neurons'>neurons</span></p>
|
944
|
-
|
945
|
-
<pre><span class='ivar'>@neurons</span></pre>
|
946
|
-
|
947
|
-
<p><span class='kw'>end</span></pre></p>
|
948
|
-
|
949
|
-
<pre> </td>
|
950
|
-
</tr></pre>
|
951
|
-
|
952
|
-
<p></table> </div></p>
|
953
|
-
|
954
|
-
<pre></div>
|
955
|
-
|
956
|
-
<div id="instance_method_details" class="method_details_list">
|
957
|
-
<h2>Instance Method Details</h2>
|
958
|
-
|
959
|
-
<div class="method_details first">
|
960
|
-
<h3 class="signature first" id="add_genes-instance_method">
|
961
|
-
|
962
|
-
- (<tt>Object</tt>) <strong>add_genes</strong>(*genes)</pre>
|
963
|
-
|
964
|
-
<p></h3><div class=“docstring”></p>
|
965
|
-
|
966
|
-
<pre><div class="discussion"></pre>
|
967
|
-
|
968
|
-
<p><p>Genes added here MUST correspond to pre-existing neurons. Be sure
|
969
|
-
to do add_neurons first!!!!</p></p>
|
970
|
-
|
971
|
-
<pre></div></pre>
|
972
|
-
|
973
|
-
<p></div> <div class=“tags”></p>
|
974
|
-
|
975
|
-
<p></div><table class=“source_code”></p>
|
976
|
-
|
977
|
-
<pre><tr>
|
978
|
-
<td>
|
979
|
-
<pre class="lines"></pre>
|
980
|
-
|
981
|
-
<p>163 164 165 166 167 168 169</pre></p>
|
982
|
-
|
983
|
-
<pre></td>
|
984
|
-
<td>
|
985
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 163</span></pre>
|
986
|
-
|
987
|
-
<p><span class='kw'>def</span> <span class='id
|
988
|
-
identifier rubyid_add_genes'>add_genes</span><span
|
989
|
-
class='lparen'>(</span><span
|
990
|
-
class='op'>*</span><span class='id identifier
|
991
|
-
rubyid_genes'>genes</span><span
|
992
|
-
class='rparen'>)</span></p>
|
993
|
-
|
994
|
-
<pre><span class='id identifier rubyid_genes'>genes</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_gene'>gene</span><span class='op'>|</span>
|
995
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NeatException</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Neuron </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_gene'>gene</span><span class='period'>.</span><span class='id identifier rubyid_in_neuron'>in_neuron</span><span class='embexpr_end'>}</span><span class='tstring_content'> missing</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='ivar'>@neurons</span><span class='period'>.</span><span class='id identifier rubyid_member?'>member?</span> <span class='id identifier rubyid_gene'>gene</span><span class='period'>.</span><span class='id identifier rubyid_in_neuron'>in_neuron</span>
|
996
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NeatException</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Neuron </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_gene'>gene</span><span class='period'>.</span><span class='id identifier rubyid_out_neuron'>out_neuron</span><span class='embexpr_end'>}</span><span class='tstring_content'> missing</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='ivar'>@neurons</span><span class='period'>.</span><span class='id identifier rubyid_member?'>member?</span> <span class='id identifier rubyid_gene'>gene</span><span class='period'>.</span><span class='id identifier rubyid_out_neuron'>out_neuron</span>
|
997
|
-
<span class='ivar'>@genes</span><span class='lbracket'>[</span><span class='id identifier rubyid_gene'>gene</span><span class='period'>.</span><span class='id identifier rubyid_innovation'>innovation</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_gene'>gene</span>
|
998
|
-
<span class='kw'>end</span></pre>
|
999
|
-
|
1000
|
-
<p><span class='kw'>end</span></pre></p>
|
1001
|
-
|
1002
|
-
<pre> </td>
|
1003
|
-
</tr></pre>
|
1004
|
-
|
1005
|
-
<p></table> </div></p>
|
1006
|
-
|
1007
|
-
<pre> <div class="method_details ">
|
1008
|
-
<h3 class="signature " id="add_neurons-instance_method">
|
1009
|
-
|
1010
|
-
- (<tt>Object</tt>) <strong>add_neurons</strong>(*neus)</pre>
|
1011
|
-
|
1012
|
-
<p></h3><div class=“docstring”></p>
|
1013
|
-
|
1014
|
-
<pre><div class="discussion"></pre>
|
1015
|
-
|
1016
|
-
<p><p>Add new neurons to the fold</p></p>
|
1017
|
-
|
1018
|
-
<pre></div></pre>
|
1019
|
-
|
1020
|
-
<p></div> <div class=“tags”></p>
|
1021
|
-
|
1022
|
-
<p></div><table class=“source_code”></p>
|
1023
|
-
|
1024
|
-
<pre><tr>
|
1025
|
-
<td>
|
1026
|
-
<pre class="lines"></pre>
|
1027
|
-
|
1028
|
-
<p>155 156 157 158 159</pre></p>
|
1029
|
-
|
1030
|
-
<pre></td>
|
1031
|
-
<td>
|
1032
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 155</span></pre>
|
1033
|
-
|
1034
|
-
<p><span class='kw'>def</span> <span class='id
|
1035
|
-
identifier rubyid_add_neurons'>add_neurons</span><span
|
1036
|
-
class='lparen'>(</span><span
|
1037
|
-
class='op'>*</span><span class='id identifier
|
1038
|
-
rubyid_neus'>neus</span><span
|
1039
|
-
class='rparen'>)</span></p>
|
1040
|
-
|
1041
|
-
<pre><span class='id identifier rubyid_neus'>neus</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_neu'>neu</span><span class='op'>|</span>
|
1042
|
-
<span class='ivar'>@neurons</span><span class='lbracket'>[</span><span class='id identifier rubyid_neu'>neu</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_neu'>neu</span>
|
1043
|
-
<span class='kw'>end</span></pre>
|
1044
|
-
|
1045
|
-
<p><span class='kw'>end</span></pre></p>
|
1046
|
-
|
1047
|
-
<pre> </td>
|
1048
|
-
</tr></pre>
|
1049
|
-
|
1050
|
-
<p></table> </div></p>
|
1051
|
-
|
1052
|
-
<pre> <div class="method_details ">
|
1053
|
-
<h3 class="signature " id="dump_s-instance_method">
|
1054
|
-
|
1055
|
-
- (<tt>Object</tt>) <strong>dump_s</strong></pre>
|
1056
|
-
|
1057
|
-
<p></h3><table class=“source_code”></p>
|
1058
|
-
|
1059
|
-
<pre><tr>
|
1060
|
-
<td>
|
1061
|
-
<pre class="lines"></pre>
|
1062
|
-
|
1063
|
-
<p>218 219 220 221 222</pre></p>
|
1064
|
-
|
1065
|
-
<pre></td>
|
1066
|
-
<td>
|
1067
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 218</span></pre>
|
1068
|
-
|
1069
|
-
<p><span class='kw'>def</span> <span class='id
|
1070
|
-
identifier rubyid_dump_s'>dump_s</span></p>
|
1071
|
-
|
1072
|
-
<pre><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\ngenes:\n</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@genes</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_gene'>gene</span><span class='op'>|</span>
|
1073
|
-
<span class='id identifier rubyid_gene'>gene</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\nneurons:\n</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='ivar'>@neurons</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_neu'>neu</span><span class='op'>|</span>
|
1074
|
-
<span class='id identifier rubyid_neu'>neu</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span></pre>
|
1075
|
-
|
1076
|
-
<p><span class='kw'>end</span></pre></p>
|
1077
|
-
|
1078
|
-
<pre> </td>
|
1079
|
-
</tr></pre>
|
1080
|
-
|
1081
|
-
<p></table> </div></p>
|
1082
|
-
|
1083
|
-
<pre> <div class="method_details ">
|
1084
|
-
<h3 class="signature " id="fitness_cost-instance_method">
|
1085
|
-
|
1086
|
-
- (<tt>Object</tt>) <strong>fitness_cost</strong></pre>
|
1087
|
-
|
1088
|
-
<p></h3><div class=“docstring”></p>
|
1089
|
-
|
1090
|
-
<pre><div class="discussion"></pre>
|
1091
|
-
|
1092
|
-
<p><p>Calculate the cost of this genotype.</p></p>
|
1093
|
-
|
1094
|
-
<pre></div></pre>
|
1095
|
-
|
1096
|
-
<p></div> <div class=“tags”></p>
|
1097
|
-
|
1098
|
-
<p></div><table class=“source_code”></p>
|
1099
|
-
|
1100
|
-
<pre><tr>
|
1101
|
-
<td>
|
1102
|
-
<pre class="lines"></pre>
|
1103
|
-
|
1104
|
-
<p>213 214 215 216</pre></p>
|
1105
|
-
|
1106
|
-
<pre></td>
|
1107
|
-
<td>
|
1108
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 213</span></pre>
|
1109
|
-
|
1110
|
-
<p><span class='kw'>def</span> <span class='id
|
1111
|
-
identifier rubyid_fitness_cost'>fitness_cost</span></p>
|
1112
|
-
|
1113
|
-
<pre><span class='id identifier rubyid_p'>p</span> <span class='op'>=</span> <span class='ivar'>@controller</span><span class='period'>.</span><span class='id identifier rubyid_parms'>parms</span>
|
1114
|
-
<span class='id identifier rubyid_p'>p</span><span class='period'>.</span><span class='id identifier rubyid_fitness_cost_per_neuron'>fitness_cost_per_neuron</span> <span class='op'>*</span> <span class='ivar'>@neurons</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>+</span> <span class='id identifier rubyid_p'>p</span><span class='period'>.</span><span class='id identifier rubyid_fitness_cost_per_gene'>fitness_cost_per_gene</span> <span class='op'>*</span> <span class='ivar'>@genes</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span></pre>
|
1115
|
-
|
1116
|
-
<p><span class='kw'>end</span></pre></p>
|
1117
|
-
|
1118
|
-
<pre> </td>
|
1119
|
-
</tr></pre>
|
1120
|
-
|
1121
|
-
<p></table> </div></p>
|
1122
|
-
|
1123
|
-
<pre> <div class="method_details ">
|
1124
|
-
<h3 class="signature " id="forget!-instance_method">
|
1125
|
-
|
1126
|
-
- (<tt>Object</tt>) <strong>forget!</strong></pre>
|
1127
|
-
|
1128
|
-
<p></h3><div class=“docstring”></p>
|
1129
|
-
|
1130
|
-
<pre><div class="discussion"></pre>
|
1131
|
-
|
1132
|
-
<p><p>Make the neurons forget their wiring.</p></p>
|
1133
|
-
|
1134
|
-
<pre></div></pre>
|
1135
|
-
|
1136
|
-
<p></div> <div class=“tags”></p>
|
1137
|
-
|
1138
|
-
<p></div><table class=“source_code”></p>
|
1139
|
-
|
1140
|
-
<pre><tr>
|
1141
|
-
<td>
|
1142
|
-
<pre class="lines"></pre>
|
1143
|
-
|
1144
|
-
<p>134 135 136 137</pre></p>
|
1145
|
-
|
1146
|
-
<pre></td>
|
1147
|
-
<td>
|
1148
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 134</span></pre>
|
1149
|
-
|
1150
|
-
<p><span class='kw'>def</span> <span class='id
|
1151
|
-
identifier rubyid_forget!'>forget!</span></p>
|
1152
|
-
|
1153
|
-
<pre><span class='ivar'>@neurons</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_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_neu'>neu</span><span class='op'>|</span> <span class='id identifier rubyid_neu'>neu</span><span class='period'>.</span><span class='id identifier rubyid_clear_graph'>clear_graph</span> <span class='rbrace'>}</span>
|
1154
|
-
<span class='ivar'>@neural_gene_map</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_h'>h</span><span class='comma'>,</span> <span class='id identifier rubyid_k'>k</span><span class='op'>|</span> <span class='id identifier rubyid_h'>h</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='rbrace'>}</span></pre>
|
1155
|
-
|
1156
|
-
<p><span class='kw'>end</span></pre></p>
|
1157
|
-
|
1158
|
-
<pre> </td>
|
1159
|
-
</tr></pre>
|
1160
|
-
|
1161
|
-
<p></table> </div></p>
|
1162
|
-
|
1163
|
-
<pre> <div class="method_details ">
|
1164
|
-
<h3 class="signature " id="innervate!-instance_method">
|
1165
|
-
|
1166
|
-
- (<tt>Object</tt>) <strong>innervate!</strong>(*hneus)</pre>
|
1167
|
-
|
1168
|
-
<p></h3><div class=“docstring”></p>
|
1169
|
-
|
1170
|
-
<pre><div class="discussion"></pre>
|
1171
|
-
|
1172
|
-
<p><p>We take the neural hashes (presumably from other neurons), and
|
1173
|
-
innervate them. We do this in distinctions based on the neuron&#39;s
|
1174
|
-
names. FIXME We need to randomly select a neuron in the case of
|
1175
|
-
clashes.</p></p>
|
1176
|
-
|
1177
|
-
<pre></div></pre>
|
1178
|
-
|
1179
|
-
<p></div> <div class=“tags”></p>
|
1180
|
-
|
1181
|
-
<pre><p class="tag_title">Parameters:</p></pre>
|
1182
|
-
|
1183
|
-
<p><ul class=“param”></p>
|
1184
|
-
|
1185
|
-
<pre><li>
|
1186
|
-
|
1187
|
-
<span class='name'>hneus</span>
|
1188
|
-
|
1189
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
1190
|
-
|
1191
|
-
&mdash;
|
1192
|
-
<div class='inline'></pre>
|
1193
|
-
|
1194
|
-
<p><p>– hashes of neurons to innervate</p> </div></p>
|
1195
|
-
|
1196
|
-
<pre></li></pre>
|
1197
|
-
|
1198
|
-
<p></ul></p>
|
1199
|
-
|
1200
|
-
<p></div><table class=“source_code”></p>
|
1201
|
-
|
1202
|
-
<pre><tr>
|
1203
|
-
<td>
|
1204
|
-
<pre class="lines"></pre>
|
1205
|
-
|
1206
|
-
<p>175 176 177 178 179</pre></p>
|
1207
|
-
|
1208
|
-
<pre></td>
|
1209
|
-
<td>
|
1210
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 175</span></pre>
|
1211
|
-
|
1212
|
-
<p><span class='kw'>def</span> <span class='id
|
1213
|
-
identifier rubyid_innervate!'>innervate!</span><span
|
1214
|
-
class='lparen'>(</span><span
|
1215
|
-
class='op'>*</span><span class='id identifier
|
1216
|
-
rubyid_hneus'>hneus</span><span
|
1217
|
-
class='rparen'>)</span></p>
|
1218
|
-
|
1219
|
-
<pre><span class='id identifier rubyid_hneus'>hneus</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_neus'>neus</span><span class='op'>|</span>
|
1220
|
-
<span class='ivar'>@neurons</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span> <span class='id identifier rubyid_neus'>neus</span><span class='period'>.</span><span class='id identifier rubyid_dclone'>dclone</span>
|
1221
|
-
<span class='kw'>end</span></pre>
|
1222
|
-
|
1223
|
-
<p><span class='kw'>end</span></pre></p>
|
1224
|
-
|
1225
|
-
<pre> </td>
|
1226
|
-
</tr></pre>
|
1227
|
-
|
1228
|
-
<p></table> </div></p>
|
1229
|
-
|
1230
|
-
<pre> <div class="method_details ">
|
1231
|
-
<h3 class="signature " id="neucleate-instance_method">
|
1232
|
-
|
1233
|
-
- (<tt>Object</tt>) <strong>neucleate</strong>(clean: true, &amp;block)</pre>
|
1234
|
-
|
1235
|
-
<p></h3><div class=“docstring”></p>
|
1236
|
-
|
1237
|
-
<pre><div class="discussion"></pre>
|
1238
|
-
|
1239
|
-
<p><p>We add genes given here to the genome. An array of genes is
|
1240
|
-
returned from the block and we simply add them in.</p></p>
|
1241
|
-
|
1242
|
-
<pre></div></pre>
|
1243
|
-
|
1244
|
-
<p></div> <div class=“tags”></p>
|
1245
|
-
|
1246
|
-
<pre><p class="tag_title">Parameters:</p></pre>
|
1247
|
-
|
1248
|
-
<p><ul class=“param”></p>
|
1249
|
-
|
1250
|
-
<pre><li>
|
1251
|
-
|
1252
|
-
<span class='name'>clean</span>
|
1253
|
-
|
1254
|
-
<span class='type'>(<tt>boolean</tt>)</span>
|
1255
|
-
|
1256
|
-
</li>
|
1257
|
-
|
1258
|
-
<li>
|
1259
|
-
|
1260
|
-
<span class='name'>block</span>
|
1261
|
-
|
1262
|
-
<span class='type'>(<tt>Proc</tt>)</span>
|
1263
|
-
|
1264
|
-
</li></pre>
|
1265
|
-
|
1266
|
-
<p></ul></p>
|
1267
|
-
|
1268
|
-
<p></div><table class=“source_code”></p>
|
1269
|
-
|
1270
|
-
<pre><tr>
|
1271
|
-
<td>
|
1272
|
-
<pre class="lines"></pre>
|
1273
|
-
|
1274
|
-
<p>113 114 115 116 117 118 119 120 121 122 123</pre></p>
|
1275
|
-
|
1276
|
-
<pre></td>
|
1277
|
-
<td>
|
1278
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 113</span></pre>
|
1279
|
-
|
1280
|
-
<p><span class='kw'>def</span> <span class='id
|
1281
|
-
identifier rubyid_neucleate'>neucleate</span><span
|
1282
|
-
class='lparen'>(</span><span
|
1283
|
-
class='label'>clean:</span> <span
|
1284
|
-
class='kw'>true</span><span
|
1285
|
-
class='comma'>,</span> <span
|
1286
|
-
class='op'>&amp;</span><span class='id
|
1287
|
-
identifier rubyid_block'>block</span><span
|
1288
|
-
class='rparen'>)</span></p>
|
1289
|
-
|
1290
|
-
<pre><span class='id identifier rubyid_genes'>genes</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='lbracket'>[</span><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='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_g'>g</span><span class='op'>|</span>
|
1291
|
-
<span class='id identifier rubyid_g'>g</span><span class='period'>.</span><span class='id identifier rubyid_genotype'>genotype</span> <span class='op'>=</span> <span class='kw'>self</span>
|
1292
|
-
<span class='lbracket'>[</span><span class='id identifier rubyid_g'>g</span><span class='period'>.</span><span class='id identifier rubyid_innovation'>innovation</span><span class='comma'>,</span> <span class='id identifier rubyid_g'>g</span><span class='rbracket'>]</span> <span class='rbrace'>}</span><span class='rbracket'>]</span>
|
1293
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_clean'>clean</span>
|
1294
|
-
<span class='ivar'>@genes</span> <span class='op'>=</span> <span class='id identifier rubyid_genes'>genes</span>
|
1295
|
-
<span class='kw'>else</span>
|
1296
|
-
<span class='ivar'>@genes</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span> <span class='id identifier rubyid_genes'>genes</span>
|
1297
|
-
<span class='kw'>end</span>
|
1298
|
-
<span class='id identifier rubyid_nuke_redundancies!'>nuke_redundancies!</span></pre>
|
1299
|
-
|
1300
|
-
<p><span class='kw'>end</span></pre></p>
|
1301
|
-
|
1302
|
-
<pre> </td>
|
1303
|
-
</tr></pre>
|
1304
|
-
|
1305
|
-
<p></table> </div></p>
|
1306
|
-
|
1307
|
-
<pre> <div class="method_details ">
|
1308
|
-
<h3 class="signature " id="nuke_redundancies!-instance_method">
|
1309
|
-
|
1310
|
-
- (<tt>Object</tt>) <strong>nuke_redundancies!</strong></pre>
|
1311
|
-
|
1312
|
-
<p></h3><div class=“docstring”></p>
|
1313
|
-
|
1314
|
-
<pre><div class="discussion"></pre>
|
1315
|
-
|
1316
|
-
<p><p>Remove any redundancies in the genome, any genes refering to the
|
1317
|
-
same two neurons. Simply choose one and delete the rest. TODO: implement
|
1318
|
-
nuke_redundancies!</p></p>
|
1319
|
-
|
1320
|
-
<pre></div></pre>
|
1321
|
-
|
1322
|
-
<p></div> <div class=“tags”></p>
|
1323
|
-
|
1324
|
-
<p></div><table class=“source_code”></p>
|
1325
|
-
|
1326
|
-
<pre><tr>
|
1327
|
-
<td>
|
1328
|
-
<pre class="lines"></pre>
|
1329
|
-
|
1330
|
-
<p>129 130 131</pre></p>
|
1331
|
-
|
1332
|
-
<pre></td>
|
1333
|
-
<td>
|
1334
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 129</span></pre>
|
1335
|
-
|
1336
|
-
<p><span class='kw'>def</span> <span class='id
|
1337
|
-
identifier
|
1338
|
-
rubyid_nuke_redundancies!'>nuke_redundancies!</span></p>
|
1339
|
-
|
1340
|
-
<pre><span class='id identifier rubyid_log'>log</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>nuke_redundancies! NIY</span><span class='tstring_end'>&#39;</span></span></pre>
|
1341
|
-
|
1342
|
-
<p><span class='kw'>end</span></pre></p>
|
1343
|
-
|
1344
|
-
<pre> </td>
|
1345
|
-
</tr></pre>
|
1346
|
-
|
1347
|
-
<p></table> </div></p>
|
1348
|
-
|
1349
|
-
<pre> <div class="method_details ">
|
1350
|
-
<h3 class="signature " id="prune!-instance_method">
|
1351
|
-
|
1352
|
-
- (<tt>Object</tt>) <strong>prune!</strong></pre>
|
1353
|
-
|
1354
|
-
<p></h3><div class=“docstring”></p>
|
1355
|
-
|
1356
|
-
<pre><div class="discussion"></pre>
|
1357
|
-
|
1358
|
-
<p><p>Go through the list of neurons and drop any neurons not referenced
|
1359
|
-
by the genes.</p></p>
|
1360
|
-
|
1361
|
-
<p><p>Then go through the genes and drop any that are dangling (i.e. no
|
1362
|
-
matching neurons)</p></p>
|
1363
|
-
|
1364
|
-
<p><p>Then make sure that @neural_inputs and @neural_outputs reference
|
1365
|
-
the actual instance neurons in @neurons</p></p>
|
1366
|
-
|
1367
|
-
<p><p>TODO add this circularity check to prune!</p></p>
|
1368
|
-
|
1369
|
-
<pre></div></pre>
|
1370
|
-
|
1371
|
-
<p></div> <div class=“tags”></p>
|
1372
|
-
|
1373
|
-
<p></div><table class=“source_code”></p>
|
1374
|
-
|
1375
|
-
<pre><tr>
|
1376
|
-
<td>
|
1377
|
-
<pre class="lines"></pre>
|
1378
|
-
|
1379
|
-
<p>191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
|
1380
|
-
210</pre></p>
|
1381
|
-
|
1382
|
-
<pre></td>
|
1383
|
-
<td>
|
1384
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 191</span></pre>
|
1385
|
-
|
1386
|
-
<p><span class='kw'>def</span> <span class='id
|
1387
|
-
identifier rubyid_prune!'>prune!</span></p>
|
1388
|
-
|
1389
|
-
<pre><span class='comment'># Take care of dangling neurons</pre>
|
1390
|
-
|
1391
|
-
<p></span> <span class='id identifier
|
1392
|
-
rubyid_neunames'>neunames</span> <span
|
1393
|
-
class='op'>=</span> <span
|
1394
|
-
class='ivar'>@genes</span><span
|
1395
|
-
class='period'>.</span><span class='id identifier
|
1396
|
-
rubyid_values'>values</span><span
|
1397
|
-
class='period'>.</span><span class='id identifier
|
1398
|
-
rubyid_map'>map</span><span
|
1399
|
-
class='lbrace'>{</span><span
|
1400
|
-
class='op'>|</span><span class='id identifier
|
1401
|
-
rubyid_g'>g</span><span
|
1402
|
-
class='op'>|</span> <span
|
1403
|
-
class='lbracket'>[</span><span class='id identifier
|
1404
|
-
rubyid_g'>g</span><span
|
1405
|
-
class='period'>.</span><span class='id identifier
|
1406
|
-
rubyid_in_neuron'>in_neuron</span><span
|
1407
|
-
class='comma'>,</span> <span class='id identifier
|
1408
|
-
rubyid_g'>g</span><span
|
1409
|
-
class='period'>.</span><span class='id identifier
|
1410
|
-
rubyid_out_neuron'>out_neuron</span><span
|
1411
|
-
class='rbracket'>]</span><span
|
1412
|
-
class='rbrace'>}</span><span
|
1413
|
-
class='period'>.</span><span class='id identifier
|
1414
|
-
rubyid_flatten'>flatten</span><span
|
1415
|
-
class='period'>.</span><span class='id identifier
|
1416
|
-
rubyid_to_set'>to_set</span></p>
|
1417
|
-
|
1418
|
-
<pre><span class='ivar'>@neurons</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='lbracket'>[</span><span class='ivar'>@neurons</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span>
|
1419
|
-
<span class='kw'>not</span> <span class='id identifier rubyid_neunames'>neunames</span><span class='period'>.</span><span class='id identifier rubyid_member?'>member?</span> <span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span>
|
1420
|
-
<span class='kw'>end</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span>
|
1421
|
-
<span class='lbracket'>[</span><span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_n'>n</span><span class='rbracket'>]</span>
|
1422
|
-
<span class='kw'>end</span><span class='rbracket'>]</span>
|
1423
|
-
|
1424
|
-
<span class='comment'># Take care of dangling genes</pre>
|
1425
|
-
|
1426
|
-
<p></span> <span class='ivar'>@genes</span>
|
1427
|
-
<span class='op'>=</span> <span
|
1428
|
-
class='const'>Hash</span><span
|
1429
|
-
class='lbracket'>[</span><span
|
1430
|
-
class='ivar'>@genes</span><span
|
1431
|
-
class='period'>.</span><span class='id identifier
|
1432
|
-
rubyid_values'>values</span><span
|
1433
|
-
class='period'>.</span><span class='id identifier
|
1434
|
-
rubyid_reject'>reject</span> <span
|
1435
|
-
class='kw'>do</span> <span
|
1436
|
-
class='op'>|</span><span class='id identifier
|
1437
|
-
rubyid_gene'>gene</span><span
|
1438
|
-
class='op'>|</span></p>
|
1439
|
-
|
1440
|
-
<pre> <span class='kw'>not</span> <span class='lparen'>(</span><span class='ivar'>@neurons</span><span class='period'>.</span><span class='id identifier rubyid_member?'>member?</span><span class='lparen'>(</span><span class='id identifier rubyid_gene'>gene</span><span class='period'>.</span><span class='id identifier rubyid_in_neuron'>in_neuron</span><span class='rparen'>)</span> <span class='kw'>and</span> <span class='ivar'>@neurons</span><span class='period'>.</span><span class='id identifier rubyid_member?'>member?</span><span class='lparen'>(</span><span class='id identifier rubyid_gene'>gene</span><span class='period'>.</span><span class='id identifier rubyid_out_neuron'>out_neuron</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1441
|
-
<span class='kw'>end</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_gene'>gene</span><span class='op'>|</span>
|
1442
|
-
<span class='lbracket'>[</span><span class='id identifier rubyid_gene'>gene</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_gene'>gene</span><span class='rbracket'>]</span>
|
1443
|
-
<span class='kw'>end</span><span class='rbracket'>]</span>
|
1444
|
-
|
1445
|
-
<span class='comment'># Make sure @neural_inputs and @neural_outputs are consistent</pre>
|
1446
|
-
|
1447
|
-
<p></span> <span class='ivar'>@neural_inputs</span>
|
1448
|
-
<span class='op'>=</span> <span
|
1449
|
-
class='const'>Hash</span><span
|
1450
|
-
class='lbracket'>[</span><span
|
1451
|
-
class='ivar'>@neural_inputs</span><span
|
1452
|
-
class='period'>.</span><span class='id identifier
|
1453
|
-
rubyid_values'>values</span><span
|
1454
|
-
class='period'>.</span><span class='id identifier
|
1455
|
-
rubyid_map'>map</span><span
|
1456
|
-
class='lbrace'>{</span><span
|
1457
|
-
class='op'>|</span><span class='id identifier
|
1458
|
-
rubyid_n'>n</span><span
|
1459
|
-
class='op'>|</span> <span
|
1460
|
-
class='lbracket'>[</span><span class='id identifier
|
1461
|
-
rubyid_n'>n</span><span
|
1462
|
-
class='period'>.</span><span class='id identifier
|
1463
|
-
rubyid_name'>name</span><span
|
1464
|
-
class='comma'>,</span> <span
|
1465
|
-
class='ivar'>@neurons</span><span
|
1466
|
-
class='lbracket'>[</span><span class='id identifier
|
1467
|
-
rubyid_n'>n</span><span
|
1468
|
-
class='period'>.</span><span class='id identifier
|
1469
|
-
rubyid_name'>name</span><span
|
1470
|
-
class='rbracket'>]</span><span
|
1471
|
-
class='rbracket'>]</span><span
|
1472
|
-
class='rbrace'>}</span><span
|
1473
|
-
class='rbracket'>]</span></p>
|
1474
|
-
|
1475
|
-
<pre><span class='ivar'>@neural_outputs</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='lbracket'>[</span><span class='ivar'>@neural_outputs</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</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_n'>n</span><span class='op'>|</span> <span class='lbracket'>[</span><span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='ivar'>@neurons</span><span class='lbracket'>[</span><span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='rbracket'>]</span></pre>
|
1476
|
-
|
1477
|
-
<p><span class='kw'>end</span></pre></p>
|
1478
|
-
|
1479
|
-
<pre> </td>
|
1480
|
-
</tr></pre>
|
1481
|
-
|
1482
|
-
<p></table> </div></p>
|
1483
|
-
|
1484
|
-
<pre> <div class="method_details ">
|
1485
|
-
<h3 class="signature " id="wire!-instance_method">
|
1486
|
-
|
1487
|
-
- (<tt>Object</tt>) <strong>wire!</strong></pre>
|
1488
|
-
|
1489
|
-
<p></h3><div class=“docstring”></p>
|
1490
|
-
|
1491
|
-
<pre><div class="discussion"></pre>
|
1492
|
-
|
1493
|
-
<p><p>Wire up the neurons based on the genes.</p></p>
|
1494
|
-
|
1495
|
-
<pre></div></pre>
|
1496
|
-
|
1497
|
-
<p></div> <div class=“tags”></p>
|
1498
|
-
|
1499
|
-
<p></div><table class=“source_code”></p>
|
1500
|
-
|
1501
|
-
<pre><tr>
|
1502
|
-
<td>
|
1503
|
-
<pre class="lines"></pre>
|
1504
|
-
|
1505
|
-
<p>140 141 142 143 144 145 146 147 148 149 150 151 152</pre></p>
|
1506
|
-
|
1507
|
-
<pre></td>
|
1508
|
-
<td>
|
1509
|
-
<pre class="code"><span class="info file"># File 'lib/rubyneat/critter.rb', line 140</span></pre>
|
1510
|
-
|
1511
|
-
<p><span class='kw'>def</span> <span class='id
|
1512
|
-
identifier rubyid_wire!'>wire!</span></p>
|
1513
|
-
|
1514
|
-
<pre><span class='id identifier rubyid_forget!'>forget!</span>
|
1515
|
-
<span class='ivar'>@genes</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_innov'>innov</span><span class='comma'>,</span> <span class='id identifier rubyid_gene'>gene</span><span class='op'>|</span>
|
1516
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_gene'>gene</span><span class='period'>.</span><span class='id identifier rubyid_enabled?'>enabled?</span>
|
1517
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NeatException</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Can&#39;t find </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_gene'>gene</span><span class='period'>.</span><span class='id identifier rubyid_out_neuron'>out_neuron</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='ivar'>@neurons</span><span class='lbracket'>[</span><span class='id identifier rubyid_gene'>gene</span><span class='period'>.</span><span class='id identifier rubyid_out_neuron'>out_neuron</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1518
|
-
<span class='ivar'>@neurons</span><span class='lbracket'>[</span><span class='id identifier rubyid_gene'>gene</span><span class='period'>.</span><span class='id identifier rubyid_out_neuron'>out_neuron</span><span class='rbracket'>]</span> <span class='op'>&lt;&lt;</span> <span class='ivar'>@neurons</span><span class='lbracket'>[</span><span class='id identifier rubyid_gene'>gene</span><span class='period'>.</span><span class='id identifier rubyid_in_neuron'>in_neuron</span><span class='rbracket'>]</span>
|
1519
|
-
<span class='ivar'>@neural_gene_map</span><span class='lbracket'>[</span><span class='id identifier rubyid_gene'>gene</span><span class='period'>.</span><span class='id identifier rubyid_out_neuron'>out_neuron</span><span class='rbracket'>]</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_gene'>gene</span> <span class='kw'>unless</span> <span class='id identifier rubyid_gene'>gene</span><span class='period'>.</span><span class='id identifier rubyid_in_neuron'>in_neuron</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1520
|
-
<span class='kw'>end</span>
|
1521
|
-
<span class='kw'>end</span> <span class='kw'>unless</span> <span class='ivar'>@genes</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1522
|
-
<span class='kw'>if</span> <span class='ivar'>@genes</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1523
|
-
<span class='gvar'>$log</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Genes Not Present</span><span class='tstring_end'>&#39;</span></span>
|
1524
|
-
<span class='kw'>end</span></pre>
|
1525
|
-
|
1526
|
-
<p><span class='kw'>end</span></pre></p>
|
1527
|
-
|
1528
|
-
<pre> </td>
|
1529
|
-
</tr></pre>
|
1530
|
-
|
1531
|
-
<p></table> </div></p>
|
1532
|
-
|
1533
|
-
<pre></div></pre>
|
1534
|
-
|
1535
|
-
<p></div></p>
|
1536
|
-
|
1537
|
-
<pre> <div id="footer">
|
1538
|
-
Generated on Sun Mar 16 16:36:51 2014 by
|
1539
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1540
|
-
0.8.7.3 (ruby-2.1.1).</pre>
|
1541
|
-
|
1542
|
-
<p></div></p>
|
1543
|
-
|
1544
|
-
<pre></body></pre>
|
1545
|
-
|
1546
|
-
<p></html></p>
|
1547
|
-
</main>
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
<footer id="validator-badges" role="contentinfo">
|
1552
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
1553
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
1554
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
1555
|
-
</footer>
|
1556
|
-
|