Skip to content

Commit 5e4276b

Browse files
fix #4197
1 parent dc9221e commit 5e4276b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/sat/sat_local_search.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ namespace sat {
260260
}
261261

262262
void local_search::verify_constraint(constraint const& c) const {
263-
unsigned value = constraint_value(c);
263+
uint64_t value = constraint_value(c);
264264
IF_VERBOSE(11, display(verbose_stream() << "verify ", c););
265265
TRACE("sat", display(verbose_stream() << "verify ", c););
266266
if (c.m_k < value) {
@@ -278,8 +278,8 @@ namespace sat {
278278
}
279279
}
280280

281-
unsigned local_search::constraint_value(constraint const& c) const {
282-
unsigned value = 0;
281+
uint64_t local_search::constraint_value(constraint const& c) const {
282+
uint64_t value = 0;
283283
for (literal t : c) {
284284
if (is_true(t)) {
285285
value += constraint_coeff(c, t);
@@ -682,7 +682,7 @@ namespace sat {
682682
bool tt = cur_solution(v);
683683
coeff_vector const& falsep = m_vars[v].m_watch[!tt];
684684
for (pbcoeff const& pbc : falsep) {
685-
int slack = constraint_slack(pbc.m_constraint_id);
685+
auto slack = constraint_slack(pbc.m_constraint_id);
686686
if (slack < 0)
687687
++best_bsb;
688688
else if (slack < static_cast<int>(pbc.m_coeff))
@@ -697,7 +697,7 @@ namespace sat {
697697
coeff_vector const& falsep = m_vars[v].m_watch[!cur_solution(v)];
698698
auto it = falsep.begin(), end = falsep.end();
699699
for (; it != end; ++it) {
700-
int slack = constraint_slack(it->m_constraint_id);
700+
auto slack = constraint_slack(it->m_constraint_id);
701701
if (slack < 0) {
702702
if (bsb == best_bsb) {
703703
break;
@@ -784,7 +784,7 @@ namespace sat {
784784
for (auto const& pbc : truep) {
785785
unsigned ci = pbc.m_constraint_id;
786786
constraint& c = m_constraints[ci];
787-
int old_slack = c.m_slack;
787+
auto old_slack = c.m_slack;
788788
c.m_slack -= pbc.m_coeff;
789789
DEBUG_CODE(verify_slack(c););
790790
if (c.m_slack < 0 && old_slack >= 0) { // from non-negative to negative: sat -> unsat
@@ -794,7 +794,7 @@ namespace sat {
794794
for (auto const& pbc : falsep) {
795795
unsigned ci = pbc.m_constraint_id;
796796
constraint& c = m_constraints[ci];
797-
int old_slack = c.m_slack;
797+
auto old_slack = c.m_slack;
798798
c.m_slack += pbc.m_coeff;
799799
DEBUG_CODE(verify_slack(c););
800800
if (c.m_slack >= 0 && old_slack < 0) { // from negative to non-negative: unsat -> sat

src/sat/sat_local_search.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ namespace sat {
122122
struct constraint {
123123
unsigned m_id;
124124
unsigned m_k;
125-
int m_slack;
125+
int64_t m_slack;
126126
unsigned m_size;
127127
literal_vector m_literals;
128128
constraint(unsigned k, unsigned id) : m_id(id), m_k(k), m_slack(0), m_size(0) {}
@@ -196,8 +196,8 @@ namespace sat {
196196
inline bool is_unit(literal l) const { return m_vars[l.var()].m_unit; }
197197

198198
unsigned num_constraints() const { return m_constraints.size(); } // constraint index from 1 to num_constraint
199-
200-
unsigned constraint_slack(unsigned ci) const { return m_constraints[ci].m_slack; }
199+
200+
uint64_t constraint_slack(unsigned ci) const { return m_constraints[ci].m_slack; }
201201

202202
void init();
203203
void reinit();
@@ -221,7 +221,7 @@ namespace sat {
221221
void verify_slack(constraint const& c) const;
222222
void verify_slack() const;
223223
bool verify_goodvar() const;
224-
unsigned constraint_value(constraint const& c) const;
224+
uint64_t constraint_value(constraint const& c) const;
225225
unsigned constraint_coeff(constraint const& c, literal l) const;
226226
void print_info(std::ostream& out);
227227
void extract_model();

0 commit comments

Comments
 (0)