evolvable 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/evolvable/gene.rb +1 -3
- data/lib/evolvable/gene_combination.rb +5 -1
- data/lib/evolvable/genome.rb +4 -4
- data/lib/evolvable/version.rb +1 -1
- data/lib/evolvable.rb +8 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '068f9c6690af16e24cb522c25a9a33963bff2f1757dca841858a4baff1f2b777'
|
4
|
+
data.tar.gz: 5d4fbe538753cb309042cf7cec6ded7c3e10d7bace1b8a1d495698be5225114d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e49437b455e04a05324091220b215cc99e69576adcd4c8181495cb7ba83d89ed43d0a5743ba3f9264940ea547e2e48790306d3eb03e967a0b3b7f8433eb16479
|
7
|
+
data.tar.gz: a2e2ff86d7c325e718e53ae6edf24665e23ea908d3cd3568cedcd643b473c0d4fa8027d54d7d0c3ae25ee1a1218bedb648440a292c2ca28959bfeed07dfdf316
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
##
|
1
|
+
## 1.2.0 - 2022-1-22
|
2
|
+
|
3
|
+
* Make it easier to dump and load genomes and use custom serializers. [69afd7c](https://github.com/mattruzicka/evolvable/commit/69afd7c957cbf89cc03b4f3f0ba967bf571c34c5)
|
4
|
+
* Avoid needing Gene#combine implementations to deal with nil args. Technically this could be a breaking change if you have custom combination logic for when two evolvables have different numbers of the same kind of gene and you do something other than just return the gene that isn't nil, but that this is the case seems unlikely, especially considering I'm not even aware of anyone else using this gem in the wild. If you do, please reach out! I'd love to hear from you, even if you're angry about this! [7ae1087](https://github.com/mattruzicka/evolvable/commit/7ae108762505230d81afc79b2f6c3e679fadc1a4)
|
5
|
+
|
6
|
+
|
7
|
+
## 1.1.0 - 2021-12-30
|
2
8
|
|
3
9
|
Features
|
4
10
|
* Updated documentation.
|
data/lib/evolvable/gene.rb
CHANGED
@@ -62,7 +62,11 @@ module Evolvable
|
|
62
62
|
Array.new(count) do |index|
|
63
63
|
gene_a = genes_1[index]
|
64
64
|
gene_b = genes_2[index]
|
65
|
-
|
65
|
+
if gene_a && gene_b
|
66
|
+
gene_class.combine(gene_a, gene_b)
|
67
|
+
else
|
68
|
+
gene_a || gene_b || gene_class.new
|
69
|
+
end
|
66
70
|
end
|
67
71
|
end
|
68
72
|
end
|
data/lib/evolvable/genome.rb
CHANGED
@@ -8,8 +8,8 @@ module Evolvable
|
|
8
8
|
class Genome
|
9
9
|
extend Forwardable
|
10
10
|
|
11
|
-
def self.load(data)
|
12
|
-
new(config:
|
11
|
+
def self.load(data, serializer: Serializer)
|
12
|
+
new(config: serializer.load(data))
|
13
13
|
end
|
14
14
|
|
15
15
|
def initialize(config: {})
|
@@ -79,8 +79,8 @@ module Evolvable
|
|
79
79
|
self.class.name
|
80
80
|
end
|
81
81
|
|
82
|
-
def dump
|
83
|
-
|
82
|
+
def dump(serializer: Serializer)
|
83
|
+
serializer.dump @config
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
data/lib/evolvable/version.rb
CHANGED
data/lib/evolvable.rb
CHANGED
@@ -230,4 +230,12 @@ module Evolvable
|
|
230
230
|
:find_genes,
|
231
231
|
:find_genes_count,
|
232
232
|
:genes
|
233
|
+
|
234
|
+
def dump_genome(serializer: Serializer)
|
235
|
+
@genome.dump(serializer: serializer)
|
236
|
+
end
|
237
|
+
|
238
|
+
def load_genome(data, serializer: Serializer)
|
239
|
+
@genome = Genome.load(data, serializer: serializer)
|
240
|
+
end
|
233
241
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evolvable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Ruzicka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
|
-
rubygems_version: 3.
|
122
|
+
rubygems_version: 3.3.3
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Add evolutionary behavior to any Ruby object
|