Skip to content

Commit 13784d8

Browse files
committed
When TD is <= 0 just forget about it
1 parent ff38b93 commit 13784d8

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/comp_analyzer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ void CompAnalyzer::calc_blocked(
246246
<< " avg blocked/lit: " << (double)blocked_tot/(double)(n*2-2) << " T: " << cpu_time()-start_time);
247247
verb_print(1, "cls with blocked lits: " << cls_blocked << " / " << long_irred_cls.size()
248248
<< " = " << (double)cls_blocked/(double)long_irred_cls.size()*100 << "%");
249-
250249
}
251250

252251
// Builds occ lists and sets things up, Done exactly ONCE for a whole counting runkk

src/counter.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ bool Counter::remove_duplicates(vector<Lit>& lits) {
134134
void Counter::compute_score(TWD::TreeDecomposition& tdec, uint32_t nodes, bool print) {
135135
const auto& bags = tdec.Bags();
136136
td_width = tdec.width();
137-
if (print || conf.verb >= 1) verb_print(0, "[td] Calculated TD width: " << td_width-1);
137+
if (td_width <= 0) {
138+
if (print) verb_print(1, "TD width is 0, ignoring TD");
139+
return;
140+
}
141+
if (print) verb_print(2, "[td] Calculated TD width: " << td_width-1);
138142
const auto& adj = tdec.get_adj_list();
139143
#if 0
140144
for(uint32_t i = 0; i < bags.size(); i++) {
@@ -150,14 +154,14 @@ void Counter::compute_score(TWD::TreeDecomposition& tdec, uint32_t nodes, bool p
150154
#endif
151155
std::vector<int> dists = tdec.distanceFromCentroid(nodes);
152156
if (dists.empty()) {
153-
verb_print(1, "All projected vars in the same bag, ignoring TD");
157+
if (print) verb_print(1, "All projected vars in the same bag, ignoring TD");
154158
return;
155159
} else {
156160
int max_dst = 0;
157161
for(int i=1; i < (int)nodes; i++)
158162
max_dst = std::max(max_dst, dists[i]);
159163
if (max_dst == 0) {
160-
verb_print(1, "All projected vars are the same distance, ignoring TD");
164+
if (print) verb_print(1, "All projected vars are the same distance, ignoring TD");
161165
return;
162166
}
163167
}
@@ -213,9 +217,8 @@ void Counter::compute_score(TWD::TreeDecomposition& tdec, uint32_t nodes, bool p
213217
tdscore[i] = val;
214218
}
215219

216-
for(uint32_t i = 1; i < nodes; i++) {
217-
verb_print(2, "TD var: " << i << " tdscore: " << tdscore[i]);
218-
}
220+
for(uint32_t i = 1; i < nodes; i++)
221+
verb_print(2, "TD var: " << i << " tdscore: " << tdscore[i]);
219222
}
220223

221224
TWD::TreeDecomposition Counter::td_decompose_component(double mult) {

0 commit comments

Comments
 (0)