void EncodingGraph::encode() {
- if (solver->getTuner()->getTunable(ENCODINGGRAPHOPT, &offon) == 0)
+ if (solver->isUnSAT() || solver->getTuner()->getTunable(ENCODINGGRAPHOPT, &offon) == 0)
return;
buildGraph();
SetIteratorEncodingSubGraph *itesg = subgraphs.iterator();
#include "csolver.h"
void computePolarities(CSolver *This) {
+ if(This->isUnSAT()){
+ return;
+ }
SetIteratorBooleanEdge *iterator = This->getConstraints();
while (iterator->hasNext()) {
BooleanEdge boolean = iterator->next();
}
void DecomposeOrderTransform::doTransform() {
+ if(solver->isUnSAT())
+ return;
HashsetOrder *orders = solver->getActiveOrders()->copy();
SetIteratorOrder *orderit = orders->iterator();
while (orderit->hasNext()) {
}
void ElementOpt::doTransform() {
- if (solver->getTuner()->getTunable(ELEMENTOPT, &onoff) == 0)
+ if (solver->isUnSAT() || solver->getTuner()->getTunable(ELEMENTOPT, &onoff) == 0)
return;
//Set once we know we are going to use it.
}
void IntegerEncodingTransform::doTransform() {
+ if(solver->isUnSAT()){
+ return;
+ }
HashsetOrder *orders = solver->getActiveOrders()->copy();
SetIteratorOrder *orderit = orders->iterator();
while (orderit->hasNext()) {
}
void Preprocess::doTransform() {
- if (!solver->isBooleanVarUsed() || solver->getTuner()->getTunable(PREPROCESS, &onoff) == 0)
+ if (solver->isUnSAT() || !solver->isBooleanVarUsed() || solver->getTuner()->getTunable(PREPROCESS, &onoff) == 0)
return;
BooleanIterator bit(solver);
}
void VarOrderingOpt::doTransform() {
+ if(solver->isUnSAT()){
+ return;
+ }
BooleanVarOrdering direction = (BooleanVarOrdering)solver->getTuner()->getTunable(VARIABLEORDER, &boolVarOrderingDesc);
if ( direction == CONSTRAINTORDERING ) {
return;
}
void SATEncoder::encodeAllSATEncoder(CSolver *csolver) {
+ if(csolver->isUnSAT()){
+ return;
+ }
SetIteratorBooleanEdge *iterator = csolver->getConstraints();
while (iterator->hasNext()) {
BooleanEdge constraint = iterator->next();
#include <strings.h>
void naiveEncodingDecision(CSolver *This) {
+ if(This->isUnSAT()){
+ return;
+ }
SetIteratorBooleanEdge *iterator = This->getConstraints();
while (iterator->hasNext()) {
BooleanEdge b = iterator->next();
}
for (int i = 1; i < argc; i++) {
CSolver *solver = CSolver::deserialize(argv[i]);
+ solver->printConstraints();
int value = solver->solve();
if (value == 1) {
printf("%s is SAT\n", argv[i]);
} else {
printf("%s is UNSAT\n", argv[i]);
}
- solver->printConstraints();
delete solver;
}
JAVAC := javac
UNAME := $(shell uname)
-JAVA_INC := /usr/lib/jvm/java-1.8.0-openjdk-amd64/include/
+JAVA_INC := /usr/lib/jvm/default-java/include/
LIB_NAME := cons_comp
LIB_SO := lib_$(LIB_NAME).so
}
int CSolver::solve() {
+ if(isUnSAT()){
+ return IS_UNSAT;
+ }
long long startTime = getTimeNano();
bool deleteTuner = false;
if (tuner == NULL) {
time2 = getTimeNano();
model_print("Encoding Graph Time: %f\n", (time2 - time1) / NANOSEC);
-
+
satEncoder->encodeAllSATEncoder(this);
time1 = getTimeNano();
/** When everything is done, the client calls this function and then csolver starts to encode*/
int solve();
-
+
/** After getting the solution from the SAT solver, client can get the value of an element via this function*/
uint64_t getElementValue(Element *element);