Refactoring ...
authorHamed Gorjiara <hgorjiar@uci.edu>
Thu, 2 Aug 2018 19:45:17 +0000 (12:45 -0700)
committerHamed Gorjiara <hgorjiar@uci.edu>
Thu, 2 Aug 2018 19:45:17 +0000 (12:45 -0700)
src/Collections/corestructs.cc [new file with mode: 0644]
src/Collections/corestructs.h
src/csolver.cc

diff --git a/src/Collections/corestructs.cc b/src/Collections/corestructs.cc
new file mode 100644 (file)
index 0000000..ba9bf91
--- /dev/null
@@ -0,0 +1,10 @@
+#include "classlist.h"
+#include "corestructs.h"
+#include "boolean.h"
+
+void BooleanEdge::print(){
+       if (isNegated())
+               model_print("!");
+       b->print();
+       model_print("\n");
+}
\ No newline at end of file
index b0ff819..8f34078 100644 (file)
@@ -23,10 +23,13 @@ public:
        operator bool() {
                return getBoolean() != NULL;
        }
+        void print();
 private:
        Boolean *b;
 };
 
+
+
 inline bool boolEdgeEquals(BooleanEdge b1, BooleanEdge b2) {
        return b1 == b2;
 }
index b42dbe0..f7ea101 100644 (file)
@@ -512,7 +512,6 @@ void CSolver::addConstraint(BooleanEdge constraint) {
        if (isTrue(constraint))
                return;
        else if (isFalse(constraint)) {
-               int t = 0;
                setUnSAT();
        }
        else {
@@ -608,7 +607,7 @@ int CSolver::solve() {
 
        ElementOpt eop(this);
        eop.doTransform();
-       
+
        EncodingGraph eg(this);
        eg.buildGraph();
        eg.encode();
@@ -639,10 +638,7 @@ void CSolver::printConstraints() {
        SetIteratorBooleanEdge *it = getConstraints();
        while (it->hasNext()) {
                BooleanEdge b = it->next();
-               if (b.isNegated())
-                       model_print("!");
-               b->print();
-               model_print("\n");
+               b.print();
        }
        delete it;
 }
@@ -692,20 +688,4 @@ void CSolver::autoTune(uint budget) {
        delete autotuner;
 }
 
-//Set* CSolver::addItemsToRange(Element* element, uint num, ...){
-//        va_list args;
-//        va_start(args, num);
-//        element->getRange()
-//        uint setSize = set->getSize();
-//        uint newSize = setSize+ num;
-//        uint64_t members[newSize];
-//        for(uint i=0; i<setSize; i++){
-//                members[i] = set->getElement(i);
-//        }
-//        for( uint i=0; i< num; i++){
-//                uint64_t arg = va_arg(args, uint64_t);
-//                members[setSize+i] = arg;
-//        }
-//        va_end(args);
-//        return createSet(set->getType(), members, newSize);
-//}
+