Skip to content

Commit 90a9456

Browse files
committed
Randomize lit to take
This means it will be more likely to be removed. When looking at another lit, another time.
1 parent 51741af commit 90a9456

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/comp_analyzer.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,6 @@ void CompAnalyzer::initialize(
277277
assert(cl.size() > 2);
278278
const uint32_t long_cl_off = long_clauses_data.size();
279279

280-
Lit example_blocking = NOT_A_LIT;
281-
auto& blk_lits = clid_to_blocking_lits[max_clid];
282-
if (!blk_lits.empty()) example_blocking = blk_lits[0];
283-
284280
if (cl.size() > 3) {
285281
Lit blk_lit = cl[cl.size()/2];
286282
for(const auto&l: cl) long_clauses_data.push_back(l);
@@ -291,7 +287,7 @@ void CompAnalyzer::initialize(
291287
ClData d;
292288
d.id = max_clid;
293289
d.blk_lit = blk_lit;
294-
d.example_blocking = example_blocking;
290+
d.example_blocking = NOT_A_LIT;
295291
d.off = long_cl_off;
296292
unif_occ_long[var].push_back(d);
297293
}
@@ -305,7 +301,7 @@ void CompAnalyzer::initialize(
305301
ClData d;
306302
d.id = max_clid;
307303
d.blk_lit = lits[0];
308-
d.example_blocking = example_blocking;
304+
d.example_blocking = NOT_A_LIT;
309305
d.off = lits[1].raw();
310306
unif_occ_long[l.var()].push_back(d);
311307
}
@@ -391,11 +387,17 @@ void CompAnalyzer::initialize(
391387
}
392388
}
393389

394-
// check longs
390+
// check longs & adjust blocking lits to random ones
395391
for(uint32_t v = 0; v < unif_occ_long.size(); v++) {
396392
assert(unif_occ_long[v].size() == holder.size_long(v));
397393
for(uint32_t i = 0; i < unif_occ_long[v].size(); i++) {
398394
assert(unif_occ_long[v][i] == holder.begin_long(v)[i]);
395+
auto& d = holder.begin_long(v)[i];
396+
auto& blk_lits = clid_to_blocking_lits[d.id];
397+
if (!blk_lits.empty()) {
398+
std::uniform_int_distribution<uint32_t> dist(0, blk_lits.size()-1);
399+
d.example_blocking = blk_lits[dist(mtrand)];
400+
}
399401
}
400402
}
401403
}

0 commit comments

Comments
 (0)