Skip to content

Commit df54479

Browse files
committed
Cleanup
1 parent 8f42b45 commit df54479

File tree

2 files changed

+15
-25
lines changed

2 files changed

+15
-25
lines changed

src/counter.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,9 +1618,9 @@ RetState Counter::backtrack() {
16181618
do {
16191619
#ifdef VERBOSE_DEBUG
16201620
if (dec_level() > 0) {
1621-
debug_print("[backtrack] top count here: " << decisions.top().total_model_count()
1622-
<< " left: " << decisions.top().left_model_count()
1623-
<< " right: " << decisions.top().right_model_count()
1621+
debug_print("[backtrack] top count here: " << *decisions.top().total_model_count()
1622+
<< " left: " << *decisions.top().left_model_count()
1623+
<< " right: " << *decisions.top().right_model_count()
16241624
<< " is right: " << decisions.top().is_right_branch()
16251625
<< " dec lit: " << top_dec_lit()
16261626
<< " dec lev: " << dec_level());
@@ -1633,7 +1633,7 @@ RetState Counter::backtrack() {
16331633
<< dec_level()
16341634
<< " instead of backtracking." << " Num unprocessed comps: "
16351635
<< decisions.top().num_unproc_comps()
1636-
<< " so far the count: " << decisions.top().total_model_count());
1636+
<< " so far the count: " << *decisions.top().total_model_count());
16371637
return PROCESS_COMPONENT;
16381638
}
16391639

@@ -1722,11 +1722,11 @@ RetState Counter::backtrack() {
17221722
// NOTE: -1 here because we have JUST processed the child
17231723
// ->> (see below next_unproc_comp() call)
17241724
<< " num unprocessed comps here: " << dst.num_unproc_comps()-1
1725-
<< " current count here: " << dst.total_model_count()
1725+
<< " current count here: " << *dst.total_model_count()
17261726
<< " branch: " << dst.is_right_branch()
1727-
<< " before including child it was: " << parent_count_before
1728-
<< " (left: " << parent_count_before_left
1729-
<< " right: " << parent_count_before_right
1727+
<< " before including child it was: " << *parent_count_before
1728+
<< " (left: " << *parent_count_before_left
1729+
<< " right: " << *parent_count_before_right
17301730
<< ")");
17311731

17321732
dst.next_unproc_comp(); // step to the next comp not yet processed
@@ -3776,11 +3776,7 @@ void Counter::set_lit(const Lit lit, int32_t dec_lev, Antecedent ant) {
37763776
break;
37773777
}
37783778
debug_print("Var found in parent.");
3779-
if (i > dec_lev) {
3780-
FF tmp = fg->one();
3781-
*tmp /= *get_weight(lit);
3782-
decisions[i].include_solution_left_side(tmp);
3783-
}
3779+
if (i > dec_lev) decisions[i].div_solution_left_side(get_weight(lit));
37843780

37853781
bool in_children = false;
37863782
const auto& d = decisions.at(i);

src/stack.hpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class StackLevel {
167167
}
168168

169169
void include_solution(const FF& solutions) {
170-
VERBOSE_DEBUG_DO(cout << COLRED << "incl sol: " << solutions << COLDEF << " ");
170+
VERBOSE_DEBUG_DO(cout << COLRED << "incl sol: " << *solutions << COLDEF << " ");
171171
#ifdef VERBOSE_DEBUG
172172
auto before = fg->zero();
173173
if (branch_mc[act_branch]) before = branch_mc[act_branch]->dup();
@@ -191,8 +191,8 @@ class StackLevel {
191191
VERBOSE_DEBUG_DO(common_print(before));
192192
}
193193

194-
void include_solution_left_side(const FF& solutions) {
195-
VERBOSE_DEBUG_DO(cout << COLRED << "left side incl sol: " << solutions << COLDEF << " " << endl;);
194+
void div_solution_left_side(const FF& div_by) {
195+
VERBOSE_DEBUG_DO(cout << COLRED << "left side div sol: " << *div_by << COLDEF << " " << endl;);
196196
if (act_branch == 0) return;
197197
#ifdef VERBOSE_DEBUG
198198
auto before = fg->zero();
@@ -204,15 +204,9 @@ class StackLevel {
204204
return;
205205
}
206206

207-
if (solutions->is_zero()) {
208-
branch_unsat[0] = true;
209-
branch_mc[0] = nullptr;
210-
} else {
211-
if (!is_indep) branch_mc[0] = fg->one();
212-
else {
213-
assert(!is_zero(0));
214-
*branch_mc[0] *= *solutions;
215-
}
207+
if (is_indep) {
208+
assert(!is_zero(0));
209+
*branch_mc[0] /= *div_by;
216210
}
217211
VERBOSE_DEBUG_DO(cout << "now "
218212
<< ((0) ? "right" : "left")

0 commit comments

Comments
 (0)