fixed some warnings in bsat2

This commit is contained in:
Allen Ho 2024-03-04 10:16:14 +08:00
parent bfbec71211
commit d87b1cd543
5 changed files with 9 additions and 4 deletions

View File

@ -45,12 +45,14 @@ int Minisat::parseOptions(int& argc, char** argv, bool strict)
} }
if (!parsed_ok) if (!parsed_ok)
{
if (strict && match(argv[i], "-")) if (strict && match(argv[i], "-"))
{ fprintf(stderr, "ERROR! Unknown flag \"%s\". Use '--%shelp' for help.\n", argv[i], Option::getHelpPrefixString()); return 0; } // exit(0); { fprintf(stderr, "ERROR! Unknown flag \"%s\". Use '--%shelp' for help.\n", argv[i], Option::getHelpPrefixString()); return 0; } // exit(0);
else else
argv[j++] = argv[i]; argv[j++] = argv[i];
} }
} }
}
argc -= (i - j); argc -= (i - j);
return 1; return 1;

View File

@ -62,7 +62,7 @@ class Option
struct OptionLt { struct OptionLt {
bool operator()(const Option* x, const Option* y) { bool operator()(const Option* x, const Option* y) {
int test1 = strcmp(x->category, y->category); int test1 = strcmp(x->category, y->category);
return test1 < 0 || test1 == 0 && strcmp(x->type_name, y->type_name) < 0; return test1 < 0 || ( test1 == 0 && strcmp(x->type_name, y->type_name) < 0 );
} }
}; };

View File

@ -230,10 +230,12 @@ bool SimpSolver::merge(const Clause& _ps, const Clause& _qs, Var v, vec<Lit>& ou
if (var(qs[i]) != v){ if (var(qs[i]) != v){
for (j = 0; j < ps.size(); j++) for (j = 0; j < ps.size(); j++)
if (var(ps[j]) == var(qs[i])) if (var(ps[j]) == var(qs[i]))
{
if (ps[j] == ~qs[i]) if (ps[j] == ~qs[i])
return false; return false;
else else
goto next; goto next;
}
out_clause.push(qs[i]); out_clause.push(qs[i]);
} }
next:; next:;
@ -264,10 +266,12 @@ bool SimpSolver::merge(const Clause& _ps, const Clause& _qs, Var v, int& size)
if (var(__qs[i]) != v){ if (var(__qs[i]) != v){
for (int j = 0; j < ps.size(); j++) for (int j = 0; j < ps.size(); j++)
if (var(__ps[j]) == var(__qs[i])) if (var(__ps[j]) == var(__qs[i]))
{
if (__ps[j] == ~__qs[i]) if (__ps[j] == ~__qs[i])
return false; return false;
else else
goto next; goto next;
}
size++; size++;
} }
next:; next:;

View File

@ -211,7 +211,7 @@ void Solver::cancelUntil(int level) {
for (int c = trail.size()-1; c >= trail_lim[level]; c--){ for (int c = trail.size()-1; c >= trail_lim[level]; c--){
Var x = var(trail[c]); Var x = var(trail[c]);
assigns [x] = l_Undef; assigns [x] = l_Undef;
if (phase_saving > 1 || (phase_saving == 1) && c > trail_lim.last()) if (phase_saving > 1 || ((phase_saving == 1) && c > trail_lim.last()))
polarity[x] = sign(trail[c]); polarity[x] = sign(trail[c]);
insertVarOrder(x); } insertVarOrder(x); }
qhead = trail_lim[level]; qhead = trail_lim[level];
@ -659,7 +659,7 @@ lbool Solver::search(int nof_conflicts)
}else{ }else{
// NO CONFLICT // NO CONFLICT
if (nof_conflicts >= 0 && conflictC >= nof_conflicts || !withinBudget()){ if ( (nof_conflicts >= 0 && conflictC >= nof_conflicts) || !withinBudget()){
// Reached bound on number of conflicts: // Reached bound on number of conflicts:
progress_estimate = progressEstimate(); progress_estimate = progressEstimate();
cancelUntil(0); cancelUntil(0);

View File

@ -93,7 +93,6 @@ public:
void moveTo(vec<T>& dest) { dest.clear(true); dest.data = data; dest.sz = sz; dest.cap = cap; data = NULL; sz = 0; cap = 0; } void moveTo(vec<T>& dest) { dest.clear(true); dest.data = data; dest.sz = sz; dest.cap = cap; data = NULL; sz = 0; cap = 0; }
}; };
template<class T> template<class T>
void vec<T>::capacity(int min_cap) { void vec<T>::capacity(int min_cap) {
if (cap >= min_cap) return; if (cap >= min_cap) return;