feldtruby 0.4.8 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -1
- data/Gemfile.lock +1 -1
- data/lib/feldtruby/optimize/objective.rb +1 -1
- data/lib/feldtruby/version.rb +1 -1
- data/test/test_optimize_objective.rb +25 -1
- metadata +16 -28
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 649d3dfa9702ca3b927e1f439220f1aeed6ca970
|
4
|
+
data.tar.gz: 3bc58c5d5c11417907254bc22d4b974b1725bed6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e02ff98f8487db6542dc5d9d86c53d7e1a8e228b872d2a1e51f075fcc6b8f4ad2025d5123d1e8f2e84a3ee7efc72b4fce411464696e8181e07a8227fbbd06f0e
|
7
|
+
data.tar.gz: 79e5b1e5ee1cd35181e3675c159d242a9cd1861218f361a6b545f4753b38af329427dd28d1b2d83c690aebe96d915e97c3894d24c71d1ddca8da689c0f39040e
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -481,7 +481,7 @@ end
|
|
481
481
|
class PercentageQualityValue < QualityValue
|
482
482
|
def value_to_s
|
483
483
|
return "N/A" if @sub_qualities.any? {|sq| sq.nil?}
|
484
|
-
"%s%%" % (value * 100.0).to_significant_digits(6).to_s
|
484
|
+
"%s%%" % ((1.0 - value) * 100.0).to_significant_digits(6).to_s
|
485
485
|
end
|
486
486
|
end
|
487
487
|
|
data/lib/feldtruby/version.rb
CHANGED
@@ -477,6 +477,30 @@ describe "Using MWGR for range-independent aggregate fitness calc" do
|
|
477
477
|
@o.rank_candidates([i3,i1]).must_equal [i1,i3]
|
478
478
|
@o.rank_candidates([i2,i3]).must_equal [i2,i3]
|
479
479
|
end
|
480
|
+
|
481
|
+
it "prints the quality inverted in 100.0 to make it more human-understandable" do
|
482
|
+
i1 = [1,2]
|
483
|
+
q1 = @o.quality_of(i1) # [1, 3] => 0.0
|
484
|
+
q1.to_s.must_equal "100.0% (SubQs = [1.0, 3.0], ver. 4)"
|
485
|
+
|
486
|
+
i2 = [1,3]
|
487
|
+
q2 = @o.quality_of(i2) # [2, 4] => 0.5
|
488
|
+
q2.to_s.must_equal "50.0% (SubQs = [2.0, 4.0], ver. 6)"
|
489
|
+
q1.to_s.must_equal "50.0% (SubQs = [1.0, 3.0], ver. 6)"
|
490
|
+
|
491
|
+
i3 = [1,4]
|
492
|
+
q3 = @o.quality_of(i3) # [3, 5] => (0+1.0)/2
|
493
|
+
q3.to_s.must_equal "50.0% (SubQs = [3.0, 5.0], ver. 8)"
|
494
|
+
q2.to_s.must_equal "50.0% (SubQs = [2.0, 4.0], ver. 8)"
|
495
|
+
q1.to_s.must_equal "50.0% (SubQs = [1.0, 3.0], ver. 8)"
|
496
|
+
|
497
|
+
i4 = [1,2,3]
|
498
|
+
q4 = @o.quality_of(i4) # [2, 6] => (0.5+1.0)/2
|
499
|
+
q4.to_s.must_equal "75.0% (SubQs = [2.0, 6.0], ver. 9)"
|
500
|
+
q3.to_s.must_equal "33.3333% (SubQs = [3.0, 5.0], ver. 9)"
|
501
|
+
q2.to_s.must_equal "41.6667% (SubQs = [2.0, 4.0], ver. 9)"
|
502
|
+
q1.to_s.must_equal "50.0% (SubQs = [1.0, 3.0], ver. 9)"
|
503
|
+
end
|
480
504
|
end
|
481
505
|
|
482
506
|
class ObjectiveReturningNil < FeldtRuby::Optimize::Objective
|
@@ -492,7 +516,7 @@ describe "Can handle objectives that return nil" do
|
|
492
516
|
q1 = o.quality_of([1])
|
493
517
|
q1.sub_qualities.must_equal [1]
|
494
518
|
q1.value.must_equal 0.0 # Perfect score
|
495
|
-
q1.to_s.must_equal "
|
519
|
+
q1.to_s.must_equal "100.0% (SubQs = [1.0], ver. 2)"
|
496
520
|
|
497
521
|
q2 = o.quality_of([])
|
498
522
|
q2.sub_qualities.must_equal [nil]
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feldtruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.9
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Robert Feldt
|
@@ -14,81 +13,71 @@ dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rinruby
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: json
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: nokogiri
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: mongo
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: bson_ext
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
description: Robert Feldt's Common Ruby Code lib
|
@@ -196,27 +185,26 @@ files:
|
|
196
185
|
- test/tmp_shorter.csv
|
197
186
|
homepage: https://github.com/robertfeldt/feldtruby
|
198
187
|
licenses: []
|
188
|
+
metadata: {}
|
199
189
|
post_install_message:
|
200
190
|
rdoc_options: []
|
201
191
|
require_paths:
|
202
192
|
- lib
|
203
193
|
required_ruby_version: !ruby/object:Gem::Requirement
|
204
|
-
none: false
|
205
194
|
requirements:
|
206
|
-
- -
|
195
|
+
- - '>='
|
207
196
|
- !ruby/object:Gem::Version
|
208
197
|
version: '0'
|
209
198
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
|
-
none: false
|
211
199
|
requirements:
|
212
|
-
- -
|
200
|
+
- - '>='
|
213
201
|
- !ruby/object:Gem::Version
|
214
202
|
version: '0'
|
215
203
|
requirements: []
|
216
204
|
rubyforge_project:
|
217
|
-
rubygems_version:
|
205
|
+
rubygems_version: 2.0.0
|
218
206
|
signing_key:
|
219
|
-
specification_version:
|
207
|
+
specification_version: 4
|
220
208
|
summary: Robert Feldt's Common Ruby Code lib
|
221
209
|
test_files:
|
222
210
|
- test/helper.rb
|