ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
SimpSolver.cpp
Go to the documentation of this file.
1/***********************************************************************************[SimpSolver.cc]
2Copyright (c) 2006, Niklas Een, Niklas Sorensson
3Copyright (c) 2007-2010, Niklas Sorensson
4
5Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
6associated documentation files (the "Software"), to deal in the Software without restriction,
7including without limitation the rights to use, copy, modify, merge, publish, distribute,
8sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in all copies or
12substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
15NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
18OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19**************************************************************************************************/
20
21#include "sat/glucose/Sort.h"
23#include "sat/glucose/System.h"
24
26
27using namespace Gluco;
28
29//=================================================================================================
30// Options:
31
32
33static const char* _cat = "SIMP";
34
35static BoolOption opt_use_asymm (_cat, "asymm", "Shrink clauses by asymmetric branching.", false);
36static BoolOption opt_use_rcheck (_cat, "rcheck", "Check if a clause is already implied. (costly)", false);
37static BoolOption opt_use_elim (_cat, "elim", "Perform variable elimination.", true);
38static IntOption opt_grow (_cat, "grow", "Allow a variable elimination step to grow by a number of clauses.", 0);
39static IntOption opt_clause_lim (_cat, "cl-lim", "Variables are not eliminated if it produces a resolvent with a length above this limit. -1 means no limit", 20, IntRange(-1, INT32_MAX));
40static IntOption opt_subsumption_lim (_cat, "sub-lim", "Do not check if subsumption against a clause larger than this. -1 means no limit.", 1000, IntRange(-1, INT32_MAX));
41static DoubleOption opt_simp_garbage_frac(_cat, "simp-gc-frac", "The fraction of wasted memory allowed before a garbage collection is triggered during simplification.", 0.5, DoubleRange(0, false, HUGE_VAL, false));
42
43
44//=================================================================================================
45// Constructor/Destructor:
46
47
49 grow (opt_grow)
50 , clause_lim (opt_clause_lim)
51 , subsumption_lim (opt_subsumption_lim)
52 , simp_garbage_frac (opt_simp_garbage_frac)
53 , use_asymm (opt_use_asymm)
54 , use_rcheck (opt_use_rcheck)
55 , use_elim (opt_use_elim)
56 , merges (0)
57 , asymm_lits (0)
58 , eliminated_vars (0)
60 , elimorder (1)
64 , bwdsub_assigns (0)
65 , n_touched (0)
66{
67 vec<Lit> dummy(1,lit_Undef);
68 ca.extra_clause_field = true; // NOTE: must happen before allocating the dummy clause below.
69 bwdsub_tmpunit = ca.alloc(dummy);
70 remove_satisfied = false;
71}
72
73
77
78
79Var SimpSolver::newVar(bool sign, bool dvar) {
80 Var v = Solver::newVar(sign, dvar);
81
82 frozen .push((char)false);
83 eliminated.push((char)false);
84
86 n_occ .push(0);
87 n_occ .push(0);
88 occurs .init(v);
89 touched .push(0);
90 elim_heap .insert(v);
91 }
92 return v; }
93
94
95
96lbool SimpSolver::solve_(bool do_simp, bool turn_off_simp)
97{
98 vec<Var> extra_frozen;
99 lbool result = l_True;
100
101 do_simp &= use_simplification;
102
103 if (do_simp){
104 // Assumptions must be temporarily frozen to run variable elimination:
105 for (int i = 0; i < assumptions.size(); i++){
106 Var v = var(assumptions[i]);
107
108 // If an assumption has been eliminated, remember it.
109 assert(!isEliminated(v));
110
111 if (!frozen[v]){
112 // Freeze and store.
113 setFrozen(v, true);
114 extra_frozen.push(v);
115 } }
116
117 result = lbool(eliminate(turn_off_simp));
118 }
119
120 if (result == l_True)
121 result = Solver::solve_();
122 else if (verbosity >= 1)
123 printf("===============================================================================\n");
124
125 if (result == l_True)
126 extendModel();
127
128 if (do_simp)
129 // Unfreeze the assumptions that were frozen:
130 for (int i = 0; i < extra_frozen.size(); i++)
131 setFrozen(extra_frozen[i], false);
132
133 return result;
134}
135
136
137
139{
140#ifndef NDEBUG
141 for (int i = 0; i < ps.size(); i++)
142 assert(!isEliminated(var(ps[i])));
143#endif
144 int nclauses = clauses.size();
145
146 if (use_rcheck && implied(ps))
147 return true;
148
149 if (!Solver::addClause_(ps))
150 return false;
151
152 if(!parsing && certifiedUNSAT) {
153 for (int i = 0; i < ps.size(); i++)
154 fprintf(certifiedOutput, "%i " , (var(ps[i]) + 1) * (-2 * sign(ps[i]) + 1) );
155 fprintf(certifiedOutput, "0\n");
156 }
157
158 if (use_simplification && clauses.size() == nclauses + 1){
159 CRef cr = clauses.last();
160 const Clause& c = ca[cr];
161
162 // NOTE: the clause is added to the queue immediately and then
163 // again during 'gatherTouchedClauses()'. If nothing happens
164 // in between, it will only be checked once. Otherwise, it may
165 // be checked twice unnecessarily. This is an unfortunate
166 // consequence of how backward subsumption is used to mimic
167 // forward subsumption.
168 subsumption_queue.insert(cr);
169 for (int i = 0; i < c.size(); i++){
170 occurs[var(c[i])].push(cr);
171 n_occ[toInt(c[i])]++;
172 touched[var(c[i])] = 1;
173 n_touched++;
174 if (elim_heap.inHeap(var(c[i])))
175 elim_heap.increase(var(c[i]));
176 }
177 }
178
179 return true;
180}
181
182
184{
185 const Clause& c = ca[cr];
186
188 for (int i = 0; i < c.size(); i++){
189 n_occ[toInt(c[i])]--;
190 updateElimHeap(var(c[i]));
191 occurs.smudge(var(c[i]));
192 }
193
195}
196
197
199{
200 Clause& c = ca[cr];
201 assert(decisionLevel() == 0);
203
204 // FIX: this is too inefficient but would be nice to have (properly implemented)
205 // if (!find(subsumption_queue, &c))
206 subsumption_queue.insert(cr);
207
208 if (certifiedUNSAT) {
209 for (int i = 0; i < c.size(); i++)
210 if (c[i] != l) fprintf(certifiedOutput, "%i " , (var(c[i]) + 1) * (-2 * sign(c[i]) + 1) );
211 fprintf(certifiedOutput, "0\n");
212 }
213
214 if (c.size() == 2){
215 removeClause(cr);
216 c.strengthen(l);
217 }else{
218 if (certifiedUNSAT) {
219 fprintf(certifiedOutput, "d ");
220 for (int i = 0; i < c.size(); i++)
221 fprintf(certifiedOutput, "%i " , (var(c[i]) + 1) * (-2 * sign(c[i]) + 1) );
222 fprintf(certifiedOutput, "0\n");
223 }
224
225 detachClause(cr, true);
226 c.strengthen(l);
227 attachClause(cr);
228 remove(occurs[var(l)], cr);
229 n_occ[toInt(l)]--;
231 }
232
233 return c.size() == 1 ? enqueue(c[0]) && propagate() == CRef_Undef : true;
234}
235
236
237// Returns FALSE if clause is always satisfied ('out_clause' should not be used).
238bool SimpSolver::merge(const Clause& _ps, const Clause& _qs, Var v, vec<Lit>& out_clause)
239{
240 merges++;
241 out_clause.clear();
242
243 bool ps_smallest = _ps.size() < _qs.size();
244 const Clause& ps = ps_smallest ? _qs : _ps;
245 const Clause& qs = ps_smallest ? _ps : _qs;
246
247 int i, j;
248 for (i = 0; i < qs.size(); i++){
249 if (var(qs[i]) != v){
250 for (j = 0; j < ps.size(); j++)
251 if (var(ps[j]) == var(qs[i])) {
252 if (ps[j] == ~qs[i])
253 return false;
254 else
255 goto next;
256 }
257 out_clause.push(qs[i]);
258 }
259 next:;
260 }
261
262 for (i = 0; i < ps.size(); i++)
263 if (var(ps[i]) != v)
264 out_clause.push(ps[i]);
265
266 return true;
267}
268
269
270// Returns FALSE if clause is always satisfied.
271bool SimpSolver::merge(const Clause& _ps, const Clause& _qs, Var v, int& size)
272{
273 merges++;
274
275 bool ps_smallest = _ps.size() < _qs.size();
276 const Clause& ps = ps_smallest ? _qs : _ps;
277 const Clause& qs = ps_smallest ? _ps : _qs;
278 const Lit* __ps = (const Lit*)ps;
279 const Lit* __qs = (const Lit*)qs;
280
281 size = ps.size()-1;
282
283 for (int i = 0; i < qs.size(); i++){
284 if (var(__qs[i]) != v){
285 for (int j = 0; j < ps.size(); j++)
286 if (var(__ps[j]) == var(__qs[i])) {
287 if (__ps[j] == ~__qs[i])
288 return false;
289 else
290 goto next;
291 }
292 size++;
293 }
294 next:;
295 }
296
297 return true;
298}
299
300
302{
303 if (n_touched == 0) return;
304
305 int i,j;
306 for (i = j = 0; i < subsumption_queue.size(); i++)
307 if (ca[subsumption_queue[i]].mark() == 0)
308 ca[subsumption_queue[i]].mark(2);
309
310 for (i = 0; i < touched.size(); i++)
311 if (touched[i]){
312 const vec<CRef>& cs = occurs.lookup(i);
313 for (j = 0; j < cs.size(); j++)
314 if (ca[cs[j]].mark() == 0){
315 subsumption_queue.insert(cs[j]);
316 ca[cs[j]].mark(2);
317 }
318 touched[i] = 0;
319 }
320
321 for (i = 0; i < subsumption_queue.size(); i++)
322 if (ca[subsumption_queue[i]].mark() == 2)
323 ca[subsumption_queue[i]].mark(0);
324
325 n_touched = 0;
326}
327
328
330{
331 assert(decisionLevel() == 0);
332
333 trail_lim.push(trail.size());
334 for (int i = 0; i < c.size(); i++)
335 if (value(c[i]) == l_True){
336 cancelUntil(0);
337 return false;
338 }else if (value(c[i]) != l_False){
339 assert(value(c[i]) == l_Undef);
340 uncheckedEnqueue(~c[i]);
341 }
342
343 bool result = propagate() != CRef_Undef;
344 cancelUntil(0);
345 return result;
346}
347
348
349// Backward subsumption + backward subsumption resolution
351{
352 int cnt = 0;
353 int subsumed = 0;
354 int deleted_literals = 0;
355 assert(decisionLevel() == 0);
356
357 while (subsumption_queue.size() > 0 || bwdsub_assigns < trail.size()){
358
359 // Empty subsumption queue and return immediately on user-interrupt:
360 if (asynch_interrupt){
361 subsumption_queue.clear();
362 bwdsub_assigns = trail.size();
363 break; }
364
365 // Check top-level assignments by creating a dummy clause and placing it in the queue:
366 if (subsumption_queue.size() == 0 && bwdsub_assigns < trail.size()){
367 Lit l = trail[bwdsub_assigns++];
368 ca[bwdsub_tmpunit][0] = l;
369 ca[bwdsub_tmpunit].calcAbstraction();
371
372 CRef cr = subsumption_queue.peek(); subsumption_queue.pop();
373 Clause& c = ca[cr];
374
375 if (c.mark()) continue;
376
377 if (verbose && verbosity >= 2 && cnt++ % 1000 == 0)
378 printf("subsumption left: %10d (%10d subsumed, %10d deleted literals)\r", subsumption_queue.size(), subsumed, deleted_literals);
379
380 assert(c.size() > 1 || value(c[0]) == l_True); // Unit-clauses should have been propagated before this point.
381
382 // Find best variable to scan:
383 Var best = var(c[0]);
384 for (int i = 1; i < c.size(); i++)
385 if (occurs[var(c[i])].size() < occurs[best].size())
386 best = var(c[i]);
387
388 // Search all candidates:
389 vec<CRef>& _cs = occurs.lookup(best);
390 CRef* cs = (CRef*)_cs;
391
392 for (int j = 0; j < _cs.size(); j++)
393 if (c.mark())
394 break;
395 else if (!ca[cs[j]].mark() && cs[j] != cr && (subsumption_lim == -1 || ca[cs[j]].size() < subsumption_lim)){
396 Lit l = c.subsumes(ca[cs[j]]);
397
398 if (l == lit_Undef)
399 subsumed++, removeClause(cs[j]);
400 else if (l != lit_Error){
401 deleted_literals++;
402
403 if (!strengthenClause(cs[j], ~l))
404 return false;
405
406 // Did current candidate get deleted from cs? Then check candidate at index j again:
407 if (var(l) == best)
408 j--;
409 }
410 }
411 }
412
413 return true;
414}
415
416
418{
419 Clause& c = ca[cr];
420 assert(decisionLevel() == 0);
421
422 if (c.mark() || satisfied(c)) return true;
423
424 trail_lim.push(trail.size());
425 Lit l = lit_Undef;
426 for (int i = 0; i < c.size(); i++)
427 if (var(c[i]) != v && value(c[i]) != l_False)
428 uncheckedEnqueue(~c[i]);
429 else
430 l = c[i];
431
432 if (propagate() != CRef_Undef){
433 cancelUntil(0);
434 asymm_lits++;
435 if (!strengthenClause(cr, l))
436 return false;
437 }else
438 cancelUntil(0);
439
440 return true;
441}
442
443
445{
447
448 const vec<CRef>& cls = occurs.lookup(v);
449
450 if (value(v) != l_Undef || cls.size() == 0)
451 return true;
452
453 for (int i = 0; i < cls.size(); i++)
454 if (!asymm(v, cls[i]))
455 return false;
456
458}
459
460
461static void mkElimClause(vec<uint32_t>& elimclauses, Lit x)
462{
463 elimclauses.push(toInt(x));
464 elimclauses.push(1);
465}
466
467
468static void mkElimClause(vec<uint32_t>& elimclauses, Var v, Clause& c)
469{
470 int first = elimclauses.size();
471 int v_pos = -1;
472
473 // Copy clause to elimclauses-vector. Remember position where the
474 // variable 'v' occurs:
475 for (int i = 0; i < c.size(); i++){
476 elimclauses.push(toInt(c[i]));
477 if (var(c[i]) == v)
478 v_pos = i + first;
479 }
480 assert(v_pos != -1);
481
482 // Swap the first literal with the 'v' literal, so that the literal
483 // containing 'v' will occur first in the clause:
484 uint32_t tmp = elimclauses[v_pos];
485 elimclauses[v_pos] = elimclauses[first];
486 elimclauses[first] = tmp;
487
488 // Store the length of the clause last:
489 elimclauses.push(c.size());
490}
491
492
493
495{
496 int i, j;
497 assert(!frozen[v]);
498 assert(!isEliminated(v));
499 assert(value(v) == l_Undef);
500
501 // Split the occurrences into positive and negative:
502 //
503 const vec<CRef>& cls = occurs.lookup(v);
504 vec<CRef> pos, neg;
505 for (i = 0; i < cls.size(); i++)
506 (find(ca[cls[i]], mkLit(v)) ? pos : neg).push(cls[i]);
507
508 // Check wether the increase in number of clauses stays within the allowed ('grow'). Moreover, no
509 // clause must exceed the limit on the maximal clause size (if it is set):
510 //
511 int cnt = 0;
512 int clause_size = 0;
513
514 for (i = 0; i < pos.size(); i++)
515 for (j = 0; j < neg.size(); j++)
516 if (merge(ca[pos[i]], ca[neg[j]], v, clause_size) &&
517 (++cnt > cls.size() + grow || (clause_lim != -1 && clause_size > clause_lim)))
518 return true;
519
520 // Delete and store old clauses:
521 eliminated[v] = true;
522 setDecisionVar(v, false);
524
525 if (pos.size() > neg.size()){
526 for (i = 0; i < neg.size(); i++)
527 mkElimClause(elimclauses, v, ca[neg[i]]);
528 mkElimClause(elimclauses, mkLit(v));
529 eliminated_clauses += neg.size();
530 }else{
531 for (i = 0; i < pos.size(); i++)
532 mkElimClause(elimclauses, v, ca[pos[i]]);
533 mkElimClause(elimclauses, ~mkLit(v));
534 eliminated_clauses += pos.size();
535 }
536
537
538 // Produce clauses in cross product:
539 vec<Lit>& resolvent = add_tmp;
540 for (i = 0; i < pos.size(); i++)
541 for (j = 0; j < neg.size(); j++)
542 if (merge(ca[pos[i]], ca[neg[j]], v, resolvent) && !addClause_(resolvent))
543 return false;
544
545 for (i = 0; i < cls.size(); i++)
546 removeClause(cls[i]);
547
548 // Free occurs list for this variable:
549 occurs[v].clear(true);
550
551 // Free watchers lists for this variable, if possible:
552 if (watches[ mkLit(v)].size() == 0) watches[ mkLit(v)].clear(true);
553 if (watches[~mkLit(v)].size() == 0) watches[~mkLit(v)].clear(true);
554
556}
557
558
560{
561 assert(!frozen[v]);
562 assert(!isEliminated(v));
563 assert(value(v) == l_Undef);
564
565 if (!ok) return false;
566
567 eliminated[v] = true;
568 setDecisionVar(v, false);
569 const vec<CRef>& cls = occurs.lookup(v);
570
571 vec<Lit>& subst_clause = add_tmp;
572 for (int i = 0; i < cls.size(); i++){
573 Clause& c = ca[cls[i]];
574
575 subst_clause.clear();
576 for (int j = 0; j < c.size(); j++){
577 Lit p = c[j];
578 subst_clause.push(var(p) == v ? x ^ sign(p) : p);
579 }
580
581
582 if (!addClause_(subst_clause))
583 return ok = false;
584
585 removeClause(cls[i]);
586
587 }
588
589 return true;
590}
591
592
594{
595 int i, j;
596 Lit x;
597
598 for (i = elimclauses.size()-1; i > 0; i -= j){
599 for (j = elimclauses[i--]; j > 1; j--, i--)
601 goto next;
602
603 x = toLit(elimclauses[i]);
604 model[var(x)] = lbool(!sign(x));
605 next:;
606 }
607}
608
609
610bool SimpSolver::eliminate(bool turn_off_elim)
611{
612 //abctime clk = Abc_Clock();
613 if (!simplify())
614 return false;
615 else if (!use_simplification)
616 return true;
617
618 // Main simplification loop:
619 //
620
621 int toPerform = clauses.size()<=4800000;
622
623 if(!toPerform) {
624 printf("c Too many clauses... No preprocessing\n");
625 }
626
627 while (toPerform && (n_touched > 0 || bwdsub_assigns < trail.size() || elim_heap.size() > 0)){
628
630 // printf(" ## (time = %6.2f s) BWD-SUB: queue = %d, trail = %d\n", cpuTime(), subsumption_queue.size(), trail.size() - bwdsub_assigns);
631 if ((subsumption_queue.size() > 0 || bwdsub_assigns < trail.size()) &&
633 ok = false; goto cleanup; }
634
635 // Empty elim_heap and return immediately on user-interrupt:
636 if (asynch_interrupt){
637 assert(bwdsub_assigns == trail.size());
638 assert(subsumption_queue.size() == 0);
639 assert(n_touched == 0);
640 elim_heap.clear();
641 goto cleanup; }
642
643 // printf(" ## (time = %6.2f s) ELIM: vars = %d\n", cpuTime(), elim_heap.size());
644 for (int cnt = 0; !elim_heap.empty(); cnt++){
645 Var elim = elim_heap.removeMin();
646
647 if (asynch_interrupt) break;
648
649 if (isEliminated(elim) || value(elim) != l_Undef) continue;
650
651 if (verbosity >= 2 && cnt % 100 == 0)
652 printf("elimination left: %10d\r", elim_heap.size());
653
654 if (use_asymm){
655 // Temporarily freeze variable. Otherwise, it would immediately end up on the queue again:
656 bool was_frozen = frozen[elim] != 0;
657 frozen[elim] = true;
658 if (!asymmVar(elim)){
659 ok = false; goto cleanup; }
660 frozen[elim] = was_frozen; }
661
662 // At this point, the variable may have been set by assymetric branching, so check it
663 // again. Also, don't eliminate frozen variables:
664 if (use_elim && value(elim) == l_Undef && !frozen[elim] && !eliminateVar(elim)){
665 ok = false; goto cleanup; }
666
668 }
669
670 assert(subsumption_queue.size() == 0);
671 }
672 cleanup:
673
674 // If no more simplification is needed, free all simplification-related data structures:
675 if (turn_off_elim){
676 touched .clear(true);
677 occurs .clear(true);
678 n_occ .clear(true);
679 elim_heap.clear(true);
680 subsumption_queue.clear(true);
681
682 use_simplification = false;
683 remove_satisfied = true;
684 ca.extra_clause_field = false;
685
686 // Force full cleanup (this is safe and desirable since it only happens once):
689 }else{
690 // Cheaper cleanup:
691 cleanUpClauses(); // TODO: can we make 'cleanUpClauses()' not be linear in the problem size somehow?
692 checkGarbage();
693 }
694
695 if (verbosity >= 1 && elimclauses.size() > 0)
696 printf("c | Eliminated clauses: %10.2f Mb |\n",
697 double(elimclauses.size() * sizeof(uint32_t)) / (1024*1024));
698 return ok;
699}
700
701
703{
704 occurs.cleanAll();
705 int i,j;
706 for (i = j = 0; i < clauses.size(); i++)
707 if (ca[clauses[i]].mark() == 0)
708 clauses[j++] = clauses[i];
709 clauses.shrink(i - j);
710}
711
712
713//=================================================================================================
714// Garbage Collection methods:
715
716
718{
719 int i;
720 if (!use_simplification) return;
721
722 // All occurs lists:
723 //
724 for (i = 0; i < nVars(); i++){
725 vec<CRef>& cs = occurs[i];
726 for (int j = 0; j < cs.size(); j++)
727 ca.reloc(cs[j], to);
728 }
729
730 // Subsumption queue:
731 //
732 for (i = 0; i < subsumption_queue.size(); i++)
733 ca.reloc(subsumption_queue[i], to);
734
735 // Temporary clause:
736 //
737 ca.reloc(bwdsub_tmpunit, to);
738}
739
740
742{
743 // Initialize the next region to a size corresponding to the estimated utilization degree. This
744 // is not precise but should avoid some unnecessary reallocations for the new region:
745 ClauseAllocator to(ca.size() - ca.wasted());
746
748 to.extra_clause_field = ca.extra_clause_field; // NOTE: this is important to keep (or lose) the extra fields.
749 relocAll(to);
751 if (verbosity >= 2)
752 printf("| Garbage collection: %12d bytes => %12d bytes |\n",
754 to.moveTo(ca);
755}
756
758{
760 grow = opt_grow;
762 elimclauses.clear(false);
763 touched.clear(false);
764 occurs.clear(false);
765 n_occ.clear(false);
766 elim_heap.clear(false);
767 subsumption_queue.clear(false);
768 frozen.clear(false);
769 eliminated.clear(false);
770 vec<Lit> dummy(1,lit_Undef);
771 ca.extra_clause_field = true; // NOTE: must happen before allocating the dummy clause below.
772 bwdsub_tmpunit = ca.alloc(dummy);
773 remove_satisfied = false;
774}
775
unsigned int uint32_t
Definition Fxch.h:32
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define l_True
Definition bmcBmcS.c:35
#define l_Undef
Definition bmcBmcS.c:34
#define l_False
Definition bmcBmcS.c:36
#define INT32_MAX
Definition pstdint.h:415
ABC_NAMESPACE_IMPL_START typedef signed char value
void moveTo(ClauseAllocator &to)
unsigned size
Lit subsumes(const Clause &other) const
void strengthen(Lit p)
unsigned mark
uint32_t size() const
Definition Alloc.h:58
virtual void reset()
Heap< ElimLt > elim_heap
Definition SimpSolver.h:138
void updateElimHeap(Var v)
Definition SimpSolver.h:176
bool substitute(Var v, Lit x)
void removeClause(CRef cr)
double simp_garbage_frac
Definition SimpSolver.h:91
vec< char > frozen
Definition SimpSolver.h:140
void setFrozen(Var v, bool b)
Definition SimpSolver.h:188
bool implied(const vec< Lit > &c)
Queue< CRef > subsumption_queue
Definition SimpSolver.h:139
bool eliminate(bool turn_off_elim=false)
bool strengthenClause(CRef cr, Lit l)
bool eliminateVar(Var v)
Var newVar(bool polarity=true, bool dvar=true)
bool asymmVar(Var v)
bool asymm(Var v, CRef cr)
bool merge(const Clause &_ps, const Clause &_qs, Var v, vec< Lit > &out_clause)
vec< char > touched
Definition SimpSolver.h:134
bool addClause_(vec< Lit > &ps)
bool isEliminated(Var v) const
Definition SimpSolver.h:175
vec< char > eliminated
Definition SimpSolver.h:141
virtual void garbageCollect()
OccLists< Var, vec< CRef >, ClauseDeleted > occurs
Definition SimpSolver.h:136
bool backwardSubsumptionCheck(bool verbose=false)
vec< int > n_occ
Definition SimpSolver.h:137
void gatherTouchedClauses()
void relocAll(ClauseAllocator &to)
vec< uint32_t > elimclauses
Definition SimpSolver.h:133
FILE * certifiedOutput
Definition Solver.h:188
int decisionLevel() const
Definition Solver.h:417
bool addClause_(vec< Lit > &ps)
Definition Glucose.cpp:224
CRef propagate()
Definition Glucose.cpp:803
OccLists< Lit, vec< Watcher >, WatcherDeleted > watches
Definition Solver.h:234
vec< Lit > assumptions
Definition Solver.h:250
vec< Lit > add_tmp
Definition Solver.h:276
vec< int > trail_lim
Definition Solver.h:245
void cancelUntil(int level)
Definition Glucose.cpp:471
lbool value(Var x) const
Definition Solver.h:419
void relocAll(ClauseAllocator &to)
Definition Glucose.cpp:1386
bool certifiedUNSAT
Definition Solver.h:189
void removeClause(CRef cr)
Definition Glucose.cpp:333
vec< Lit > trail
Definition Solver.h:243
virtual void reset()
Definition Glucose.cpp:1440
vec< CRef > clauses
Definition Solver.h:237
void detachClause(CRef cr, bool strict=false)
Definition Glucose.cpp:306
void checkGarbage()
Definition Solver.h:395
void rebuildOrderHeap()
Definition Glucose.cpp:981
void attachClause(CRef cr)
Definition Glucose.cpp:289
ClauseAllocator ca
Definition Solver.h:261
int nVars() const
Definition Solver.h:426
bool remove_satisfied
Definition Solver.h:253
bool enqueue(Lit p, CRef from=CRef_Undef)
Definition Solver.h:401
bool asynch_interrupt
Definition Solver.h:288
vec< lbool > model
Definition Solver.h:152
lbool solve_()
Definition Glucose.cpp:1209
Var newVar(bool polarity=true, bool dvar=true)
Definition Glucose.cpp:202
bool simplify()
Definition Glucose.cpp:999
int verbosity
Definition Solver.h:158
void setDecisionVar(Var v, bool b)
Definition Solver.h:430
void uncheckedEnqueue(Lit p, CRef from=CRef_Undef)
Definition Glucose.cpp:783
lbool modelValue(Var x) const
Definition Solver.h:421
bool satisfied(const Clause &c) const
Definition Glucose.cpp:352
int size(void) const
Definition Vec.h:65
void clear(bool dealloc=false)
Definition Vec.h:124
void push(void)
Definition Vec.h:75
bool pos
Definition globals.c:30
Cube * p
Definition exorList.c:222
Definition Alg.h:28
int toInt(Var v)
Definition SolverTypes.h:74
const Lit lit_Error
Definition SolverTypes.h:82
RegionAllocator< uint32_t >::Ref CRef
const Lit lit_Undef
Definition SolverTypes.h:81
int var(Lit p)
Definition SolverTypes.h:71
bool sign(Lit p)
Definition SolverTypes.h:70
int Var
Definition SolverTypes.h:52
const CRef CRef_Undef
Lit toLit(int i)
Definition SolverTypes.h:76
Lit mkLit(Var var, bool sign=false)
Definition SolverTypes.h:67
#define true
Definition place_base.h:28
signed char lbool
Definition satVec.h:135
#define assert(ex)
Definition util_old.h:213
#define HUGE_VAL
Definition util_old.h:295
signed char mark
Definition value.h:8