Skip to content

Commit 54dd093

Browse files
committed
Fixing debug printing
1 parent 123aeed commit 54dd093

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/counter.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ bool Counter::compute_cube(Cube& c, const int side) {
14511451
cout << endl;
14521452
const auto& tmp = decisions.top().get_model_side(side);
14531453
FF side_count = fg->zero();
1454-
if (tmp != nullptr) *side_count2 = *tmp;
1454+
if (tmp != nullptr) side_count = tmp->dup();
14551455
cout << COLORG "cube's SOLE count: " << *tmp << endl;
14561456
cout << COLORG "cube's RECORDED count: " << c.cnt << COLDEF << endl;
14571457
#endif
@@ -1579,20 +1579,20 @@ FF Counter::check_count(const bool also_incl_curr_and_later_dec) {
15791579
if (!after_mul->is_zero()) after_mul = fg->one();
15801580
else after_mul = fg->zero();
15811581
}
1582-
debug_print("correct : " << std::setprecision(10) << cnt);
1583-
debug_print("after_mul: : " << after_mul);
1584-
debug_print("dec_w : " << dec_w);
1582+
debug_print("correct : " << std::setprecision(10) << *cnt);
1583+
debug_print("after_mul: : " << *after_mul);
1584+
debug_print("dec_w : " << *dec_w);
15851585
debug_print("active : " << (decisions.top().is_right_branch() ? "right" : "left"));
1586-
debug_print("ds.top().left_model_count() : " << decisions.top().left_model_count());
1587-
debug_print("ds.top().right_model_count() : " << decisions.top().right_model_count());
1586+
debug_print("ds.top().left_model_count() : " << *decisions.top().left_model_count());
1587+
debug_print("ds.top().right_model_count() : " << *decisions.top().right_model_count());
15881588

15891589
// It can be that a subcomponent above is UNSAT, in that case, it'd be UNSAT
15901590
// and the count cannot be checked
15911591
if (solution_exist) {
15921592
if (!weighted()) assert(*decisions.top().total_model_count() == *cnt);
15931593
else {
15941594
bool okay = true;
1595-
FF diff = after_mul->dup();
1595+
auto diff = after_mul->dup();
15961596
*diff-= *cnt;
15971597
if (!diff->is_zero()) {
15981598
auto diff_ratio = diff->dup();
@@ -1645,7 +1645,7 @@ RetState Counter::backtrack() {
16451645
const Lit lit = top_dec_lit();
16461646
assert(dec_level() > 0);
16471647
CHECK_COUNT_DO(check_count(true));
1648-
SLOW_DEBUG_DO(assert(decisions.top().right_model_count() == 0));
1648+
SLOW_DEBUG_DO(assert(decisions.top().right_model_count()->is_zero()));
16491649
// could be the flipped that's FALSEified so that would
16501650
// mean the watchlist is not "sane". We need to propagate the flipped var and
16511651
// then it'll be fine

src/stack.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ class StackLevel {
153153
void include_one_sol() {
154154
VERBOSE_DEBUG_DO(cout << COLRED << "incl sol: ONE" << COLDEF << " ");
155155
#ifdef VERBOSE_DEBUG
156-
auto before = branch_mc[act_branch];
156+
auto before = fg->zero();
157+
if (branch_mc[act_branch]) before = branch_mc[act_branch]->dup();
157158
#endif
158159
if (branch_unsat[act_branch]) {
159160
VERBOSE_DEBUG_DO(cout << "-> incl sol unsat branch, doing nothing." << endl);
@@ -168,7 +169,8 @@ class StackLevel {
168169
void include_solution(const FF& solutions) {
169170
VERBOSE_DEBUG_DO(cout << COLRED << "incl sol: " << solutions << COLDEF << " ");
170171
#ifdef VERBOSE_DEBUG
171-
auto before = branch_mc[act_branch];
172+
auto before = fg->zero();
173+
if (branch_mc[act_branch]) before = branch_mc[act_branch]->dup();
172174
#endif
173175
if (branch_unsat[act_branch]) {
174176
VERBOSE_DEBUG_DO(cout << "-> incl sol unsat branch, doing nothing." << endl);
@@ -193,7 +195,8 @@ class StackLevel {
193195
VERBOSE_DEBUG_DO(cout << COLRED << "left side incl sol: " << solutions << COLDEF << " " << endl;);
194196
if (act_branch == 0) return;
195197
#ifdef VERBOSE_DEBUG
196-
auto before = branch_mc[0];
198+
auto before = fg->zero();
199+
if (branch_mc[0]) before = branch_mc[0]->dup();
197200
#endif
198201
if (branch_unsat[0]) {
199202
VERBOSE_DEBUG_DO(cout << "-> left side incl sol unsat branch, doing nothing." << endl);

0 commit comments

Comments
 (0)