mirror of
https://github.com/Z3Prover/z3
synced 2025-04-06 09:34:08 +00:00
fix #4197
This commit is contained in:
parent
dc9221e4bd
commit
5e4276b0bd
|
@ -260,7 +260,7 @@ namespace sat {
|
|||
}
|
||||
|
||||
void local_search::verify_constraint(constraint const& c) const {
|
||||
unsigned value = constraint_value(c);
|
||||
uint64_t value = constraint_value(c);
|
||||
IF_VERBOSE(11, display(verbose_stream() << "verify ", c););
|
||||
TRACE("sat", display(verbose_stream() << "verify ", c););
|
||||
if (c.m_k < value) {
|
||||
|
@ -278,8 +278,8 @@ namespace sat {
|
|||
}
|
||||
}
|
||||
|
||||
unsigned local_search::constraint_value(constraint const& c) const {
|
||||
unsigned value = 0;
|
||||
uint64_t local_search::constraint_value(constraint const& c) const {
|
||||
uint64_t value = 0;
|
||||
for (literal t : c) {
|
||||
if (is_true(t)) {
|
||||
value += constraint_coeff(c, t);
|
||||
|
@ -682,7 +682,7 @@ namespace sat {
|
|||
bool tt = cur_solution(v);
|
||||
coeff_vector const& falsep = m_vars[v].m_watch[!tt];
|
||||
for (pbcoeff const& pbc : falsep) {
|
||||
int slack = constraint_slack(pbc.m_constraint_id);
|
||||
auto slack = constraint_slack(pbc.m_constraint_id);
|
||||
if (slack < 0)
|
||||
++best_bsb;
|
||||
else if (slack < static_cast<int>(pbc.m_coeff))
|
||||
|
@ -697,7 +697,7 @@ namespace sat {
|
|||
coeff_vector const& falsep = m_vars[v].m_watch[!cur_solution(v)];
|
||||
auto it = falsep.begin(), end = falsep.end();
|
||||
for (; it != end; ++it) {
|
||||
int slack = constraint_slack(it->m_constraint_id);
|
||||
auto slack = constraint_slack(it->m_constraint_id);
|
||||
if (slack < 0) {
|
||||
if (bsb == best_bsb) {
|
||||
break;
|
||||
|
@ -784,7 +784,7 @@ namespace sat {
|
|||
for (auto const& pbc : truep) {
|
||||
unsigned ci = pbc.m_constraint_id;
|
||||
constraint& c = m_constraints[ci];
|
||||
int old_slack = c.m_slack;
|
||||
auto old_slack = c.m_slack;
|
||||
c.m_slack -= pbc.m_coeff;
|
||||
DEBUG_CODE(verify_slack(c););
|
||||
if (c.m_slack < 0 && old_slack >= 0) { // from non-negative to negative: sat -> unsat
|
||||
|
@ -794,7 +794,7 @@ namespace sat {
|
|||
for (auto const& pbc : falsep) {
|
||||
unsigned ci = pbc.m_constraint_id;
|
||||
constraint& c = m_constraints[ci];
|
||||
int old_slack = c.m_slack;
|
||||
auto old_slack = c.m_slack;
|
||||
c.m_slack += pbc.m_coeff;
|
||||
DEBUG_CODE(verify_slack(c););
|
||||
if (c.m_slack >= 0 && old_slack < 0) { // from negative to non-negative: unsat -> sat
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace sat {
|
|||
struct constraint {
|
||||
unsigned m_id;
|
||||
unsigned m_k;
|
||||
int m_slack;
|
||||
int64_t m_slack;
|
||||
unsigned m_size;
|
||||
literal_vector m_literals;
|
||||
constraint(unsigned k, unsigned id) : m_id(id), m_k(k), m_slack(0), m_size(0) {}
|
||||
|
@ -196,8 +196,8 @@ namespace sat {
|
|||
inline bool is_unit(literal l) const { return m_vars[l.var()].m_unit; }
|
||||
|
||||
unsigned num_constraints() const { return m_constraints.size(); } // constraint index from 1 to num_constraint
|
||||
|
||||
unsigned constraint_slack(unsigned ci) const { return m_constraints[ci].m_slack; }
|
||||
|
||||
uint64_t constraint_slack(unsigned ci) const { return m_constraints[ci].m_slack; }
|
||||
|
||||
void init();
|
||||
void reinit();
|
||||
|
@ -221,7 +221,7 @@ namespace sat {
|
|||
void verify_slack(constraint const& c) const;
|
||||
void verify_slack() const;
|
||||
bool verify_goodvar() const;
|
||||
unsigned constraint_value(constraint const& c) const;
|
||||
uint64_t constraint_value(constraint const& c) const;
|
||||
unsigned constraint_coeff(constraint const& c, literal l) const;
|
||||
void print_info(std::ostream& out);
|
||||
void extract_model();
|
||||
|
|
Loading…
Reference in a new issue