dither 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dither.gemspec +1 -1
- data/lib/dither/ateg_pairwise.rb +17 -17
- data/lib/dither/java_ext/dither.rb +13 -0
- data/lib/dither/version.rb +1 -1
- data/lib/dither.rb +1 -1
- data/spec/dither/dither_spec.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: f2101991f7e2d91e73b8e8ceba02ac57bb040d02
|
4
|
+
data.tar.gz: e8db83997558c3553b76e0b7058aa95f2870553c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 200f11225a3af395164e40329b3f992833fc4da90f7357e3f2ff031bfcc95f0c9e24aa4da0181e8b702a2bba8c453c8f240474fc7e6ad61630fa33ea73aae7b3
|
7
|
+
data.tar.gz: 5f982c50511d7241f52af2c490746421024a53404ccf6f2ab2b71f8311db7556c89d3873c9a649e00611c0f84eb6e7bce94535f2a659a66ad5c07d6f7eefd2c0
|
data/dither.gemspec
CHANGED
data/lib/dither/ateg_pairwise.rb
CHANGED
@@ -41,22 +41,22 @@ module Dither
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
@constraints = nil
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
44
|
+
if opts[:constraints]
|
45
|
+
@constraints = []
|
46
|
+
opts[:constraints].each do |a|
|
47
|
+
constraint = a.map { |k, v| pair_cache[k][v] }
|
48
|
+
constraint.extend(Pairs)
|
49
|
+
@constraints << constraint
|
50
|
+
end
|
51
|
+
end
|
52
52
|
@comb = []
|
53
53
|
@t = opts[:t]
|
54
54
|
(0...params.length).to_a.combination(t).each do |a|
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
car, *cdr = a.map { |b| pair_cache[b] }
|
56
|
+
tmp = car.product(*cdr)
|
57
|
+
tmp.each { |b| b.extend(Pairs) }
|
58
58
|
tmp.reject! { |b| constraints.any? { |c| c.all? { |d| b.include?(d)} } } if constraints
|
59
|
-
|
59
|
+
@comb.push(*tmp)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -68,14 +68,14 @@ module Dither
|
|
68
68
|
|
69
69
|
def filter
|
70
70
|
return unless constraints
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
scratch.each_with_index do |e, i|
|
72
|
+
scratch[i] = nil if constraints.any? { |a| a.in_test_case?(e) }
|
73
|
+
end
|
74
74
|
end
|
75
75
|
|
76
76
|
def best_fit
|
77
|
-
|
78
|
-
|
77
|
+
max, _ = scratch.compact
|
78
|
+
.map { |a| [a, comb.count { |b| b.in_test_case?(a) }] }
|
79
79
|
.max { |a, b| a[1] <=> b[1] }
|
80
80
|
comb.delete_if { |a| a.in_test_case?(max) }
|
81
81
|
max
|
@@ -13,6 +13,19 @@ module Dither
|
|
13
13
|
raise Dither::Error.new(e.message)
|
14
14
|
end
|
15
15
|
|
16
|
+
def self.ateg(params, opts = {})
|
17
|
+
opts = DEFUALT_OPTS.dup.merge(opts)
|
18
|
+
constraints = constraints_to_java(params.length, opts[:constraints])
|
19
|
+
com.github.jesg.dither.Dither.ateg(
|
20
|
+
opts[:t].to_java(:int),
|
21
|
+
opts[:seed].to_java(:Integer),
|
22
|
+
params.map(&:to_java).to_java,
|
23
|
+
constraints,
|
24
|
+
(opts[:previously_tested] || []).map(&:to_java).to_java).to_a
|
25
|
+
rescue com.github.jesg.dither.DitherError => e
|
26
|
+
raise Dither::Error.new(e.message)
|
27
|
+
end
|
28
|
+
|
16
29
|
private
|
17
30
|
|
18
31
|
def self.constraints_to_java(param_length, constraints)
|
data/lib/dither/version.rb
CHANGED
data/lib/dither.rb
CHANGED
data/spec/dither/dither_spec.rb
CHANGED
@@ -174,7 +174,7 @@ describe Dither do
|
|
174
174
|
it 'can run 4-way ateg with seed' do
|
175
175
|
params = [(0...2).to_a, (0...2).to_a, (0...2).to_a, (0..3).to_a]
|
176
176
|
expect(Dither.ateg(params, :t => 4, :seed => 0, :constraints => [
|
177
|
-
|
178
|
-
|
177
|
+
{ 0 => 1, 1 => 1, 2 => 1, 3 => 1 },
|
178
|
+
], :previously_tested => [[1,1,1,2]]).length).to eq 30
|
179
179
|
end
|
180
180
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dither
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Gowan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|