CVC3
2.4.1
|
#include <dpllt_basic.h>
DPLLTBasic::DPLLTBasic | ( | TheoryAPI * | theoryAPI, |
Decider * | decider, | ||
CVC3::ContextManager * | cm, | ||
bool | printStats = false |
||
) |
Definition at line 239 of file dpllt_basic.cpp.
References createManager(), d_cnf, d_assertions, d_cm, and CVC3::ContextManager::getCurrentContext().
DPLLTBasic::~DPLLTBasic | ( | ) | [virtual] |
Definition at line 254 of file dpllt_basic.cpp.
References d_assertions, d_cnf, d_mng, d_assertionsStack, d_mngStack, and d_cnfStack.
void DPLLTBasic::createManager | ( | ) | [private] |
Definition at line 137 of file dpllt_basic.cpp.
References SatSolver::Create(), SATDLevelHook(), SATDecisionHook(), SATAssignmentHook(), and SATDeductionHook().
Referenced by DPLLTBasic(), pop(), checkSat(), and continueCheck().
void DPLLTBasic::generate_CDB | ( | CNF_Formula_Impl & | cnf | ) | [private] |
Definition at line 147 of file dpllt_basic.cpp.
References SAT::CNF_Formula_Impl::numVars(), SAT::CNF_Formula_Impl::simplify(), SAT::CNF_Formula_Impl::end(), and SAT::CNF_Formula_Impl::begin().
Referenced by addNewClauses(), checkSat(), and continueCheck().
void DPLLTBasic::handle_result | ( | SatSolver::SATStatus | outcome | ) | [private] |
Definition at line 170 of file dpllt_basic.cpp.
References SATISFIABLE, UNSATISFIABLE, and std::endl().
Referenced by checkSat(), and continueCheck().
void DPLLTBasic::verify_solution | ( | ) | [private] |
Definition at line 215 of file dpllt_basic.cpp.
References SatSolver::Clause::IsNull(), and DebugAssert.
Referenced by checkSat(), and continueCheck().
void DPLLTBasic::addNewClause | ( | const Clause & | c | ) |
Definition at line 275 of file dpllt_basic.cpp.
References DebugAssert, SAT::Clause::size(), SAT::Clause::getMaxVar(), d_mng, SatSolver::NumVariables(), SAT::Clause::begin(), SAT::Clause::end(), cvc2SAT(), satSolver(), and SatSolver::AddClause().
void DPLLTBasic::addNewClauses | ( | CNF_Formula_Impl & | cnf | ) |
Definition at line 289 of file dpllt_basic.cpp.
References SAT::CNF_Formula_Impl::numVars(), d_mng, SatSolver::NumVariables(), SatSolver::AddVariables(), SAT::CNF_Formula_Impl::simplify(), SAT::CNF_Formula_Impl::end(), SAT::CNF_Formula_Impl::begin(), cvc2SAT(), SatSolver::AddClause(), and generate_CDB().
Referenced by SATDecisionHook(), SATAssignmentHook(), and SATDeductionHook().
SatSolver::Lit SAT::DPLLTBasic::cvc2SAT | ( | Lit | l | ) | [inline] |
Definition at line 64 of file dpllt_basic.h.
References SAT::Lit::isNull(), d_mng, SatSolver::MakeLit(), SatSolver::GetVar(), SAT::Lit::getVar(), and SAT::Lit::isPositive().
Referenced by SATDecisionHook(), addNewClause(), and addNewClauses().
Lit SAT::DPLLTBasic::SAT2cvc | ( | SatSolver::Lit | l | ) | [inline] |
Definition at line 68 of file dpllt_basic.h.
References SatSolver::Lit::IsNull(), d_mng, SatSolver::GetVarIndex(), SatSolver::GetVarFromLit(), and SatSolver::GetPhaseFromLit().
SatSolver* SAT::DPLLTBasic::satSolver | ( | ) | [inline] |
Definition at line 73 of file dpllt_basic.h.
References d_mng.
Referenced by SATAssignmentHook(), and addNewClause().
void DPLLTBasic::push | ( | ) | [virtual] |
Set a checkpoint for backtracking.
This should effectively save the current state of the solver. Note that it should also result in a call to TheoryAPI::push.
Implements SAT::DPLLT.
Definition at line 314 of file dpllt_basic.cpp.
References SAT::DPLLT::d_theoryAPI, SAT::DPLLT::TheoryAPI::push(), d_pushLevel, d_prevStackSize, d_mngStack, d_prevAStackSize, d_assertionsStack, d_readyPrev, and d_ready.
void DPLLTBasic::pop | ( | ) | [virtual] |
Restore checkpoint.
This should return the state to what it was immediately before the last call to push. In particular, if one or more calls to checkSat, continueCheck, or addAssertion have been made since the last push, these should be undone. Note also that in this case, a single call to DPLLT::pop may result in multiple calls to TheoryAPI::pop.
Implements SAT::DPLLT.
Definition at line 324 of file dpllt_basic.cpp.
References d_pushLevel, d_prevStackSize, d_prevAStackSize, d_readyPrev, d_assertionsStack, d_assertions, d_mngStack, d_mng, d_cnf, d_cnfStack, DebugAssert, d_ready, createManager(), SAT::DPLLT::d_theoryAPI, and SAT::DPLLT::TheoryAPI::pop().
void DPLLTBasic::addAssertion | ( | const CNF_Formula & | cnf | ) | [virtual] |
Add new clauses to the SAT solver.
This is used to add clauses that form a "context" for the next call to checkSat
Implements SAT::DPLLT.
Definition at line 379 of file dpllt_basic.cpp.
References SAT::CNF_Formula::end(), SAT::CNF_Formula::begin(), SAT::DPLLT::d_theoryAPI, and SAT::DPLLT::TheoryAPI::assertLit().
std::vector< SAT::Lit > DPLLTBasic::getCurAssignments | ( | ) | [virtual] |
Implements SAT::DPLLT.
Definition at line 368 of file dpllt_basic.cpp.
std::vector< std::vector< SAT::Lit > > DPLLTBasic::getCurClauses | ( | ) | [virtual] |
Implements SAT::DPLLT.
Definition at line 373 of file dpllt_basic.cpp.
QueryResult DPLLTBasic::checkSat | ( | const CNF_Formula & | cnf | ) | [virtual] |
Check the satisfiability of a set of clauses in the current context.
If the result is SATISFIABLE, UNKNOWN, or ABORT, the DPLLT engine should remain in the state it is in until pop() is called. If the result is UNSATISFIABLE, the DPLLT engine should return to the state it was in when called. Note that it should be possible to call checkSat multiple times, even if the result is true (each additional call should use the context left by the previous call).
Implements SAT::DPLLT.
Definition at line 396 of file dpllt_basic.cpp.
References d_ready, d_cnfStack, d_cnf, d_mng, SatSolver::NumVariables(), SatSolver::GetVarAssignment(), SatSolver::GetVar(), SAT::CNF_Formula_Impl::newClause(), SAT::CNF_Formula::addLiteral(), d_mngStack, DebugAssert, createManager(), d_assertions, generate_CDB(), SAT::DPLLT::d_theoryAPI, SAT::DPLLT::TheoryAPI::push(), SatSolver::Satisfiable(), SatSolver::SATISFIABLE, SAT::DPLLT::theoryAPI(), verify_solution(), SAT::CD_CNF_Formula::numClauses(), d_assertionsStack, d_cm, CVC3::ContextManager::getCurrentContext(), handle_result(), SatSolver::UNSATISFIABLE, SAT::DPLLT::TheoryAPI::pop(), UNSATISFIABLE, SATISFIABLE, and CVC3::ABORT.
QueryResult DPLLTBasic::continueCheck | ( | const CNF_Formula & | cnf | ) | [virtual] |
Continue checking the last check with additional constraints.
Should only be called after a previous call to checkSat (or continueCheck) that returned SATISFIABLE. It should add the clauses in cnf to the existing clause database and search for a satisfying assignment. As with checkSat, if the result is not UNSATISFIABLE, the DPLLT engine should remain in the state containing the satisfiable assignment until pop() is called. Similarly, if the result is UNSATISFIABLE, the DPLLT engine should return to the state it was in when checkSat was last called.
Implements SAT::DPLLT.
Definition at line 472 of file dpllt_basic.cpp.
References d_ready, d_assertions, SAT::CD_CNF_Formula::numClauses(), generate_CDB(), d_mng, SatSolver::Continue(), SatSolver::SATISFIABLE, SAT::DPLLT::theoryAPI(), verify_solution(), handle_result(), SatSolver::UNSATISFIABLE, SAT::DPLLT::d_theoryAPI, SAT::DPLLT::TheoryAPI::pop(), d_cnf, d_mngStack, createManager(), d_cnfStack, DebugAssert, UNSATISFIABLE, SATISFIABLE, and CVC3::ABORT.
Get value of variable: unassigned, false, or true.
Implements SAT::DPLLT.
Definition at line 85 of file dpllt_basic.h.
References d_mng, SatSolver::GetVarAssignment(), and SatSolver::GetVar().
CVC3::Proof DPLLTBasic::getSatProof | ( | CNF_Manager * | , |
CVC3::TheoryCore * | |||
) | [virtual] |
Get the proof from SAT engine.
Implements SAT::DPLLT.
Definition at line 522 of file dpllt_basic.cpp.
CVC3::ContextManager* SAT::DPLLTBasic::d_cm [private] |
Definition at line 34 of file dpllt_basic.h.
Referenced by DPLLTBasic(), and checkSat().
bool SAT::DPLLTBasic::d_ready [private] |
Definition at line 36 of file dpllt_basic.h.
Referenced by push(), pop(), checkSat(), and continueCheck().
SatSolver* SAT::DPLLTBasic::d_mng [private] |
Definition at line 37 of file dpllt_basic.h.
Referenced by ~DPLLTBasic(), addNewClause(), addNewClauses(), pop(), checkSat(), continueCheck(), cvc2SAT(), SAT2cvc(), satSolver(), and getValue().
CNF_Formula_Impl* SAT::DPLLTBasic::d_cnf [private] |
Definition at line 38 of file dpllt_basic.h.
Referenced by DPLLTBasic(), ~DPLLTBasic(), pop(), checkSat(), and continueCheck().
CD_CNF_Formula* SAT::DPLLTBasic::d_assertions [private] |
Definition at line 39 of file dpllt_basic.h.
Referenced by DPLLTBasic(), ~DPLLTBasic(), pop(), checkSat(), and continueCheck().
std::vector<SatSolver*> SAT::DPLLTBasic::d_mngStack [private] |
Definition at line 41 of file dpllt_basic.h.
Referenced by ~DPLLTBasic(), push(), pop(), checkSat(), and continueCheck().
std::vector<CNF_Formula_Impl*> SAT::DPLLTBasic::d_cnfStack [private] |
Definition at line 42 of file dpllt_basic.h.
Referenced by ~DPLLTBasic(), pop(), checkSat(), and continueCheck().
Definition at line 43 of file dpllt_basic.h.
Referenced by ~DPLLTBasic(), push(), pop(), and checkSat().
bool SAT::DPLLTBasic::d_printStats [private] |
Definition at line 44 of file dpllt_basic.h.
CVC3::CDO<unsigned> SAT::DPLLTBasic::d_pushLevel [private] |
Definition at line 46 of file dpllt_basic.h.
CVC3::CDO<bool> SAT::DPLLTBasic::d_readyPrev [private] |
Definition at line 47 of file dpllt_basic.h.
CVC3::CDO<unsigned> SAT::DPLLTBasic::d_prevStackSize [private] |
Definition at line 48 of file dpllt_basic.h.
CVC3::CDO<unsigned> SAT::DPLLTBasic::d_prevAStackSize [private] |
Definition at line 49 of file dpllt_basic.h.