Go to the source code of this file.
◆ kissat_compact_literals()
| unsigned kissat_compact_literals |
( |
struct kissat * | solver, |
|
|
unsigned * | mfixed_ptr ) |
Definition at line 21 of file compact.c.
21 {
23#if !defined(KISSAT_QUIET) || !defined(KISSAT_NDEBUG)
24 const unsigned active =
solver->active;
25#ifndef KISSAT_QUIET
26 const unsigned inactive =
solver->vars - active;
28 "compacting garbage collection "
29 "(%u inactive variables %.2f%%)",
30 inactive, kissat_percent (inactive,
solver->vars));
31#endif
32#endif
33#ifdef LOGGING
36#endif
38 unsigned vars = 0;
42 continue;
43 const unsigned ilit =
LIT (iidx);
44 unsigned mlit;
49 mlit = mfixed =
LIT (vars);
50 LOG2 (
"first fixed %u mapped to %u assigned to %d", ilit, mfixed,
53 mfixed =
NOT (mfixed);
54 LOG2 (
"all other fixed mapped to %u", mfixed);
55 vars++;
56 }
else if (
value < 0) {
58 LOG2 (
"negatively fixed %u mapped to %u", ilit, mlit);
59 } else {
60 mlit = mfixed;
61 LOG2 (
"positively fixed %u mapped to %u", ilit, mlit);
62 }
66 LOG2 (
"remapping %u to %u", ilit, mlit);
67 vars++;
68 } else {
70 if (elit) {
71 const unsigned eidx =
ABS (elit);
72 import *import = &PEEK_STACK (solver->import, eidx);
75 import->imported = false;
76 LOG2 (
"external variable %d not imported anymore", eidx);
78 } else
79 LOG2 (
"skipping inactive %u", ilit);
80 continue;
81 }
84 if (mlit == ilit)
85 continue;
87 const unsigned eidx =
ABS (elit);
88 if (elit < 0)
90 reimport_literal (
solver, eidx, mlit);
91 }
92 *mfixed_ptr = mfixed;
93 LOG (
"compacting to %u variables %.2f%% from %u", vars,
96 return vars;
97}
#define POKE_STACK(S, N, E)
ABC_NAMESPACE_IMPL_START typedef signed char value
#define all_variables(IDX)
#define KISSAT_assert(ignore)
#define kissat_phase(...)
◆ kissat_finalize_compacting()
| void kissat_finalize_compacting |
( |
struct kissat * | solver, |
|
|
unsigned | vars, |
|
|
unsigned | mfixed ) |
Definition at line 322 of file compact.c.
323 {
324 LOG (
"finalizing compacting");
326#ifdef LOGGING
328#endif
329 if (vars ==
solver->vars) {
330#ifdef LOGGING
331 solver->compacting =
false;
332 LOG (
"number of variables does not change");
333#endif
334 return;
335 }
336
337 unsigned reduced =
solver->vars - vars;
338 LOG (
"compacted number of variables from %u to %u",
solver->vars, vars);
339
340 bool first = true;
344 first = false;
347 }
348
350
352 const unsigned ilit =
LIT (iidx);
353 const unsigned mlit = kissat_map_literal (
solver, ilit,
true);
355 compact_literal (
solver, mlit, ilit);
356 }
357
359 compact_units (
solver, mfixed);
360
365
370 compact_export (
solver, vars);
371 compact_best_and_target_values (
solver, vars);
372
374#ifdef LOGGING
375 solver->compacting =
false;
376#endif
378}
void kissat_decrease_size(kissat *solver)