mirror of
https://github.com/Z3Prover/z3
synced 2025-04-25 01:55:32 +00:00
add missing fixed propagations on negated integer inequalities
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
ae5a713e81
commit
21a31fcd26
9 changed files with 92 additions and 94 deletions
|
@ -46,9 +46,6 @@ Revision History:
|
|||
|
||||
namespace lp {
|
||||
|
||||
typedef unsigned lpvar;
|
||||
const lpvar null_lpvar = UINT_MAX;
|
||||
const constraint_index null_ci = UINT_MAX;
|
||||
|
||||
class lar_solver : public column_namer {
|
||||
struct term_hasher {
|
||||
|
@ -123,9 +120,7 @@ public:
|
|||
static_matrix<double, double> & A_d();
|
||||
static_matrix<double, double > const & A_d() const;
|
||||
|
||||
static bool valid_index(unsigned j){ return static_cast<int>(j) >= 0;}
|
||||
|
||||
bool column_is_int(column_index const& j) const { return column_is_int((unsigned)j); }
|
||||
static bool valid_index(unsigned j) { return static_cast<int>(j) >= 0;}
|
||||
|
||||
bool column_is_int(unsigned j) const;
|
||||
bool column_value_is_int(unsigned j) const { return m_mpq_lar_core_solver.m_r_x[j].is_int(); }
|
||||
|
@ -136,7 +131,8 @@ public:
|
|||
}
|
||||
|
||||
unsigned external_to_column_index(unsigned) const;
|
||||
|
||||
|
||||
// NSB code review: function seems misnamed. 'j' can be a term index. Columns are not term indices.
|
||||
const mpq& get_column_value_rational(unsigned j) const {
|
||||
if (tv::is_term(j)) {
|
||||
j = m_var_register.external_to_local(j);
|
||||
|
@ -147,8 +143,6 @@ public:
|
|||
bool column_is_fixed(unsigned j) const;
|
||||
bool column_is_free(unsigned j) const;
|
||||
|
||||
bool well_formed(lar_term const& t) const;
|
||||
|
||||
const lar_term & get_term(unsigned j) const;
|
||||
|
||||
public:
|
||||
|
@ -203,6 +197,14 @@ public:
|
|||
|
||||
bool compare_values(impq const& lhs, lconstraint_kind k, const mpq & rhs);
|
||||
|
||||
// columns
|
||||
|
||||
bool column_is_int(column_index const& j) const { return column_is_int((unsigned)j); }
|
||||
column_index to_column_index(unsigned v) const { return column_index(external_to_column_index(v)); }
|
||||
bool is_fixed(column_index const& j) const { return column_is_fixed(j); }
|
||||
const impq& get_value(column_index const& j) const { return get_column_value(j); }
|
||||
|
||||
|
||||
void update_column_type_and_bound(var_index j, lconstraint_kind kind, const mpq & right_side, constraint_index constr_index);
|
||||
void update_column_type_and_bound_with_ub(var_index j, lconstraint_kind kind, const mpq & right_side, constraint_index constr_index);
|
||||
void update_column_type_and_bound_with_no_ub(var_index j, lconstraint_kind kind, const mpq & right_side, constraint_index constr_index);
|
||||
|
@ -280,14 +282,13 @@ public:
|
|||
|
||||
var_index external_to_local(unsigned j) const {
|
||||
var_index local_j;
|
||||
if (
|
||||
m_var_register.external_is_used(j, local_j) ||
|
||||
m_term_register.external_is_used(j, local_j))
|
||||
{
|
||||
return local_j;
|
||||
}
|
||||
else
|
||||
if (m_var_register.external_is_used(j, local_j) ||
|
||||
m_term_register.external_is_used(j, local_j)) {
|
||||
return local_j;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
bool column_has_upper_bound(unsigned j) const {
|
||||
|
@ -298,11 +299,11 @@ public:
|
|||
return m_mpq_lar_core_solver.m_r_solver.column_has_lower_bound(j);
|
||||
}
|
||||
|
||||
const impq& get_upper_bound(unsigned j) const {
|
||||
const impq& get_upper_bound(column_index j) const {
|
||||
return m_mpq_lar_core_solver.m_r_solver.m_upper_bounds[j];
|
||||
}
|
||||
|
||||
const impq& get_lower_bound(unsigned j) const {
|
||||
const impq& get_lower_bound(column_index j) const {
|
||||
return m_mpq_lar_core_solver.m_r_solver.m_lower_bounds[j];
|
||||
}
|
||||
|
||||
|
|
|
@ -27,10 +27,14 @@ namespace nla {
|
|||
}
|
||||
|
||||
namespace lp {
|
||||
|
||||
typedef unsigned var_index;
|
||||
typedef unsigned constraint_index;
|
||||
typedef unsigned row_index;
|
||||
enum lconstraint_kind { LE = -2, LT = -1 , GE = 2, GT = 1, EQ = 0, NE = 3 };
|
||||
typedef unsigned lpvar;
|
||||
const lpvar null_lpvar = UINT_MAX;
|
||||
const constraint_index null_ci = UINT_MAX;
|
||||
|
||||
|
||||
// index that comes from term or variable.
|
||||
|
@ -79,6 +83,7 @@ class column_index {
|
|||
public:
|
||||
column_index(unsigned j): m_index(j) {}
|
||||
unsigned index() const { return m_index; }
|
||||
bool is_null() const { return m_index == null_lpvar; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1371,19 +1371,19 @@ void core::update_to_refine_of_var(lpvar j) {
|
|||
}
|
||||
|
||||
bool core::patch_blocker(lpvar u, const monic& m) const {
|
||||
SASSERT(m_to_refine.contains(m.var()));
|
||||
if (var_is_used_in_a_correct_monic(u)) {
|
||||
TRACE("nla_solver", tout << "u = " << u << " blocked as used in a correct monomial\n";);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ret = u == m.var() || m.contains_var(u);
|
||||
|
||||
TRACE("nla_solver", tout << "u = " << u << ", m = "; print_monic(m, tout) <<
|
||||
"ret = " << ret << "\n";);
|
||||
|
||||
return ret;
|
||||
SASSERT(m_to_refine.contains(m.var()));
|
||||
if (var_is_used_in_a_correct_monic(u)) {
|
||||
TRACE("nla_solver", tout << "u = " << u << " blocked as used in a correct monomial\n";);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ret = u == m.var() || m.contains_var(u);
|
||||
|
||||
TRACE("nla_solver", tout << "u = " << u << ", m = "; print_monic(m, tout) <<
|
||||
"ret = " << ret << "\n";);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool core::try_to_patch(lpvar k, const rational& v, const monic & m) {
|
||||
return m_lar_solver.try_to_patch(k, v,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue