22 LOG (
"learned empty clause");
23 external->check_learned_empty_clause ();
37 LOG (
"learned unit clause %d, stored at position %d",
lit,
vlit (
lit));
41 const unsigned uidx =
vlit (
lit);
65 LOG (
"moved to front variable %d and bumped to %" PRId64
"", idx,
80static inline bool evsids_limit_hit (
double score) {
92 for (
auto idx :
vars) {
93 const double tmp =
stab[idx];
97 PHASE (
"rescore",
stats.rescored,
"rescoring %d variable scores by 1/%g",
100 double factor = 1.0 / divider;
101 for (
auto idx :
vars)
105 "new score increment %g after %" PRId64
" conflicts",
score_inc,
112 double old_score =
score (idx);
114 double new_score = old_score +
score_inc;
115 if (evsids_limit_hit (new_score)) {
116 LOG (
"bumping %g score of %d hits EVSIDS score limit", old_score, idx);
118 old_score =
score (idx);
123 LOG (
"new %g score of %d", new_score, idx);
124 score (idx) = new_score;
125 if (
scores.contains (idx))
144 double f = 1e3 /
opts.scorefactor;
146 if (evsids_limit_hit (new_score_inc)) {
147 LOG (
"bumping %g increment by %g hits EVSIDS score limit",
score_inc,
153 LOG (
"bumped score increment from %g to %g with factor %g",
score_inc,
212 const int64_t stamp = ++
stats.recomputed;
213 for (
const auto &
lit : *c) {
236 if (new_glue < c->glue)
258 int &antecedent_size) {
286 LOG (
"%d unit after explanation", -
lit);
292 const unsigned uidx =
vlit (-
lit);
308 LOG (
"found new level %d contributing to conflict", v.
level);
314 LOG (
"analyzed literal %d assigned at level %d",
lit, v.
level);
321 int &antecedent_size) {
327 for (
const auto &other : *reason)
356 LOG (
"bumping also reason literal %d assigned at level %d",
lit, v.
level);
363 size_t analyzed_limit) {
374 for (
const auto &other : *reason) {
382 if (
analyzed.size () > analyzed_limit)
389 if (!
opts.bumpreason)
392 LOG (
"decisions per conflict rate %g > limit %d",
393 (
double)
averages.current.decisions,
opts.bumpreasonrate);
397 LOG (
"delaying reason bumping %" PRId64
" more times",
403 const int depth_limit =
opts.bumpreasondepth +
stable;
404 size_t saved_analyzed =
analyzed.size ();
405 size_t analyzed_limit = saved_analyzed *
opts.bumpreasonlimit;
407 if (
analyzed.size () <= analyzed_limit)
411 if (
analyzed.size () > analyzed_limit) {
412 LOG (
"not bumping reason side literals as limit exhausted");
413 for (
size_t i = saved_analyzed; i !=
analyzed.size (); i++) {
422 LOG (
"bumping reasons up to depth %d",
opts.bumpreasondepth);
425 LOG (
"delay internal %" PRId64,
delay[
stable].bumpreasons.interval);
446 LOG (
"clearing %zd analyzed literals",
analyzed.size ());
459 for (
auto idx :
vars) {
467 LOG (
"clearing %zd analyzed levels",
levels.size ());
468 for (
const auto &l :
levels)
486 uint64_t res = v.
level;
508 const size_t size =
clause.size ();
516 }
else if (size == 1) {
538 res->
used = 1 + (glue <=
opts.reducetier2glue);
541 LOG (
"jump level %d", jump);
559 }
else if (tmp > res) {
561 LOG (
"bt level is now %d due to %d", res,
lit);
580 int res = 0, count = 0;
590 }
else if (tmp == res) {
592 if (res ==
level && count > 1)
597 LOG (
"%d literals on actual conflict level %d", count, res);
604 for (
int i = 0; i < 2; i++) {
608 int highest_position = i;
609 int highest_literal =
lit;
610 int highest_level =
var (highest_literal).
level;
612 for (
int j = i + 1; j < size; j++) {
613 const int other =
lits[j];
615 if (highest_level >= tmp)
617 highest_literal = other;
618 highest_position = j;
620 if (highest_level == res)
626 if (highest_position == i)
629 if (highest_position > 1) {
635 lits[i] = highest_literal;
637 if (highest_position > 1)
660 LOG (
"chronological backtracking disabled using jump level %d", res);
661 }
else if (
opts.chronoalways) {
664 LOG (
"forced chronological backtracking to level %d", res);
665 }
else if (jump >=
level - 1) {
667 LOG (
"jump level identical to chronological backtrack level %d", res);
670 LOG (
"using jump level %d since it is lower than assumption level %zd",
672 }
else if (
level - jump >
opts.chronolevelim) {
675 LOG (
"back-jumping over %d > %d levels prohibited"
676 "thus backtracking chronologically to level %d",
678 }
else if (
opts.chronoreusetrail) {
679 int best_idx = 0, best_pos = 0;
683 const int idx = abs (
trail[i]);
689 LOG (
"best variable score %g",
score (best_idx));
692 const int idx = abs (
trail[i]);
698 LOG (
"best variable bumped %" PRId64
"",
bumped (best_idx));
701 LOG (
"best variable %d at trail position %d", best_idx, best_pos);
715 LOG (
"default non-chronological back-jumping to level %d", res);
718 LOG (
"chronological backtracking to level %d to reuse trail", res);
723 LOG (
"non-chronological back-jumping to level %d", res);
733 LOG (c,
"trying eager subsumption with");
736 const auto begin =
clauses.begin ();
739 int64_t before =
stats.eagersub;
741 while (it != begin &&
stats.eagertried++ <=
lim) {
749 int needed = c->
size;
750 for (
auto &
lit : *d) {
758 LOG (d,
"eager subsumed");
765 uint64_t subsumed =
stats.eagersub - before;
767 LOG (
"eagerly subsumed %" PRIu64
" clauses", subsumed);
776 LOG (new_conflict,
"applying OTFS on lit %d", uip);
777 auto sorted = std::vector<int> ();
778 sorted.reserve (new_conflict->
size);
780 ++
stats.otfs.strengthened;
785 const int other_init =
lits[0] ^
lits[1] ^ uip;
789 const int old_size = new_conflict->
size;
791 for (
int i = 0; i < old_size; ++i) {
792 const int other =
lits[i];
793 sorted.push_back (other);
795 lits[new_size++] = other;
798 LOG (new_conflict,
"removing all units in");
801 const int other =
lits[0] ^
lits[1] ^ uip;
804 LOG (new_conflict,
"putting uip at pos 1");
806 if (other_init != other)
818 for (
auto i = begin; i != end; i++) {
830 int highest_level = 0;
831 for (
int i = 1; i < new_size; i++) {
832 const unsigned other =
lits[i];
836 LOG (
"checking %d", other);
837 if (
level <= highest_level)
840 highest_level =
level;
842 LOG (
"highest lit is %d",
lits[highest_pos]);
843 if (highest_pos != 1)
845 LOG (
"removing %d literals", new_conflict->
size - new_size);
848 LOG (new_conflict,
"new size = 1, so interrupting");
857 if (other_init != other)
864 LOG (new_conflict,
"strengthened clause by OTFS");
875 LOG (subsumed,
"subsumed");
884 LOG (
"turning redundant subsuming clause into irredundant clause");
887 proof->strengthen (subsuming->
id);
889 stats.current.irredundant++;
890 stats.added.irredundant++;
893 stats.current.redundant--;
895 stats.added.redundant--;
904 const std::vector<int> &old) {
905 stats.strengthened++;
916 LOG (c,
"strengthened");
917 external->check_shrunken_clause (c);
928 int64_t current =
stats.decisions;
984 LOG (
"single highest level literal %d", forced);
1000 LOG (
"forcing %d", forced);
1026 external->export_learned_empty_clause ();
1047 LOG (reason,
"analyzing conflict");
1052 const auto &t = &
trail;
1056 int resolvent_size = 0;
1057 int antecedent_size = 1;
1058 int conflict_size = 0;
1060 const bool otfs =
opts.otfs;
1063 antecedent_size = 1;
1064 analyze_reason (uip, reason, open, resolvent_size, antecedent_size);
1066 conflict_size = antecedent_size - 1;
1069 if (otfs && resolved > 0 && antecedent_size > 2 &&
1070 resolvent_size < antecedent_size) {
1072 LOG (
analyzed,
"found candidate for OTFS conflict");
1073 LOG (
clause,
"found candidate for OTFS conflict");
1074 LOG (reason,
"found candidate (size %d) for OTFS resolvent",
1086 LOG (
"clause is actually unit %d, stopping", -uip);
1098 if (resolved == 1 && resolvent_size < conflict_size) {
1101 LOG (reason,
"changing conflict to");
1104 ++
stats.otfs.subsumed;
1108 LOG (reason,
"changing conflict to");
1117 LOG (
"forcing %d", forced);
1136 antecedent_size = 1;
1139 analyze_reason (0, reason, open, resolvent_size, antecedent_size);
1140 conflict_size = antecedent_size - 1;
1149 const int lit = (*t)[--i];
1164 LOG (reason,
"analyzing %d reason", uip);
1168 LOG (
"first UIP %d", uip);
1173 int size = (int)
clause.size ();
1174 const int glue = (int)
levels.size () - 1;
1175 LOG (
clause,
"1st UIP size %d and glue %d clause", size, glue);
1178 stats.learned.literals += size;
1179 stats.learned.clauses++;
1195 else if (
opts.minimize)
1198 size = (int)
clause.size ();
1210 external->export_learned_unit_clause (-uip);
1214 stats.units += (size == 1);
1215 stats.binaries += (size == 2);
1266 if (driving_clause &&
opts.eagersubsume)
1269 if (
lim.recompute_tier <=
stats.conflicts)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define CADICAL_assert(ignore)
#define UPDATE_AVERAGE(A, Y)
void remove_watch(Watches &ws, Clause *clause)
void update_watch_size(Watches &ws, int blit, Clause *conflict)
#define MSORT(LIMIT, FIRST, LAST, RANK, LESS)
void update_queue_unassigned(int idx)
void watch_literal(int lit, int blit, Clause *c)
void bump_also_all_reason_literals()
void mark_garbage(Clause *)
void build_chain_for_empty()
void rescale_variable_scores()
vector< int64_t > lrat_chain
void bump_clause(Clause *)
void bump_also_reason_literals(int lit, int depth_limit, size_t size_limit)
void report(char type, int verbose_level=0)
bool bump_also_reason_literal(int lit)
void bump_variable_score_inc()
Clause * new_learned_redundant_clause(int glue)
void mark_removed(int lit)
void promote_clause(Clause *, int new_glue)
void update_decision_rate_average()
Clause * on_the_fly_strengthen(Clause *conflict, int lit)
void learn_empty_clause()
void otfs_strengthen_clause(Clause *, int, int, const std::vector< int > &)
Clause * learn_external_reason_clause(int lit, int falsified_elit=0, bool no_backtrack=false)
vector< int64_t > conclusion
void eagerly_subsume_recently_learned_clauses(Clause *)
signed char val(int lit) const
signed char marked(int lit) const
int64_t unit_id(int lit) const
vector< int64_t > unit_chain
void otfs_subsume_clause(Clause *subsuming, Clause *subsumed)
void bump_variable(int lit)
vector< int > assumptions
void backtrack(int target_level=0)
void clear_analyzed_levels()
void clear_unit_analyzed_literals()
int recompute_glue(Clause *)
int find_conflict_level(int &forced)
unsigned vlit(int lit) const
void bump_clause2(Clause *)
vector< int > unit_analyzed
vector< Clause * > clauses
void clear_analyzed_literals()
void analyze_literal(int lit, int &open, int &resolvent_size, int &antecedent_size)
Clause * new_driving_clause(const int glue, int &jump)
int otfs_find_backtrack_level(int &forced)
void shrink_and_minimize_clause()
int64_t & unit_clauses(int uidx)
void bump_variable_score(int lit)
size_t shrink_clause(Clause *, int new_size)
void explain_external_propagations()
void learn_unit_clause(int lit)
bool external_prop_is_lazy
int64_t & bumped(int lit)
vector< int64_t > mini_chain
Watches & watches(int lit)
void analyze_reason(int lit, Clause *, int &open, int &resolvent_size, int &antecedent_size)
void search_assign_driving(int lit, Clause *reason)
int determine_actual_backtrack_level(int jump)
void build_chain_for_units(int lit, Clause *reason, bool forced)
struct CaDiCaL::Level::@023147271015376226021074167111310127126167046351 seen
analyze_bumped_rank(Internal *i)
Type operator()(const int &a) const
analyze_bumped_smaller(Internal *i)
bool operator()(const int &a, const int &b) const
bool operator()(const int &a, const int &b) const
analyze_trail_larger(Internal *s)
analyze_trail_negative_rank(Internal *s)