initialize variables
authorKshitij Bansal <kshitij@cs.nyu.edu>
Fri, 4 Jul 2014 19:34:40 +0000 (15:34 -0400)
committerKshitij Bansal <kshitij@cs.nyu.edu>
Fri, 4 Jul 2014 19:34:40 +0000 (15:34 -0400)
src/main/portfolio_util.cpp
src/prop/bvminisat/core/Solver.cc
src/theory/bv/bv_subtheory_algebraic.cpp
src/theory/bv/bv_subtheory_algebraic.h

index cfaa76aa8f27d6e3db0c0a1fc373980706ba8c20..af8d463cb037873f0dfb5c524449ac165f7928fa 100644 (file)
@@ -80,7 +80,7 @@ vector<Options> parseThreadSpecificOptions(Options opts)
         }
       }
       free(targv[0]);
-      delete targv;
+      delete [] targv;
       free(tbuf);
     }
   }
index e54c8d17443d9dd3855687e41cf4f74c8c649978..b6238460b64e55d2c927e7aed3e0577ef1cac43d 100644 (file)
@@ -135,6 +135,15 @@ Solver::Solver(CVC4::context::Context* c) :
   , progress_estimate  (0)
   , remove_satisfied   (true)
 
+  , ca                 ()
+
+  // even though these are temporaries and technically should be set
+  // before calling, lets intialize them. this will reduces chances of
+  // non-determinism in portfolio (parallel) solver if variables are
+  // being (incorrectly) used without initialization.
+  , seen(),  analyze_stack(), analyze_toclear(), add_tmp()
+  , max_learnts(0.0), learntsize_adjust_confl(0.0), learntsize_adjust_cnt(0)
+
     // Resource constraints:
     //
   , conflict_budget    (-1)
index 750e67a2d433b1d95c4a33878ff33991d838caad..9dd86b5eacc5c1c959c0ffc6d719a76f5c4b1077 100644 (file)
@@ -193,6 +193,10 @@ AlgebraicSolver::AlgebraicSolver(context::Context* c, TheoryBV* bv)
   , d_isDifficult(c, false)
   , d_budget(options::bitvectorAlgebraicBudget())
   , d_explanations()
+  , d_inputAssertions()
+  , d_ids()
+  , d_numSolved(0)
+  , d_numCalls(0)
   , d_ctx(new context::Context())
   , d_quickXplain(options::bitvectorQuickXplain() ? new QuickXPlain("alg", d_quickSolver) : NULL)
   , d_statistics()
@@ -641,7 +645,7 @@ bool AlgebraicSolver::useHeuristic() {
   if (d_numCalls == 0)
     return true;
   
-  double success_rate = d_numSolved/d_numCalls;
+  double success_rate = double(d_numSolved)/double(d_numCalls);
   d_statistics.d_useHeuristic.setData(success_rate);
   return success_rate > 0.8;
 }
index a39631696b93b3d415422afcf430f6ef7320cb64..fbc8c3ff0350fa4175ce3ac4d25d11a5ccdd14f0 100644 (file)
@@ -174,8 +174,8 @@ class AlgebraicSolver : public SubtheorySolver {
   std::vector<Node> d_explanations; /**< explanations for assertions indexed by assertion id */
   TNodeSet d_inputAssertions;   /**< assertions in current context (for debugging purposes only) */
   NodeIdMap d_ids;              /**< map from assertions to ids */
-  double d_numSolved;
-  double d_numCalls;
+  uint64_t d_numSolved;
+  uint64_t d_numCalls;
 
   context::Context* d_ctx;
   QuickXPlain* d_quickXplain;   /**< separate quickXplain module as it can reuse the current SAT solver */