#include "sattranslator.h"
#include "tunable.h"
#include "polarityassignment.h"
-#include "analyzer.h"
+#include "transformer.h"
#include "autotuner.h"
#include "astops.h"
#include "structs.h"
elapsedTime(0)
{
satEncoder = new SATEncoder(this);
+ transformer = new Transformer(this);
}
/** This function tears down the solver and the entire AST */
delete boolTrue;
delete boolFalse;
delete satEncoder;
+ delete transformer;
}
CSolver *CSolver::clone() {
return set;
}
+Element *CSolver::createRangeVar(VarType type, uint64_t lowrange, uint64_t highrange) {
+ Set *s = createRangeSet(type, lowrange, highrange);
+ return getElementVar(s);
+}
+
MutableSet *CSolver::createMutableSet(VarType type) {
MutableSet *set = new MutableSet(type);
allSets.push(set);
}
}
+bool CSolver::isTrue(Boolean *b) {
+ return b->isTrue();
+}
+
+bool CSolver::isFalse(Boolean *b) {
+ return b->isFalse();
+}
+
+Boolean *CSolver::applyLogicalOperation(LogicOp op, Boolean * arg1, Boolean * arg2) {
+ Boolean * array[] = {arg1, arg2};
+ return applyLogicalOperation(op, array, 2);
+}
+
+Boolean *CSolver::applyLogicalOperation(LogicOp op, Boolean *arg) {
+ Boolean * array[] = {arg};
+ return applyLogicalOperation(op, array, 1);
+}
+
+
Boolean *CSolver::applyLogicalOperation(LogicOp op, Boolean **array, uint asize) {
Boolean * newarray[asize];
switch(op) {
}
break;
}
+ case SATC_IFF: {
+ for(uint i=0;i<2;i++) {
+ if (array[i]->type == BOOLCONST) {
+ if (array[i]->isTrue()) {
+ return array[1-i];
+ } else {
+ newarray[0]=array[1-i];
+ return applyLogicalOperation(SATC_NOT, newarray, 1);
+ }
+ }
+ }
+ break;
+ }
case SATC_XOR: {
for(uint i=0;i<2;i++) {
if (array[i]->type == BOOLCONST) {
return order;
}
-int CSolver::startEncoding() {
+int CSolver::solve() {
bool deleteTuner = false;
if (tuner == NULL) {
tuner = new DefaultTuner();
long long startTime = getTimeNano();
computePolarities(this);
- orderAnalysis(this);
+ transformer->orderAnalysis();
naiveEncodingDecision(this);
satEncoder->encodeAllSATEncoder(this);
int result = unsat ? IS_UNSAT : satEncoder->solve();