evolvable 0.1.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -1
  3. data/.yardopts +4 -0
  4. data/CHANGELOG.md +63 -0
  5. data/Gemfile +3 -0
  6. data/Gemfile.lock +39 -39
  7. data/LICENSE +21 -0
  8. data/README.md +234 -248
  9. data/README_YARD.md +237 -0
  10. data/bin/console +20 -43
  11. data/evolvable.gemspec +2 -3
  12. data/examples/ascii_art.rb +62 -0
  13. data/examples/ascii_gene.rb +9 -0
  14. data/examples/hello_world.rb +91 -0
  15. data/examples/images/diagram.png +0 -0
  16. data/examples/stickman.rb +77 -0
  17. data/exe/hello +16 -0
  18. data/lib/evolvable/count_gene.rb +42 -0
  19. data/lib/evolvable/equalize_goal.rb +29 -0
  20. data/lib/evolvable/error/undefined_method.rb +7 -0
  21. data/lib/evolvable/evaluation.rb +74 -0
  22. data/lib/evolvable/evolution.rb +58 -0
  23. data/lib/evolvable/gene.rb +67 -0
  24. data/lib/evolvable/gene_combination.rb +69 -0
  25. data/lib/evolvable/genome.rb +86 -0
  26. data/lib/evolvable/goal.rb +52 -0
  27. data/lib/evolvable/maximize_goal.rb +30 -0
  28. data/lib/evolvable/minimize_goal.rb +29 -0
  29. data/lib/evolvable/mutation.rb +71 -42
  30. data/lib/evolvable/point_crossover.rb +71 -0
  31. data/lib/evolvable/population.rb +202 -83
  32. data/lib/evolvable/rigid_count_gene.rb +17 -0
  33. data/lib/evolvable/search_space.rb +181 -0
  34. data/lib/evolvable/selection.rb +45 -0
  35. data/lib/evolvable/serializer.rb +21 -0
  36. data/lib/evolvable/uniform_crossover.rb +42 -0
  37. data/lib/evolvable/version.rb +1 -1
  38. data/lib/evolvable.rb +203 -56
  39. metadata +46 -24
  40. data/.rubocop.yml +0 -20
  41. data/lib/evolvable/crossover.rb +0 -35
  42. data/lib/evolvable/errors/not_implemented.rb +0 -5
  43. data/lib/evolvable/helper_methods.rb +0 -45
  44. data/lib/evolvable/hooks.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 046213e8982bac4913f713e33942e9ef5ead7bd655871f995cbbe36797ce64f9
4
- data.tar.gz: 2980cf144a9ed46e3abea9d0d395ee582a1207002fa2ab88bb2c967580f3bd6e
3
+ metadata.gz: 145d256bfb7b28668a14cab664de8dabc2e0bfe8bbfa4c2301e9c1aaae843cf2
4
+ data.tar.gz: ce722823a53c91a053657d2bc990372de614b7236390ddc27ac88571932f5a5f
5
5
  SHA512:
6
- metadata.gz: 934eb04d489153638b00c002a2315e35140867f36ebfd9ecd8b3eb30fc0b6f249991a7b5f7b8f83a848bc3de9c36d9e060a89e16e7492bdf7d59f18d63aff405
7
- data.tar.gz: ed1cac7f1c24265c29488d2e58304fc81b57be1a2891b87ab4b229218da63f3961cc1ea9dfda926df7226b083db0f2262cbb343ec667f3aa603831887b70e0bd
6
+ metadata.gz: d68b7d03481e1ff1a3dce744dd98075bfd2567f24acddb5a770c1ae7acd737fd99c32f3f3434381d47bc2a54e5dd4047e822be12cf5f1bcd3e79f6f7b71cc698
7
+ data.tar.gz: 2c9fd505b36a76dc6f25dfa3a70d58e6387ab3689716b29bfbfd5291649b9de2f160609f1192e9843fe9c4dd54759350924e8e442ae4d49728cff87510b5c518
data/.gitignore CHANGED
@@ -9,5 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
-
13
12
  .byebug_history
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ --plugin readme
2
+ --markup markdown
3
+
4
+ lib/**/*.rb
data/CHANGELOG.md CHANGED
@@ -0,0 +1,63 @@
1
+ ## Unreleased
2
+
3
+ Features
4
+ * Updated documentation.
5
+ * Genome abstraction for genes. [69afd7c](https://github.com/mattruzicka/evolvable/commit/69afd7c957cbf89cc03b4f3f0ba967bf571c34c5)
6
+ * Built-in support for count genes. [69afd7c](https://github.com/mattruzicka/evolvable/commit/69afd7c957cbf89cc03b4f3f0ba967bf571c34c5)
7
+ * Add serializer for dumping and loading for population and genogenome objects [9d2a42a](https://github.com/mattruzicka/evolvable/commit/9d2a42a29103e1525b3c5471578ee97baeb6e8c6)
8
+ * Keep previous generation parents for generating evolvables for the current generation whenever [856ac3a](https://github.com/mattruzicka/evolvable/commit/856ac3a778106d34221ce8ce8ae14b963877dc76)
9
+ * Add #new_evolvables methods to Evolvable Selection, Crossover, and Mutation for acting on evolvables [856ac3a](https://github.com/mattruzicka/evolvable/commit/856ac3a778106d34221ce8ce8ae14b963877dc76)
10
+ * Add EvolvablePopulation#reset_evolvables [b61cccb](https://github.com/mattruzicka/evolvable/commit/b61cccbee8ac8cc9f00496e5461131bb796af974)
11
+ * Improve gene class lookup. Suppose you have an evolvable Dog class with a Dog::TailGene class. Now you can just pass 'TailGene' as the 'type' in your gene space definition [079dcef](https://github.com/mattruzicka/evolvable/commit/079dcef000e57553db8c6e5b89207d2d8e5c9890)
12
+ * Allow Evolvable.search_space to return a hash, array (when only one gene type), or array of arrays [be56c9c](https://github.com/mattruzicka/evolvable/commit/be56c9cc73c7202abc4588cb20c340d1e49498ed)
13
+ * Add Evolvable.search_spaces method which can be defined instead of or in addition to Evolvable.search_space, as an array of search space definitions (configs or Evolvable::SearchSpace objects) [a3c3896](https://github.com/mattruzicka/evolvable/commit/a3c3896d8b1799b7fac6143812a5ef630f716d85)
14
+ * Add ability to inititalize evaluation, selection, combination, and mutation objects with a hash of parameters or object. [7c8fd58](https://github.com/mattruzicka/evolvable/commit/7c8fd586ec882f35e5ce35c5bc6a28982e4d0640)
15
+ * Add the following delegated methods to Evolvable::Population to change the default evolutionary parameters [ffb9998](https://github.com/mattruzicka/evolvable/commit/ffb9998b09f02fa6759322c324b2f448fd3af223)
16
+
17
+ ```
18
+ selection_size
19
+ selection_size=
20
+ mutation_rate
21
+ mutation_rate=
22
+ mutation_probability
23
+ mutation_probability=
24
+ ```
25
+
26
+
27
+ Changes
28
+ * Renamed Goal classes. The old, namespaced goal classes will be removed in version 2.0 [a3fb191](https://github.com/mattruzicka/evolvable/commit/a3fb1915230cc297e545d873a80f0324bca5833d)
29
+ * Renamed Evolvable#population_index to generation_index. The The population_index method will be removed in version 2.0 [e0251f7](https://github.com/mattruzicka/evolvable/commit/e0251f7c51818c30986d5a9a2b44f3834107ec55)
30
+ * Renamed evolvable_class keyword arg in Evolvable::Population#initialize to evolvable_type and suport strings and classes as arguments. Passing evolvable_class is deprecated and will be removed in version 2.0 and at that time the evolvable_tyoe keyword arg will be required [1491f4b](https://github.com/mattruzicka/evolvable/commit/1491f4b6f5bb615ae17e749922a852edce48072b)
31
+ * Renamed Evolvable::Population#new_instance to #new_evolvable + use the previous generation's parents to generate a new instance, if there is one. Otherwise, it continues to randomly intitialize the instances from the defined gene space.
32
+ * Renamed Evolvable#new_instance to #new_evolvable, .initialize_instance to .initialize_evolvable, and #initialize_instance to #after_initialize.
33
+ * Renamed "instance" and "instances" to "evolvable" and "evolvables" across the code base and API.
34
+ * Renamed Evolvable::GeneSpace to Evolvable::SearchSpace. Using Evolvable::GeneSpace and Evolvable.gene_space is deprecated and support will be removed in version 2.0 [837322a](https://github.com/mattruzicka/evolvable/commit/837322a66c87d6b3fdf992c1b6c7e1b2fb920fe7)
35
+ * Renamed Evolution#crossover to Evolution#combination. Using Evolution#crossover is deprecated and support will be removed in version 2.0 [7fad505](https://github.com/mattruzicka/evolvable/commit/7fad505a6dbc679412d5c0565d64791a6edad6b7)
36
+ * Renamed Population#crossover, crossover= to combination [d2190c5](https://github.com/mattruzicka/evolvable/commit/d2190c5b32584a95e25c40a30b685e634a1b6b7f)
37
+ * Renamed Gene.crossover to Gene.combine. Gene.crossover is deprecated and support will be removedin version 2.0 [ed2190c5](https://github.com/mattruzicka/evolvable/commit/ed2190c5b32584a95e25c40a30b685e634a1b6b7f)
38
+
39
+
40
+ ## 1.0.2 - 2021-04-04
41
+
42
+ Features
43
+ * Make gene_key assignment a class level concern. Makes custom gene initialization simpler. https://github.com/mattruzicka/evolvable/pull/6
44
+
45
+ ## 1.0.1
46
+
47
+ Bug fixes
48
+ * Fix goal normalization in `Evolvable::Evaluation` when given an object
49
+
50
+ ## 1.0.0
51
+
52
+ Hello 🌎 🌍 🌏
53
+
54
+ Check out the [README](https://github.com/mattruzicka/evolvable/blob/master/README.md) for everything
55
+
56
+ ___
57
+
58
+
59
+ 🧬 🧬 🧬
60
+
61
+ Please [open an issue](https://github.com/mattruzicka/evolvable/issues/new) if you cannot find what you're looking for
62
+
63
+ 🧬 🧬 🧬
data/Gemfile CHANGED
@@ -3,3 +3,6 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
+
7
+ gem 'byebug'
8
+ gem 'readme_yard', path: '/Users/matt/Code/readme_yard'
data/Gemfile.lock CHANGED
@@ -1,55 +1,55 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- evolvable (0.1.0)
4
+ evolvable (1.1.0)
5
+
6
+ PATH
7
+ remote: /Users/matt/Code/readme_yard
8
+ specs:
9
+ readme_yard (0.2.0)
10
+ tty-markdown (~> 0.7)
11
+ yard-readme (~> 0.3)
5
12
 
6
13
  GEM
7
14
  remote: https://rubygems.org/
8
15
  specs:
9
- ast (2.4.0)
10
- byebug (11.0.0)
11
- diff-lcs (1.3)
12
- jaro_winkler (1.5.2)
13
- parallel (1.13.0)
14
- parser (2.6.0.0)
15
- ast (~> 2.4.0)
16
- powerpack (0.1.2)
17
- rainbow (3.0.0)
18
- rake (10.5.0)
19
- rspec (3.8.0)
20
- rspec-core (~> 3.8.0)
21
- rspec-expectations (~> 3.8.0)
22
- rspec-mocks (~> 3.8.0)
23
- rspec-core (3.8.0)
24
- rspec-support (~> 3.8.0)
25
- rspec-expectations (3.8.2)
26
- diff-lcs (>= 1.2.0, < 2.0)
27
- rspec-support (~> 3.8.0)
28
- rspec-mocks (3.8.0)
29
- diff-lcs (>= 1.2.0, < 2.0)
30
- rspec-support (~> 3.8.0)
31
- rspec-support (3.8.0)
32
- rubocop (0.64.0)
33
- jaro_winkler (~> 1.5.1)
34
- parallel (~> 1.10)
35
- parser (>= 2.5, != 2.5.1.1)
36
- powerpack (~> 0.1)
37
- rainbow (>= 2.2.2, < 4.0)
38
- ruby-progressbar (~> 1.7)
39
- unicode-display_width (~> 1.4.0)
40
- ruby-progressbar (1.10.0)
41
- unicode-display_width (1.4.1)
16
+ byebug (11.1.3)
17
+ kramdown (2.3.1)
18
+ rexml
19
+ pastel (0.8.0)
20
+ tty-color (~> 0.5)
21
+ rexml (3.2.5)
22
+ rouge (3.26.0)
23
+ strings (0.2.1)
24
+ strings-ansi (~> 0.2)
25
+ unicode-display_width (>= 1.5, < 3.0)
26
+ unicode_utils (~> 1.4)
27
+ strings-ansi (0.2.0)
28
+ tty-color (0.6.0)
29
+ tty-markdown (0.7.0)
30
+ kramdown (>= 1.16.2, < 3.0)
31
+ pastel (~> 0.8)
32
+ rouge (~> 3.14)
33
+ strings (~> 0.2.0)
34
+ tty-color (~> 0.5)
35
+ tty-screen (~> 0.8)
36
+ tty-screen (0.8.1)
37
+ unicode-display_width (2.0.0)
38
+ unicode_utils (1.4.0)
39
+ yard (0.9.26)
40
+ yard-readme (0.3.0)
41
+ yard (~> 0.9.26)
42
42
 
43
43
  PLATFORMS
44
44
  ruby
45
+ x86_64-darwin-18
45
46
 
46
47
  DEPENDENCIES
47
48
  bundler (~> 2.0)
48
- byebug (~> 11.0)
49
+ byebug
49
50
  evolvable!
50
- rake (~> 10.0)
51
- rspec (~> 3.0)
52
- rubocop (~> 0.64.0)
51
+ readme_yard!
52
+ yard
53
53
 
54
54
  BUNDLED WITH
55
- 2.0.1
55
+ 2.2.15
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Matt Ruzicka
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.