Skip to content

Commit df7a489

Browse files
committed
Correcting s-line for SATISFIABLE decision instance of pseudo-Boolean problems
1 parent 4737575 commit df7a489

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

MsSolver.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,12 @@ void MsSolver::maxsat_solve(solve_Command cmd)
490490
if (status == l_Undef && termCallback != nullptr && 0 != termCallback(termCallbackState))
491491
asynch_interrupt = true;
492492
if (soft_cls.size() == 0) {
493-
if (!ipamir_used) opt_satisfiable_out = false;
493+
if (!ipamir_used) {
494+
if (!opt_maxsat && goal == NULL && satisfied) // force a correct output for
495+
opt_satisfiable_out = asynch_interrupt = true; // pseudo-Boolean decision problems
496+
else opt_satisfiable_out = false;
497+
if (opt_verbosity > 0) printStats(true);
498+
}
494499
return;
495500
} else if (status == l_True) {
496501
for (int i = 0; i < soft_cls.size(); i++)

PbSolver.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,9 +719,10 @@ void PbSolver::solve(solve_Command cmd)
719719
if (opt_verbosity >= 1){
720720
if (!sat)
721721
reportf(asynch_interrupt ? "\bUNKNOWN\b\n" : "\bUNSATISFIABLE\b\n");
722-
else if (goal == NULL)
722+
else if (goal == NULL && !opt_maxsat) {
723723
reportf("\bSATISFIABLE: No goal function specified.\b\n");
724-
else if (cmd == sc_FirstSolution){
724+
asynch_interrupt = true; // to get SATISFIABLE result
725+
} else if (cmd == sc_FirstSolution){
725726
char* tmp = toString(best_goalvalue * goal_gcd);
726727
reportf("\bFirst solution found: %s\b\n", tmp);
727728
xfree(tmp);
@@ -734,6 +735,7 @@ void PbSolver::solve(solve_Command cmd)
734735
reportf("\bOptimal solution: %s\b\n", tmp);
735736
xfree(tmp);
736737
}
738+
printStats(true);
737739
}
738740
}
739741

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Since version 1.7.0 the default SAT solver is changed to CaDiCaL by Armin Biere.
2525
git clone https://github.com/arminbiere/cadical
2626
cd cadical
2727
patch -p1 <../uwrmaxsat/cadical.patch
28-
./configure
28+
./configure --no-contracts --no-tracing
2929
make cadical
3030
cd ../uwrmaxsat
3131
cp config.cadical config.mk

SatSolver.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ bool ExtSimpSolver::impliedObservedLits(Lit lit, Minisat::vec<Lit>& props, const
175175
if (!okay()) return false;
176176
if (value(lit) != l_Undef) return value(lit) == l_True;
177177
for (int i = 0; i < assumps.size(); i++)
178-
if (value(assumps[i]) == l_False) return false;
178+
if (value(assumps[i]) == l_False) return true;
179179

180180
for (int i = 0; i < assumps.size(); i++)
181181
if (value(assumps[i]) != l_True && toInt(assumps[i]) >= 0) solver->assume(lit2val(assumps[i]));
@@ -184,15 +184,15 @@ bool ExtSimpSolver::impliedObservedLits(Lit lit, Minisat::vec<Lit>& props, const
184184
solver->limit ("decisions", 1); // set decision limit to one
185185
lbool ret = solveLimited();
186186

187-
if (ret == l_Undef && extPropagator->dec_level > 1) {
187+
if (ret != l_False && extPropagator->dec_level > 1) {
188188
for (const int clit : extPropagator->last_trails[1 - extPropagator->dec_level % 2]) {
189189
if (clit != 0) {
190190
Lit l = mkLit(abs(clit) - 1, clit < 0);
191191
if (l != lit) props.push(l);
192192
}
193193
}
194194
}
195-
return ret == l_Undef;
195+
return ret != l_False;
196196
}
197197
#elif defined(MERGESAT)
198198
bool ExtSimpSolver::impliedObservedLits(Lit lit, Minisat::vec<Lit>& props, const vec<Lit>& assumptions, int )

0 commit comments

Comments
 (0)