statfeed 1.0.1 → 1.1.0
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.
- checksums.yaml +4 -4
- data/lib/statfeed.rb +14 -7
- data/test/test_statfeed.rb +10 -23
- 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: 9c6c540c16236c35e45d7f0b20f1ec84d4d2c624
|
4
|
+
data.tar.gz: 77ab3b7498230d2c6bed53d4bd3e5a5173e32ac4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 350b2dfe60dd2801cbee43b6aed20e5d8a2161478465797bcadabfcf182c4a0a3737e416d9859f77676164d12efc4c77a9fccdf3a77f7ec0e1aae1cef572ef77
|
7
|
+
data.tar.gz: 762e4da1cfc1305d3b66e514efa831cb393a989d3245812bb3e0cf27cdadf5076a67d02444c05519f8ce66c626639a44caac45cce2b2915f2f903dcfb2a3f022
|
data/lib/statfeed.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class Statfeed
|
2
|
-
VERSION = "1.0
|
2
|
+
VERSION = "1.1.0"
|
3
3
|
attr_accessor :weights, :choices, :randoms, :heterogeneities, :accents, :statistics, :size, :decisions, :options
|
4
4
|
|
5
5
|
def initialize decisions, options, heterogeneity: 0.1, accent: 1.0
|
@@ -27,13 +27,20 @@ class Statfeed
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def populate_choices
|
30
|
-
@
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
@choices.tap do |choices|
|
31
|
+
@decisions.each_index do |decision|
|
32
|
+
options = sort_options(scheduling_values(decision))
|
33
|
+
index = options.find_index {|o| acceptable? o}
|
34
|
+
choices[decision] = options[index]
|
35
|
+
increment_statistics decision, index
|
36
|
+
normalize_statistics! decision
|
37
|
+
end
|
35
38
|
end
|
36
|
-
|
39
|
+
end
|
40
|
+
|
41
|
+
# Default is "everything's okay"
|
42
|
+
def acceptable? o
|
43
|
+
true
|
37
44
|
end
|
38
45
|
|
39
46
|
def populate_randoms
|
data/test/test_statfeed.rb
CHANGED
@@ -27,32 +27,19 @@ class TestStatfeed < Minitest::Test
|
|
27
27
|
assert_each_equal %w(a c b), actual
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
31
|
-
|
30
|
+
def test_populate_choices
|
31
|
+
actual = @sf.populate_choices
|
32
|
+
assert_each_equal %w(a b b), actual
|
32
33
|
end
|
33
34
|
|
34
|
-
def
|
35
|
-
#
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
# Should have a statistic S_m for the statistic associated with option m
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_a_sub_n
|
43
|
-
# Accent (stress) associated with the decision n
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_h_sub_n
|
47
|
-
# Heterogeneity associated with decision n
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_w_sub_m_n
|
51
|
-
# Weight associated with option m during decision n
|
52
|
-
end
|
35
|
+
def test_additional_constraints
|
36
|
+
# Define a new method excluding the a
|
37
|
+
def @sf.acceptable? o
|
38
|
+
o != 'a'
|
39
|
+
end
|
53
40
|
|
54
|
-
|
55
|
-
|
41
|
+
actual = @sf.populate_choices
|
42
|
+
assert_each_equal %w(b c c), actual
|
56
43
|
end
|
57
44
|
|
58
45
|
def assert_each_in_delta exp, act, delta = 0.001
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statfeed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|