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,708 @@
|
|
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::ClassMethods
|
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::ClassMethods";
|
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> » <span class='title'><span class='object_link'><a href="../Community.html" title="Evolvable::Community (module)">Community</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">ClassMethods</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::ClassMethods
|
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
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
91
|
+
<ul class="summary">
|
92
|
+
|
93
|
+
<li class="public ">
|
94
|
+
<span class="summary_signature">
|
95
|
+
|
96
|
+
<a href="#community_config-instance_method" title="#community_config (instance method)">#<strong>community_config</strong> ⇒ Object </a>
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
</span>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute community_config.</p>
|
114
|
+
</div></span>
|
115
|
+
|
116
|
+
</li>
|
117
|
+
|
118
|
+
|
119
|
+
</ul>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
<h2>
|
126
|
+
Instance Method Summary
|
127
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
128
|
+
</h2>
|
129
|
+
|
130
|
+
<ul class="summary">
|
131
|
+
|
132
|
+
<li class="public ">
|
133
|
+
<span class="summary_signature">
|
134
|
+
|
135
|
+
<a href="#add_population-instance_method" title="#add_population (instance method)">#<strong>add_population</strong>(name, population) ⇒ Object </a>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
</span>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<span class="summary_desc"><div class='inline'><p>Adds a population to the community.</p>
|
150
|
+
</div></span>
|
151
|
+
|
152
|
+
</li>
|
153
|
+
|
154
|
+
|
155
|
+
<li class="public ">
|
156
|
+
<span class="summary_signature">
|
157
|
+
|
158
|
+
<a href="#evolvable_community-instance_method" title="#evolvable_community (instance method)">#<strong>evolvable_community</strong>(community_config) ⇒ void </a>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
</span>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<span class="summary_desc"><div class='inline'><p>Configures a class as an evolvable community with specified populations.</p>
|
173
|
+
</div></span>
|
174
|
+
|
175
|
+
</li>
|
176
|
+
|
177
|
+
|
178
|
+
<li class="public ">
|
179
|
+
<span class="summary_signature">
|
180
|
+
|
181
|
+
<a href="#initialize_community-instance_method" title="#initialize_community (instance method)">#<strong>initialize_community</strong> ⇒ Object </a>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
</span>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
<span class="summary_desc"><div class='inline'><p>Initializes a new community instance This method exists as a hook for classes that include this module to override and customize the community instantiation process.</p>
|
196
|
+
</div></span>
|
197
|
+
|
198
|
+
</li>
|
199
|
+
|
200
|
+
|
201
|
+
<li class="public ">
|
202
|
+
<span class="summary_signature">
|
203
|
+
|
204
|
+
<a href="#load_community-instance_method" title="#load_community (instance method)">#<strong>load_community</strong>(data) ⇒ Object </a>
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
</span>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
219
|
+
|
220
|
+
</li>
|
221
|
+
|
222
|
+
|
223
|
+
<li class="public ">
|
224
|
+
<span class="summary_signature">
|
225
|
+
|
226
|
+
<a href="#new_community-instance_method" title="#new_community (instance method)">#<strong>new_community</strong> ⇒ Object </a>
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
</span>
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
<span class="summary_desc"><div class='inline'><p>Creates a new instance of the community.</p>
|
241
|
+
</div></span>
|
242
|
+
|
243
|
+
</li>
|
244
|
+
|
245
|
+
|
246
|
+
<li class="public ">
|
247
|
+
<span class="summary_signature">
|
248
|
+
|
249
|
+
<a href="#populations_by_name-instance_method" title="#populations_by_name (instance method)">#<strong>populations_by_name</strong> ⇒ Hash </a>
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
</span>
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
<span class="summary_desc"><div class='inline'><p>Returns a hash of population instances by name.</p>
|
264
|
+
</div></span>
|
265
|
+
|
266
|
+
</li>
|
267
|
+
|
268
|
+
|
269
|
+
</ul>
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
<div id="instance_attr_details" class="attr_details">
|
274
|
+
<h2>Instance Attribute Details</h2>
|
275
|
+
|
276
|
+
|
277
|
+
<span id="community_config=-instance_method"></span>
|
278
|
+
<div class="method_details first">
|
279
|
+
<h3 class="signature first" id="community_config-instance_method">
|
280
|
+
|
281
|
+
#<strong>community_config</strong> ⇒ <tt>Object</tt>
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
</h3><div class="docstring">
|
288
|
+
<div class="discussion">
|
289
|
+
<p>Returns the value of attribute community_config.</p>
|
290
|
+
|
291
|
+
|
292
|
+
</div>
|
293
|
+
</div>
|
294
|
+
<div class="tags">
|
295
|
+
|
296
|
+
|
297
|
+
</div><table class="source_code">
|
298
|
+
<tr>
|
299
|
+
<td>
|
300
|
+
<pre class="lines">
|
301
|
+
|
302
|
+
|
303
|
+
77
|
304
|
+
78
|
305
|
+
79</pre>
|
306
|
+
</td>
|
307
|
+
<td>
|
308
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 77</span>
|
309
|
+
|
310
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_community_config'>community_config</span>
|
311
|
+
<span class='ivar'>@community_config</span>
|
312
|
+
<span class='kw'>end</span></pre>
|
313
|
+
</td>
|
314
|
+
</tr>
|
315
|
+
</table>
|
316
|
+
</div>
|
317
|
+
|
318
|
+
</div>
|
319
|
+
|
320
|
+
|
321
|
+
<div id="instance_method_details" class="method_details_list">
|
322
|
+
<h2>Instance Method Details</h2>
|
323
|
+
|
324
|
+
|
325
|
+
<div class="method_details first">
|
326
|
+
<h3 class="signature first" id="add_population-instance_method">
|
327
|
+
|
328
|
+
#<strong>add_population</strong>(name, population) ⇒ <tt>Object</tt>
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
</h3><div class="docstring">
|
335
|
+
<div class="discussion">
|
336
|
+
<p>Adds a population to the community</p>
|
337
|
+
|
338
|
+
|
339
|
+
</div>
|
340
|
+
</div>
|
341
|
+
<div class="tags">
|
342
|
+
<p class="tag_title">Parameters:</p>
|
343
|
+
<ul class="param">
|
344
|
+
|
345
|
+
<li>
|
346
|
+
|
347
|
+
<span class='name'>name</span>
|
348
|
+
|
349
|
+
|
350
|
+
<span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
—
|
355
|
+
<div class='inline'><p>The name of the population</p>
|
356
|
+
</div>
|
357
|
+
|
358
|
+
</li>
|
359
|
+
|
360
|
+
<li>
|
361
|
+
|
362
|
+
<span class='name'>population</span>
|
363
|
+
|
364
|
+
|
365
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
—
|
370
|
+
<div class='inline'><p>The population instance</p>
|
371
|
+
</div>
|
372
|
+
|
373
|
+
</li>
|
374
|
+
|
375
|
+
</ul>
|
376
|
+
|
377
|
+
<p class="tag_title">Returns:</p>
|
378
|
+
<ul class="return">
|
379
|
+
|
380
|
+
<li>
|
381
|
+
|
382
|
+
|
383
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
—
|
388
|
+
<div class='inline'><p>The added population</p>
|
389
|
+
</div>
|
390
|
+
|
391
|
+
</li>
|
392
|
+
|
393
|
+
</ul>
|
394
|
+
|
395
|
+
</div><table class="source_code">
|
396
|
+
<tr>
|
397
|
+
<td>
|
398
|
+
<pre class="lines">
|
399
|
+
|
400
|
+
|
401
|
+
105
|
402
|
+
106
|
403
|
+
107</pre>
|
404
|
+
</td>
|
405
|
+
<td>
|
406
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 105</span>
|
407
|
+
|
408
|
+
<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>
|
409
|
+
<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>
|
410
|
+
<span class='kw'>end</span></pre>
|
411
|
+
</td>
|
412
|
+
</tr>
|
413
|
+
</table>
|
414
|
+
</div>
|
415
|
+
|
416
|
+
<div class="method_details ">
|
417
|
+
<h3 class="signature " id="evolvable_community-instance_method">
|
418
|
+
|
419
|
+
#<strong>evolvable_community</strong>(community_config) ⇒ <tt>void</tt>
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
</h3><div class="docstring">
|
426
|
+
<div class="discussion">
|
427
|
+
<p class="note returns_void">This method returns an undefined value.</p><p>Configures a class as an evolvable community with specified populations</p>
|
428
|
+
|
429
|
+
|
430
|
+
</div>
|
431
|
+
</div>
|
432
|
+
<div class="tags">
|
433
|
+
<p class="tag_title">Parameters:</p>
|
434
|
+
<ul class="param">
|
435
|
+
|
436
|
+
<li>
|
437
|
+
|
438
|
+
<span class='name'>community_config</span>
|
439
|
+
|
440
|
+
|
441
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
—
|
446
|
+
<div class='inline'><p>A hash mapping names to population classes</p>
|
447
|
+
</div>
|
448
|
+
|
449
|
+
</li>
|
450
|
+
|
451
|
+
</ul>
|
452
|
+
|
453
|
+
|
454
|
+
</div><table class="source_code">
|
455
|
+
<tr>
|
456
|
+
<td>
|
457
|
+
<pre class="lines">
|
458
|
+
|
459
|
+
|
460
|
+
82
|
461
|
+
83
|
462
|
+
84
|
463
|
+
85
|
464
|
+
86
|
465
|
+
87
|
466
|
+
88
|
467
|
+
89
|
468
|
+
90</pre>
|
469
|
+
</td>
|
470
|
+
<td>
|
471
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 82</span>
|
472
|
+
|
473
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_evolvable_community'>evolvable_community</span><span class='lparen'>(</span><span class='id identifier rubyid_community_config'>community_config</span><span class='rparen'>)</span>
|
474
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_community_config'>community_config</span> <span class='op'>=</span> <span class='id identifier rubyid_community_config'>community_config</span>
|
475
|
+
<span class='id identifier rubyid_community_config'>community_config</span><span class='period'>.</span><span class='id identifier rubyid_each_key'>each_key</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='op'>|</span>
|
476
|
+
<span class='id identifier rubyid_method_name'>method_name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
477
|
+
<span class='id identifier rubyid_define_method'>define_method</span><span class='lparen'>(</span><span class='id identifier rubyid_method_name'>method_name</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
478
|
+
<span class='id identifier rubyid_instance_variable_get'>instance_variable_get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_method_name'>method_name</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_method_name'>method_name</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_find_or_new_evolvable'>find_or_new_evolvable</span><span class='lparen'>(</span><span class='id identifier rubyid_method_name'>method_name</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
479
|
+
<span class='kw'>end</span>
|
480
|
+
<span class='kw'>end</span>
|
481
|
+
<span class='kw'>end</span></pre>
|
482
|
+
</td>
|
483
|
+
</tr>
|
484
|
+
</table>
|
485
|
+
</div>
|
486
|
+
|
487
|
+
<div class="method_details ">
|
488
|
+
<h3 class="signature " id="initialize_community-instance_method">
|
489
|
+
|
490
|
+
#<strong>initialize_community</strong> ⇒ <tt>Object</tt>
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
</h3><div class="docstring">
|
497
|
+
<div class="discussion">
|
498
|
+
<p>Initializes a new community instance
|
499
|
+
This method exists as a hook for classes that include this module to override
|
500
|
+
and customize the community instantiation process.</p>
|
501
|
+
|
502
|
+
|
503
|
+
</div>
|
504
|
+
</div>
|
505
|
+
<div class="tags">
|
506
|
+
|
507
|
+
<p class="tag_title">Returns:</p>
|
508
|
+
<ul class="return">
|
509
|
+
|
510
|
+
<li>
|
511
|
+
|
512
|
+
|
513
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
—
|
518
|
+
<div class='inline'><p>A new community instance</p>
|
519
|
+
</div>
|
520
|
+
|
521
|
+
</li>
|
522
|
+
|
523
|
+
</ul>
|
524
|
+
|
525
|
+
</div><table class="source_code">
|
526
|
+
<tr>
|
527
|
+
<td>
|
528
|
+
<pre class="lines">
|
529
|
+
|
530
|
+
|
531
|
+
69
|
532
|
+
70
|
533
|
+
71</pre>
|
534
|
+
</td>
|
535
|
+
<td>
|
536
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 69</span>
|
537
|
+
|
538
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize_community'>initialize_community</span>
|
539
|
+
<span class='id identifier rubyid_new'>new</span>
|
540
|
+
<span class='kw'>end</span></pre>
|
541
|
+
</td>
|
542
|
+
</tr>
|
543
|
+
</table>
|
544
|
+
</div>
|
545
|
+
|
546
|
+
<div class="method_details ">
|
547
|
+
<h3 class="signature " id="load_community-instance_method">
|
548
|
+
|
549
|
+
#<strong>load_community</strong>(data) ⇒ <tt>Object</tt>
|
550
|
+
|
551
|
+
|
552
|
+
|
553
|
+
|
554
|
+
|
555
|
+
</h3><table class="source_code">
|
556
|
+
<tr>
|
557
|
+
<td>
|
558
|
+
<pre class="lines">
|
559
|
+
|
560
|
+
|
561
|
+
73
|
562
|
+
74
|
563
|
+
75</pre>
|
564
|
+
</td>
|
565
|
+
<td>
|
566
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 73</span>
|
567
|
+
|
568
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_load_community'>load_community</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
569
|
+
<span class='const'><span class='object_link'><a href="../Serializer.html" title="Evolvable::Serializer (class)">Serializer</a></span></span><span class='period'>.</span><span class='id identifier rubyid_load'><span class='object_link'><a href="../Serializer.html#load-class_method" title="Evolvable::Serializer.load (method)">load</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
570
|
+
<span class='kw'>end</span></pre>
|
571
|
+
</td>
|
572
|
+
</tr>
|
573
|
+
</table>
|
574
|
+
</div>
|
575
|
+
|
576
|
+
<div class="method_details ">
|
577
|
+
<h3 class="signature " id="new_community-instance_method">
|
578
|
+
|
579
|
+
#<strong>new_community</strong> ⇒ <tt>Object</tt>
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
</h3><div class="docstring">
|
586
|
+
<div class="discussion">
|
587
|
+
<p>Creates a new instance of the community</p>
|
588
|
+
|
589
|
+
|
590
|
+
</div>
|
591
|
+
</div>
|
592
|
+
<div class="tags">
|
593
|
+
|
594
|
+
<p class="tag_title">Returns:</p>
|
595
|
+
<ul class="return">
|
596
|
+
|
597
|
+
<li>
|
598
|
+
|
599
|
+
|
600
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
601
|
+
|
602
|
+
|
603
|
+
|
604
|
+
—
|
605
|
+
<div class='inline'><p>A new community instance</p>
|
606
|
+
</div>
|
607
|
+
|
608
|
+
</li>
|
609
|
+
|
610
|
+
</ul>
|
611
|
+
|
612
|
+
</div><table class="source_code">
|
613
|
+
<tr>
|
614
|
+
<td>
|
615
|
+
<pre class="lines">
|
616
|
+
|
617
|
+
|
618
|
+
61
|
619
|
+
62
|
620
|
+
63</pre>
|
621
|
+
</td>
|
622
|
+
<td>
|
623
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 61</span>
|
624
|
+
|
625
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_new_community'>new_community</span>
|
626
|
+
<span class='id identifier rubyid_initialize_community'>initialize_community</span>
|
627
|
+
<span class='kw'>end</span></pre>
|
628
|
+
</td>
|
629
|
+
</tr>
|
630
|
+
</table>
|
631
|
+
</div>
|
632
|
+
|
633
|
+
<div class="method_details ">
|
634
|
+
<h3 class="signature " id="populations_by_name-instance_method">
|
635
|
+
|
636
|
+
#<strong>populations_by_name</strong> ⇒ <tt>Hash</tt>
|
637
|
+
|
638
|
+
|
639
|
+
|
640
|
+
|
641
|
+
|
642
|
+
</h3><div class="docstring">
|
643
|
+
<div class="discussion">
|
644
|
+
<p>Returns a hash of population instances by name</p>
|
645
|
+
|
646
|
+
|
647
|
+
</div>
|
648
|
+
</div>
|
649
|
+
<div class="tags">
|
650
|
+
|
651
|
+
<p class="tag_title">Returns:</p>
|
652
|
+
<ul class="return">
|
653
|
+
|
654
|
+
<li>
|
655
|
+
|
656
|
+
|
657
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
658
|
+
|
659
|
+
|
660
|
+
|
661
|
+
—
|
662
|
+
<div class='inline'><p>A hash mapping names to population instances</p>
|
663
|
+
</div>
|
664
|
+
|
665
|
+
</li>
|
666
|
+
|
667
|
+
</ul>
|
668
|
+
|
669
|
+
</div><table class="source_code">
|
670
|
+
<tr>
|
671
|
+
<td>
|
672
|
+
<pre class="lines">
|
673
|
+
|
674
|
+
|
675
|
+
94
|
676
|
+
95
|
677
|
+
96
|
678
|
+
97
|
679
|
+
98
|
680
|
+
99</pre>
|
681
|
+
</td>
|
682
|
+
<td>
|
683
|
+
<pre class="code"><span class="info file"># File 'lib/evolvable/community.rb', line 94</span>
|
684
|
+
|
685
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_populations_by_name'>populations_by_name</span>
|
686
|
+
<span class='ivar'>@populations_by_name</span> <span class='op'>||=</span> <span class='id identifier rubyid_community_config'>community_config</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_hash'>hash</span><span class='comma'>,</span> <span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_population_klass'>population_klass</span><span class='rparen'>)</span><span class='op'>|</span>
|
687
|
+
<span class='id identifier rubyid_hash'>hash</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_klass'>population_klass</span><span class='period'>.</span><span class='id identifier rubyid_new_population'>new_population</span><span class='lparen'>(</span><span class='label'>size:</span> <span class='int'>0</span><span class='rparen'>)</span>
|
688
|
+
<span class='id identifier rubyid_hash'>hash</span>
|
689
|
+
<span class='kw'>end</span>
|
690
|
+
<span class='kw'>end</span></pre>
|
691
|
+
</td>
|
692
|
+
</tr>
|
693
|
+
</table>
|
694
|
+
</div>
|
695
|
+
|
696
|
+
</div>
|
697
|
+
|
698
|
+
</div>
|
699
|
+
|
700
|
+
<div id="footer">
|
701
|
+
Generated on Sat May 10 18:39:22 2025 by
|
702
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
703
|
+
0.9.37 (ruby-3.4.2).
|
704
|
+
</div>
|
705
|
+
|
706
|
+
</div>
|
707
|
+
</body>
|
708
|
+
</html>
|