Fixing the Integer encoding ...
authorHamed <hamed.gorjiara@gmail.com>
Sat, 26 Aug 2017 00:42:38 +0000 (17:42 -0700)
committerHamed <hamed.gorjiara@gmail.com>
Sat, 26 Aug 2017 00:42:38 +0000 (17:42 -0700)
src/ASTAnalyses/orderencoder.h
src/ASTTransform/integerencoding.cc

index fa3089f..19240cf 100644 (file)
@@ -12,7 +12,6 @@
 #include "mymemory.h"
 
 void computeStronglyConnectedComponentGraph(OrderGraph *graph);
-void orderAnalysis(CSolver *solver);
 void initializeNodeInfoSCC(OrderGraph *graph);
 void DFSNodeVisit(OrderNode *node, Vector<OrderNode *> *finishNodes, bool isReverse, bool mustvisit, uint sccNum);
 void DFS(OrderGraph *graph, Vector<OrderNode *> *finishNodes);
index ff384cb..bada3f0 100644 (file)
@@ -6,25 +6,24 @@
 #include "predicate.h"
 #include "element.h"
 #include "rewriter.h"
+#include "set.h"
+
 
-/*
 void orderIntegerEncodingSATEncoder(SATEncoder *This, BooleanOrder *boolOrder){
        Order* order = boolOrder->order;
        if (order->elementTable == NULL) {
                order->initializeOrderElementsHashTable();
        }
        //getting two elements and using LT predicate ...
-       Element* elem1 = getOrderIntegerElement(This, order, boolOrder->first);
-       Element* elem2 = getOrderIntegerElement(This, order, boolOrder->second);
-       Set * sarray[]={order->auxSet, order->auxSet};
+       ElementSet* elem1 = (ElementSet*)getOrderIntegerElement(This, order, boolOrder->first);
+       ElementSet* elem2 = (ElementSet*)getOrderIntegerElement(This, order, boolOrder->second);
+       Set * sarray[]={elem1->set, elem2->set};
        Predicate *predicate =new PredicateOperator(LT, sarray, 2);
        Element * parray[]={elem1, elem2};
        BooleanPredicate * boolean=new BooleanPredicate(predicate, parray, 2, NULL);
        {//Adding new elements and boolean/predicate to solver regarding memory management
                This->solver->allBooleans.push(boolean);
                This->solver->allPredicates.push(predicate);
-               This->solver->allElements.push(elem1);
-               This->solver->allElements.push(elem2);
                This->solver->constraints.add(boolean);
        }
        replaceBooleanWithBoolean(This->solver, boolOrder, boolean);
@@ -35,11 +34,13 @@ Element* getOrderIntegerElement(SATEncoder* This,Order *order, uint64_t item) {
        HashSetOrderElement* eset = order->elementTable;
        OrderElement oelement ={item, NULL};
        if( !eset->contains(&oelement)){
-               Element* elem = new ElementSet(order->auxSet);
+               Set* set = new Set(order->set->type, 1, (uint64_t) order->set->getSize());
+               Element* elem = new ElementSet(set);
                eset->add(allocOrderElement(item, elem));
+               This->solver->allElements.push(elem);
+               This->solver->allSets.push(set);
                return elem;
        } else
                return eset->get(&oelement)->elem;
 }
 
-*/