mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
d8e00bc02e
commit
cc394f0fe9
5 changed files with 25 additions and 21 deletions
|
@ -2395,9 +2395,7 @@ bool lar_solver::inside_bounds(lpvar j, const impq& val) const {
|
|||
|
||||
bool lar_solver::try_to_patch(lpvar j, const mpq& val, const std::function<bool (lpvar)>& blocker, const std::function<void (lpvar)>& report_change) {
|
||||
if (is_base(j)) {
|
||||
bool r = remove_from_basis(j);
|
||||
SASSERT(r);
|
||||
(void)r;
|
||||
VERIFY(remove_from_basis(j));
|
||||
}
|
||||
impq ival(val);
|
||||
if (!inside_bounds(j, ival))
|
||||
|
@ -2409,10 +2407,10 @@ bool lar_solver::try_to_patch(lpvar j, const mpq& val, const std::function<bool
|
|||
const mpq & a = c.coeff();
|
||||
unsigned rj = m_mpq_lar_core_solver.m_r_basis[row_index];
|
||||
impq rj_new_val = a * delta + get_column_value(rj);
|
||||
if (column_is_int(rj) && ! rj_new_val.is_int())
|
||||
return false;
|
||||
if (column_is_int(rj) && !rj_new_val.is_int())
|
||||
return false;
|
||||
if (!inside_bounds(rj, rj_new_val) || blocker(rj))
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
set_column_value(j, ival);
|
||||
|
@ -2423,6 +2421,7 @@ bool lar_solver::try_to_patch(lpvar j, const mpq& val, const std::function<bool
|
|||
m_mpq_lar_core_solver.m_r_solver.add_delta_to_x(rj, a * delta);
|
||||
report_change(rj);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1342,18 +1342,17 @@ bool core::var_is_used_in_a_correct_monic(lpvar j) const {
|
|||
|
||||
void core::update_to_refine_of_var(lpvar j) {
|
||||
for (const monic & m : emons().get_use_list(j)) {
|
||||
if (val(var(m)) == mul_val(m))
|
||||
if (var_val(m) == mul_val(m))
|
||||
m_to_refine.erase(var(m));
|
||||
else
|
||||
m_to_refine.insert(var(m));
|
||||
}
|
||||
if (is_monic_var(j)) {
|
||||
const monic& m = emons()[j];
|
||||
if (val(var(m)) == mul_val(m))
|
||||
if (var_val(m) == mul_val(m))
|
||||
m_to_refine.erase(j);
|
||||
else
|
||||
m_to_refine.insert(j);
|
||||
|
||||
m_to_refine.insert(j);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1373,15 +1372,15 @@ void core::patch_monomial_with_real_var(lpvar j) {
|
|||
return;
|
||||
if (!var_is_int(j) &&
|
||||
!var_is_used_in_a_correct_monic(j)
|
||||
&& try_to_patch(j, v)) {
|
||||
&& try_to_patch(j, v)
|
||||
) {
|
||||
m_to_refine.erase(j);
|
||||
} else {
|
||||
rational r = val(j) / v;
|
||||
for (lpvar k: m.vars()) {
|
||||
if (var_is_int(k)) continue;
|
||||
if (var_is_used_in_a_correct_monic(k))
|
||||
continue;
|
||||
if (try_to_patch(k, r * val(k))) { // r * val(k) gives the right value of k
|
||||
if (!var_is_int(k) &&
|
||||
!var_is_used_in_a_correct_monic(k) &&
|
||||
try_to_patch(k, r * val(k))) { // r * val(k) gives the right value of k
|
||||
m_to_refine.erase(j);
|
||||
break;
|
||||
}
|
||||
|
@ -1394,7 +1393,7 @@ void core::patch_monomial_with_real_var(lpvar j) {
|
|||
|
||||
void core::patch_monomials_with_real_vars() {
|
||||
auto to_refine = m_to_refine.index();
|
||||
// the rest of the function might change m_to_refine, so have to copy
|
||||
// the rest of the function might change m_to_refine, so have to copy
|
||||
for (lpvar j : to_refine) {
|
||||
patch_monomial_with_real_var(j);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
m_index.resize(0);
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out) const {
|
||||
std::ostream& display(std::ostream& out) const {
|
||||
for (unsigned j : m_index) {
|
||||
out << j << " ";
|
||||
}
|
||||
|
@ -105,4 +105,10 @@ public:
|
|||
const unsigned * end() const { return m_index.end(); }
|
||||
const unsigned_vector& index() { return m_index; }
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& out, lp::u_set const& s) {
|
||||
return s.display(out);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue