added support for dumping the SAT problem the sat solver is working on
authorlianah <lianahady@gmail.com>
Mon, 8 Apr 2013 19:31:08 +0000 (15:31 -0400)
committerlianah <lianahady@gmail.com>
Mon, 8 Apr 2013 19:31:08 +0000 (15:31 -0400)
src/prop/minisat/core/Solver.h
src/prop/minisat/simp/SimpSolver.cc
src/prop/options

index 9338f9b557ad4af9ea09766c30df84dcbe6eccd2..55780479abc502641e1fad9533ee603b775768a3 100644 (file)
@@ -173,6 +173,7 @@ public:
     bool    solve        (Lit p, Lit q, Lit r);     // Search for a model that respects three assumptions.
     bool    okay         () const;                  // FALSE means solver is in a conflicting state
 
+    void    toDimacs     (); 
     void    toDimacs     (FILE* f, const vec<Lit>& assumps);            // Write CNF to file in DIMACS-format.
     void    toDimacs     (const char *file, const vec<Lit>& assumps);
     void    toDimacs     (FILE* f, Clause& c, vec<Var>& map, Var& max);
@@ -539,12 +540,14 @@ inline bool     Solver::solve         (const vec<Lit>& assumps){ budgetOff(); as
 inline lbool    Solver::solveLimited  (const vec<Lit>& assumps){ assumps.copyTo(assumptions); return solve_(); }
 inline bool     Solver::okay          ()      const   { return ok; }
 
+inline void     Solver::toDimacs     () { vec<Lit> as; toDimacs(stdout, as); }
 inline void     Solver::toDimacs     (const char* file){ vec<Lit> as; toDimacs(file, as); }
 inline void     Solver::toDimacs     (const char* file, Lit p){ vec<Lit> as; as.push(p); toDimacs(file, as); }
 inline void     Solver::toDimacs     (const char* file, Lit p, Lit q){ vec<Lit> as; as.push(p); as.push(q); toDimacs(file, as); }
 inline void     Solver::toDimacs     (const char* file, Lit p, Lit q, Lit r){ vec<Lit> as; as.push(p); as.push(q); as.push(r); toDimacs(file, as); }
 
 
+
 //=================================================================================================
 // Debug etc:
 
index 9c3e59954e38ea9148e6167d10afbefd606c75c5..0e0e5d3ae8fe54ab0ef01ee25b44fbfaa36ea5d2 100644 (file)
@@ -113,6 +113,10 @@ Var SimpSolver::newVar(bool sign, bool dvar, bool isTheoryAtom, bool preRegister
 
 lbool SimpSolver::solve_(bool do_simp, bool turn_off_simp)
 {
+    if (options::minisatDumpDimacs()) {
+      toDimacs(); 
+      return l_Undef; 
+    }
     popTrail();
 
     vec<Var> extra_frozen;
index cda99538c053dd98f3a273c8e3ca56ac6a7587d5..e3a0f814a20a40ba36b85bec56312e905615bf9c 100644 (file)
@@ -28,4 +28,7 @@ option sat_refine_conflicts --refine-conflicts bool
 option minisatUseElim --minisat-elimination bool :default true :read-write 
  use Minisat elimination
 
+option minisatDumpDimacs --minisat-dump-dimacs bool :default false
+ instead of solving minisat dumps the asserted clauses in Dimacs format
 endmodule