diff --git a/include/Solver.hh b/include/Solver.hh index e79bd6c..deabece 100644 --- a/include/Solver.hh +++ b/include/Solver.hh @@ -103,6 +103,8 @@ class Solver{ int nPropagations=0; //!< number of propagations int nDecisions=0; //!< number of decisions + int best_var; + std::vector> prove; //!< Structure to get the counterexample @@ -127,6 +129,7 @@ class Solver{ //!< Decay activities float* activity; + float percentage; /** @@ -161,6 +164,8 @@ bool canBeSAT(); #endif + void reset_scores(); + /** * Select new variable */ diff --git a/lib/CommandLineInterface.hh b/lib/CommandLineInterface.hh index f98e0f7..f3dc659 100644 --- a/lib/CommandLineInterface.hh +++ b/lib/CommandLineInterface.hh @@ -106,6 +106,7 @@ namespace tabular{ node* curr=prove.begin(); while(!prove.ended(curr)){ std::cout<left->key_value<<"&"<right->key_value<<"="<key_value<<"\n"; +// if(curr->key_value.size()>0) break; curr=curr->next(); } } @@ -136,6 +137,7 @@ namespace tabular{ while(!prove.ended(curr)){ fout<<"\""<left->key_value<<"\" -> "<<"\""<key_value<<"\";\n"; fout<<"\""<right->key_value<<"\" -> "<<"\""<key_value<<"\";\n"; +// if(curr->key_value.size()>0) break; curr=curr->next(); } } diff --git a/release/SATIVA.cc b/release/SATIVA.cc index 9da95e6..976f197 100644 --- a/release/SATIVA.cc +++ b/release/SATIVA.cc @@ -20,6 +20,10 @@ void launchOnPig(Solver* solver); int main(int argc, char** argv){ + +#if VERBOSE + system("setterm -cursor off"); +#endif for(int i=1; i[(2*nL)+1]; watches=watches+nL; reason= new Clause[(2*nL)+1]; @@ -287,10 +288,26 @@ Literal Solver::select(){ return branch_variable; }; +void Solver::reset_scores(){ + for(int i=-nLiterals;i"); + for(;i<=41;++i)printf(" "); + printf("%3d%%]\r",(int)((percentage*4)*100)); +#endif Clause* conflict=propagate(); if(conflict!=nullptr){ //!< Exist a conflict +#if VERBOSE +#endif nConflicts++; std::vector to_learn;int btLevel; if(decisionLevel()==root_level){ @@ -301,12 +318,17 @@ bool Solver::CDCL(){ btLevel=analyze(conflict, to_learn); backtrack(btLevel); record(to_learn); - decayActivity(); }else{ #if ASSERT assert(canBeSAT()); #endif - if(decisionLevel()==0) simplify(); + if(decisionLevel()==0){ + simplify(); + decayActivity(); +#if VERBOSE + percentage=((float)nAssigns())/((float)nLiterals); +#endif + } if(learnts.size()-nAssigns()>=learnts.size()) reduceLearnts(); if(nAssigns()==nLiterals) return true; else if(nConflicts>max_conflict) { @@ -335,9 +357,6 @@ void Solver::simplify(){ x->del(); } } -#if VERBOSE - if(deletedClauses-tmp>0) std::cout<<"Deleted clauses: "<