Skip to content

Commit

Permalink
Fixing an issue with the solver option: -top=<k>
Browse files Browse the repository at this point in the history
  • Loading branch information
marekpiotrow committed Jul 8, 2020
1 parent ddec2a5 commit 1a73e74
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions MsSolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,12 @@ void MsSolver::maxsat_solve(solve_Command cmd)
}

// Freeze goal function variables (for SatELite):
for (int i = 0; i < soft_cls.size(); i++)
for (int i = 0; i < soft_cls.size(); i++) {
sat_solver.setFrozen(var(soft_cls[i].snd->last()), true);
if (opt_output_top > 0)
for (int j = soft_cls[i].snd->size() - 2; j >= 0; j--)
sat_solver.setFrozen(var((*soft_cls[i].snd)[j]), true);
}
sat_solver.verbosity = opt_verbosity - 1;

goal_gcd = soft_cls[0].fst;
Expand Down Expand Up @@ -535,7 +539,7 @@ void MsSolver::maxsat_solve(solve_Command cmd)
model[var(soft_cls[i].snd->last())] = !sign(soft_cls[i].snd->last());
Int goalvalue = evalGoal(soft_cls, model, soft_unsat) + fixed_goalval;
extern bool opt_satisfiable_out;
if (goalvalue < best_goalvalue) {
if (goalvalue < best_goalvalue || opt_output_top > 0 && goalvalue == best_goalvalue) {
best_goalvalue = goalvalue;
model.moveTo(best_model);
char* tmp = toString(best_goalvalue * goal_gcd);
Expand Down

0 comments on commit 1a73e74

Please sign in to comment.