Skip to content

Commit a02096f

Browse files
committed
Stats now, working
1 parent c3e2177 commit a02096f

File tree

8 files changed

+21
-3
lines changed

8 files changed

+21
-3
lines changed

src/comp_analyzer.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,19 @@ bool CompAnalyzer::explore_comp(const uint32_t v, const uint32_t sup_comp_long_c
213213
return true;
214214
}
215215

216+
void CompAnalyzer::maybe_reset_var(const uint32_t v) {
217+
if (holder.tstamp(v) < counter->get_tstamp(holder.lev(v))) {
218+
/* holder.size_bin(v) = holder.orig_size_bin(v); */
219+
holder.size_long(v) = holder.orig_size_long(v);
220+
reset_comps++;
221+
}
222+
}
223+
216224
// Each variable knows the level it was visited at, and the stimestamp at the time
217225
// Each level knows the HIGHEST stamp it has been seen
218226
// When checking a var, we go to the level, see the stamp, if it's larger than the stamp of the var,
219227
// we need to reset the size
220-
228+
//
221229
// Create a component based on variable provided
222230
void CompAnalyzer::record_comp(const uint32_t var, const uint32_t sup_comp_long_cls, const uint32_t sup_comp_bin_cls) {
223231
SLOW_DEBUG_DO(assert(is_unknown(var)));

src/comp_analyzer.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ class CompAnalyzer {
176176
uint32_t get_bin_cls() const { return archetype.num_bin_cls; }
177177
uint32_t get_max_var() const { return max_var; }
178178
CompArchetype& get_archetype() { return archetype; }
179+
void maybe_reset_var(const uint32_t v);
179180

180181
private:
181182
// the id of the last clause

src/comp_management.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,13 @@ void CompManager::record_remaining_comps_for(StackLevel &top) {
101101
const Comp& super_comp = get_super_comp(top);
102102
const uint32_t new_comps_start_ofs = comp_stack.size();
103103

104-
if (counter->dec_level() >= 1 && !counter->check_any_new_sat(super_comp.get_trail_sz())) {
104+
if (conf.do_sat_cl_check && counter->dec_level() >= 1 && !counter->check_any_new_sat(super_comp.get_trail_sz())) {
105105
Comp *p_new_comp = copy_comp(&super_comp, counter);
106+
all_vars_in_comp(*p_new_comp, vt) ana.maybe_reset_var(*vt);
106107
deal_with_new_comp(top, super_comp, p_new_comp);
108+
stats.no_new_sat_cls++;
107109
} else {
110+
stats.new_sat_cls++;
108111
// This reinitializes archetype, sets up seen[] or all cls&vars unvisited (if unset), etc.
109112
// Sets all unknown vars in seen[] and sets all clauses in seen[] to unvisited
110113
// Also zeroes out frequency_scores. Sets num_long_cls and num_bin_cls to 0

src/counter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4280,6 +4280,6 @@ bool Counter::check_any_new_sat(uint32_t prev_trail) const {
42804280
if (!already_sat) return true;
42814281
}
42824282
}
4283-
cout << "returning FALSE from linkin_any_sat, prev trail:" << prev_trail << " trail now: " << trail.size() << endl;
4283+
/* cout << "returning FALSE from linkin_any_sat, prev trail:" << prev_trail << " trail now: " << trail.size() << endl; */
42844284
return false;
42854285
}

src/counter_config.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ struct CounterConfiguration {
4040
int max_num_rst = -1;
4141
uint32_t lbd_cutoff_always_keep_cube = 3;
4242
uint32_t max_num_cubes_per_restart = 6;
43+
int do_sat_cl_check = 1;
4344

4445
int cache_time_update = 2;
4546

src/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ void add_ganak_options()
133133
myopt("--appmct", conf.appmc_timeout, atof, "after K seconds");
134134
myopt("--epsilon", conf.appmc_epsilon, atof, "AppMC epsilon");
135135
myopt("--chronobt", conf.do_chronobt, atof, "ChronoBT. SAT must be DISABLED or this will fail");
136+
myopt("--satclcheck", conf.do_sat_cl_check, atoi, "If no SAT clauses since last time, copy component");
136137
//
137138
// Arjun options
138139
myopt("--arjun", do_arjun, atoi, "Use arjun");

src/statistics.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ void DataAndStatistics::print_short(const Counter* counter, const CompCache* cac
115115
<< setw(5) << comp_sorts/1000 << " / "
116116
<< setw(5) << std::setprecision(8) << safe_div(comp_sizes, comp_sorts))
117117
<< std::setprecision(2);
118+
verb_print(1, "comp not recompute due to sat " << no_new_sat_cls << " / " << new_sat_cls << " perc: "
119+
<< safe_div(no_new_sat_cls, (no_new_sat_cls+new_sat_cls)));
118120

119121
verb_print(1, "vivif: try/cls/clviv/litsravg "
120122
<< setw(9) << vivif_tried << " "

src/statistics.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ class DataAndStatistics {
125125
// Components
126126
uint64_t comp_sorts = 0;
127127
uint64_t comp_sizes = 0;
128+
uint64_t no_new_sat_cls = 0;
129+
uint64_t new_sat_cls = 0;
128130

129131
uint64_t num_cached_comps = 0;
130132
uint64_t total_num_cached_comps = 0;

0 commit comments

Comments
 (0)