Preprocessing check
authorHamed Gorjiara <hgorjiar@uci.edu>
Thu, 6 Dec 2018 23:08:50 +0000 (15:08 -0800)
committerHamed Gorjiara <hgorjiar@uci.edu>
Thu, 6 Dec 2018 23:08:50 +0000 (15:08 -0800)
src/ASTTransform/preprocess.cc
src/csolver.cc
src/csolver.h

index 1e60c19..7b4877b 100644 (file)
@@ -13,7 +13,7 @@ Preprocess::~Preprocess() {
 }
 
 void Preprocess::doTransform() {
-       if (solver->getTuner()->getTunable(PREPROCESS, &onoff) == 0)
+       if (!solver->isBooleanVarUsed() && solver->getTuner()->getTunable(PREPROCESS, &onoff) == 0)
                return;
 
        BooleanIterator bit(solver);
index fbe0dd0..45163be 100644 (file)
@@ -34,6 +34,7 @@ CSolver::CSolver() :
        boolTrue(BooleanEdge(new BooleanConst(true))),
        boolFalse(boolTrue.negate()),
        unsat(false),
+       booleanVarUsed(false),
        tuner(NULL),
        elapsedTime(0),
        satsolverTimeout(NOTIMEOUT)
@@ -136,6 +137,7 @@ void CSolver::resetSolver() {
        boolTrue = BooleanEdge(new BooleanConst(true));
        boolFalse = boolTrue.negate();
        unsat = false;
+       booleanVarUsed = false;
        elapsedTime = 0;
        tuner = NULL;
        satEncoder->resetSATEncoder();
@@ -308,6 +310,8 @@ Function *CSolver::completeTable(Table *table, UndefinedBehavior behavior) {
 BooleanEdge CSolver::getBooleanVar(VarType type) {
        Boolean *boolean = new BooleanVar(type);
        allBooleans.push(boolean);
+       if(!booleanVarUsed)
+               booleanVarUsed = true;
        return BooleanEdge(boolean);
 }
 
index 16937dd..c604486 100644 (file)
@@ -141,7 +141,7 @@ public:
        void setUnSAT() { model_print("Setting UNSAT %%%%%%\n"); unsat = true; }
        void setSatSolverTimeout(long seconds) { satsolverTimeout = seconds;}
        bool isUnSAT() { return unsat; }
-
+        bool isBooleanVarUsed(){return booleanVarUsed;}
        void printConstraint(BooleanEdge boolean);
        void printConstraints();
 
@@ -218,7 +218,8 @@ private:
 
        SATEncoder *satEncoder;
        bool unsat;
-       Tuner *tuner;
+        bool booleanVarUsed;
+        Tuner *tuner;
        long long elapsedTime;
        long satsolverTimeout;
        friend class ElementOpt;