evolvable 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +2 -0
- data/CHANGELOG.md +24 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +44 -25
- data/README.md +498 -190
- data/README_YARD.md +85 -166
- data/bin/console +10 -19
- data/docs/Evolvable/ClassMethods.html +1233 -0
- data/docs/Evolvable/Community/ClassMethods.html +708 -0
- data/docs/Evolvable/Community.html +1342 -0
- data/docs/Evolvable/CountGene.html +886 -0
- data/docs/Evolvable/EqualizeGoal.html +347 -0
- data/docs/Evolvable/Error.html +134 -0
- data/docs/Evolvable/Evaluation.html +773 -0
- data/docs/Evolvable/Evolution.html +616 -0
- data/docs/Evolvable/Gene/ClassMethods.html +413 -0
- data/docs/Evolvable/Gene.html +522 -0
- data/docs/Evolvable/GeneCluster/ClassMethods.html +431 -0
- data/docs/Evolvable/GeneCluster.html +280 -0
- data/docs/Evolvable/GeneCombination.html +515 -0
- data/docs/Evolvable/GeneSpace.html +619 -0
- data/docs/Evolvable/Genome.html +1070 -0
- data/docs/Evolvable/Goal.html +500 -0
- data/docs/Evolvable/MaximizeGoal.html +348 -0
- data/docs/Evolvable/MinimizeGoal.html +348 -0
- data/docs/Evolvable/Mutation.html +729 -0
- data/docs/Evolvable/PointCrossover.html +444 -0
- data/docs/Evolvable/Population.html +2826 -0
- data/docs/Evolvable/RigidCountGene.html +501 -0
- data/docs/Evolvable/Selection.html +594 -0
- data/docs/Evolvable/Serializer.html +293 -0
- data/docs/Evolvable/UniformCrossover.html +286 -0
- data/docs/Evolvable.html +1619 -0
- data/docs/_index.html +341 -0
- data/docs/class_list.html +54 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +503 -0
- data/docs/file.README.html +750 -0
- data/docs/file_list.html +59 -0
- data/docs/frames.html +22 -0
- data/docs/index.html +750 -0
- data/docs/js/app.js +344 -0
- data/docs/js/full_list.js +242 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +1302 -0
- data/docs/top-level-namespace.html +110 -0
- data/evolvable.gemspec +6 -6
- data/examples/ascii_art.rb +5 -9
- data/examples/stickman.rb +25 -33
- data/{examples/hello_world.rb → exe/hello_evolvable_world} +46 -30
- data/lib/evolvable/community.rb +190 -0
- data/lib/evolvable/count_gene.rb +65 -0
- data/lib/evolvable/equalize_goal.rb +2 -9
- data/lib/evolvable/evaluation.rb +113 -14
- data/lib/evolvable/evolution.rb +38 -15
- data/lib/evolvable/gene.rb +124 -25
- data/lib/evolvable/gene_cluster.rb +106 -0
- data/lib/evolvable/gene_combination.rb +57 -16
- data/lib/evolvable/gene_space.rb +111 -0
- data/lib/evolvable/genome.rb +32 -4
- data/lib/evolvable/goal.rb +19 -24
- data/lib/evolvable/maximize_goal.rb +2 -9
- data/lib/evolvable/minimize_goal.rb +3 -9
- data/lib/evolvable/mutation.rb +87 -41
- data/lib/evolvable/point_crossover.rb +24 -4
- data/lib/evolvable/population.rb +258 -84
- data/lib/evolvable/rigid_count_gene.rb +36 -0
- data/lib/evolvable/selection.rb +68 -14
- data/lib/evolvable/serializer.rb +46 -0
- data/lib/evolvable/uniform_crossover.rb +30 -6
- data/lib/evolvable/version.rb +2 -1
- data/lib/evolvable.rb +268 -107
- metadata +57 -36
- data/examples/images/diagram.png +0 -0
- data/exe/hello +0 -16
- data/lib/evolvable/error/undefined_method.rb +0 -7
- data/lib/evolvable/search_space.rb +0 -181
@@ -0,0 +1,1342 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: Evolvable::Community
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.37
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "Evolvable::Community";
|
19
|
+
relpath = '../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../_index.html">Index (C)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../Evolvable.html" title="Evolvable (module)">Evolvable</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Community</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: Evolvable::Community
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Defined in:</dt>
|
81
|
+
<dd>lib/evolvable/community.rb</dd>
|
82
|
+
</dl>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<h2>Overview</h2><div class="docstring">
|
87
|
+
<div class="discussion">
|
88
|
+
<p>The <code>Community</code> module provides a framework for coordinating multiple evolvable populations
|
89
|
+
under a unified interface. Each population represents a distinct type of evolvable, and
|
90
|
+
each key returns a single evolvable instance drawn from its corresponding population.</p>
|
91
|
+
|
92
|
+
<p>Communities are ideal for simulations or systems where different components evolve
|
93
|
+
in parallel but interact as part of a larger whole - such as ecosystems, design systems,
|
94
|
+
or modular agents. Evolvables from different populations can co-evolve, influencing each other's fitness.</p>
|
95
|
+
|
96
|
+
<p>Use the <code>evolvable_community</code> macro to declare the set of named populations in the community.
|
97
|
+
Each population will have a corresponding method (e.g., <code>fish_1</code>, <code>plant</code>, <code>shrimp</code>) that
|
98
|
+
returns a single evolvable instance. You can evolve all populations together using the
|
99
|
+
<code>evolve</code> method, or per population.</p>
|
100
|
+
|
101
|
+
<p><strong>Key Features</strong></p>
|
102
|
+
|
103
|
+
<ul>
|
104
|
+
<li>Define a community composed of named populations</li>
|
105
|
+
<li>Automatically generate accessors for each evolvable instance</li>
|
106
|
+
<li>Coordinate evolution across populations through a shared interface</li>
|
107
|
+
<li>Evolve all populations in a single call with <code>evolve(...)</code></li>
|
108
|
+
</ul>
|
109
|
+
|
110
|
+
<p>This <code>FishTank</code> example sets up a community with four named populations:</p>
|
111
|
+
|
112
|
+
<pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>FishTank</span>
|
113
|
+
<span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="../Evolvable.html" title="Evolvable (module)">Evolvable</a></span></span><span class='op'>::</span><span class='const'>Community</span>
|
114
|
+
|
115
|
+
<span class='id identifier rubyid_evolvable_community'>evolvable_community</span> <span class='label'>fish_1:</span> <span class='const'>Fish</span><span class='comma'>,</span>
|
116
|
+
<span class='label'>fish_2:</span> <span class='const'>Fish</span><span class='comma'>,</span>
|
117
|
+
<span class='label'>plant:</span> <span class='const'>AquariumPlant</span><span class='comma'>,</span>
|
118
|
+
<span class='label'>shrimp:</span> <span class='const'>CleanerShrimp</span>
|
119
|
+
|
120
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_describe_tank'>describe_tank</span>
|
121
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>🐟 Fish 1: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_fish_1'>fish_1</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'> (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_fish_1'>fish_1</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</span></span>
|
122
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>🐟 Fish 2: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_fish_2'>fish_2</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'> (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_fish_2'>fish_2</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</span></span>
|
123
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>🌿 Plant: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_plant'>plant</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'> (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_plant'>plant</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</span></span>
|
124
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>🦐 Shrimp: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_shrimp'>shrimp</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'> (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_shrimp'>shrimp</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</span></span>
|
125
|
+
<span class='kw'>end</span>
|
126
|
+
<span class='kw'>end</span>
|
127
|
+
</code></pre>
|
128
|
+
|
129
|
+
<p>Initialize the community, describe the tank, and evolve each population:</p>
|
130
|
+
|
131
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_tank'>tank</span> <span class='op'>=</span> <span class='const'>FishTank</span><span class='period'>.</span><span class='id identifier rubyid_new_community'>new_community</span>
|
132
|
+
<span class='id identifier rubyid_tank'>tank</span><span class='period'>.</span><span class='id identifier rubyid_describe_tank'>describe_tank</span>
|
133
|
+
<span class='id identifier rubyid_tank'>tank</span><span class='period'>.</span><span class='id identifier rubyid_evolve'>evolve</span>
|
134
|
+
</code></pre>
|
135
|
+
|
136
|
+
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
<div class="tags">
|
140
|
+
|
141
|
+
|
142
|
+
</div><h2>Defined Under Namespace</h2>
|
143
|
+
<p class="children">
|
144
|
+
|
145
|
+
|
146
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Community/ClassMethods.html" title="Evolvable::Community::ClassMethods (module)">ClassMethods</a></span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
</p>
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
<h2>
|
161
|
+
Class Method Summary
|
162
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
163
|
+
</h2>
|
164
|
+
|
165
|
+
<ul class="summary">
|
166
|
+
|
167
|
+
<li class="public ">
|
168
|
+
<span class="summary_signature">
|
169
|
+
|
170
|
+
<a href="#included-class_method" title="included (class method)">.<strong>included</strong>(base) ⇒ Object </a>
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
</span>
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
185
|
+
|
186
|
+
</li>
|
187
|
+
|
188
|
+
|
189
|
+
</ul>
|
190
|
+
|
191
|
+
<h2>
|
192
|
+
Instance Method Summary
|
193
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
194
|
+
</h2>
|
195
|
+
|
196
|
+
<ul class="summary">
|
197
|
+
|
198
|
+
<li class="public ">
|
199
|
+
<span class="summary_signature">
|
200
|
+
|
201
|
+
<a href="#add_evolvable-instance_method" title="#add_evolvable (instance method)">#<strong>add_evolvable</strong>(name, evolvable) ⇒ Object </a>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
</span>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
<span class="summary_desc"><div class='inline'><p>Adds an evolvable instance to the community.</p>
|
216
|
+
</div></span>
|
217
|
+
|
218
|
+
</li>
|
219
|
+
|
220
|
+
|
221
|
+
<li class="public ">
|
222
|
+
<span class="summary_signature">
|
223
|
+
|
224
|
+
<a href="#add_population-instance_method" title="#add_population (instance method)">#<strong>add_population</strong>(name, population) ⇒ Object </a>
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
</span>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
<span class="summary_desc"><div class='inline'><p>Adds a population to the community.</p>
|
239
|
+
</div></span>
|
240
|
+
|
241
|
+
</li>
|
242
|
+
|
243
|
+
|
244
|
+
<li class="public ">
|
245
|
+
<span class="summary_signature">
|
246
|
+
|
247
|
+
<a href="#evolvables_by_name-instance_method" title="#evolvables_by_name (instance method)">#<strong>evolvables_by_name</strong> ⇒ Hash </a>
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
</span>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
<span class="summary_desc"><div class='inline'><p>Returns a hash of evolvable instances by name.</p>
|
262
|
+
</div></span>
|
263
|
+
|
264
|
+
</li>
|
265
|
+
|
266
|
+
|
267
|
+
<li class="public ">
|
268
|
+
<span class="summary_signature">
|
269
|
+
|
270
|
+
<a href="#evolve-instance_method" title="#evolve (instance method)">#<strong>evolve</strong> ⇒ void </a>
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
</span>
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
<span class="summary_desc"><div class='inline'><p>Evolves all populations in the community.</p>
|
285
|
+
</div></span>
|
286
|
+
|
287
|
+
</li>
|
288
|
+
|
289
|
+
|
290
|
+
<li class="public ">
|
291
|
+
<span class="summary_signature">
|
292
|
+
|
293
|
+
<a href="#find_evolvable-instance_method" title="#find_evolvable (instance method)">#<strong>find_evolvable</strong>(name) ⇒ Object<sup>?</sup> </a>
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
</span>
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
<span class="summary_desc"><div class='inline'><p>Finds an evolvable instance by name.</p>
|
308
|
+
</div></span>
|
309
|
+
|
310
|
+
</li>
|
311
|
+
|
312
|
+
|
313
|
+
<li class="public ">
|
314
|
+
<span class="summary_signature">
|
315
|
+
|
316
|
+
<a href="#find_or_new_evolvable-instance_method" title="#find_or_new_evolvable (instance method)">#<strong>find_or_new_evolvable</strong>(name) ⇒ Object </a>
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
</span>
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
<span class="summary_desc"><div class='inline'><p>Finds an existing evolvable instance by name or creates a new one.</p>
|
331
|
+
</div></span>
|
332
|
+
|
333
|
+
</li>
|
334
|
+
|
335
|
+
|
336
|
+
<li class="public ">
|
337
|
+
<span class="summary_signature">
|
338
|
+
|
339
|
+
<a href="#find_population-instance_method" title="#find_population (instance method)">#<strong>find_population</strong>(name) ⇒ Object<sup>?</sup> </a>
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
</span>
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
<span class="summary_desc"><div class='inline'><p>Finds a population by name.</p>
|
354
|
+
</div></span>
|
355
|
+
|
356
|
+
</li>
|
357
|
+
|
358
|
+
|
359
|
+
<li class="public ">
|
360
|
+
<span class="summary_signature">
|
361
|
+
|
362
|
+
<a href="#new_evolvable-instance_method" title="#new_evolvable (instance method)">#<strong>new_evolvable</strong>(name) ⇒ Object </a>
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
</span>
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
<span class="summary_desc"><div class='inline'><p>Creates a new evolvable instance from the corresponding population.</p>
|
377
|
+
</div></span>
|
378
|
+
|
379
|
+
</li>
|
380
|
+
|
381
|
+
|
382
|
+
<li class="public ">
|
383
|
+
<span class="summary_signature">
|
384
|
+
|
385
|
+
<a href="#populations-instance_method" title="#populations (instance method)">#<strong>populations</strong> ⇒ Array </a>
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
</span>
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
<span class="summary_desc"><div class='inline'><p>Returns an array of population instances.</p>
|
400
|
+
</div></span>
|
401
|
+
|
402
|
+
</li>
|
403
|
+
|
404
|
+
|
405
|
+
<li class="public ">
|
406
|
+
<span class="summary_signature">
|
407
|
+
|
408
|
+
<a href="#populations_by_name-instance_method" title="#populations_by_name (instance method)">#<strong>populations_by_name</strong> ⇒ Hash </a>
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
</span>
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
|
422
|
+
<span class="summary_desc"><div class='inline'><p>Returns a hash of population instances by name.</p>
|
423
|
+
</div></span>
|
424
|
+
|
425
|
+
</li>
|
426
|
+
|
427
|
+
|
428
|
+
<li class="public ">
|
429
|
+
<span class="summary_signature">
|
430
|
+
|
431
|
+
<a href="#reset_evolvables-instance_method" title="#reset_evolvables (instance method)">#<strong>reset_evolvables</strong> ⇒ Hash </a>
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
</span>
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
<span class="summary_desc"><div class='inline'><p>Resets the evolvables hash to an empty hash.</p>
|
446
|
+
</div></span>
|
447
|
+
|
448
|
+
</li>
|
449
|
+
|
450
|
+
|
451
|
+
<li class="public ">
|
452
|
+
<span class="summary_signature">
|
453
|
+
|
454
|
+
<a href="#reset_populations-instance_method" title="#reset_populations (instance method)">#<strong>reset_populations</strong> ⇒ Hash </a>
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
</span>
|
459
|
+
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
<span class="summary_desc"><div class='inline'><p>Resets the populations hash to an empty hash.</p>
|
469
|
+
</div></span>
|
470
|
+
|
471
|
+
</li>
|
472
|
+
|
473
|
+
|
474
|
+
</ul>
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
<div id="class_method_details" class="method_details_list">
|
480
|
+
<h2>Class Method Details</h2>
|
481
|
+
|
482
|
+
|
483
|
+
<div class="method_details first">
|
484
|
+
<h3 class="signature first" id="included-class_method">
|
485
|
+
|
486
|
+
.<strong>included</strong>(base) ⇒ <tt>Object</tt>
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
</h3><table class="source_code">
|
493
|
+
<tr>
|
494
|
+
<td>
|
495
|
+
<pre class="lines">
|
496
|
+
|
497
|
+
|
498
|
+
54
|
499
|
+
55
|
500
|
+
56</pre>
|
501
|
+
</td>
|
502
|
+
<td>
|
503
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 54</span>
|
504
|
+
|
505
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_included'>included</span><span class='lparen'>(</span><span class='id identifier rubyid_base'>base</span><span class='rparen'>)</span>
|
506
|
+
<span class='id identifier rubyid_base'>base</span><span class='period'>.</span><span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Community/ClassMethods.html" title="Evolvable::Community::ClassMethods (module)">ClassMethods</a></span></span><span class='rparen'>)</span>
|
507
|
+
<span class='kw'>end</span></pre>
|
508
|
+
</td>
|
509
|
+
</tr>
|
510
|
+
</table>
|
511
|
+
</div>
|
512
|
+
|
513
|
+
</div>
|
514
|
+
|
515
|
+
<div id="instance_method_details" class="method_details_list">
|
516
|
+
<h2>Instance Method Details</h2>
|
517
|
+
|
518
|
+
|
519
|
+
<div class="method_details first">
|
520
|
+
<h3 class="signature first" id="add_evolvable-instance_method">
|
521
|
+
|
522
|
+
#<strong>add_evolvable</strong>(name, evolvable) ⇒ <tt>Object</tt>
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
</h3><div class="docstring">
|
529
|
+
<div class="discussion">
|
530
|
+
<p>Adds an evolvable instance to the community</p>
|
531
|
+
|
532
|
+
|
533
|
+
</div>
|
534
|
+
</div>
|
535
|
+
<div class="tags">
|
536
|
+
<p class="tag_title">Parameters:</p>
|
537
|
+
<ul class="param">
|
538
|
+
|
539
|
+
<li>
|
540
|
+
|
541
|
+
<span class='name'>name</span>
|
542
|
+
|
543
|
+
|
544
|
+
<span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
|
545
|
+
|
546
|
+
|
547
|
+
|
548
|
+
—
|
549
|
+
<div class='inline'><p>The name of the evolvable</p>
|
550
|
+
</div>
|
551
|
+
|
552
|
+
</li>
|
553
|
+
|
554
|
+
<li>
|
555
|
+
|
556
|
+
<span class='name'>evolvable</span>
|
557
|
+
|
558
|
+
|
559
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
—
|
564
|
+
<div class='inline'><p>The evolvable instance</p>
|
565
|
+
</div>
|
566
|
+
|
567
|
+
</li>
|
568
|
+
|
569
|
+
</ul>
|
570
|
+
|
571
|
+
<p class="tag_title">Returns:</p>
|
572
|
+
<ul class="return">
|
573
|
+
|
574
|
+
<li>
|
575
|
+
|
576
|
+
|
577
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
578
|
+
|
579
|
+
|
580
|
+
|
581
|
+
—
|
582
|
+
<div class='inline'><p>The added evolvable</p>
|
583
|
+
</div>
|
584
|
+
|
585
|
+
</li>
|
586
|
+
|
587
|
+
</ul>
|
588
|
+
|
589
|
+
</div><table class="source_code">
|
590
|
+
<tr>
|
591
|
+
<td>
|
592
|
+
<pre class="lines">
|
593
|
+
|
594
|
+
|
595
|
+
174
|
596
|
+
175
|
597
|
+
176</pre>
|
598
|
+
</td>
|
599
|
+
<td>
|
600
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 174</span>
|
601
|
+
|
602
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_add_evolvable'>add_evolvable</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_evolvable'>evolvable</span><span class='rparen'>)</span>
|
603
|
+
<span class='id identifier rubyid_evolvables_by_name'>evolvables_by_name</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_evolvable'>evolvable</span>
|
604
|
+
<span class='kw'>end</span></pre>
|
605
|
+
</td>
|
606
|
+
</tr>
|
607
|
+
</table>
|
608
|
+
</div>
|
609
|
+
|
610
|
+
<div class="method_details ">
|
611
|
+
<h3 class="signature " id="add_population-instance_method">
|
612
|
+
|
613
|
+
#<strong>add_population</strong>(name, population) ⇒ <tt>Object</tt>
|
614
|
+
|
615
|
+
|
616
|
+
|
617
|
+
|
618
|
+
|
619
|
+
</h3><div class="docstring">
|
620
|
+
<div class="discussion">
|
621
|
+
<p>Adds a population to the community</p>
|
622
|
+
|
623
|
+
|
624
|
+
</div>
|
625
|
+
</div>
|
626
|
+
<div class="tags">
|
627
|
+
<p class="tag_title">Parameters:</p>
|
628
|
+
<ul class="param">
|
629
|
+
|
630
|
+
<li>
|
631
|
+
|
632
|
+
<span class='name'>name</span>
|
633
|
+
|
634
|
+
|
635
|
+
<span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
|
636
|
+
|
637
|
+
|
638
|
+
|
639
|
+
—
|
640
|
+
<div class='inline'><p>The name of the population</p>
|
641
|
+
</div>
|
642
|
+
|
643
|
+
</li>
|
644
|
+
|
645
|
+
<li>
|
646
|
+
|
647
|
+
<span class='name'>population</span>
|
648
|
+
|
649
|
+
|
650
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
651
|
+
|
652
|
+
|
653
|
+
|
654
|
+
—
|
655
|
+
<div class='inline'><p>The population instance</p>
|
656
|
+
</div>
|
657
|
+
|
658
|
+
</li>
|
659
|
+
|
660
|
+
</ul>
|
661
|
+
|
662
|
+
<p class="tag_title">Returns:</p>
|
663
|
+
<ul class="return">
|
664
|
+
|
665
|
+
<li>
|
666
|
+
|
667
|
+
|
668
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
669
|
+
|
670
|
+
|
671
|
+
|
672
|
+
—
|
673
|
+
<div class='inline'><p>The added population</p>
|
674
|
+
</div>
|
675
|
+
|
676
|
+
</li>
|
677
|
+
|
678
|
+
</ul>
|
679
|
+
|
680
|
+
</div><table class="source_code">
|
681
|
+
<tr>
|
682
|
+
<td>
|
683
|
+
<pre class="lines">
|
684
|
+
|
685
|
+
|
686
|
+
138
|
687
|
+
139
|
688
|
+
140</pre>
|
689
|
+
</td>
|
690
|
+
<td>
|
691
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 138</span>
|
692
|
+
|
693
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_add_population'>add_population</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_population'>population</span><span class='rparen'>)</span>
|
694
|
+
<span class='id identifier rubyid_populations_by_name'>populations_by_name</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_population'>population</span>
|
695
|
+
<span class='kw'>end</span></pre>
|
696
|
+
</td>
|
697
|
+
</tr>
|
698
|
+
</table>
|
699
|
+
</div>
|
700
|
+
|
701
|
+
<div class="method_details ">
|
702
|
+
<h3 class="signature " id="evolvables_by_name-instance_method">
|
703
|
+
|
704
|
+
#<strong>evolvables_by_name</strong> ⇒ <tt>Hash</tt>
|
705
|
+
|
706
|
+
|
707
|
+
|
708
|
+
|
709
|
+
|
710
|
+
</h3><div class="docstring">
|
711
|
+
<div class="discussion">
|
712
|
+
<p>Returns a hash of evolvable instances by name</p>
|
713
|
+
|
714
|
+
|
715
|
+
</div>
|
716
|
+
</div>
|
717
|
+
<div class="tags">
|
718
|
+
|
719
|
+
<p class="tag_title">Returns:</p>
|
720
|
+
<ul class="return">
|
721
|
+
|
722
|
+
<li>
|
723
|
+
|
724
|
+
|
725
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
726
|
+
|
727
|
+
|
728
|
+
|
729
|
+
—
|
730
|
+
<div class='inline'><p>A hash mapping names to evolvable instances</p>
|
731
|
+
</div>
|
732
|
+
|
733
|
+
</li>
|
734
|
+
|
735
|
+
</ul>
|
736
|
+
|
737
|
+
</div><table class="source_code">
|
738
|
+
<tr>
|
739
|
+
<td>
|
740
|
+
<pre class="lines">
|
741
|
+
|
742
|
+
|
743
|
+
180
|
744
|
+
181
|
745
|
+
182</pre>
|
746
|
+
</td>
|
747
|
+
<td>
|
748
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 180</span>
|
749
|
+
|
750
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_evolvables_by_name'>evolvables_by_name</span>
|
751
|
+
<span class='ivar'>@evolvables_by_name</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
752
|
+
<span class='kw'>end</span></pre>
|
753
|
+
</td>
|
754
|
+
</tr>
|
755
|
+
</table>
|
756
|
+
</div>
|
757
|
+
|
758
|
+
<div class="method_details ">
|
759
|
+
<h3 class="signature " id="evolve-instance_method">
|
760
|
+
|
761
|
+
#<strong>evolve</strong> ⇒ <tt>void</tt>
|
762
|
+
|
763
|
+
|
764
|
+
|
765
|
+
|
766
|
+
|
767
|
+
</h3><div class="docstring">
|
768
|
+
<div class="discussion">
|
769
|
+
<p class="note returns_void">This method returns an undefined value.</p><p>Evolves all populations in the community</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
|
+
124
|
784
|
+
125
|
785
|
+
126</pre>
|
786
|
+
</td>
|
787
|
+
<td>
|
788
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 124</span>
|
789
|
+
|
790
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_evolve'>evolve</span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span>
|
791
|
+
<span class='id identifier rubyid_populations'>populations</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_population'>population</span><span class='op'>|</span> <span class='id identifier rubyid_population'>population</span><span class='period'>.</span><span class='id identifier rubyid_evolve'>evolve</span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
792
|
+
<span class='kw'>end</span></pre>
|
793
|
+
</td>
|
794
|
+
</tr>
|
795
|
+
</table>
|
796
|
+
</div>
|
797
|
+
|
798
|
+
<div class="method_details ">
|
799
|
+
<h3 class="signature " id="find_evolvable-instance_method">
|
800
|
+
|
801
|
+
#<strong>find_evolvable</strong>(name) ⇒ <tt>Object</tt><sup>?</sup>
|
802
|
+
|
803
|
+
|
804
|
+
|
805
|
+
|
806
|
+
|
807
|
+
</h3><div class="docstring">
|
808
|
+
<div class="discussion">
|
809
|
+
<p>Finds an evolvable instance by name</p>
|
810
|
+
|
811
|
+
|
812
|
+
</div>
|
813
|
+
</div>
|
814
|
+
<div class="tags">
|
815
|
+
<p class="tag_title">Parameters:</p>
|
816
|
+
<ul class="param">
|
817
|
+
|
818
|
+
<li>
|
819
|
+
|
820
|
+
<span class='name'>name</span>
|
821
|
+
|
822
|
+
|
823
|
+
<span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
|
824
|
+
|
825
|
+
|
826
|
+
|
827
|
+
—
|
828
|
+
<div class='inline'><p>The name of the evolvable</p>
|
829
|
+
</div>
|
830
|
+
|
831
|
+
</li>
|
832
|
+
|
833
|
+
</ul>
|
834
|
+
|
835
|
+
<p class="tag_title">Returns:</p>
|
836
|
+
<ul class="return">
|
837
|
+
|
838
|
+
<li>
|
839
|
+
|
840
|
+
|
841
|
+
<span class='type'>(<tt>Object</tt>, <tt>nil</tt>)</span>
|
842
|
+
|
843
|
+
|
844
|
+
|
845
|
+
—
|
846
|
+
<div class='inline'><p>The evolvable instance or nil if not found</p>
|
847
|
+
</div>
|
848
|
+
|
849
|
+
</li>
|
850
|
+
|
851
|
+
</ul>
|
852
|
+
|
853
|
+
</div><table class="source_code">
|
854
|
+
<tr>
|
855
|
+
<td>
|
856
|
+
<pre class="lines">
|
857
|
+
|
858
|
+
|
859
|
+
152
|
860
|
+
153
|
861
|
+
154</pre>
|
862
|
+
</td>
|
863
|
+
<td>
|
864
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 152</span>
|
865
|
+
|
866
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_find_evolvable'>find_evolvable</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
867
|
+
<span class='id identifier rubyid_evolvables_by_name'>evolvables_by_name</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
|
868
|
+
<span class='kw'>end</span></pre>
|
869
|
+
</td>
|
870
|
+
</tr>
|
871
|
+
</table>
|
872
|
+
</div>
|
873
|
+
|
874
|
+
<div class="method_details ">
|
875
|
+
<h3 class="signature " id="find_or_new_evolvable-instance_method">
|
876
|
+
|
877
|
+
#<strong>find_or_new_evolvable</strong>(name) ⇒ <tt>Object</tt>
|
878
|
+
|
879
|
+
|
880
|
+
|
881
|
+
|
882
|
+
|
883
|
+
</h3><div class="docstring">
|
884
|
+
<div class="discussion">
|
885
|
+
<p>Finds an existing evolvable instance by name or creates a new one</p>
|
886
|
+
|
887
|
+
|
888
|
+
</div>
|
889
|
+
</div>
|
890
|
+
<div class="tags">
|
891
|
+
<p class="tag_title">Parameters:</p>
|
892
|
+
<ul class="param">
|
893
|
+
|
894
|
+
<li>
|
895
|
+
|
896
|
+
<span class='name'>name</span>
|
897
|
+
|
898
|
+
|
899
|
+
<span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
|
900
|
+
|
901
|
+
|
902
|
+
|
903
|
+
—
|
904
|
+
<div class='inline'><p>The name of the evolvable</p>
|
905
|
+
</div>
|
906
|
+
|
907
|
+
</li>
|
908
|
+
|
909
|
+
</ul>
|
910
|
+
|
911
|
+
<p class="tag_title">Returns:</p>
|
912
|
+
<ul class="return">
|
913
|
+
|
914
|
+
<li>
|
915
|
+
|
916
|
+
|
917
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
918
|
+
|
919
|
+
|
920
|
+
|
921
|
+
—
|
922
|
+
<div class='inline'><p>The existing or new evolvable instance</p>
|
923
|
+
</div>
|
924
|
+
|
925
|
+
</li>
|
926
|
+
|
927
|
+
</ul>
|
928
|
+
|
929
|
+
</div><table class="source_code">
|
930
|
+
<tr>
|
931
|
+
<td>
|
932
|
+
<pre class="lines">
|
933
|
+
|
934
|
+
|
935
|
+
159
|
936
|
+
160
|
937
|
+
161</pre>
|
938
|
+
</td>
|
939
|
+
<td>
|
940
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 159</span>
|
941
|
+
|
942
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_find_or_new_evolvable'>find_or_new_evolvable</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
943
|
+
<span class='id identifier rubyid_find_evolvable'>find_evolvable</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_new_evolvable'>new_evolvable</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
944
|
+
<span class='kw'>end</span></pre>
|
945
|
+
</td>
|
946
|
+
</tr>
|
947
|
+
</table>
|
948
|
+
</div>
|
949
|
+
|
950
|
+
<div class="method_details ">
|
951
|
+
<h3 class="signature " id="find_population-instance_method">
|
952
|
+
|
953
|
+
#<strong>find_population</strong>(name) ⇒ <tt>Object</tt><sup>?</sup>
|
954
|
+
|
955
|
+
|
956
|
+
|
957
|
+
|
958
|
+
|
959
|
+
</h3><div class="docstring">
|
960
|
+
<div class="discussion">
|
961
|
+
<p>Finds a population by name</p>
|
962
|
+
|
963
|
+
|
964
|
+
</div>
|
965
|
+
</div>
|
966
|
+
<div class="tags">
|
967
|
+
<p class="tag_title">Parameters:</p>
|
968
|
+
<ul class="param">
|
969
|
+
|
970
|
+
<li>
|
971
|
+
|
972
|
+
<span class='name'>name</span>
|
973
|
+
|
974
|
+
|
975
|
+
<span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
|
976
|
+
|
977
|
+
|
978
|
+
|
979
|
+
—
|
980
|
+
<div class='inline'><p>The name of the population</p>
|
981
|
+
</div>
|
982
|
+
|
983
|
+
</li>
|
984
|
+
|
985
|
+
</ul>
|
986
|
+
|
987
|
+
<p class="tag_title">Returns:</p>
|
988
|
+
<ul class="return">
|
989
|
+
|
990
|
+
<li>
|
991
|
+
|
992
|
+
|
993
|
+
<span class='type'>(<tt>Object</tt>, <tt>nil</tt>)</span>
|
994
|
+
|
995
|
+
|
996
|
+
|
997
|
+
—
|
998
|
+
<div class='inline'><p>The population instance or nil if not found</p>
|
999
|
+
</div>
|
1000
|
+
|
1001
|
+
</li>
|
1002
|
+
|
1003
|
+
</ul>
|
1004
|
+
|
1005
|
+
</div><table class="source_code">
|
1006
|
+
<tr>
|
1007
|
+
<td>
|
1008
|
+
<pre class="lines">
|
1009
|
+
|
1010
|
+
|
1011
|
+
145
|
1012
|
+
146
|
1013
|
+
147</pre>
|
1014
|
+
</td>
|
1015
|
+
<td>
|
1016
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 145</span>
|
1017
|
+
|
1018
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_find_population'>find_population</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
1019
|
+
<span class='id identifier rubyid_populations_by_name'>populations_by_name</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
|
1020
|
+
<span class='kw'>end</span></pre>
|
1021
|
+
</td>
|
1022
|
+
</tr>
|
1023
|
+
</table>
|
1024
|
+
</div>
|
1025
|
+
|
1026
|
+
<div class="method_details ">
|
1027
|
+
<h3 class="signature " id="new_evolvable-instance_method">
|
1028
|
+
|
1029
|
+
#<strong>new_evolvable</strong>(name) ⇒ <tt>Object</tt>
|
1030
|
+
|
1031
|
+
|
1032
|
+
|
1033
|
+
|
1034
|
+
|
1035
|
+
</h3><div class="docstring">
|
1036
|
+
<div class="discussion">
|
1037
|
+
<p>Creates a new evolvable instance from the corresponding population</p>
|
1038
|
+
|
1039
|
+
|
1040
|
+
</div>
|
1041
|
+
</div>
|
1042
|
+
<div class="tags">
|
1043
|
+
<p class="tag_title">Parameters:</p>
|
1044
|
+
<ul class="param">
|
1045
|
+
|
1046
|
+
<li>
|
1047
|
+
|
1048
|
+
<span class='name'>name</span>
|
1049
|
+
|
1050
|
+
|
1051
|
+
<span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
|
1052
|
+
|
1053
|
+
|
1054
|
+
|
1055
|
+
—
|
1056
|
+
<div class='inline'><p>The name of the evolvable</p>
|
1057
|
+
</div>
|
1058
|
+
|
1059
|
+
</li>
|
1060
|
+
|
1061
|
+
</ul>
|
1062
|
+
|
1063
|
+
<p class="tag_title">Returns:</p>
|
1064
|
+
<ul class="return">
|
1065
|
+
|
1066
|
+
<li>
|
1067
|
+
|
1068
|
+
|
1069
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
1070
|
+
|
1071
|
+
|
1072
|
+
|
1073
|
+
—
|
1074
|
+
<div class='inline'><p>The new evolvable instance</p>
|
1075
|
+
</div>
|
1076
|
+
|
1077
|
+
</li>
|
1078
|
+
|
1079
|
+
</ul>
|
1080
|
+
|
1081
|
+
</div><table class="source_code">
|
1082
|
+
<tr>
|
1083
|
+
<td>
|
1084
|
+
<pre class="lines">
|
1085
|
+
|
1086
|
+
|
1087
|
+
166
|
1088
|
+
167
|
1089
|
+
168</pre>
|
1090
|
+
</td>
|
1091
|
+
<td>
|
1092
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 166</span>
|
1093
|
+
|
1094
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_new_evolvable'>new_evolvable</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
1095
|
+
<span class='id identifier rubyid_evolvables_by_name'>evolvables_by_name</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_find_population'>find_population</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_new_evolvable'>new_evolvable</span>
|
1096
|
+
<span class='kw'>end</span></pre>
|
1097
|
+
</td>
|
1098
|
+
</tr>
|
1099
|
+
</table>
|
1100
|
+
</div>
|
1101
|
+
|
1102
|
+
<div class="method_details ">
|
1103
|
+
<h3 class="signature " id="populations-instance_method">
|
1104
|
+
|
1105
|
+
#<strong>populations</strong> ⇒ <tt>Array</tt>
|
1106
|
+
|
1107
|
+
|
1108
|
+
|
1109
|
+
|
1110
|
+
|
1111
|
+
</h3><div class="docstring">
|
1112
|
+
<div class="discussion">
|
1113
|
+
<p>Returns an array of population instances</p>
|
1114
|
+
|
1115
|
+
|
1116
|
+
</div>
|
1117
|
+
</div>
|
1118
|
+
<div class="tags">
|
1119
|
+
|
1120
|
+
<p class="tag_title">Returns:</p>
|
1121
|
+
<ul class="return">
|
1122
|
+
|
1123
|
+
<li>
|
1124
|
+
|
1125
|
+
|
1126
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
1127
|
+
|
1128
|
+
|
1129
|
+
|
1130
|
+
—
|
1131
|
+
<div class='inline'><p>An array of population instances</p>
|
1132
|
+
</div>
|
1133
|
+
|
1134
|
+
</li>
|
1135
|
+
|
1136
|
+
</ul>
|
1137
|
+
|
1138
|
+
</div><table class="source_code">
|
1139
|
+
<tr>
|
1140
|
+
<td>
|
1141
|
+
<pre class="lines">
|
1142
|
+
|
1143
|
+
|
1144
|
+
118
|
1145
|
+
119
|
1146
|
+
120</pre>
|
1147
|
+
</td>
|
1148
|
+
<td>
|
1149
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 118</span>
|
1150
|
+
|
1151
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_populations'>populations</span>
|
1152
|
+
<span class='id identifier rubyid_populations_by_name'>populations_by_name</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span>
|
1153
|
+
<span class='kw'>end</span></pre>
|
1154
|
+
</td>
|
1155
|
+
</tr>
|
1156
|
+
</table>
|
1157
|
+
</div>
|
1158
|
+
|
1159
|
+
<div class="method_details ">
|
1160
|
+
<h3 class="signature " id="populations_by_name-instance_method">
|
1161
|
+
|
1162
|
+
#<strong>populations_by_name</strong> ⇒ <tt>Hash</tt>
|
1163
|
+
|
1164
|
+
|
1165
|
+
|
1166
|
+
|
1167
|
+
|
1168
|
+
</h3><div class="docstring">
|
1169
|
+
<div class="discussion">
|
1170
|
+
<p>Returns a hash of population instances by name</p>
|
1171
|
+
|
1172
|
+
|
1173
|
+
</div>
|
1174
|
+
</div>
|
1175
|
+
<div class="tags">
|
1176
|
+
|
1177
|
+
<p class="tag_title">Returns:</p>
|
1178
|
+
<ul class="return">
|
1179
|
+
|
1180
|
+
<li>
|
1181
|
+
|
1182
|
+
|
1183
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1184
|
+
|
1185
|
+
|
1186
|
+
|
1187
|
+
—
|
1188
|
+
<div class='inline'><p>A hash mapping names to population instances</p>
|
1189
|
+
</div>
|
1190
|
+
|
1191
|
+
</li>
|
1192
|
+
|
1193
|
+
</ul>
|
1194
|
+
|
1195
|
+
</div><table class="source_code">
|
1196
|
+
<tr>
|
1197
|
+
<td>
|
1198
|
+
<pre class="lines">
|
1199
|
+
|
1200
|
+
|
1201
|
+
112
|
1202
|
+
113
|
1203
|
+
114</pre>
|
1204
|
+
</td>
|
1205
|
+
<td>
|
1206
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 112</span>
|
1207
|
+
|
1208
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_populations_by_name'>populations_by_name</span>
|
1209
|
+
<span class='ivar'>@populations_by_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_populations_by_name'>populations_by_name</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
|
1210
|
+
<span class='kw'>end</span></pre>
|
1211
|
+
</td>
|
1212
|
+
</tr>
|
1213
|
+
</table>
|
1214
|
+
</div>
|
1215
|
+
|
1216
|
+
<div class="method_details ">
|
1217
|
+
<h3 class="signature " id="reset_evolvables-instance_method">
|
1218
|
+
|
1219
|
+
#<strong>reset_evolvables</strong> ⇒ <tt>Hash</tt>
|
1220
|
+
|
1221
|
+
|
1222
|
+
|
1223
|
+
|
1224
|
+
|
1225
|
+
</h3><div class="docstring">
|
1226
|
+
<div class="discussion">
|
1227
|
+
<p>Resets the evolvables hash to an empty hash</p>
|
1228
|
+
|
1229
|
+
|
1230
|
+
</div>
|
1231
|
+
</div>
|
1232
|
+
<div class="tags">
|
1233
|
+
|
1234
|
+
<p class="tag_title">Returns:</p>
|
1235
|
+
<ul class="return">
|
1236
|
+
|
1237
|
+
<li>
|
1238
|
+
|
1239
|
+
|
1240
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1241
|
+
|
1242
|
+
|
1243
|
+
|
1244
|
+
—
|
1245
|
+
<div class='inline'><p>An empty hash</p>
|
1246
|
+
</div>
|
1247
|
+
|
1248
|
+
</li>
|
1249
|
+
|
1250
|
+
</ul>
|
1251
|
+
|
1252
|
+
</div><table class="source_code">
|
1253
|
+
<tr>
|
1254
|
+
<td>
|
1255
|
+
<pre class="lines">
|
1256
|
+
|
1257
|
+
|
1258
|
+
186
|
1259
|
+
187
|
1260
|
+
188</pre>
|
1261
|
+
</td>
|
1262
|
+
<td>
|
1263
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 186</span>
|
1264
|
+
|
1265
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_reset_evolvables'>reset_evolvables</span>
|
1266
|
+
<span class='ivar'>@evolvables_by_name</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1267
|
+
<span class='kw'>end</span></pre>
|
1268
|
+
</td>
|
1269
|
+
</tr>
|
1270
|
+
</table>
|
1271
|
+
</div>
|
1272
|
+
|
1273
|
+
<div class="method_details ">
|
1274
|
+
<h3 class="signature " id="reset_populations-instance_method">
|
1275
|
+
|
1276
|
+
#<strong>reset_populations</strong> ⇒ <tt>Hash</tt>
|
1277
|
+
|
1278
|
+
|
1279
|
+
|
1280
|
+
|
1281
|
+
|
1282
|
+
</h3><div class="docstring">
|
1283
|
+
<div class="discussion">
|
1284
|
+
<p>Resets the populations hash to an empty hash</p>
|
1285
|
+
|
1286
|
+
|
1287
|
+
</div>
|
1288
|
+
</div>
|
1289
|
+
<div class="tags">
|
1290
|
+
|
1291
|
+
<p class="tag_title">Returns:</p>
|
1292
|
+
<ul class="return">
|
1293
|
+
|
1294
|
+
<li>
|
1295
|
+
|
1296
|
+
|
1297
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1298
|
+
|
1299
|
+
|
1300
|
+
|
1301
|
+
—
|
1302
|
+
<div class='inline'><p>An empty hash</p>
|
1303
|
+
</div>
|
1304
|
+
|
1305
|
+
</li>
|
1306
|
+
|
1307
|
+
</ul>
|
1308
|
+
|
1309
|
+
</div><table class="source_code">
|
1310
|
+
<tr>
|
1311
|
+
<td>
|
1312
|
+
<pre class="lines">
|
1313
|
+
|
1314
|
+
|
1315
|
+
130
|
1316
|
+
131
|
1317
|
+
132</pre>
|
1318
|
+
</td>
|
1319
|
+
<td>
|
1320
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 130</span>
|
1321
|
+
|
1322
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_reset_populations'>reset_populations</span>
|
1323
|
+
<span class='ivar'>@populations_by_name</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1324
|
+
<span class='kw'>end</span></pre>
|
1325
|
+
</td>
|
1326
|
+
</tr>
|
1327
|
+
</table>
|
1328
|
+
</div>
|
1329
|
+
|
1330
|
+
</div>
|
1331
|
+
|
1332
|
+
</div>
|
1333
|
+
|
1334
|
+
<div id="footer">
|
1335
|
+
Generated on Sat May 10 18:39:22 2025 by
|
1336
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1337
|
+
0.9.37 (ruby-3.4.2).
|
1338
|
+
</div>
|
1339
|
+
|
1340
|
+
</div>
|
1341
|
+
</body>
|
1342
|
+
</html>
|