dither 0.2.1-java → 0.2.2-java

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a987783363aa9b53be68e9b15beb1fae453985e
4
- data.tar.gz: e207f2588859e02213785fea494d02bc8d75af72
3
+ metadata.gz: 7c4f7b41b32e5ea6f96a929e5ffe96bb822c1810
4
+ data.tar.gz: 3cf78c076a39e9031bb4009f51c5e676da3c8589
5
5
  SHA512:
6
- metadata.gz: 04cdb9b5a5d9fa432daeb000a4efc4297d990581d351da6f3b5cc774c864d0043a7daea53abe436b36d50e051189927a2c5cad9bbd072b138a920cd979c5528c
7
- data.tar.gz: 00f0c16140b9726118fe75c9caf333bde02e43e00fce6ee369acbcfa3f3baa5291431541193169b017ea8bb2c24457ced00f1bf45b723b66ec567906654b38d8
6
+ metadata.gz: e113ff89775611ac9624a6ebaf9c230e176b2b10904333c82134953a2ecb8f9222147e626ff2e48a5c7d6d26747d1639c5309cf748c99bc256be6aa46f6d1d45
7
+ data.tar.gz: 6b405fa6986676656ec3da84808b7b85453e9a8f94bd8b081b6025cb7349c182e6c5c91e36e468cda5ce01f84f3eb3deda7f3f8a19dc48510fd6636293355fce
data/ext/dither/ipog.cc CHANGED
@@ -13,6 +13,7 @@
13
13
  #include <utility>
14
14
  #include <tuple>
15
15
  #include <limits.h>
16
+ #include <cstddef>
16
17
 
17
18
  namespace dither {
18
19
 
@@ -107,37 +108,41 @@ void Ipog::run() {
107
108
  const std::vector<param> &test_case = *pairs;
108
109
  bool case_covered = constraint_handler->violate_constraints(test_case);
109
110
 
110
- if (!case_covered) {
111
- bool is_merged = false;
112
- auto prev = unbound_.before_begin();
113
- auto next = unbound_.begin();
114
- auto end = unbound_.end();
115
- while (next != end) {
116
- const int merge_result = merge(k, *next, test_case);
117
- if (merge_result == 0) {
118
- bound_.push_front(*next);
119
- unbound_.erase_after(prev);
120
- is_merged = true;
121
- break;
122
- } else if (merge_result == 1) {
123
- is_merged = true;
124
- break;
125
- }
126
- ++prev;
127
- ++next;
128
- }
129
-
130
- if (!is_merged) {
131
- dtest_case unbound_test_case(param_cache_.size(), -1);
132
- for (auto it = test_case.cbegin(); it != test_case.cend(); ++it) {
133
- unbound_test_case[(*it).first] = (*it).second;
134
- }
135
- if (!constraint_handler->violate_constraints(unbound_test_case)) {
136
- unbound_.push_front(unbound_test_case);
137
- }
138
- }
139
- }
111
+ if(!case_covered) {
112
+ for (auto it = unbound_.cbegin(); it != unbound_.cend(); ++it) {
113
+ if(is_covered(*it, test_case)) {
114
+ case_covered = true;
115
+ break;
116
+ }
117
+ }
118
+ }
119
+
120
+ if (!case_covered) {
121
+ bool is_merged = false;
122
+
123
+ for(auto next = unbound_.begin(); next != unbound_.end(); ++next) {
124
+ const int merge_result = merge(k, *next, test_case);
125
+
126
+ if (merge_result > 0) {
127
+ dtest_case tmp = *next;
128
+ for (auto it = test_case.cbegin(); it != test_case.cend(); ++it) {
129
+ tmp[(*it).first] = (*it).second;
130
+ }
131
+ is_merged = true;
132
+ break;
133
+ }
134
+ }
140
135
 
136
+ if (!is_merged) {
137
+ dtest_case unbound_test_case(param_cache_.size(), -1);
138
+ for (auto it = test_case.cbegin(); it != test_case.cend(); ++it) {
139
+ unbound_test_case[(*it).first] = (*it).second;
140
+ }
141
+ if (!constraint_handler->violate_constraints(unbound_test_case)) {
142
+ unbound_.push_front(unbound_test_case);
143
+ }
144
+ }
145
+ }
141
146
  }
142
147
  }
143
148
  ground_solutions();
@@ -163,12 +168,8 @@ inline const int Ipog::merge(const int k, dtest_case &test_case,
163
168
  return -1;
164
169
  }
165
170
 
166
- for (auto it = pairs.cbegin(); it != pairs.cend(); ++it) {
167
- test_case[(*it).first] = (*it).second;
168
- }
169
-
170
- for (auto i = 0; i < k; i++) {
171
- if (test_case[i] == -1) {
171
+ for (auto i = 0; i <= k; i++) {
172
+ if (merge_scratch_[i] == -1) {
172
173
  return 1;
173
174
  }
174
175
  }
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Dither
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'
4
4
  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.2.1
4
+ version: 0.2.2
5
5
  platform: java
6
6
  authors:
7
7
  - Jason Gowan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-12 00:00:00.000000000 Z
11
+ date: 2015-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement