1 | #include <stdio.h> |
---|
2 | #include <stdint.h> |
---|
3 | #include <zlib.h> |
---|
4 | |
---|
5 | #if defined(__GNUC__) |
---|
6 | # define DD_INLINE __inline__ |
---|
7 | # if (__GNUC__ >2 || __GNUC_MINOR__ >=7) |
---|
8 | # define DD_UNUSED __attribute__ ((__unused__)) |
---|
9 | # else |
---|
10 | # define DD_UNUSED |
---|
11 | # endif |
---|
12 | #else |
---|
13 | # if defined(__cplusplus) |
---|
14 | # define DD_INLINE inline |
---|
15 | # else |
---|
16 | # define DD_INLINE |
---|
17 | # endif |
---|
18 | # define DD_UNUSED |
---|
19 | #endif |
---|
20 | |
---|
21 | |
---|
22 | typedef struct satManagerStruct satManager_t; |
---|
23 | typedef struct satClauseStruct satClause_t; |
---|
24 | typedef struct satArrayStruct satArray_t; |
---|
25 | typedef struct satHeapStruct satHeap_t; |
---|
26 | typedef struct satSmtManagerStruct satSmtManager_t; /** sateen: smt manager **/ |
---|
27 | typedef struct satSmtVarStruct satSmtVar_t; /** sateen: smt variable **/ |
---|
28 | typedef struct satTernaryStruct satTernary_t; /** alembic: ternary structure **/ |
---|
29 | typedef struct satTrieStruct satTrie_t; /** alembic: trie structure **/ |
---|
30 | typedef struct satQueueStruct satQueue_t; /** varelim: queue structure **/ |
---|
31 | |
---|
32 | typedef struct satStackStruct satStack_t; /** standard stack structure **/ |
---|
33 | typedef struct satSCCStruct satSCC_t; /** SCC structure **/ |
---|
34 | |
---|
35 | #define SMT_ADD_THEORY |
---|
36 | #define OPTIMIZE_CLAUSE |
---|
37 | #define LUBY_RESTART |
---|
38 | |
---|
39 | struct satHeapStruct { |
---|
40 | long size; |
---|
41 | int (*compare)(void *, const void *, const void *); |
---|
42 | long *heap; |
---|
43 | long *indices; |
---|
44 | }; |
---|
45 | |
---|
46 | struct satArrayStruct { |
---|
47 | long total; |
---|
48 | long size; |
---|
49 | long space[0]; |
---|
50 | }; |
---|
51 | |
---|
52 | struct satQueueStruct { |
---|
53 | long max; /* max size of queue */ |
---|
54 | long size; /* The number of entries */ |
---|
55 | long first; /* The front index of entries */ |
---|
56 | long last; /* The last index of entries */ |
---|
57 | long elems[0]; /* The location to save entries */ |
---|
58 | }; |
---|
59 | |
---|
60 | struct satStackStruct { |
---|
61 | long max; /* max size of queue */ |
---|
62 | /*long size;*/ /* The number of entries */ |
---|
63 | long top; /* The top index of entries */ |
---|
64 | long elems[0]; /* The location to save entries */ |
---|
65 | }; |
---|
66 | |
---|
67 | struct satSCCStruct { |
---|
68 | unsigned idx; |
---|
69 | unsigned min; |
---|
70 | int done; |
---|
71 | }; |
---|
72 | |
---|
73 | struct satTernaryStruct { |
---|
74 | satTernary_t *lokid; /* lower child */ |
---|
75 | union { satTernary_t *eqkid[2]; /* equal child */ |
---|
76 | satClause_t *c; }eqleaf;/* pointer of a clause */ |
---|
77 | satTernary_t *hikid; /* higher child */ |
---|
78 | int valid; /* valid mark */ |
---|
79 | long id; /* node id */ |
---|
80 | }; |
---|
81 | |
---|
82 | struct satTrieStruct{ |
---|
83 | long id; /* node id or clause index */ |
---|
84 | long depth; /* depth in a tree */ |
---|
85 | satArray_t *child[2]; /* children */ |
---|
86 | satTrie_t *parent; /* parent */ |
---|
87 | int valid; /* valid mark */ |
---|
88 | }; |
---|
89 | |
---|
90 | |
---|
91 | struct satClauseStruct { |
---|
92 | long size; |
---|
93 | union { double activity; long abstract; } info; |
---|
94 | satArray_t *dependent; |
---|
95 | long lits[0]; |
---|
96 | }; |
---|
97 | |
---|
98 | struct satManagerStruct { |
---|
99 | long status; |
---|
100 | long nVars; |
---|
101 | long nClauses; |
---|
102 | satArray_t *clauses; /*array of satClause_t * */ |
---|
103 | satArray_t *learned; /*array of satClause_t * */ |
---|
104 | satArray_t *blocking; /*array of satClause_t * */ |
---|
105 | satArray_t *theory; /*array of satClause_t * */ |
---|
106 | satArray_t *deleted; /*array of satClause_t * */ |
---|
107 | satArray_t *shortClauses; /*array of satClause_t * */ |
---|
108 | satHeap_t *variableHeap; |
---|
109 | satArray_t *decisionStackSeperator; /* array of long */ |
---|
110 | satArray_t *previousDecisionHistory; /* array of long */ |
---|
111 | |
---|
112 | char *values; |
---|
113 | char *marks; |
---|
114 | char *visits; |
---|
115 | long *dominator; |
---|
116 | long *dominator2; |
---|
117 | char *dummy; |
---|
118 | char *equi; |
---|
119 | char *pure; |
---|
120 | char *bvars; /** HH: boolean variables marked by Sateen **/ |
---|
121 | satArray_t **wls; |
---|
122 | satClause_t **antes; |
---|
123 | |
---|
124 | |
---|
125 | long *levels; |
---|
126 | long *decisionStack; /* array of long */ |
---|
127 | long *maps; |
---|
128 | long curPos; /* first unimplicated variable */ |
---|
129 | long curBinPos; /* first unimplicated variable */ |
---|
130 | long stackPos; /* position of last assigned variable */ |
---|
131 | long nCurConflicts; |
---|
132 | long preLevelZeroStackPos; |
---|
133 | long polarityChangeLimit; |
---|
134 | |
---|
135 | char *removable; |
---|
136 | char *unremovable; |
---|
137 | int minimizeConflictLimit; |
---|
138 | double *activity; |
---|
139 | int minimizeAssert; |
---|
140 | int minimizeAssertLimit; |
---|
141 | int implydepth; |
---|
142 | long minimizeAssertTry; |
---|
143 | |
---|
144 | long nRestarts; |
---|
145 | double progress; |
---|
146 | |
---|
147 | double varDecay; |
---|
148 | double clauseDecay; |
---|
149 | double varInc; |
---|
150 | double clauseInc; |
---|
151 | double learnedSizeFactor; |
---|
152 | double learnedSizeInc; |
---|
153 | |
---|
154 | double restartFirst; |
---|
155 | #ifdef LUBY_RESTART |
---|
156 | long restartInc; |
---|
157 | #endif |
---|
158 | #ifndef LUBY_RESTART |
---|
159 | double restartInc; |
---|
160 | #endif |
---|
161 | long restartIndex; |
---|
162 | double randomSeed; |
---|
163 | double randomFrequency; |
---|
164 | |
---|
165 | long reduceClausesThresh; |
---|
166 | |
---|
167 | satArray_t *clearned; |
---|
168 | satArray_t *elearned; |
---|
169 | satArray_t *cclearned; |
---|
170 | satArray_t *redundant; |
---|
171 | satArray_t *tlearned; |
---|
172 | satArray_t *dependent; |
---|
173 | satArray_t *temp; |
---|
174 | satArray_t *tempUnitClauses; |
---|
175 | satArray_t *seen; |
---|
176 | satArray_t *subsumedClauseArray; |
---|
177 | satArray_t *mdominatorClause; |
---|
178 | |
---|
179 | double nStarts, nDecisions, nRandomDecisions; |
---|
180 | double nHistoryDecisions, nTHistoryDecisions; |
---|
181 | double nImplications, nConflicts; |
---|
182 | double nCurClauseLits, nCurLearnedLits; |
---|
183 | double nTotalClauseLits, nTotalLearnedLits; |
---|
184 | double nTotalLearnedClauses, nCurLearnedClauses; |
---|
185 | double preTotalLearnedCl, preTotalLearnedLit; |
---|
186 | double nCurBlockingClauses, nCurBlockingLits; |
---|
187 | double nTotalBlockingClauses, nTotalBlockingLits; |
---|
188 | double nSubsumedClauses, nSubsumedDeletedLiterals; |
---|
189 | int nSimplify; |
---|
190 | |
---|
191 | double preJumpCl; |
---|
192 | double nForceRestart; |
---|
193 | double nPolarityChange; |
---|
194 | |
---|
195 | long nReduceClauses; |
---|
196 | long nFirstUip; |
---|
197 | long simpDBAssigns; |
---|
198 | long simpDBProps; |
---|
199 | long n2LitClauses; |
---|
200 | long nJump; |
---|
201 | long nLevel; |
---|
202 | long bsAssigns; |
---|
203 | long nLearnedDom; |
---|
204 | long nLearnedMDom; |
---|
205 | |
---|
206 | double readTime; |
---|
207 | double solveTime; |
---|
208 | double preJump; |
---|
209 | double preLit; |
---|
210 | |
---|
211 | int enableFrequentRestart; |
---|
212 | int buildBridge; |
---|
213 | int useRandom; |
---|
214 | int defaultSign; |
---|
215 | int polarityMode; |
---|
216 | int changeDirection; |
---|
217 | int allSat; |
---|
218 | int coreGeneration; |
---|
219 | int includeLevelZero; |
---|
220 | int enableSimplify; |
---|
221 | int usePreviousDecisionHistory; |
---|
222 | int checkSubsumption; |
---|
223 | int printModel; |
---|
224 | int enableAddTheoryClause; /* Hyondeuk Kim */ |
---|
225 | int enableOptimizeClause; /* Hyondeuk Kim */ |
---|
226 | |
---|
227 | satClause_t *nullClause; |
---|
228 | |
---|
229 | void *SMTManager; /* sateen pointer */ |
---|
230 | satArray_t *explanation; /*array of int */ |
---|
231 | |
---|
232 | /** HHJ: Elements for Alembic/distillation **/ |
---|
233 | long tempInt; /* Temporary usage */ |
---|
234 | int verbosity; /* Verbose level */ |
---|
235 | char *cnfFileName; /* Name of cnf file */ |
---|
236 | FILE *LGF; /* Name of log file */ |
---|
237 | char *outfile; /* Name of output cnf file */ |
---|
238 | long *scores; /* Scores of literals */ |
---|
239 | long *clausesList; /* Clauses list of literals */ |
---|
240 | long *clausesLearnedList; /* Clauses learned list of literals */ |
---|
241 | satArray_t *candidates; /* candidates for simplification */ |
---|
242 | satTernary_t *ternary; /* Ternary root */ |
---|
243 | |
---|
244 | /** Options **/ |
---|
245 | char *simpCnf; /* Simplified CNF */ |
---|
246 | int substitute; /* turn on equivalent variables substitution */ |
---|
247 | int writeCnf; /* Writing simplified CNF */ |
---|
248 | int simplify; /* Simplification mode */ |
---|
249 | int eliminateVar; /* Variable elimination only mode */ |
---|
250 | int distill; /* Distillation mode */ |
---|
251 | int computeSCC; /* Computation of strongly connected component */ |
---|
252 | int nIteratePreprocess; /* N interations of preprocessing */ |
---|
253 | int subsumeInConflict; /* Subsumption check in conflict analysis */ |
---|
254 | int minimizeConflict; /* Conflict clause minimization */ |
---|
255 | int writeSimplifiedCNF; /* Exit after writing a simplified CNF file */ |
---|
256 | int periodicDistill; /* Periodic distillation */ |
---|
257 | int writeStatistics; /* Write a statistics file */ |
---|
258 | int limitDistill; |
---|
259 | long distillMin; /* Minimum length of clause to distill */ |
---|
260 | long distillMax; /* Maximum length of clause to distill */ |
---|
261 | long preLearnedPos; /* Index of the array of new conflicts */ |
---|
262 | |
---|
263 | double distillInc; /* Periode of distillation */ |
---|
264 | |
---|
265 | double reductionWithDistill; /* Threshold for periodic distillation */ |
---|
266 | long boundPeriodicDistill; /* Value to bound periodic distillation */ |
---|
267 | long nRejectDistill; /* The number of rejects to distill */ |
---|
268 | double distillTime; /* Time spent for distillations */ |
---|
269 | double elimTime; /* Time spent for eliminations */ |
---|
270 | double nImplicationsInDistill; /* The number of implications in distillation */ |
---|
271 | |
---|
272 | long nTernaryNodes; /* The number of built trie node */ |
---|
273 | long nVisitedTernaryNodes; /* The number of visited tries nodes */ |
---|
274 | long nInClForDistill; /* The number of input clauses for distillation */ |
---|
275 | long nInLitForDistill; /* The number of input literals for distillation */ |
---|
276 | long nInLearnedClForDistill; /* The number of input learned clauses for distillation */ |
---|
277 | long nInLearnedLitForDistill; /* The number of input learned literals for distillation */ |
---|
278 | long nOutClForDistill; /* The number of output clauses for distillation */ |
---|
279 | long nOutLitForDistill; /* The number of output literals for distillation */ |
---|
280 | long nOutLearnedClForDistill; /* The number of output learned clauses for distillation */ |
---|
281 | long nOutLearnedLitForDistill; /* The number of output learned literals for distillation */ |
---|
282 | long nDeletedVar; /* The number of delete variables */ |
---|
283 | long nOldLearnedInDistill; /* The number of old conflicts in distillation */ |
---|
284 | long nLearnedInDistill; /* The number of conflicts in distillation */ |
---|
285 | long nResolvedInDistill; /* The number of resolvents in distillation */ |
---|
286 | long nDistill; /* The number of distillation */ |
---|
287 | long nSATCl; /* The number of clauses satisfied */ |
---|
288 | long nLearnedClInDistill; /* The number of learned clauses in distillation */ |
---|
289 | long nLearnedLitInDistill; /* The number of learned literals in distillation */ |
---|
290 | long nLearnedUnitClInDistill; /* The number of learned unit clauses in distillation */ |
---|
291 | long nUIPConflictClauses; |
---|
292 | long nUIPConflictLits; |
---|
293 | |
---|
294 | /** HH : On-the-fly clause improvement **/ |
---|
295 | long nExtraSubsumes; |
---|
296 | long depthOfConflict; |
---|
297 | long depthOfStrong; |
---|
298 | long depthOfOTS; |
---|
299 | long nDistillInConflict; /* The number of subsumptions with OCI */ |
---|
300 | long nEliminatedClsInConflict; /* The number of clauses eliminated in OCI */ |
---|
301 | long nEliminatedLitsInConflict; /* The number of literals eliminated in OCI */ |
---|
302 | long nOmittedConflictClauses; /* The number of omitted conflict clauses */ |
---|
303 | long nOmittedConflictLits; /* The number of omitted conflict literals */ |
---|
304 | |
---|
305 | long nAuxLearnedClauses; /* The number of auxilary learned clauses */ |
---|
306 | long nAuxLearnedLits; /* The number of auxilary learned literals */ |
---|
307 | long nAuxConflictAnalysis; /* The number of auxilary conflict analysis */ |
---|
308 | |
---|
309 | /** HHJ : Variable Elimination **/ |
---|
310 | satHeap_t *varElimHeap; /* Heap for variable elimination */ |
---|
311 | satQueue_t *satQueue; /* Queue for sat */ |
---|
312 | satStack_t *satStack; /* Stack for sat */ |
---|
313 | satArray_t *resolvents; /* Literal pool of resolvent created by variable elimination */ |
---|
314 | satArray_t *elimtable; /* Array of the elimtable variables */ |
---|
315 | char *litMarks; /* Array of the marks of the literals */ |
---|
316 | long majorityClauseLength; /* Majority clause length */ |
---|
317 | long minorityClauseLength; /* Non majority clause length */ |
---|
318 | long *clausesHistogram; /* Statistics of clause sizes */ |
---|
319 | long grow; /* Bound of the number of clauses increases */ |
---|
320 | long nInputVars; |
---|
321 | long nInputClauses; |
---|
322 | long nInputLiterals; |
---|
323 | long nEquiVars; /* The number of variables in equivalent relation */ |
---|
324 | long nVarElimTry; /* The number of variables check in elimination */ |
---|
325 | long nVarElimReject; /* The number of variables declined in elimination */ |
---|
326 | long nSubsumeTry; /* The number of calls of backward subsumption */ |
---|
327 | long nLits; /* The number of original literals */ |
---|
328 | long nResolvents; /* The number of resolvents generated */ |
---|
329 | long nResolventLits; /* The number of resolvent literals */ |
---|
330 | long nEliminatedCls; /* The number of eliminated original clauses */ |
---|
331 | long nEliminatedLits; /* The number of eliminated literals */ |
---|
332 | long nEliminatedVars; /* The number of eliminated variables */ |
---|
333 | long nSelfsubsume; /* The number of selfsubsumptions in resolution */ |
---|
334 | long nBackwardSelfsubsume; /* The number of selfsubsumptions in backward check */ |
---|
335 | long nLitStrengthened; /* The number of literals removed by slefsubsumption */ |
---|
336 | long nNewUnitLits; /* The number of unit literals generated */ |
---|
337 | long nDuplicates; /* The number of duplicate literals by substitution */ |
---|
338 | long nNewTautologies; /* The number of additional tautology cases by substitution */ |
---|
339 | |
---|
340 | int conflictLevels[5]; |
---|
341 | int *mcla; |
---|
342 | int mclaSize; |
---|
343 | int mclaTotal; |
---|
344 | int maxContiguousLevel; |
---|
345 | int maxContiguousLevelTotal; |
---|
346 | int maxContiguousLevelCount; |
---|
347 | int maxContiguousLimit; |
---|
348 | double preThickTail; |
---|
349 | int maxContiguousDataCollect; |
---|
350 | int maxContiguousData[6]; |
---|
351 | int nStrongConflictClauses; |
---|
352 | int nSupplementalConflictClauses; |
---|
353 | |
---|
354 | /** HH: Dominator based learning **/ |
---|
355 | #ifdef HH_BINARY |
---|
356 | long *binWls; /** HH: the number of binary clauses in each watched literal list **/ |
---|
357 | #endif |
---|
358 | long nBinImplications; /** HH: the number of binary implications **/ |
---|
359 | long nDomSubsumes; /** HH: the number of subsuming dominator clauses **/ |
---|
360 | long nDomStrengthened; /** HH: the number of subsuming dominator clauses **/ |
---|
361 | long nMDomStrengthened; /** HH: the number of subsuming multiple dominator clauses **/ |
---|
362 | long nDomEliminated; /** HH: the number of eliminated dominator |
---|
363 | clauses **/ |
---|
364 | long nMergeUnit; /** HH: the number of unit clauses by merging |
---|
365 | two literal clauses **/ |
---|
366 | long simplimit; /** HH: limit of simplification **/ |
---|
367 | |
---|
368 | |
---|
369 | long nCurImps; /** HH: the number of implications at the current level **/ |
---|
370 | long nPerSimVars; |
---|
371 | long nPerSimCls; |
---|
372 | long nPerSimLearnd; |
---|
373 | long nPerSimLits; |
---|
374 | long nPerSimLearnedLits; |
---|
375 | long nPerSim; |
---|
376 | |
---|
377 | long *repr; |
---|
378 | long equiv; |
---|
379 | long mergedv; |
---|
380 | long nSCCs; |
---|
381 | long nMerged; |
---|
382 | long nDuplicateLits; |
---|
383 | }; |
---|
384 | |
---|
385 | /** HHJ : The number of flag bits of clause |
---|
386 | * has been changed from 4. |
---|
387 | **/ |
---|
388 | #define SATCsizeShift 5 |
---|
389 | #define SATCLearned 1 |
---|
390 | #define SATCBlocking 2 |
---|
391 | #define SATCTheory 4 |
---|
392 | #define SATCVisited 8 |
---|
393 | #define SATCIrredundant 16 |
---|
394 | #define SATCMask 31 |
---|
395 | #define SATCTypeMask 7 |
---|
396 | #define SATSizeClause(c) (c->size >> SATCsizeShift) |
---|
397 | #define SATVar(l) (l >> 1) |
---|
398 | #define SATSign(l) (l & 1) |
---|
399 | #define SATValue(m, l) ((m->values(SATVar(l))) ^ SATsign(l)) |
---|
400 | #define SATCurLevel(m) (m->decisionStackSeperator->size) |
---|
401 | #define SATClauseLearned(c) (c->size & 1) |
---|
402 | #define SATClauseBlock(c) (c->size & 2) |
---|
403 | |
---|
404 | /** HHJ : New macros **/ |
---|
405 | #define SATClauseOriginal(c) ((c->size & 15) == 0) |
---|
406 | #define SATClauseIrredundant(c) (c->size & SATCIrredundant) |
---|
407 | #define SATClauseVisited(c) (c->size & SATCVisited) |
---|
408 | /*---------------------------------------------------------------------------*/ |
---|
409 | /* Constant declarations */ |
---|
410 | /*---------------------------------------------------------------------------*/ |
---|
411 | #ifndef CUR_DATE |
---|
412 | #define CUR_DATE "<compile date not supplied>" |
---|
413 | #endif |
---|
414 | |
---|
415 | #ifndef CUR_VER |
---|
416 | #define CUR_VER "U of Colorado/Boulder, CirCUs Release 2.0" |
---|
417 | #endif |
---|
418 | |
---|
419 | |
---|
420 | void TimeOutHandle(void); |
---|
421 | void MemOutHandle(void); |
---|
422 | char * DateReadFromDateString( char * datestr); |
---|
423 | long sat_mem_used(int field); |
---|
424 | |
---|
425 | satArray_t *sat_array_alloc(long num); |
---|
426 | satArray_t *sat_array_insert(satArray_t *arr, long datum); |
---|
427 | satArray_t *sat_array_alloc_insert(satArray_t *arr, long datum); |
---|
428 | satArray_t *sat_array_copy(satArray_t *arr1, satArray_t *arr2); |
---|
429 | satArray_t *sat_array_realloc(satArray_t *arr, long size); |
---|
430 | satQueue_t *sat_queue_alloc(long num); |
---|
431 | |
---|
432 | int sat_main(char * filename, int timeout, satArray_t* options); |
---|
433 | |
---|
434 | int sat_read_cnf(satManager_t *m, char *filename); |
---|
435 | satHeap_t *sat_heap_init(satManager_t *m, int (*compare_heap)(void *, const void *, const void *)); |
---|
436 | void sat_heap_free(satHeap_t *h); |
---|
437 | void sat_heap_insert(satManager_t *m, satHeap_t *h, long n); |
---|
438 | void sat_heap_remove_var_assigned_level_zero(satManager_t *m, satHeap_t *h); |
---|
439 | long sat_heap_remove_min(satManager_t *m, satHeap_t *h); |
---|
440 | int sat_heap_check(satManager_t *m, satHeap_t *h, long i); |
---|
441 | void sat_heap_update(satManager_t *m, satHeap_t *h, long n); |
---|
442 | void sat_heap_resize(satManager_t *m, satHeap_t *h, long prenVars); |
---|
443 | int compare_sort_learned(const void *x1, const void *y1); |
---|
444 | int compare_sort_variable_id(const void *x1, const void *y1); |
---|
445 | int compare_sort_learned(const void *x1, const void *y1); |
---|
446 | int compare_sort_theory(const void *x1, const void *y1); |
---|
447 | int compare_sort_block(const void *x1, const void *y1); |
---|
448 | void sat_generate_next_restart_bound(satManager_t *m); |
---|
449 | void sat_print_clause_array(satManager_t *m, satArray_t *learned); |
---|
450 | void sat_decide_polarity_new(satManager_t *m); |
---|
451 | void sat_reduce_blocking_clauses(satManager_t *m); |
---|
452 | int sat_compare_activity(void *activity, const void *x, const void *y); |
---|
453 | int sat_print_unsat_core(satManager_t *m, char *cnfFilename); |
---|
454 | void sat_print_assignment(satManager_t *m); |
---|
455 | |
---|
456 | satArray_t *sat_optimize_clause_with_implication_graph(satManager_t *m, satArray_t *clearned); |
---|
457 | void sat_array_delete_elem(satArray_t *arr, long elem); |
---|
458 | void sat_enqueue_check(satManager_t *m, long lit, satClause_t *ante); |
---|
459 | void sat_circus_solve(satManager_t *m); |
---|
460 | void sat_dpll(satManager_t *m, long nConflicts); |
---|
461 | int sat_backward_subsumption_check(satManager_t *m); |
---|
462 | void sat_enqueue(satManager_t *m, long lit, satClause_t *ante); |
---|
463 | void sat_add_watched_literal(satManager_t *m, satClause_t *c); |
---|
464 | void sat_delete_watched_literal(satManager_t *m, satClause_t *c); |
---|
465 | void sat_delete_clause(satManager_t *m, satClause_t *c); |
---|
466 | void sat_simplify(satManager_t *m); |
---|
467 | void sat_undo(satManager_t *m, long level); |
---|
468 | void sat_reduce_learned_clauses(satManager_t *m); |
---|
469 | void sat_update_clause_activity(satManager_t *m, satClause_t *c); |
---|
470 | void sat_update_variable_activity(satManager_t *m, long v); |
---|
471 | void sat_update_clause_decay(satManager_t *m); |
---|
472 | void sat_update_variable_decay(satManager_t *m); |
---|
473 | void sat_print_literal(satManager_t *m, long lit, FILE *fp); |
---|
474 | void sat_print_clause(satManager_t *m, satClause_t *c); |
---|
475 | void sat_verify(satManager_t *m); |
---|
476 | int sat_verify_original_cnf(satManager_t *m, char *filename); |
---|
477 | void sat_remove_satisfied_clauses(satManager_t *m, satArray_t *arr); |
---|
478 | void sat_report_result(satManager_t *m); |
---|
479 | void sat_free_manager(satManager_t *m); |
---|
480 | void sat_conflict_analysis_for_literal(satManager_t *m, long tLit); |
---|
481 | void sat_conflict_analysis_strong(satManager_t *m, satClause_t *conflicting, long sLimit, long implLimit); |
---|
482 | void sat_conflict_analysis_supplemental(satManager_t *m, satClause_t *conflicting, long refV, long sLimit); |
---|
483 | long sat_conflict_analysis_empowerment(satManager_t *m, satClause_t *conflicting, long rLevel); |
---|
484 | void sat_init_variable_activity(satManager_t *m, satClause_t *c); |
---|
485 | void sat_check_equivalent_relation(satManager_t *m); |
---|
486 | void sat_print_dot_for_implication_graph( satManager_t *m, satClause_t *c, long level, int iAllLevel); |
---|
487 | void sat_print_clause_simple(satManager_t *m, satClause_t *c); |
---|
488 | void sat_print_clauses(satManager_t *m, satArray_t *learned); |
---|
489 | void sat_print_cnf(satManager_t *m, long iter); |
---|
490 | void sat_clean_up_equi_job(satManager_t *m, satArray_t *save0); |
---|
491 | void sat_update_equivalent_class(satManager_t *m, satArray_t *arr, long leanred); |
---|
492 | void sat_decide_polarity(satManager_t *m); |
---|
493 | |
---|
494 | |
---|
495 | satClause_t *sat_implication(satManager_t *m); |
---|
496 | satClause_t *sat_add_clause(satManager_t *m, satArray_t *arr, long learned); |
---|
497 | satClause_t *sat_add_clause_only(satManager_t *m, satArray_t *arr, long learned); |
---|
498 | satClause_t *sat_new_clause(satArray_t *arr, long learned); |
---|
499 | satClause_t *sat_check_equivalent_relation_aux(satManager_t *m); |
---|
500 | |
---|
501 | long sat_get_mapped_index(satManager_t *m, long index); |
---|
502 | long sat_abstract_level(satManager_t *m, long v); |
---|
503 | long sat_make_decision(satManager_t *m); |
---|
504 | long sat_conflict_analysis(satManager_t *m, satClause_t *conflicting); |
---|
505 | void sat_estimate_progress(satManager_t *m); |
---|
506 | void sat_print_cnf_less_than(FILE *fp, satArray_t *arr, long limit); |
---|
507 | void sat_print_implication_graph(satManager_t *m, long level); |
---|
508 | void sat_print_database(satManager_t *m); |
---|
509 | void sat_print_variables(satManager_t *m); |
---|
510 | int sat_read_cnf(satManager_t *m, char *filename); |
---|
511 | void sat_create_database(satManager_t *m); |
---|
512 | int sat_check_complementary(int depth, int nLits, double avg); |
---|
513 | void sat_change_search_direction(satManager_t *m); |
---|
514 | int sat_is_redundant_lit(satManager_t *m, long lit, long absLevel); |
---|
515 | void sat_check_marks(satManager_t *m); |
---|
516 | void sat_decide_restart(satManager_t *m, long nConflicts); |
---|
517 | satClause_t * sat_add_learned_clause(satManager_t *m, satArray_t *learned); |
---|
518 | void sat_reduce_theory_clauses(satManager_t *m); |
---|
519 | void sat_make_dependent_graph(satManager_t *m, satClause_t *c); |
---|
520 | void sat_generate_unsat_core_main(satManager_t *m); |
---|
521 | void sat_generate_unsat_core(satManager_t *m, satClause_t *cl); |
---|
522 | void sat_free_clause_array(satArray_t *arr); |
---|
523 | |
---|
524 | char *sat_remove_space(char *line); |
---|
525 | char *sat_copy_word(char *lp, char *word); |
---|
526 | double sat_drand(satManager_t *m); |
---|
527 | satManager_t * sat_init_manager(); |
---|
528 | void sat_mark_for_pure_lits(satManager_t *m, satClause_t *c); |
---|
529 | satArray_t * sat_generate_unsat_core_clauses_index_array(satManager_t *m); |
---|
530 | satClause_t * sat_add_theory_clause(satManager_t *m, satArray_t *learned); |
---|
531 | satClause_t * sat_add_blocking_clause(satManager_t *m, satArray_t *learned); |
---|
532 | void sat_add_blocking_clause_for_theorem_prover(satManager_t *m, satArray_t *arr); |
---|
533 | |
---|
534 | int smt_get_size_of_atomic_variable(satManager_t *m); |
---|
535 | int smt_call_theory_solver(satManager_t *m, long bound); |
---|
536 | void smt_theory_undo(satManager_t *m); |
---|
537 | void sat_print_clause_in_dimacs(FILE *fp, satArray_t *arr); |
---|
538 | |
---|
539 | void sat_init_options_for_varelim(satManager_t *m); |
---|
540 | void sat_init_options_for_distill(satManager_t *m); |
---|
541 | |
---|
542 | void sat_distill_clauses_array(satManager_t *m, satArray_t* clauses, long learned); |
---|
543 | void sat_choose_candidates_for_distillation(satManager_t *m, satArray_t* clauses); |
---|
544 | void sat_reshape_cnf_database_with_distilled_clauses(satManager_t *m, int checkSubsumption); |
---|
545 | void sat_squeeze_clauses_array(satManager_t *m, int checkSubsumption); |
---|
546 | void sat_build_ternary_tree(satManager_t *m, satArray_t *clauses); |
---|
547 | void sat_ternary_tree_based_implication(satManager_t *m, satTernary_t *ternary, int depth, long learned); |
---|
548 | void sat_distill_clauses_with_restarting(satManager_t *m); |
---|
549 | void sat_distill_clauses_with_preprocessing(satManager_t *m); |
---|
550 | void sat_distill_clauses(satManager_t *m); |
---|
551 | void sat_report_result_for_distillation(satManager_t *m); |
---|
552 | void sat_print_array_as_clause(satManager_t *m, satArray_t *arr); |
---|
553 | void sat_add_all_watched_literal(satManager_t *m, satClause_t *c); |
---|
554 | void sat_sort_literal_by_score(satArray_t *arr, long *scores); |
---|
555 | void sat_sort_literal_by_score_aux(long *lits, long *scores, long size); |
---|
556 | void sat_insert_ternary_tree(satTernary_t *root, satArray_t *clause); |
---|
557 | void sat_free_clause(satClause_t *c); |
---|
558 | void sat_make_decision_based_on_trie(satManager_t *m, long lit); |
---|
559 | void sat_conflict_analysis_on_decisions(satManager_t *m, satArray_t *clearned, satClause_t *traversed, long learned); |
---|
560 | void sat_ternary_tree_based_undo(satManager_t *m, long level); |
---|
561 | void sat_print_scores(satManager_t *m); |
---|
562 | void sat_assert_pure_literals(satManager_t *m); |
---|
563 | void sat_delete_unmakred_clauses_for_simplification(satManager_t *m); |
---|
564 | void sat_free_ternary(satTernary_t *ternary); |
---|
565 | void sat_sort_clause_array_by_length(satArray_t *cl); |
---|
566 | void sat_strengthen_clause_in_conflict_analysis(satManager_t *m, satClause_t *c, int marked); |
---|
567 | int sat_check_subsumption_resolvent_and_clause(satManager_t *m, satClause_t *c, long nMarks); |
---|
568 | long sat_conflict_analysis_with_distillation(satManager_t *m, satClause_t *conflicting, long learned); |
---|
569 | int sat_check_subsumption_in_conflict_analysis(satManager_t *m, satClause_t *cp, satClause_t *cq); |
---|
570 | int sat_recompute_var_score(satManager_t *m); |
---|
571 | satClause_t* sat_resolvent_analysis(satManager_t *m, satTernary_t *t, long learned); |
---|
572 | satClause_t * sat_implication_for_simplification(satManager_t *m); |
---|
573 | satClause_t* sat_add_distilled_clause(satManager_t *m, satArray_t *arr, long learned); |
---|
574 | long sat_get_decision_lit(satManager_t *m, long level); |
---|
575 | void sat_check_marked_variables_on_decision_stack(satManager_t *m); |
---|
576 | void sat_traverse_ternary_tree_to_print_out_dot(satManager_t *m, FILE *fp, satTernary_t *ternary, long *nNode); |
---|
577 | |
---|
578 | |
---|
579 | int sat_eliminate_var_main(satManager_t *m); |
---|
580 | int sat_eliminate_var(satManager_t *m, long v); |
---|
581 | int sat_merge_sort_literals(satManager_t *m, satClause_t *cp, satClause_t *cq, long cpindex, long cqindex, long v); |
---|
582 | int sat_strengthen_clause(satManager_t *m, satClause_t *c, long index); |
---|
583 | int sat_elimination_progress(satManager_t *m); |
---|
584 | void sat_extend_model(satManager_t *m); |
---|
585 | void sat_reset_all_watched_lists(satManager_t *m); |
---|
586 | void sat_build_occurrence_list(satManager_t *m); |
---|
587 | satClause_t * sat_implication_on_all_watched_literals(satManager_t *m); |
---|
588 | int sat_backward_subsumption_check(satManager_t *m); |
---|
589 | void sat_gather_touched_clauses(satManager_t *m); |
---|
590 | void sat_recover_clauses_DB(satManager_t *m); |
---|
591 | int sat_squeeze_clause(satManager_t *m, satClause_t *c); |
---|
592 | void sat_remove_marked_clauses(satManager_t *m, satArray_t *arr); |
---|
593 | void sat_init_clauses_statistics(satManager_t *m); |
---|
594 | void sat_update_clauses_statistics(satManager_t *m, satClause_t *c); |
---|
595 | long sat_check_clauses_high_density(satManager_t *m); |
---|
596 | void sat_print_clauses_histogram(satManager_t *m); |
---|
597 | void sat_check_duplications_in_clauses(satArray_t *clauses); |
---|
598 | int sat_check_clauses_duplicate(satClause_t *cp, satClause_t *cq); |
---|
599 | void sat_strengthen_clause_in_conflict_analysis(satManager_t *m, satClause_t *c, int marked); |
---|
600 | void sat_strengthen_set_of_clauses_in_conflict_analysis(satManager_t *m); |
---|
601 | int sat_check_subsumption_in_conflict_analysis(satManager_t *m, satClause_t *cp, satClause_t *cq); |
---|
602 | int sat_check_subsumption_resolvent_and_clause(satManager_t *m, satClause_t *c, long nMarks); |
---|
603 | satClause_t *sat_copy_clause(satManager_t *m, satClause_t *c); |
---|
604 | void sat_calculate_restart_bound_new(satManager_t *m); |
---|
605 | void sat_check_duplicate_literals(satManager_t *m, satClause_t *c); |
---|
606 | int sat_minimize_conflict(satManager_t *m, long v, int depth); |
---|
607 | void sat_cleanup_for_minimize_conflict(satManager_t *m, satArray_t *arr); |
---|
608 | void sat_check_duplicate_literals(satManager_t *m, satClause_t *c); |
---|
609 | long sat_number_of_current_implications(satManager_t *m); |
---|
610 | satClause_t * sat_binary_implication(satManager_t *m); |
---|
611 | satClause_t* sat_find_binary_clause(satManager_t *m, long a, long b); |
---|
612 | void sat_print_options(satManager_t *m); |
---|
613 | void sat_assert_pure_literals(satManager_t *m); |
---|
614 | int sat_minimize_asserting(satManager_t *m, long v, int depth); |
---|
615 | void sat_cleanup_for_minimize_assert(satManager_t *m, satArray_t *arr); |
---|
616 | void sat_insert_clauses_into_subsumption_check_queue(satManager_t *m, satArray_t *clauses); |
---|
617 | long sat_get_literal_index_of_clause(satManager_t *m, satClause_t *c, long lit); |
---|
618 | void sat_set_clause_deleted(satManager_t *m, satClause_t *c); |
---|
619 | |
---|
620 | void sat_add_resolvents_from_lit_pool(satManager_t *m, satArray_t *pool); |
---|
621 | void sat_report_result_for_var_elim(satManager_t *m); |
---|
622 | long sat_get_literal_index_of_clause(satManager_t *m, satClause_t *c, long lit); |
---|
623 | void sat_calculate_clause_abs(satClause_t *c); |
---|
624 | void sat_clean_all_watched_lists_of_clause(satManager_t *m, satClause_t *c); |
---|
625 | void sat_clean_all_watched_list_of_literal(satManager_t *m, long lit); |
---|
626 | void sat_clean_all_watched_list_of_variable(satManager_t *m, long v); |
---|
627 | long sat_get_num_assignments_of_a_level(satManager_t *m, long level); |
---|
628 | void sat_clean_resolvents_DB(satManager_t *m, long v, long begin); |
---|
629 | void sat_mark_clauses_of_var_deleted(satManager_t *m, long v); |
---|
630 | void sat_mark_occur_list_to_be_deleted(satManager_t *m, long index); |
---|
631 | void sat_find_value_of_eliminated_var_on_clauses(satManager_t *m, satArray_t *clauses, long v); |
---|
632 | void sat_make_resolution_graph(satClause_t *c, satClause_t *ct); |
---|
633 | void sat_delete_dependencies_of_clause_array(satArray_t *arr); |
---|
634 | long sat_delete_redundant_resolvents(satManager_t *m, satClause_t *cp); |
---|
635 | void sat_check_resolvent_dependencies(satManager_t *m, satClause_t *cp, satClause_t *cq, satClause_t *c); |
---|
636 | void sat_print_clause_array_part(satManager_t *m, satArray_t *arr, long begin, long end); |
---|
637 | void sat_print_current_DB_to_cnf(satManager_t *m, char *cnfFilename); |
---|
638 | void sat_write_eliminated_DB(satManager_t *m, int turnOffClauses); |
---|
639 | void sat_check_all_watched_list_of_eliminsated_variables(satManager_t *m); |
---|
640 | long sat_check_unit_clause(satManager_t *m, satClause_t *c); |
---|
641 | int sat_check_clause_after_merge_sort(satManager_t *m, satArray_t *arr, long begin); |
---|
642 | int sat_check_all_clauses_sorted(satManager_t *m); |
---|
643 | int sat_delete_clause_from_watched_list(satManager_t *m, satClause_t *c, long wlindex, long cindex); |
---|
644 | int sat_verify_watched_literal(satManager_t *m, satClause_t *c); |
---|
645 | |
---|
646 | inline long sat_subsume_on_sorted_clauses(satManager_t *m, satClause_t *cp, satClause_t *cq); |
---|
647 | inline long sat_subsume_on_clauses(satManager_t *m, satClause_t *cp, satClause_t *cq); |
---|
648 | |
---|
649 | int sat_compress_clause(satManager_t *m, satClause_t *c); |
---|
650 | void sat_sort_literal_aux(long *lits, long size); |
---|
651 | void sat_sort_clause_array(satArray_t *arr, int (*compare_sort)(const void *, const void *)); |
---|
652 | void sat_sort_clause_array_aux(long *carr, long size, int (*compare_sort)(const void *, const void *)); |
---|
653 | void sat_literal_array_sort(satArray_t *arr); |
---|
654 | void sat_sort_clause_literal(satClause_t *c); |
---|
655 | |
---|
656 | void sat_heap_up(satManager_t *m, satHeap_t *h, long i); |
---|
657 | void sat_heap_down(satManager_t *m, satHeap_t *h, long i); |
---|
658 | |
---|
659 | satQueue_t* sat_queue_init(long maxElements); |
---|
660 | void sat_queue_clear(satQueue_t *Q); |
---|
661 | void sat_queue_free(satQueue_t *Q); |
---|
662 | void sat_queue_insert(satQueue_t *Q, long n); |
---|
663 | long sat_queue_pop(satQueue_t *Q); |
---|
664 | void sat_queue_print(satQueue_t *Q); |
---|
665 | void vel_heap_remove_var_eliminated(satManager_t *m); |
---|
666 | void vel_heap_up(satManager_t *m, long i); |
---|
667 | void vel_heap_down(satManager_t *m, long i); |
---|
668 | long vel_heap_remove_min(satManager_t *m); |
---|
669 | void vel_heap_clear(satManager_t *m); |
---|
670 | void vel_heap_update(satManager_t *m, long n); |
---|
671 | void vel_heap_init(satManager_t *m, long size); |
---|
672 | void vel_heap_print(satManager_t *m); |
---|
673 | void vel_heap_free(satManager_t *m); |
---|
674 | int vel_heap_check(satManager_t *m, long i); |
---|
675 | int vel_heap_inHeap(satManager_t *m, long n); |
---|
676 | void vel_heap_insert(satManager_t *m, long n); |
---|
677 | |
---|
678 | satStack_t* sat_stack_init(long maxElements); |
---|
679 | void sat_stack_clear(satStack_t *stack); |
---|
680 | void sat_stack_free(satStack_t *stack); |
---|
681 | satStack_t* sat_stack_push(satStack_t *stack, long n); |
---|
682 | long sat_stack_pop(satStack_t *stack); |
---|
683 | void sat_stack_print(satStack_t *stack); |
---|
684 | satSCC_t * sat_scc_alloc(long size); |
---|
685 | long sat_find_repr(satManager_t *m, long lit); |
---|
686 | void sat_update_repr(satManager_t *m, long litp, long litq); |
---|
687 | void sat_strongly_connected_component(satManager_t *m); |
---|
688 | |
---|
689 | |
---|