/*_________________________________________________________________________________________________ | | simplify : [void] -> [bool] | | Description: | Simplify the clause database according to the current top-level assigment. Currently, the only | thing done here is the removal of satisfied clauses, but more things can be put here. |________________________________________________________________________________________________@*/ bool MiniSATP::simplify() { remove_satisfied = false; assert(decisionLevel() == 0); // Modified Lines // if (!ok || propagate() != NULL) // return ok = false; if (!ok) return false; Clause * confl = propagate( ); if ( confl != NULL ) { fillExplanation( confl ); return ok = false; } if (nAssigns() == simpDB_assigns || (simpDB_props > 0)) return true; // Remove satisfied clauses: removeSatisfied(learnts); if (remove_satisfied) // Can be turned off. removeSatisfied(clauses); // Remove fixed variables from the variable heap: order_heap.filter(VarFilter(*this)); simpDB_assigns = nAssigns(); simpDB_props = clauses_literals + learnts_literals; // (shouldn't depend on stats really, but it will do for now) return true; }
/*_________________________________________________________________________________________________ | | simplify : [void] -> [bool] | | Description: | Simplify the clause database according to the current top-level assigment. Currently, the only | thing done here is the removal of satisfied clauses, but more things can be put here. |________________________________________________________________________________________________@*/ bool Solver::simplify() { assert(decisionLevel() == 0); if (!ok || propagate() != NULL) return ok = false; if (nAssigns() == simpDB_assigns || (simpDB_props > 0)) return true; // Remove satisfied clauses: removeSatisfied(learnts); if (remove_satisfied) // Can be turned off. removeSatisfied(clauses); // Remove fixed variables from the variable heap: order_heap.filter(VarFilter(*this)); simpDB_assigns = nAssigns(); simpDB_props = clauses_literals + learnts_literals; // (shouldn't depend on stats really, but it will do for now) return true; }
bool SimpSolver::eliminate(bool turn_off_elim) { if (!ok || !use_simplification) return ok; // Main simplification loop: //assert(subsumption_queue.size() == 0); //gatherTouchedClauses(); while (subsumption_queue.size() > 0 || elim_heap.size() > 0){ //fprintf(stderr, "subsumption phase: (%d)\n", subsumption_queue.size()); if (!backwardSubsumptionCheck(true)) return false; //fprintf(stderr, "elimination phase:\n (%d)", elim_heap.size()); for (int cnt = 0; !elim_heap.empty(); cnt++){ Var elim = elim_heap.removeMin(); if (verbosity >= 2 && cnt % 100 == 0) reportf("elimination left: %10d\r", elim_heap.size()); if (!frozen[elim] && !eliminateVar(elim)) return false; } assert(subsumption_queue.size() == 0); gatherTouchedClauses(); } // Cleanup: cleanUpClauses(); order_heap.filter(VarFilter(*this)); #ifdef INVARIANTS // Check that no more subsumption is possible: reportf("Checking that no more subsumption is possible\n"); for (int i = 0; i < clauses.size(); i++){ if (i % 1000 == 0) reportf("left %10d\r", clauses.size() - i); assert(clauses[i]->mark() == 0); for (int j = 0; j < i; j++) assert(clauses[i]->subsumes(*clauses[j]) == lit_Error); } reportf("done.\n"); // Check that no more elimination is possible: reportf("Checking that no more elimination is possible\n"); for (int i = 0; i < nVars(); i++) if (!frozen[i]) eliminateVar(i, true); reportf("done.\n"); checkLiteralCount(); #endif // If no more simplification is needed, free all simplification-related data structures: if (turn_off_elim){ use_simplification = false; touched.clear(true); occurs.clear(true); n_occ.clear(true); subsumption_queue.clear(true); elim_heap.clear(true); remove_satisfied = true; } return true; }