22 std::vector<literal_occ> loccs ((std::size_t)
max_var + 1);
23 for (std::size_t
lit = 0;
lit < loccs.size (); ++
lit) {
28 for (
const auto &
lit : *c)
30 ++loccs[std::abs (
lit)];
31 std::sort (begin (loccs), end (loccs));
32 std::vector<int> locc_map;
34 for (
const auto &locc : loccs)
35 locc_map.push_back (locc.lit);
40 for (
auto lit : loccs)
55 for (
const auto &
lit : *c)
58 int64_t max_noccs = 0;
65 for (
int idx = 1; idx <=
max_var; idx++) {
79 MSG (
"maximum occurrence %" PRId64
" of literal %d", max_noccs, res);
103 for (
const auto &c :
clauses) {
111 const auto eop =
probes.end ();
113 for (
auto i = j; i != eop; i++) {
117 const bool have_pos_bin_occs =
noccs (
lit) > 0;
118 const bool have_neg_bin_occs =
noccs (-
lit) > 0;
119 if (have_pos_bin_occs == have_neg_bin_occs)
121 if (have_pos_bin_occs)
126 MSG (
"keeping probe %d negated occs %" PRId64
"",
lit,
noccs (-
lit));
129 size_t remain = j -
probes.begin ();
131 size_t flushed =
probes.size () - remain;
141 "flushed %zd literals %.0f%% remaining %zd", flushed,
142 percent (flushed, remain + flushed), remain);
154 for (
const auto &c :
clauses) {
162 for (
int idx = 1; idx <=
max_var; idx++) {
173 const bool have_pos_bin_occs =
noccs (idx) > 0;
174 const bool have_neg_bin_occs =
noccs (-idx) > 0;
178 if (have_pos_bin_occs) {
186 MSG (
"scheduling probe %d negated occs %" PRId64
"",
probe,
191 if (have_neg_bin_occs) {
199 MSG (
"scheduling probe %d negated occs %" PRId64
"",
probe,
211 "scheduled %zd literals %.0f%%",
probes.size (),
227 while (!
probes.empty ()) {
256 for (
size_t i = 0, j = 1; j <
cube.size (); ++i, ++j)
261 else if (
cube[i] == 0)
270 MSG (
"connected terminator forces termination");
275 MSG (
"termination forced");
295 MSG (
"lookahead-probe-round %" PRId64
296 " without propagations limit and %zu assumptions",
302 int old_failed =
stats.failed;
303 int64_t old_probed =
stats.probed;
305 int64_t old_hbrs =
stats.hbrs;
312 MSG (
"empty clause before probing");
339 for (
int idx = 1; idx <=
max_var; idx++)
351 MSG (
"unsat = %d, terminating_asked () = %d ",
unsat,
365 if (max_hbrs < hbrs ||
376 MSG (
"probing derived empty clause");
379 MSG (
"probing produced %zd units",
382 MSG (
"propagating units after probing results in empty clause");
391 int64_t probed =
stats.probed - old_probed;
393 int64_t hbrs =
stats.hbrs - old_hbrs;
395 MSG (
"lookahead-probe-round %" PRId64
" probed %" PRId64
396 " and found %d failed literals",
400 PHASE (
"lookahead-probe-round",
stats.probingrounds,
401 "found %" PRId64
" hyper binary resolvents", hbrs);
403 MSG (
"lookahead literal %d with %d\n", res, max_hbrs);
409 if (!
active () || depth == 0) {
412 cubes.
cubes.push_back (std::vector<int> ());
418 MSG (
"Generating cubes of depth %i", depth);
431 MSG (
"Solved during preprocessing");
440 MSG (
"generate cubes with %zu assumptions\n",
assumptions.size ());
444 std::vector<std::vector<int>> cubes{{
assumptions}};
446 LOG (
"loccs populated\n");
449 for (
int i = 0; i < depth; ++i) {
450 LOG (
"Probing at depth %i, currently %zu have been generated", i,
452 std::vector<std::vector<int>> cubes2{std::move (cubes)};
455 for (
size_t j = 0; j < cubes2.size (); ++j) {
459 for (
auto lit : cubes2[j])
466 LOG (
"current cube is unsat; skipping");
474 LOG (
"current cube is unsat; skipping");
480 LOG (
"no lit to split %i", res);
481 cubes.push_back (cubes2[j]);
486 LOG (
"splitting on lit %i", res);
487 std::vector<int> cube1{cubes2[j]};
488 cube1.push_back (res);
489 std::vector<int> cube2{std::move (cubes2[j])};
490 cube2.push_back (-res);
491 cubes.push_back (cube1);
492 cubes.push_back (cube2);
500 std::begin (cubes), std::end (cubes),
504 for (
auto lit : current_assumptions)
511 LOG (
"Solved during preprocessing");
519 rcubes.
cubes = cubes;
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define CADICAL_assert(ignore)
bool non_tautological_cube(std::vector< int > cube)
void shrink_vector(std::vector< T > &v)
double percent(double a, double b)
void rsort(I first, I last, Rank rank)
std::vector< std::vector< int > > cubes
void mark_duplicated_binary_clauses_as_garbage()
void lookahead_flush_probes()
bool is_binary_clause(Clause *c, int &, int &)
void clean_probehbr_lrat()
CubesWithStatus generate_cubes(int, int)
void learn_empty_clause()
int most_occurring_literal()
signed char val(int lit) const
std::vector< int > lookahead_populate_locc()
void failed_literal(int lit)
vector< int > assumptions
void backtrack(int target_level=0)
void init_probehbr_lrat()
void probe_assign_decision(int lit)
vector< Clause * > clauses
int solve(bool preprocess_only=false)
void lookahead_generate_probes()
int lookahead_next_probe()
int lookahead_locc(const std::vector< int > &)
volatile bool termination_forced
bool operator<(const literal_occ &locc) const
probe_negated_noccs_rank(Internal *i)
Type operator()(int a) const