pmeth 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pmeth.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ceada8203f5a3f30779c0659894ce9ba093ace9b
|
4
|
+
data.tar.gz: c3986f76c2d706c48cc727752070be2157fb552d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
-
|
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
|
+
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-
|
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
|