28 if (inactive <
opts.compactmin)
30 return inactive >= (1e-3 *
opts.compactlim) *
max_var;
81 const int res =
table[src];
94 const signed char tmp =
internal->val (src);
101 }
else if ((src) < 0)
133 v[2 * dst] = v[2 * src];
134 v[2 * dst + 1] = v[2 * src + 1];
145 const auto end = v.end ();
146 auto j = v.begin (), i = j;
147 for (; i != end; i++) {
157 v.resize (j - v.begin ());
164static signed char *ignore_clang_analyze_memory_leak_warning;
189 LOG (
"found first fixed %d",
192 LOG (
"no variable fixed");
196 LOG (
"temporarily reset internal assumptions");
200 const bool is_constraint = !
constraint.empty ();
203 LOG (
"temporarily reset internal constraint");
222 int64_t id1 =
external->ext_units[2 * eidx];
223 int64_t id2 =
external->ext_units[2 * eidx + 1];
228 external->ext_units[2 * eidx] = new_id1;
229 external->ext_units[2 * eidx + 1] = new_id2;
232 int dst = mapper.
map_lit (src);
233 LOG (
"compact %" PRId64
234 " maps external %d to internal %d from internal %d",
235 stats.compacts, eidx, dst, src);
243 const int dst = mapper.
map_idx (src);
245 const signed char tmp =
internal->val (src);
277 for (
const auto &c :
clauses) {
279 for (
auto &src : *c) {
293 w.blit = mapper.
map_lit (w.blit);
298 int prev = 0, mapped_prev = 0, next;
299 for (
int idx =
queue.first; idx; idx = next) {
300 next =
links[idx].next;
303 const int dst = mapper.
map_idx (idx);
308 links[prev].next = dst;
311 links[idx].prev = mapped_prev;
316 links[prev].next = 0;
361 for (
auto src :
vars) {
362 const int dst = abs (mapper.
map_lit (src));
381 for (
auto src :
vars) {
382 const int dst = abs (mapper.
map_lit (src));
398 if (!
external->assumptions.empty ()) {
400 for (
const auto &elit :
external->assumptions) {
403 int eidx = abs (elit);
412 PHASE (
"compact",
stats.compacts,
"reassumed %zd external assumptions",
419 signed char *new_vals =
new signed char[2 * mapper.
new_vsize];
420 ignore_clang_analyze_memory_leak_warning = new_vals;
422 for (
auto src :
vars)
424 for (
auto src :
vars)
437 for (
auto elit :
external->constraint) {
439 int eidx = abs (elit);
445 LOG (
"re adding lit external %d internal %d to constraint", elit,
450 "added %zd external literals to constraint",
484 while (!
scores.empty ()) {
485 const int src =
scores.front ();
487 const int dst = mapper.
map_idx (src);
492 saved.push_back (dst);
497 if (!saved.empty ()) {
498 for (
const auto idx : saved)
506 "reducing internal variables from %d to %d",
max_var,
513 size_t new_target_assigned = 0, new_best_assigned = 0;
517 new_target_assigned++;
523 new_target_assigned);
545 int64_t delta =
opts.compactint * (
stats.compacts + 1);
546 lim.compact =
stats.conflicts + delta;
549 "new compact limit %" PRId64
" after %" PRId64
" conflicts",
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define CADICAL_assert(ignore)
#define INIT_EMA(E, WINDOW)
void shrink_vector(std::vector< T > &v)
void clear_n(T *base, size_t n)
vector< unsigned > relevanttab
void garbage_collection()
vector< unsigned > frozentab
vector< int64_t > unit_clauses_idx
signed char val(int lit) const
vector< int > sweep_schedule
vector< int > assumptions
vector< Clause * > clauses
vector< signed char > marks
int64_t & unit_clauses(int uidx)
Watches & watches(int lit)
void map_flush_and_shrink_lits(vector< int > &v)
void map_vector(vector< T > &v)
signed char first_fixed_val
void map2_vector(vector< T > &v)