pmeth 0.0.4 → 0.0.5

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pmeth.rb +2 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 16aba86c56088b02d3a72b8400c645aa1dfec5f2
4
- data.tar.gz: a6ac908c2e1a370e363cd002fa25bba08cdccd37
3
+ metadata.gz: ceada8203f5a3f30779c0659894ce9ba093ace9b
4
+ data.tar.gz: c3986f76c2d706c48cc727752070be2157fb552d
5
5
  SHA512:
6
- metadata.gz: 0c446aca00d392d2cf81458e37691d32fc81a78ca7fdad97bda379cf8a3914728fa6984dfe9d3b042a93122bd6acafb46bf20b1ec06ce83e51ca049d41816ebd
7
- data.tar.gz: 0df635df12846fea56937794a9510404f1c93da78e04c21bc9f1c0d492d8671a67d44b5121dc7e45e4666922f259b5019253b81469410fad58115f0a83e123b1
6
+ metadata.gz: 499c46045ead1236234721902860501e27971ed7cd331b234a1a90168778db4cf753f0722f2cd6b4e7ff480ce8ce8b99000133ba8f13d073fe36fd5aa38d2fe1
7
+ data.tar.gz: 0434f5177db12f1e65a48fc94c56efabf10325e6971d2825c83b92e44641ed05c3418f67bbed47627fe0c30e2c902e31103593baa47fc2a3dbef134bbc91370e
data/lib/pmeth.rb CHANGED
@@ -31,7 +31,7 @@ class PMeth
31
31
  permutation.delete_at(ig)
32
32
  end
33
33
  x = 0 # x is the randomly chosen size of chunks that permutation will be split into
34
- until x > 2 # the chunk to be re-ordered must have at least 2 objects
34
+ until x >= 2 # the chunk to be re-ordered must have at least 2 objects
35
35
  x = division(permutation)
36
36
  end
37
37
  sliced = permutation.each_slice(x).to_a # permutation is sliced into chunks of size x
@@ -64,7 +64,7 @@ class PMeth
64
64
 
65
65
  # Returns a permutation whose objects are ordered partly like parent_1 permutation, and partly like parent_2 permutation
66
66
  def self.recombine(parent_1, parent_2)
67
- child_permutation = []
67
+ child = []
68
68
  x = division(parent_1) # the randomly chosen size of chunks that permutations will be split into
69
69
  if prime?(parent_1.length) # to compensate for permutations with a prime number of objects:
70
70
  ig = rand(parent_1.length)-1 # choose a random object to ignore - to add back at its original index after mutation
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pmeth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edward Chalstrey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-06 00:00:00.000000000 Z
11
+ date: 2014-05-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: "Reproduction methods for genetic (and other iterative improvement) algorithms,
14
14
  being used to solve permutation problems, \n where permutations are arrays of unique