Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ dsharp
*.dot
*.nnf
*.png
*.o
6 changes: 5 additions & 1 deletion src/src_sharpSAT/MainSolver/MainSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,11 @@ bool CMainSolver::prepBCP(LiteralIdT firstLit)
CVariableVertex *pV;

for (unsigned int i = 0; i < impls.size(); i++)
if (getVar(impls[i]).setVal(impls[i].polarity(), 0))

if (getVar(impls[i]).getVal() == impls[i].oppositeLit().polarityTriVal())
return false;

else if (getVar(impls[i]).setVal(impls[i].polarity(), 0))
{
unLit = impls[i].oppositeLit();
satLit = impls[i];
Expand Down
17 changes: 15 additions & 2 deletions src/src_sharpSAT/MainSolver/MainSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ class CMainSolver: public CInstanceGraph
stopWatch.setTimeBound(i);
}

void writeBDG(const char *fileName)
void writeBDG(const char *fileName, bool falsify=false)
{
set<int> nodesSeen;
set<int> litsSeen;
Expand All @@ -283,6 +283,12 @@ class CMainSolver: public CInstanceGraph

out << "digraph backdoorgraph {" << endl;

if (falsify) {
out << " root [label=\"OR\"];" << endl;
out << "}" << endl;
return;
}

// First add the root
if (1 == decStack.top().getDTNode()->numChildren())
openList.push(decStack.top().getDTNode()->onlyChild());
Expand Down Expand Up @@ -409,9 +415,16 @@ class CMainSolver: public CInstanceGraph

}

void writeNNF(const char *fileName)
void writeNNF(const char *fileName, bool falsify=false)
{
ofstream out(fileName);

if (falsify) {
out << "nnf 1 0 0" << endl;
out << "O 0 0" << endl;
return;
}

vector<DTNode*> *nodeList = new vector<DTNode*> ();

DTNode* root;
Expand Down
9 changes: 5 additions & 4 deletions src/src_sharpSAT/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,17 @@ int main(int argc, char *argv[])
if (fileout)
theRunAn.getData().writeToFile(dataFile);

bool falsify = false;
if (0 == theRunAn.getData().getNumSatAssignments()) {
cout << "\nTheory is unsat. Skipping file output.\n" << endl;
return 0;
cout << "\nTheory is unsat. Resetting d-DNNF to empty Or.\n" << endl;
falsify = true;
}

if (graphFileout)
theSolver.writeBDG(graphFile);
theSolver.writeBDG(graphFile, falsify);

if (nnfFileout)
theSolver.writeNNF(nnfFile);
theSolver.writeNNF(nnfFile, falsify);

return 0;
}