Skip to content

Commit

Permalink
The output of unsat atoms now support probability calculation of the …
Browse files Browse the repository at this point in the history
…model using python sympy lib
  • Loading branch information
samidhtalsania committed Dec 2, 2016
1 parent 54d89a9 commit 2878820
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lpmln2wc_src/lpmln2wc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ int main(int argc, char **argv){
// W H. or H.

split(splitVecSpace, splitVec[0], is_any_of(" "), token_compress_on);
//Process soft rules of form W H.
try{

weight = (int)(stof(splitVecSpace[0]));
Expand All @@ -202,6 +203,9 @@ int main(int argc, char **argv){
trim(newStr);
newStr.pop_back();

vars = ",0,"+ to_string(weight) + vars ;


tempstr = "unsat(" + to_string(unsatcount) + vars + ") :-";

tempstr += "not " + newStr + ".\n" + newStr + ":-" ;
Expand All @@ -213,6 +217,7 @@ int main(int argc, char **argv){
cout<<tempstr;
unsatcount++;
}
//Process hard rules of form H.
catch(const std::exception& ex){
// It could be of type H. Process it.

Expand All @@ -234,6 +239,8 @@ int main(int argc, char **argv){
vars = "," + vars;
}

vars = ",1" + vars ;

string tempstr = "unsat("+to_string(unsatcount)+vars+") :- not " + str + ".\n" +
str + " :- not unsat(" + to_string(unsatcount) +vars+ ").\n" +
":~ unsat(" + to_string(unsatcount) +vars+"). [1@1," + to_string(unsatcount) + vars+ "]";
Expand Down Expand Up @@ -289,6 +296,12 @@ int main(int argc, char **argv){


splitVec[1].pop_back();
string probString = "";

if(issoft) probString += ",0,"+to_string(weight);
else probString += ",1";

vars = probString + vars;

if(splitVecSpace.size() == 1){
//W :- B
Expand Down

0 comments on commit 2878820

Please sign in to comment.