dither 0.2.5 → 0.2.6
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/ext/dither/Ipog.java +13 -24
- data/ext/dither/base_constraint_handler.h +22 -19
- data/ext/dither/combinations.h +22 -26
- data/ext/dither/dither.cc +7 -3
- data/ext/dither/dither.h +3 -2
- data/ext/dither/extconf.rb +1 -1
- data/ext/dither/ipog.cc +114 -109
- data/ext/dither/ipog.h +21 -20
- data/ext/dither/simple_constraint_handler.cc +90 -78
- data/ext/dither/simple_constraint_handler.h +19 -17
- data/lib/dither/version.rb +1 -1
- 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: b006159a1b729a73db618c798df025d7ac71584f
|
4
|
+
data.tar.gz: d53268fc1aaa144bedd5e216d887235cc573af4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e06c1afdd9e517e00c70a8dcf8984425059d4024ec86cc0fafc1a0a8a1049c7de825dd0daf5bcafeacc5f8ea04b2f441c29b6ddf679b394787a4f89e83a096bc
|
7
|
+
data.tar.gz: af4aa4e4434de024b19b50552aa63ed3cf29a50aaf8646a2278f8418e3fbffa95271af6bf1bc6497fc69c4124e2d3d0822edaa9e8c49d13acdbb1f5bd16da7fd
|
data/ext/dither/Ipog.java
CHANGED
@@ -231,37 +231,31 @@ iter:
|
|
231
231
|
// remove constraint violation
|
232
232
|
boolean isCaseCovered = violateConstraints(testCase);
|
233
233
|
if(!isCaseCovered) {
|
234
|
-
|
235
|
-
|
234
|
+
|
235
|
+
match_unbound_label:
|
236
|
+
for (final int[] innerTestCase : unbound) {
|
236
237
|
for(final Pair pair : testCase) {
|
237
238
|
if(innerTestCase[pair.i] != pair.j) {
|
238
|
-
|
239
|
-
break;
|
239
|
+
continue match_unbound_label;
|
240
240
|
}
|
241
241
|
}
|
242
|
-
|
243
|
-
|
244
|
-
break;
|
245
|
-
}
|
242
|
+
isCaseCovered = true;
|
243
|
+
break;
|
246
244
|
}
|
247
245
|
}
|
248
246
|
|
249
247
|
if (!isCaseCovered) {
|
250
|
-
final ListIterator<int[]> unboundIter = unbound.listIterator();
|
251
248
|
boolean isMerged = false;
|
252
|
-
int[] innerTestCase
|
253
|
-
while(unboundIter.hasNext()) {
|
254
|
-
innerTestCase = unboundIter.next();
|
249
|
+
for(final int[] innerTestCase : unbound) {
|
255
250
|
// -1 => no merge, 0 perfect merge (no unbound), 1 partial merge
|
256
251
|
final int mergeResult = merge(k, testCase, innerTestCase);
|
257
|
-
if(mergeResult
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
break;
|
262
|
-
} else if(mergeResult == 1) {
|
252
|
+
if(mergeResult > 0){
|
253
|
+
for(final Pair localComb : testCase) {
|
254
|
+
innerTestCase[localComb.i] = localComb.j;
|
255
|
+
}
|
263
256
|
isMerged = true;
|
264
257
|
break;
|
258
|
+
|
265
259
|
}
|
266
260
|
}
|
267
261
|
|
@@ -304,14 +298,9 @@ iter:
|
|
304
298
|
return -1;
|
305
299
|
}
|
306
300
|
|
307
|
-
// merge
|
308
|
-
for(final Pair pair : pairs) {
|
309
|
-
testCase[pair.i] = pair.j;
|
310
|
-
}
|
311
|
-
|
312
301
|
// find unbound
|
313
302
|
for(int i = 0; i < k; i++) {
|
314
|
-
if(
|
303
|
+
if(mergeScratch[i] == -1) { return 1; }
|
315
304
|
}
|
316
305
|
return 0;
|
317
306
|
}
|
@@ -15,25 +15,28 @@
|
|
15
15
|
|
16
16
|
namespace dither {
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
class BaseConstraintHandler {
|
19
|
+
public:
|
20
|
+
BaseConstraintHandler(){};
|
21
|
+
virtual ~BaseConstraintHandler(){};
|
22
|
+
virtual bool violate_constraints(const dtest_case &test_case) {
|
23
|
+
return false;
|
24
|
+
}
|
25
|
+
virtual bool violate_constraints(const std::vector<param *> &test_case) {
|
26
|
+
return false;
|
27
|
+
}
|
28
|
+
virtual bool violate_constraints(param **test_case,
|
29
|
+
const std::size_t length) {
|
30
|
+
return false;
|
31
|
+
}
|
32
|
+
virtual bool ground(dtest_case &test_case) {
|
33
|
+
for (auto it = test_case.begin(); it != test_case.end(); ++it) {
|
34
|
+
if ((*it) == -1) {
|
35
|
+
*it = 0;
|
25
36
|
}
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
for (auto it = test_case.begin(); it != test_case.end(); ++it) {
|
31
|
-
if ((*it) == -1) {
|
32
|
-
*it = 0;
|
33
|
-
}
|
34
|
-
}
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
};
|
37
|
+
}
|
38
|
+
return true;
|
39
|
+
}
|
40
|
+
};
|
38
41
|
}
|
39
42
|
#endif // BASE_CONSTRAINT_HANDLER_H_
|
data/ext/dither/combinations.h
CHANGED
@@ -125,12 +125,11 @@ inline void product(
|
|
125
125
|
}
|
126
126
|
}
|
127
127
|
|
128
|
-
inline void product3(
|
129
|
-
|
130
|
-
|
131
|
-
std::vector<dtest_case>::const_iterator end) {
|
128
|
+
inline void product3(std::forward_list<dtest_case>& results,
|
129
|
+
std::vector<dtest_case>::const_iterator begin,
|
130
|
+
std::vector<dtest_case>::const_iterator end) {
|
132
131
|
dtest_case ranges;
|
133
|
-
for(auto it = begin; it != end; ++it) {
|
132
|
+
for (auto it = begin; it != end; ++it) {
|
134
133
|
const dval tmp = (*it).size() - 1;
|
135
134
|
ranges.push_back(tmp);
|
136
135
|
}
|
@@ -138,18 +137,17 @@ inline void product3(
|
|
138
137
|
dtest_case scratch(ranges.size(), 0);
|
139
138
|
|
140
139
|
const std::size_t max = ranges.size() - 1;
|
141
|
-
for(std::size_t i = max;;) {
|
142
|
-
|
143
|
-
|
144
|
-
for(dval val = 0; val <= ranges[i]; val++) {
|
140
|
+
for (std::size_t i = max;;) {
|
141
|
+
if (i == max) {
|
142
|
+
for (dval val = 0; val <= ranges[i]; val++) {
|
145
143
|
results.push_front(scratch);
|
146
144
|
scratch[i]++;
|
147
145
|
}
|
148
146
|
scratch[i] = 0;
|
149
147
|
i--;
|
150
|
-
} else if(i == 0 && scratch[i] >= ranges[i]) {
|
148
|
+
} else if (i == 0 && scratch[i] >= ranges[i]) {
|
151
149
|
return;
|
152
|
-
} else if(scratch[i] < ranges[i]) {
|
150
|
+
} else if (scratch[i] < ranges[i]) {
|
153
151
|
scratch[i]++;
|
154
152
|
i++;
|
155
153
|
} else {
|
@@ -159,14 +157,13 @@ inline void product3(
|
|
159
157
|
}
|
160
158
|
}
|
161
159
|
|
162
|
-
inline std::size_t product4(
|
163
|
-
|
164
|
-
|
165
|
-
std::vector<std::vector<param>*>& param_matrix) {
|
160
|
+
inline std::size_t product4(std::forward_list<param**>& results,
|
161
|
+
param** param_cache,
|
162
|
+
std::vector<std::vector<param>*>& param_matrix) {
|
166
163
|
std::vector<int> ranges;
|
167
|
-
std::unique_ptr<param*[]> scratch_ptr(new param*[param_matrix.size()]);
|
164
|
+
std::unique_ptr<param* []> scratch_ptr(new param*[param_matrix.size()]);
|
168
165
|
auto scratch = scratch_ptr.get();
|
169
|
-
for(std::size_t j = 0; j < param_matrix.size(); j++) {
|
166
|
+
for (std::size_t j = 0; j < param_matrix.size(); j++) {
|
170
167
|
ranges.push_back(param_matrix[j]->size() - 1);
|
171
168
|
scratch[j] = &(*param_matrix[j])[0];
|
172
169
|
}
|
@@ -174,23 +171,22 @@ inline std::size_t product4(
|
|
174
171
|
|
175
172
|
const std::size_t max = ranges.size() - 1;
|
176
173
|
const std::size_t length = ranges.size();
|
177
|
-
|
178
|
-
for(std::size_t i = max;;) {
|
179
|
-
|
180
|
-
|
181
|
-
for(std::size_t val = 0; val <= ranges[i]; val++) {
|
174
|
+
std::size_t j = 0;
|
175
|
+
for (std::size_t i = max;;) {
|
176
|
+
if (i == max) {
|
177
|
+
for (std::size_t val = 0; val <= ranges[i]; val++) {
|
182
178
|
scratch[i] = &(*param_matrix[i])[indexes[i]];
|
183
|
-
std::copy(scratch, scratch+length, param_cache);
|
179
|
+
std::copy(scratch, scratch + length, param_cache);
|
184
180
|
results.push_front(param_cache);
|
185
181
|
param_cache += length;
|
186
182
|
indexes[i]++;
|
187
|
-
|
183
|
+
j++;
|
188
184
|
}
|
189
185
|
indexes[i] = 0;
|
190
186
|
i--;
|
191
|
-
} else if(i == 0 && indexes[i] >= ranges[i]) {
|
187
|
+
} else if (i == 0 && indexes[i] >= ranges[i]) {
|
192
188
|
return j;
|
193
|
-
} else if(indexes[i] < ranges[i]) {
|
189
|
+
} else if (indexes[i] < ranges[i]) {
|
194
190
|
indexes[i]++;
|
195
191
|
scratch[i] = &(*param_matrix[i])[indexes[i]];
|
196
192
|
i++;
|
data/ext/dither/dither.cc
CHANGED
@@ -9,7 +9,9 @@
|
|
9
9
|
|
10
10
|
#include "dither.h"
|
11
11
|
|
12
|
-
ipog_handle dither_ipog_new(const unsigned int t) {
|
12
|
+
ipog_handle dither_ipog_new(const unsigned int t) {
|
13
|
+
return new dither::Ipog(t);
|
14
|
+
}
|
13
15
|
|
14
16
|
void dither_ipog_delete(ipog_handle self) {
|
15
17
|
delete static_cast<dither::Ipog *>(self);
|
@@ -38,10 +40,12 @@ void dither_ipog_fill(ipog_handle self, int *solution) {
|
|
38
40
|
static_cast<dither::Ipog *>(self)->fill(solution);
|
39
41
|
}
|
40
42
|
|
41
|
-
void dither_ipog_add_constraint(ipog_handle self, const int constraint[],
|
43
|
+
void dither_ipog_add_constraint(ipog_handle self, const int constraint[],
|
44
|
+
const int length) {
|
42
45
|
static_cast<dither::Ipog *>(self)->add_constraint(constraint, length);
|
43
46
|
}
|
44
47
|
|
45
|
-
void dither_ipog_add_previously_tested(ipog_handle self, const int tested[],
|
48
|
+
void dither_ipog_add_previously_tested(ipog_handle self, const int tested[],
|
49
|
+
const int length) {
|
46
50
|
static_cast<dither::Ipog *>(self)->add_previously_tested(tested, length);
|
47
51
|
}
|
data/ext/dither/dither.h
CHANGED
@@ -25,7 +25,8 @@ int dither_ipog_size(ipog_handle);
|
|
25
25
|
void dither_ipog_display_raw_solution(ipog_handle);
|
26
26
|
void dither_ipog_fill(ipog_handle, int[]);
|
27
27
|
void dither_ipog_delete(ipog_handle self);
|
28
|
-
void dither_ipog_add_constraint(ipog_handle self, const int[], const int
|
29
|
-
void dither_ipog_add_previously_tested(ipog_handle self, const int[],
|
28
|
+
void dither_ipog_add_constraint(ipog_handle self, const int[], const int);
|
29
|
+
void dither_ipog_add_previously_tested(ipog_handle self, const int[],
|
30
|
+
const int);
|
30
31
|
}
|
31
32
|
#endif // DITHER_H_
|
data/ext/dither/extconf.rb
CHANGED
data/ext/dither/ipog.cc
CHANGED
@@ -19,14 +19,12 @@
|
|
19
19
|
namespace dither {
|
20
20
|
|
21
21
|
Ipog::~Ipog() {
|
22
|
-
if(constraint_handler != NULL) {
|
22
|
+
if (constraint_handler != NULL) {
|
23
23
|
delete constraint_handler;
|
24
24
|
}
|
25
25
|
}
|
26
26
|
|
27
|
-
Ipog::Ipog() {
|
28
|
-
t_ = 2;
|
29
|
-
}
|
27
|
+
Ipog::Ipog() { t_ = 2; }
|
30
28
|
|
31
29
|
Ipog::Ipog(const unsigned int t) : t_(t) {}
|
32
30
|
|
@@ -40,12 +38,12 @@ void Ipog::init_bound() {
|
|
40
38
|
(*it).resize(size, -1);
|
41
39
|
(*it).shrink_to_fit();
|
42
40
|
}
|
43
|
-
bound_.remove_if([this](dtest_case&
|
41
|
+
bound_.remove_if([this](dtest_case &a) { return has_previously_tested(a); });
|
44
42
|
|
45
43
|
merge_scratch_.resize(param_cache_.size(), -1);
|
46
44
|
|
47
|
-
if(constraints.size() > 0) {
|
48
|
-
for(auto it = param_cache_.cbegin(); it != param_cache_.cend(); ++it) {
|
45
|
+
if (constraints.size() > 0) {
|
46
|
+
for (auto it = param_cache_.cbegin(); it != param_cache_.cend(); ++it) {
|
49
47
|
const dval tmp = (*it).size() - 1;
|
50
48
|
ranges.push_back(tmp);
|
51
49
|
}
|
@@ -55,7 +53,7 @@ void Ipog::init_bound() {
|
|
55
53
|
}
|
56
54
|
}
|
57
55
|
|
58
|
-
inline param**
|
56
|
+
inline param **Ipog::cover(const int k, std::forward_list<param **> &coverage) {
|
59
57
|
std::vector<int> input(k);
|
60
58
|
for (std::size_t i = 0; i < k; i++) {
|
61
59
|
input[i] = i;
|
@@ -63,10 +61,10 @@ inline param** Ipog::cover(const int k, std::forward_list<param**> &coverage) {
|
|
63
61
|
|
64
62
|
std::forward_list<std::vector<int>> output;
|
65
63
|
combinations(t_ - 1, input, output);
|
66
|
-
std::forward_list<std::vector<std::vector<param
|
64
|
+
std::forward_list<std::vector<std::vector<param> *>> product_input;
|
67
65
|
int count = 0;
|
68
66
|
for (auto it = output.begin(); it != output.end(); ++it) {
|
69
|
-
std::vector<std::vector<param
|
67
|
+
std::vector<std::vector<param> *> param_tuple;
|
70
68
|
(*it).push_back(k);
|
71
69
|
int inner_count = 1;
|
72
70
|
for (auto iit = (*it).begin(); iit != (*it).end(); ++iit) {
|
@@ -77,10 +75,10 @@ inline param** Ipog::cover(const int k, std::forward_list<param**> &coverage) {
|
|
77
75
|
product_input.push_front(param_tuple);
|
78
76
|
}
|
79
77
|
|
80
|
-
param **local_param_cache = new param*[count*t_];
|
78
|
+
param **local_param_cache = new param *[count * t_];
|
81
79
|
std::size_t j = 0;
|
82
80
|
for (auto it = product_input.begin(); it != product_input.end(); ++it) {
|
83
|
-
j += t_*product4(coverage, local_param_cache+j, *it);
|
81
|
+
j += t_ * product4(coverage, local_param_cache + j, *it);
|
84
82
|
}
|
85
83
|
coverage.remove_if([this](param **a) { return has_previously_tested(a); });
|
86
84
|
return local_param_cache;
|
@@ -89,9 +87,9 @@ inline param** Ipog::cover(const int k, std::forward_list<param**> &coverage) {
|
|
89
87
|
void Ipog::run() {
|
90
88
|
init_bound();
|
91
89
|
for (auto k = t_; k < input_params_.size(); k++) {
|
92
|
-
std::forward_list<param**> pi;
|
90
|
+
std::forward_list<param **> pi;
|
93
91
|
param **params = cover(k, pi);
|
94
|
-
std::unique_ptr<param*[]> params_ptr(params);
|
92
|
+
std::unique_ptr<param *[]> params_ptr(params);
|
95
93
|
|
96
94
|
{
|
97
95
|
auto prev = bound_.cbefore_begin();
|
@@ -110,11 +108,12 @@ void Ipog::run() {
|
|
110
108
|
/* vertical extension */
|
111
109
|
for (auto pairs = pi.cbegin(); pairs != pi.cend(); ++pairs) {
|
112
110
|
param **test_case = *pairs;
|
113
|
-
bool case_covered =
|
111
|
+
bool case_covered =
|
112
|
+
constraint_handler->violate_constraints(test_case, t_);
|
114
113
|
|
115
|
-
if(!case_covered) {
|
114
|
+
if (!case_covered) {
|
116
115
|
for (auto it = unbound_.cbegin(); it != unbound_.cend(); ++it) {
|
117
|
-
if(is_covered(*it, test_case)) {
|
116
|
+
if (is_covered(*it, test_case)) {
|
118
117
|
case_covered = true;
|
119
118
|
break;
|
120
119
|
}
|
@@ -124,12 +123,12 @@ void Ipog::run() {
|
|
124
123
|
if (!case_covered) {
|
125
124
|
bool is_merged = false;
|
126
125
|
|
127
|
-
for(auto next = unbound_.begin(); next != unbound_.end(); ++next) {
|
126
|
+
for (auto next = unbound_.begin(); next != unbound_.end(); ++next) {
|
128
127
|
const int merge_result = merge(k, *next, test_case);
|
129
128
|
|
130
129
|
if (merge_result > 0) {
|
131
130
|
dtest_case tmp = *next;
|
132
|
-
for(std::size_t i = 0; i < t_; i++) {
|
131
|
+
for (std::size_t i = 0; i < t_; i++) {
|
133
132
|
const param *it = test_case[i];
|
134
133
|
tmp[it->first] = it->second;
|
135
134
|
}
|
@@ -140,7 +139,7 @@ void Ipog::run() {
|
|
140
139
|
|
141
140
|
if (!is_merged) {
|
142
141
|
dtest_case unbound_test_case(param_cache_.size(), -1);
|
143
|
-
for(std::size_t i = 0; i < t_; i++) {
|
142
|
+
for (std::size_t i = 0; i < t_; i++) {
|
144
143
|
const param *it = test_case[i];
|
145
144
|
unbound_test_case[it->first] = it->second;
|
146
145
|
}
|
@@ -156,8 +155,8 @@ void Ipog::run() {
|
|
156
155
|
|
157
156
|
/* -1 no merge, 0 perfect merge (no unbound), 1 partial merge */
|
158
157
|
inline const int Ipog::merge(const int k, dtest_case &test_case,
|
159
|
-
|
160
|
-
for(std::size_t i = 0; i < t_; i++) {
|
158
|
+
param **pairs) {
|
159
|
+
for (std::size_t i = 0; i < t_; i++) {
|
161
160
|
const param *it = pairs[i];
|
162
161
|
auto value = test_case[it->first];
|
163
162
|
if (!(value == -1 || value == it->second)) {
|
@@ -167,7 +166,7 @@ inline const int Ipog::merge(const int k, dtest_case &test_case,
|
|
167
166
|
|
168
167
|
std::copy(test_case.cbegin(), test_case.cend(), merge_scratch_.begin());
|
169
168
|
|
170
|
-
for(std::size_t i = 0; i < t_; i++) {
|
169
|
+
for (std::size_t i = 0; i < t_; i++) {
|
171
170
|
const param *it = pairs[i];
|
172
171
|
merge_scratch_[it->first] = it->second;
|
173
172
|
}
|
@@ -185,9 +184,8 @@ inline const int Ipog::merge(const int k, dtest_case &test_case,
|
|
185
184
|
return 0;
|
186
185
|
}
|
187
186
|
|
188
|
-
inline bool Ipog::is_covered(const dtest_case &test_case,
|
189
|
-
|
190
|
-
for(std::size_t i = 0; i < t_; i++) {
|
187
|
+
inline bool Ipog::is_covered(const dtest_case &test_case, param **params) {
|
188
|
+
for (std::size_t i = 0; i < t_; i++) {
|
191
189
|
const param *my_param = params[i];
|
192
190
|
if (test_case[my_param->first] != my_param->second) {
|
193
191
|
return false;
|
@@ -196,7 +194,7 @@ inline bool Ipog::is_covered(const dtest_case &test_case,
|
|
196
194
|
return true;
|
197
195
|
}
|
198
196
|
inline bool Ipog::is_covered(const dtest_case &test_case,
|
199
|
-
|
197
|
+
const std::vector<param *> ¶ms) {
|
200
198
|
for (auto param = params.cbegin(); param != params.cend(); ++param) {
|
201
199
|
if (test_case[(*param)->first] != (*param)->second) {
|
202
200
|
return false;
|
@@ -206,15 +204,14 @@ inline bool Ipog::is_covered(const dtest_case &test_case,
|
|
206
204
|
}
|
207
205
|
|
208
206
|
inline const int Ipog::maximize_coverage(const int k, dtest_case &test_case,
|
209
|
-
|
207
|
+
std::forward_list<param **> &pi) {
|
210
208
|
const std::vector<param> ¶m_range = param_cache_[k];
|
211
209
|
int current_max = -1;
|
212
210
|
param max_param = param_range[0];
|
213
|
-
std::forward_list<std::forward_list<param**>::iterator> covered;
|
211
|
+
std::forward_list<std::forward_list<param **>::iterator> covered;
|
214
212
|
|
215
213
|
for (auto it = param_range.cbegin(); it != param_range.cend(); ++it) {
|
216
|
-
std::forward_list<std::forward_list<param**>::iterator>
|
217
|
-
tmp_covered;
|
214
|
+
std::forward_list<std::forward_list<param **>::iterator> tmp_covered;
|
218
215
|
const param current_param = *it;
|
219
216
|
|
220
217
|
test_case[current_param.first] = current_param.second;
|
@@ -258,7 +255,7 @@ void Ipog::display_raw_solution() {
|
|
258
255
|
}
|
259
256
|
|
260
257
|
void Ipog::add_parameter(const std::string name, const int *terms,
|
261
|
-
|
258
|
+
const unsigned int terms_length) {
|
262
259
|
std::vector<int> tmp(terms, terms + terms_length);
|
263
260
|
std::pair<std::string, std::vector<int>> key_value(name, tmp);
|
264
261
|
int_params_.insert(key_value);
|
@@ -266,7 +263,7 @@ void Ipog::add_parameter(const std::string name, const int *terms,
|
|
266
263
|
}
|
267
264
|
|
268
265
|
void Ipog::add_parameter(const std::string name, const std::string *terms,
|
269
|
-
|
266
|
+
const unsigned int terms_length) {
|
270
267
|
std::vector<std::string> tmp(terms, terms + terms_length);
|
271
268
|
std::pair<std::string, std::vector<std::string>> key_value(name, tmp);
|
272
269
|
str_params_.insert(key_value);
|
@@ -288,7 +285,7 @@ void Ipog::init_param_cache() {
|
|
288
285
|
continue;
|
289
286
|
}
|
290
287
|
tmp.push_back(
|
291
|
-
|
288
|
+
std::make_tuple((*it).first, DITHER_INT_T, (*it).second.size()));
|
292
289
|
}
|
293
290
|
|
294
291
|
for (auto it = str_params_.cbegin(); it != str_params_.cend(); ++it) {
|
@@ -296,7 +293,7 @@ void Ipog::init_param_cache() {
|
|
296
293
|
continue;
|
297
294
|
}
|
298
295
|
tmp.push_back(
|
299
|
-
|
296
|
+
std::make_tuple((*it).first, DITHER_STRING_T, (*it).second.size()));
|
300
297
|
}
|
301
298
|
|
302
299
|
for (auto it = bool_params_.cbegin(); it != bool_params_.cend(); ++it) {
|
@@ -304,17 +301,18 @@ void Ipog::init_param_cache() {
|
|
304
301
|
continue;
|
305
302
|
}
|
306
303
|
tmp.push_back(
|
307
|
-
|
304
|
+
std::make_tuple((*it).first, DITHER_BOOL_T, (*it).second.size()));
|
308
305
|
}
|
309
306
|
|
310
307
|
std::sort(tmp.begin(), tmp.end(), [](std::tuple<std::string, int, int> a,
|
311
|
-
|
308
|
+
std::tuple<std::string, int, int> b) {
|
312
309
|
return std::get<2>(a) > std::get<2>(b);
|
313
310
|
});
|
314
311
|
|
315
312
|
std::unordered_map<std::string, int> original_name_to_index;
|
316
313
|
int count = 0;
|
317
|
-
for(auto it = ordered_param_names_.cbegin();
|
314
|
+
for (auto it = ordered_param_names_.cbegin();
|
315
|
+
it != ordered_param_names_.cend(); ++it, count++) {
|
318
316
|
original_name_to_index.insert({{*it, count}});
|
319
317
|
}
|
320
318
|
ordered_param_index_.resize(tmp.size());
|
@@ -328,7 +326,8 @@ void Ipog::init_param_cache() {
|
|
328
326
|
auto type = std::get<1>(*it);
|
329
327
|
reverse_param_index_.insert({{count, name}});
|
330
328
|
ordered_param_index_[count] = original_name_to_index.find(name)->second;
|
331
|
-
reverse_ordered_param_index_[original_name_to_index.find(name)->second] =
|
329
|
+
reverse_ordered_param_index_[original_name_to_index.find(name)->second] =
|
330
|
+
count;
|
332
331
|
|
333
332
|
for (dval i = 0; i < SCHAR_MAX && i < std::get<2>(*it); i++) {
|
334
333
|
param my_param;
|
@@ -344,26 +343,25 @@ void Ipog::init_param_cache() {
|
|
344
343
|
input_params_.push_back(dvals);
|
345
344
|
}
|
346
345
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
346
|
+
std::vector<dval> scratch(param_cache_.size());
|
347
|
+
for (auto it = original_previously_tested_.cbegin();
|
348
|
+
it != original_previously_tested_.cend(); ++it) {
|
349
|
+
for (std::size_t i = 0; i < scratch.size(); i++) {
|
350
|
+
scratch[reverse_ordered_param_index_[i]] = (*it)[i];
|
351
|
+
}
|
352
|
+
previously_tested_.push_back(scratch);
|
353
|
+
}
|
354
354
|
|
355
355
|
// transform constraints
|
356
|
-
for(std::size_t j = 0; j < constraints.size(); j++) {
|
357
|
-
for(std::size_t i = 0; i < scratch.size(); i++) {
|
356
|
+
for (std::size_t j = 0; j < constraints.size(); j++) {
|
357
|
+
for (std::size_t i = 0; i < scratch.size(); i++) {
|
358
358
|
scratch[reverse_ordered_param_index_[i]] = constraints[j][i];
|
359
359
|
}
|
360
360
|
std::copy(scratch.begin(), scratch.end(), constraints[j].begin());
|
361
361
|
}
|
362
362
|
}
|
363
363
|
|
364
|
-
int Ipog::size() {
|
365
|
-
return solution_size;
|
366
|
-
}
|
364
|
+
int Ipog::size() { return solution_size; }
|
367
365
|
|
368
366
|
std::string *Ipog::header() {
|
369
367
|
std::string *result = new std::string[param_cache_.size()];
|
@@ -373,39 +371,41 @@ std::string *Ipog::header() {
|
|
373
371
|
return result;
|
374
372
|
}
|
375
373
|
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
374
|
+
void Ipog::add_constraint(const int *constraint, const unsigned int length) {
|
375
|
+
std::vector<dval> tmp(length);
|
376
|
+
std::copy(constraint, constraint + length, tmp.begin());
|
377
|
+
for (auto it = tmp.cbegin(); it != tmp.cend(); ++it) {
|
378
|
+
if ((*it) > SCHAR_MAX) {
|
379
|
+
std::cerr << "WARNING: constraint value > " << SCHAR_MAX
|
380
|
+
<< " behavior undefined" << std::endl;
|
383
381
|
}
|
384
|
-
constraints.push_back(tmp);
|
385
382
|
}
|
383
|
+
constraints.push_back(tmp);
|
384
|
+
}
|
386
385
|
|
387
386
|
inline void Ipog::ground_solutions() {
|
388
|
-
|
387
|
+
std::size_t solution_count = 0;
|
389
388
|
std::vector<dval> transform_scratch(param_cache_.size(), 0);
|
390
389
|
|
391
390
|
auto prev = bound_.cbefore_begin();
|
392
391
|
auto next = bound_.begin();
|
393
392
|
auto end = bound_.cend();
|
394
393
|
while (next != end) {
|
395
|
-
if (constraint_handler->violate_constraints(*next) ||
|
394
|
+
if (constraint_handler->violate_constraints(*next) ||
|
395
|
+
has_previously_tested(*next)) {
|
396
396
|
next = bound_.erase_after(prev);
|
397
397
|
} else {
|
398
398
|
transform(transform_scratch, *next);
|
399
|
-
|
399
|
+
solution_count++;
|
400
400
|
++prev;
|
401
401
|
++next;
|
402
402
|
}
|
403
403
|
}
|
404
404
|
|
405
|
-
while(!unbound_.empty()) {
|
405
|
+
while (!unbound_.empty()) {
|
406
406
|
dtest_case first = unbound_.front();
|
407
|
-
if(constraint_handler->ground(first)) {
|
408
|
-
if(!has_previously_tested(first)) {
|
407
|
+
if (constraint_handler->ground(first)) {
|
408
|
+
if (!has_previously_tested(first)) {
|
409
409
|
transform(transform_scratch, first);
|
410
410
|
solution_count++;
|
411
411
|
bound_.push_front(first);
|
@@ -413,72 +413,77 @@ inline void Ipog::ground_solutions() {
|
|
413
413
|
}
|
414
414
|
unbound_.pop_front();
|
415
415
|
}
|
416
|
-
|
417
|
-
|
416
|
+
solution_size = solution_count;
|
417
|
+
}
|
418
418
|
|
419
419
|
void Ipog::fill(int *solution) {
|
420
420
|
std::size_t i = 0;
|
421
|
-
for(auto it = bound_.cbegin(); it != bound_.cend(); ++it) {
|
422
|
-
for(auto iit = (*it).cbegin(); iit != (*it).cend(); ++iit, i++) {
|
421
|
+
for (auto it = bound_.cbegin(); it != bound_.cend(); ++it) {
|
422
|
+
for (auto iit = (*it).cbegin(); iit != (*it).cend(); ++iit, i++) {
|
423
423
|
solution[i] = *iit;
|
424
424
|
}
|
425
425
|
}
|
426
426
|
}
|
427
427
|
|
428
428
|
void Ipog::add_previously_tested(const int values[], const std::size_t length) {
|
429
|
-
|
430
|
-
|
431
|
-
|
429
|
+
std::vector<dval> tmp(length);
|
430
|
+
std::copy(values, values + length, tmp.begin());
|
431
|
+
original_previously_tested_.push_back(tmp);
|
432
432
|
}
|
433
433
|
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
}
|
443
|
-
if(flag) {
|
444
|
-
return true;
|
434
|
+
inline bool Ipog::has_previously_tested(std::vector<param *> &test_case) {
|
435
|
+
for (auto it = previously_tested_.cbegin(); it != previously_tested_.cend();
|
436
|
+
++it) {
|
437
|
+
bool flag = true;
|
438
|
+
for (auto iit = test_case.cbegin(); iit != test_case.cend(); ++iit) {
|
439
|
+
if ((*it)[(*iit)->first] != (*iit)->second) {
|
440
|
+
flag = false;
|
441
|
+
break;
|
445
442
|
}
|
446
443
|
}
|
447
|
-
|
444
|
+
if (flag) {
|
445
|
+
return true;
|
446
|
+
}
|
448
447
|
}
|
448
|
+
return false;
|
449
|
+
}
|
449
450
|
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
}
|
460
|
-
if(flag) {
|
461
|
-
return true;
|
451
|
+
inline bool Ipog::has_previously_tested(param **params) {
|
452
|
+
for (auto it = previously_tested_.cbegin(); it != previously_tested_.cend();
|
453
|
+
++it) {
|
454
|
+
bool flag = true;
|
455
|
+
for (std::size_t i = 0; i < t_; i++) {
|
456
|
+
const param *iit = params[i];
|
457
|
+
if ((*it)[iit->first] != iit->second) {
|
458
|
+
flag = false;
|
459
|
+
break;
|
462
460
|
}
|
463
461
|
}
|
464
|
-
|
462
|
+
if (flag) {
|
463
|
+
return true;
|
464
|
+
}
|
465
465
|
}
|
466
|
+
return false;
|
467
|
+
}
|
466
468
|
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
469
|
+
inline bool Ipog::has_previously_tested(dtest_case &test_case) {
|
470
|
+
for (auto it = previously_tested_.cbegin(); it != previously_tested_.cend();
|
471
|
+
++it) {
|
472
|
+
if (std::equal(test_case.cbegin(), test_case.cend(), (*it).cbegin())) {
|
473
|
+
return true;
|
472
474
|
}
|
473
|
-
return false;
|
474
475
|
}
|
476
|
+
return false;
|
477
|
+
}
|
475
478
|
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
479
|
+
inline bool Ipog::has_previously_tested(const int k, dtest_case &test_case) {
|
480
|
+
for (auto it = previously_tested_.cbegin(); it != previously_tested_.cend();
|
481
|
+
++it) {
|
482
|
+
if (std::equal(test_case.cbegin(), test_case.cbegin() + k,
|
483
|
+
(*it).cbegin())) {
|
484
|
+
return true;
|
481
485
|
}
|
482
|
-
return false;
|
483
486
|
}
|
487
|
+
return false;
|
488
|
+
}
|
484
489
|
}
|
data/ext/dither/ipog.h
CHANGED
@@ -39,23 +39,24 @@ class Ipog {
|
|
39
39
|
std::unordered_map<std::string, int> param_index_;
|
40
40
|
std::unordered_map<int, std::string> reverse_param_index_;
|
41
41
|
dtest_case merge_scratch_;
|
42
|
-
BaseConstraintHandler*
|
42
|
+
BaseConstraintHandler *constraint_handler;
|
43
43
|
std::vector<std::vector<dval>> constraints;
|
44
44
|
std::vector<dval> ranges;
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
std::size_t solution_size;
|
46
|
+
std::vector<std::vector<dval>> original_previously_tested_;
|
47
|
+
std::vector<std::vector<dval>> previously_tested_;
|
48
48
|
|
49
|
-
inline void transform(std::vector<dval
|
50
|
-
|
49
|
+
inline void transform(std::vector<dval> &scratch,
|
50
|
+
std::vector<dval> &test_case) {
|
51
|
+
for (std::size_t i = 0; i < test_case.size(); i++) {
|
51
52
|
scratch[ordered_param_index_[i]] = test_case[i];
|
52
53
|
}
|
53
54
|
std::copy(scratch.cbegin(), scratch.cend(), test_case.begin());
|
54
55
|
}
|
55
56
|
|
56
|
-
inline bool has_previously_tested(std::vector<param
|
57
|
-
inline bool has_previously_tested(dtest_case&
|
58
|
-
inline bool has_previously_tested(const int, dtest_case&
|
57
|
+
inline bool has_previously_tested(std::vector<param *> &test_case);
|
58
|
+
inline bool has_previously_tested(dtest_case &test_case);
|
59
|
+
inline bool has_previously_tested(const int, dtest_case &test_case);
|
59
60
|
inline bool has_previously_tested(param **params);
|
60
61
|
|
61
62
|
public:
|
@@ -64,7 +65,8 @@ class Ipog {
|
|
64
65
|
Ipog(const unsigned int);
|
65
66
|
void set_t(const unsigned int t) { t_ = t; }
|
66
67
|
void add_parameter(const std::string, const int[], const unsigned int);
|
67
|
-
void add_parameter(const std::string, const std::string[],
|
68
|
+
void add_parameter(const std::string, const std::string[],
|
69
|
+
const unsigned int);
|
68
70
|
void add_parameter(const std::string);
|
69
71
|
void init_bound();
|
70
72
|
void init_param_cache();
|
@@ -73,18 +75,17 @@ class Ipog {
|
|
73
75
|
std::string *header();
|
74
76
|
inline void ground_solutions();
|
75
77
|
inline bool is_valid() { return t_ <= param_cache_.size(); }
|
76
|
-
inline param**
|
78
|
+
inline param **cover(int, std::forward_list<param **> &);
|
77
79
|
inline const int maximize_coverage(const int, dtest_case &,
|
78
|
-
|
80
|
+
std::forward_list<param **> &);
|
79
81
|
void add_constraint(const int[], const unsigned int);
|
80
|
-
|
82
|
+
void add_previously_tested(const int[], const std::size_t);
|
83
|
+
inline bool is_covered(const dtest_case &test_case, param **params);
|
84
|
+
inline bool is_covered(const param **params);
|
81
85
|
inline bool is_covered(const dtest_case &test_case,
|
82
|
-
param
|
83
|
-
inline bool is_covered(const param** params);
|
84
|
-
inline bool is_covered(const dtest_case &test_case,
|
85
|
-
const std::vector<param*> ¶ms);
|
86
|
+
const std::vector<param *> ¶ms);
|
86
87
|
inline bool is_covered(const std::vector<param> ¶ms);
|
87
|
-
inline const int merge(const int, dtest_case &, param**);
|
88
|
+
inline const int merge(const int, dtest_case &, param **);
|
88
89
|
void display_raw_solution();
|
89
90
|
void fill(int[]);
|
90
91
|
inline void display_header() {
|
@@ -107,7 +108,8 @@ class Ipog {
|
|
107
108
|
}
|
108
109
|
continue;
|
109
110
|
}
|
110
|
-
const param my_param =
|
111
|
+
const param my_param =
|
112
|
+
param_cache_[reverse_ordered_param_index_[i]][value];
|
111
113
|
switch (my_param.type) {
|
112
114
|
case DITHER_INT_T:
|
113
115
|
std::cout << int_params_[my_param.name][my_param.second];
|
@@ -127,7 +129,6 @@ class Ipog {
|
|
127
129
|
std::cout << std::endl;
|
128
130
|
}
|
129
131
|
};
|
130
|
-
|
131
132
|
}
|
132
133
|
|
133
134
|
#endif
|
@@ -12,106 +12,118 @@
|
|
12
12
|
|
13
13
|
namespace dither {
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
SimpleConstraintHandler::SimpleConstraintHandler(
|
16
|
+
std::vector<dval>& ranges, std::vector<std::vector<dval>>& pconstraints)
|
17
|
+
: params(ranges), scratch(ranges.size(), -1) {
|
18
|
+
for (auto it = pconstraints.cbegin(); it != pconstraints.cend(); ++it) {
|
19
|
+
std::vector<std::pair<std::size_t, dval>> constraint;
|
20
|
+
std::size_t i = 0;
|
21
|
+
for (auto iit = (*it).cbegin(); iit != (*it).cend(); ++iit, i++) {
|
22
|
+
if ((*iit) != -1) {
|
23
|
+
constraint.push_back(std::make_pair(i, *iit));
|
23
24
|
}
|
24
|
-
constraints.push_back(constraint);
|
25
25
|
}
|
26
|
-
|
26
|
+
constraints.push_back(constraint);
|
27
|
+
}
|
28
|
+
std::sort(constraints.begin(), constraints.end(),
|
29
|
+
[](const std::vector<std::pair<std::size_t, dval>>& a,
|
30
|
+
const std::vector<std::pair<std::size_t, dval>>& b) {
|
31
|
+
return a.size() < b.size();
|
32
|
+
});
|
33
|
+
}
|
34
|
+
|
35
|
+
bool SimpleConstraintHandler::violate_constraints(const dtest_case& test_case) {
|
36
|
+
if (violate_constraints_(test_case)) {
|
37
|
+
return true;
|
27
38
|
}
|
39
|
+
std::copy(test_case.cbegin(), test_case.cend(), scratch.begin());
|
40
|
+
return !ground(scratch);
|
41
|
+
}
|
28
42
|
|
29
|
-
|
30
|
-
|
43
|
+
inline bool SimpleConstraintHandler::violate_constraints_(
|
44
|
+
const dtest_case& test_case) {
|
45
|
+
for (auto constraint = constraints.cbegin(); constraint != constraints.cend();
|
46
|
+
++constraint) {
|
47
|
+
if (violate_constraint(test_case, *constraint)) {
|
31
48
|
return true;
|
32
49
|
}
|
33
|
-
std::copy(test_case.cbegin(), test_case.cend(), scratch.begin());
|
34
|
-
return !ground(scratch);
|
35
50
|
}
|
51
|
+
return false;
|
52
|
+
}
|
36
53
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
54
|
+
inline bool SimpleConstraintHandler::violate_constraint(
|
55
|
+
const dtest_case& test_case,
|
56
|
+
const std::vector<std::pair<std::size_t, dval>>& constraint) {
|
57
|
+
for (auto it = constraint.cbegin(); it != constraint.cend(); ++it) {
|
58
|
+
auto value = test_case[(*it).first];
|
59
|
+
if (value == -1 || value != (*it).second) {
|
60
|
+
return false;
|
42
61
|
}
|
43
|
-
return false;
|
44
62
|
}
|
63
|
+
return true;
|
64
|
+
}
|
45
65
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
66
|
+
bool SimpleConstraintHandler::violate_constraints(param** test_case,
|
67
|
+
const std::size_t length) {
|
68
|
+
std::fill(scratch.begin(), scratch.end(), -1);
|
69
|
+
for (std::size_t i = 0; i < length; i++) {
|
70
|
+
const param* p = test_case[i];
|
71
|
+
scratch[p->first] = p->second;
|
72
|
+
}
|
73
|
+
if (violate_constraints_(scratch)) {
|
53
74
|
return true;
|
54
75
|
}
|
76
|
+
return !ground(scratch);
|
77
|
+
}
|
55
78
|
|
56
|
-
|
57
|
-
std::
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
}
|
65
|
-
return !ground(scratch);
|
79
|
+
bool SimpleConstraintHandler::violate_constraints(
|
80
|
+
const std::vector<param*>& test_case) {
|
81
|
+
std::fill(scratch.begin(), scratch.end(), -1);
|
82
|
+
for (auto p : test_case) {
|
83
|
+
scratch[p->first] = p->second;
|
84
|
+
}
|
85
|
+
if (violate_constraints_(scratch)) {
|
86
|
+
return true;
|
66
87
|
}
|
88
|
+
return !ground(scratch);
|
89
|
+
}
|
67
90
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
91
|
+
bool SimpleConstraintHandler::ground(dtest_case& test_case) {
|
92
|
+
std::vector<std::size_t> indexes;
|
93
|
+
|
94
|
+
// find unbound indexes
|
95
|
+
std::size_t i = 0;
|
96
|
+
for (auto it = test_case.begin(); it != test_case.end(); ++it, i++) {
|
97
|
+
if ((*it) == -1) {
|
98
|
+
indexes.push_back(i);
|
75
99
|
}
|
76
|
-
return !ground(scratch);
|
77
100
|
}
|
101
|
+
std::vector<dval> bound_values(indexes.size(), -1);
|
102
|
+
i = 0;
|
78
103
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
indexes.push_back(i);
|
104
|
+
LOOP:
|
105
|
+
while (i < indexes.size()) {
|
106
|
+
const dval max = params[indexes[i]];
|
107
|
+
for (dval value = bound_values[i] + 1; value <= max; value++) {
|
108
|
+
test_case[indexes[i]] = value;
|
109
|
+
if (violate_constraints_(test_case)) {
|
110
|
+
continue;
|
87
111
|
}
|
112
|
+
bound_values[i] = value;
|
113
|
+
i++;
|
114
|
+
goto LOOP;
|
88
115
|
}
|
89
|
-
std::vector<dval> bound_values(indexes.size(), -1);
|
90
|
-
i = 0;
|
91
|
-
|
92
|
-
LOOP:while(i < indexes.size()) {
|
93
|
-
|
94
|
-
const dval max = params[indexes[i]];
|
95
|
-
for(dval value = bound_values[i] + 1; value <= max; value++) {
|
96
|
-
test_case[indexes[i]] = value;
|
97
|
-
if(violate_constraints_(test_case)) {
|
98
|
-
continue;
|
99
|
-
}
|
100
|
-
bound_values[i] = value;
|
101
|
-
i++;
|
102
|
-
goto LOOP;
|
103
|
-
}
|
104
|
-
|
105
|
-
if(i == 0) {
|
106
|
-
return false;
|
107
|
-
}
|
108
116
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
i--;
|
113
|
-
}
|
117
|
+
if (i == 0) {
|
118
|
+
return false;
|
119
|
+
}
|
114
120
|
|
115
|
-
|
121
|
+
// unwind
|
122
|
+
bound_values[i] = -1;
|
123
|
+
test_case[indexes[i]] = -1;
|
124
|
+
i--;
|
116
125
|
}
|
126
|
+
|
127
|
+
return true;
|
128
|
+
}
|
117
129
|
}
|
@@ -18,23 +18,25 @@
|
|
18
18
|
|
19
19
|
namespace dither {
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
21
|
+
class SimpleConstraintHandler : public BaseConstraintHandler {
|
22
|
+
protected:
|
23
|
+
std::vector<std::vector<std::pair<std::size_t, dval>>> constraints;
|
24
|
+
std::vector<dval> params;
|
25
|
+
std::vector<dval> scratch;
|
26
|
+
|
27
|
+
inline bool violate_constraint(
|
28
|
+
const dtest_case& test_case,
|
29
|
+
const std::vector<std::pair<std::size_t, dval>>& constraint);
|
30
|
+
inline bool violate_constraints_(const dtest_case& test_case);
|
31
|
+
|
32
|
+
public:
|
33
|
+
SimpleConstraintHandler(std::vector<dval>& ranges,
|
34
|
+
std::vector<std::vector<dval>>& pconstraints);
|
35
|
+
bool violate_constraints(const dtest_case& test_case);
|
36
|
+
bool violate_constraints(const std::vector<param*>& test_case);
|
37
|
+
bool violate_constraints(param** test_case, const std::size_t length);
|
38
|
+
bool ground(dtest_case& test_case);
|
39
|
+
};
|
37
40
|
}
|
38
41
|
|
39
42
|
#endif // SIMPLE_CONSTRAINT_HANDLER_H_
|
40
|
-
|
data/lib/dither/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Gowan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|