dpllt_basic.h

Go to the documentation of this file.
00001 /*****************************************************************************/
00002 /*!
00003  *\file dpllt_basic.h
00004  *\brief Basic implementation of dpllt module based on xchaff
00005  *
00006  * Author: Clark Barrett
00007  *
00008  * Created: Mon Dec 12 19:06:58 2005
00009  */
00010 /*****************************************************************************/
00011 
00012 #ifndef _cvcl__sat__dpllt_basic_h_
00013 #define _cvcl__sat__dpllt_basic_h_
00014 
00015 #include "dpllt.h"
00016 #include "sat_api.h"
00017 
00018 namespace SAT {
00019 
00020 class DPLLTBasic :public DPLLT {
00021 
00022   SatSolver* d_mng;
00023   bool d_ready;
00024   bool d_popScopes;
00025   std::vector<SatSolver*> d_mngStack;
00026   std::vector<CNF_Formula_Impl*> d_cnfStack;
00027   bool d_printStats;
00028   CNF_Formula_Impl* d_cnf;
00029 
00030   void createManager();
00031   void generate_CDB (CNF_Formula_Impl& cnf);
00032   void handle_result(SatSolver::SATStatus outcome);
00033   void verify_solution();
00034 
00035 public:
00036   DPLLTBasic::DPLLTBasic(TheoryAPI* theoryAPI, Decider* decider,
00037                          bool printStats = false);
00038   virtual ~DPLLTBasic();
00039 
00040   bool popScopes(void) { return d_popScopes; }
00041 
00042   void addNewClause(const Clause& c);
00043   void addNewClauses(CNF_Formula_Impl& cnf);
00044 
00045   SatSolver::Lit cvcl2SAT(Lit l)
00046   { return l.isNull() ? SatSolver::Lit() :
00047       d_mng->MakeLit(d_mng->GetVar(l.getVar()), l.isPositive() ? 0 : 1); }
00048 
00049   Lit SAT2cvcl(SatSolver::Lit l)
00050   { return l.IsNull() ? Lit() :
00051                         Lit(d_mng->GetVarIndex(d_mng->GetVarFromLit(l)),
00052                             d_mng->GetPhaseFromLit(l) == 0); }
00053 
00054   SatSolver* satSolver() { return d_mng; }
00055 
00056   // Implementation of virtual DPLLT methods
00057   Result checkSat(const CNF_Formula& cnf);
00058   Result continueCheck(const CNF_Formula& cnf);
00059   Var::Val getValue(Var v) { return Var::Val(d_mng->GetVarAssignment(d_mng->GetVar(v))); }
00060   void returnFromSat();
00061   void reset(bool popScopes = false);
00062 
00063 };
00064 
00065 }
00066 
00067 #endif

Generated on Thu Apr 13 16:57:31 2006 for CVC Lite by  doxygen 1.4.4