Skip to content

Commit fa4e987

Browse files
committed
Correct unate polarity assignments
1 parent cb2d173 commit fa4e987

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/main.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,9 @@ void find_unate()
556556
if (conf.verb){
557557
cout<<"test var "<<var+1<< endl;}
558558
assumptions.pop_back();
559-
assumptions.push_back(Lit(Yvar_to_Ypvar[var], true));
560-
assumptions.push_back(Lit(var, false));
559+
// Positive unate test: check UNSAT of F(y=0) & ~F(y'=1)
560+
assumptions.push_back(Lit(Yvar_to_Ypvar[var], false)); // y' = 1
561+
assumptions.push_back(Lit(var, true)); // y = 0
561562
if (conf.verb){cout<<"assumptions : "<<assumptions<<endl;}
562563
solver->set_max_confl(50);
563564
solver->set_no_confl_needed();
@@ -578,17 +579,18 @@ void find_unate()
578579
if (ret == l_False) {
579580
postive_unate.push_back(var);
580581
tmp.clear();
581-
tmp.push_back(Lit(var,true));
582+
tmp.push_back(Lit(var,false)); // fix y = 1
582583
solver->add_clause(tmp);
583584
if (conf.verb){cout<<"positive unate : added clause : "<<tmp<<endl;}
584585
tmp.clear();
585-
tmp.push_back(Lit(Yvar_to_Ypvar[var],true));
586+
tmp.push_back(Lit(Yvar_to_Ypvar[var],false)); // fix y' = 1
586587
if (conf.verb){cout<<"positive unate : added clause : "<<tmp<<endl;}
587588
solver->add_clause(tmp);
588589
}
589590
else {
590-
assumptions.push_back(Lit(Yvar_to_Ypvar[var], false));
591-
assumptions.push_back(Lit(var, true));
591+
// Negative unate test: check UNSAT of F(y=1) & ~F(y'=0)
592+
assumptions.push_back(Lit(Yvar_to_Ypvar[var], true)); // y' = 0
593+
assumptions.push_back(Lit(var, false)); // y = 1
592594
if (conf.verb){cout<<" Not positive unate .. Searching for negative unate"<<endl;
593595
cout<<"assumptions : "<<assumptions<<endl;}
594596
solver->set_max_confl(50);
@@ -605,11 +607,11 @@ void find_unate()
605607
if (ret == l_False) {
606608
negative_unate.push_back(var);
607609
tmp.clear();
608-
tmp.push_back(Lit(var,false));
610+
tmp.push_back(Lit(var,true)); // fix y = 0
609611
solver->add_clause(tmp);
610612
if (conf.verb){cout<<"negative unate : added clause : "<<tmp<<endl;}
611613
tmp.clear();
612-
tmp.push_back(Lit(Yvar_to_Ypvar[var],false));
614+
tmp.push_back(Lit(Yvar_to_Ypvar[var],true)); // fix y' = 0
613615
if (conf.verb){cout<<"negative unate : added clause : "<<tmp<<endl;}
614616
solver->add_clause(tmp);
615617
}

0 commit comments

Comments
 (0)