20 const int64_t occslim =
opts.fastelimbound;
21 const int64_t clslim =
opts.fastelimocclim;
22 const int64_t
failed = occslim + 1;
32 if (c->
size > clslim) {
36 if (++res > occslim) {
44 os.resize (j - os.begin ());
73 int64_t neg = ns.
size ();
75 int64_t bound =
opts.fastelimbound;
80 const int64_t sum =
pos + neg;
81 const int64_t product =
pos * neg;
85 LOG (
"checking number resolvents on %d bounded by "
86 "%" PRId64
" = %" PRId64
" + %" PRId64
" + %d",
87 pivot, bound,
pos, neg,
opts.fastelimbound);
89 if (product <= bound) {
90 LOG (
"fast elimination occurrence limits sufficiently small enough");
99 int64_t resolvents = 0;
101 for (
const auto &c : ps) {
105 for (
const auto &d : ns) {
111 int size =
clause.size ();
113 LOG (
"now at least %" PRId64
114 " non-tautological resolvents on pivot %d",
116 if (size >
opts.fastelimclslim) {
117 LOG (
"resolvent size %d too big after %" PRId64
119 size, resolvents, pivot);
122 if (resolvents > bound) {
123 LOG (
"too many non-tautological resolvents on %d", pivot);
128 else if (
val (pivot))
133 LOG (
"need %" PRId64
" <= %" PRId64
" non-tautological resolvents",
149 LOG (
"adding all resolvents on %d", pivot);
157 int64_t resolvents = 0;
183 LOG (
"added %" PRId64
" resolvents to eliminate %d", resolvents, pivot);
191 bool &deleted_binary_clause) {
199 int64_t bound =
opts.fastelimbound;
203 LOG (
"too many occurrences thus not eliminated %d", pivot);
210 LOG (
"too many occurrences thus not eliminated %d", -pivot);
215 const int64_t product =
pos * neg;
216 const int64_t sum =
pos + neg;
225 LOG (
"pivot %d occurs positively %" PRId64
226 " times and negatively %" PRId64
" times",
232 LOG (
"trying to eliminate %d", pivot);
242 if (product <= bound ||
244 LOG (
"number of resolvents on %d are bounded", pivot);
248 deleted_binary_clause);
252 LOG (
"too many resolvents on %d so not eliminated", pivot);
269 bool &deleted_binary_clause) {
276 stats.elimfastrounds++;
280 int64_t resolution_limit;
282 if (
opts.elimlimited) {
283 int64_t delta =
stats.propagations.search;
284 delta *= 1e-3 *
opts.elimeffort;
285 if (delta <
opts.elimmineff)
286 delta =
opts.elimmineff;
287 if (delta >
opts.elimmaxeff)
288 delta =
opts.elimmaxeff;
289 delta = max (delta, (int64_t) 2l *
active ());
291 PHASE (
"fastelim-round",
stats.elimfastrounds,
292 "limit of %" PRId64
" resolutions", delta);
294 resolution_limit =
stats.elimres + delta;
296 PHASE (
"fastelim-round",
stats.elimfastrounds,
"resolutions unlimited");
297 resolution_limit = LONG_MAX;
306 for (
const auto &c :
clauses) {
307 if (c->garbage || c->redundant)
309 bool satisfied =
false, falsified =
false;
310 for (
const auto &
lit : *c) {
311 const signed char tmp =
val (
lit);
322 for (
const auto &
lit : *c) {
342 for (
auto idx :
vars) {
349 LOG (
"scheduling %d for elimination initially", idx);
356 int64_t scheduled = schedule.
size ();
359 PHASE (
"fastelim-round",
stats.elimfastrounds,
360 "scheduled %" PRId64
" variables %.0f%% for elimination",
366 if (!c->garbage && !c->redundant)
367 for (
const auto &
lit : *c)
372 const int64_t old_resolutions =
stats.elimres;
374 const int old_eliminated =
stats.all.eliminated;
375 const int old_fixed =
stats.all.fixed;
380 const int64_t garbage_limit = (2 *
stats.irrlits / 3) + (1 << 20);
390 stats.elimres <= resolution_limit && !schedule.
empty ()) {
391 int idx = schedule.
front ();
393 flags (idx).elim =
false;
398 if (
stats.garbage.literals <= garbage_limit)
408 completed = !schedule.
size ();
410 PHASE (
"fastelim-round",
stats.elimfastrounds,
411 "tried to eliminate %" PRId64
" variables %.0f%% (%zd remain)",
412 tried,
percent (tried, scheduled), schedule.
size ());
424 int eliminated =
stats.all.eliminated - old_eliminated;
425 stats.all.fasteliminated += eliminated;
427 int64_t resolutions =
stats.elimres - old_resolutions;
428 PHASE (
"fastelim-round",
stats.elimfastrounds,
429 "eliminated %d variables %.0f%% in %" PRId64
" resolutions",
430 eliminated,
percent (eliminated, scheduled), resolutions);
433 const int units =
stats.all.fixed - old_fixed;
434 report (
'e', !
opts.reportall && !(eliminated + units));
453 stats.elimfastphases++;
454 PHASE (
"fastelim-phase",
stats.elimfastphases,
455 "starting at most %d elimination rounds",
opts.fastelimrounds);
463 int old_active_variables =
active ();
464 int old_eliminated =
stats.all.eliminated;
480 bool phase_complete =
false, deleted_binary_clause =
false;
487 bool round_complete =
false;
494 if (!round_complete) {
496 "last round %d incomplete %s", round,
497 eliminated ?
"but successful" :
"and unsuccessful");
502 if (round++ >=
opts.fastelimrounds) {
503 PHASE (
"fastelim-phase",
stats.elimphases,
"round limit %d hit (%s)",
505 eliminated ?
"though last round successful"
506 :
"last round unsuccessful anyhow");
521 "no new variable elimination candidates");
524 phase_complete =
true;
527 for (
auto idx :
vars) {
529 flags (idx).elim =
true;
532 if (phase_complete) {
533 stats.elimcompleted++;
535 "fully completed elimination %" PRId64
536 " at elimination bound %" PRId64
"",
537 stats.elimcompleted,
lim.elimbound);
540 "incomplete elimination %" PRId64
541 " at elimination bound %" PRId64
"",
542 stats.elimcompleted + 1,
lim.elimbound);
545 if (deleted_binary_clause)
551 LOG (
"elimination derived empty clause");
553 LOG (
"elimination produced %zd units",
556 LOG (
"propagating units after elimination results in empty clause");
562 eliminated =
stats.all.eliminated - old_eliminated;
564 "eliminated %d variables %.2f%%", eliminated,
565 percent (eliminated, old_active_variables));
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define CADICAL_assert(ignore)
bool contains(unsigned e) const
void push_back(unsigned e)
heap< elim_more > ElimSchedule
Occs::iterator occs_iterator
void shrink_occs(Occs &os)
Occs::const_iterator const_occs_iterator
double percent(double a, double b)
#define START_SIMPLIFIER(S, M)
#define STOP_SIMPLIFIER(S, M)
void delete_garbage_clauses()
void elimfast_add_resolvents(Eliminator &, int pivot)
void try_to_fasteliminate_variable(Eliminator &, int pivot, bool &)
void elim_update_added_clause(Eliminator &, Clause *)
void garbage_collection()
void mark_garbage(Clause *)
vector< int64_t > lrat_chain
void report(char type, int verbose_level=0)
void mark_redundant_clauses_with_eliminated_variables_as_garbage()
bool terminated_asynchronously(int factor=1)
void learn_empty_clause()
void mark_eliminated(int)
bool resolve_clauses(Eliminator &, Clause *, int pivot, Clause *, bool)
void elim(bool update_limits=true)
signed char val(int lit) const
void unmark_gate_clauses(Eliminator &)
int64_t flush_elimfast_occs(int lit)
bool elimfast_resolvents_are_bounded(Eliminator &, int pivot)
int elimfast_round(bool &completed, bool &)
void backtrack(int target_level=0)
void elim_backward_clauses(Eliminator &)
vector< Clause * > clauses
void mark_eliminated_clauses_as_garbage(Eliminator &, int pivot, bool &)
Clause * new_resolved_irredundant_clause()
void connect_watches(bool irredundant_only=false)