mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 17:45:32 +00:00
na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
cf8b3a0788
commit
49a903c875
3 changed files with 16 additions and 5 deletions
|
@ -61,6 +61,7 @@ public:
|
|||
if (is_free()) return out << "free";
|
||||
return out << "[" << pp(lo) << ", " << pp(hi) << "[";
|
||||
}
|
||||
Numeral closest_value(Numeral const& n) const;
|
||||
};
|
||||
|
||||
template<typename Numeral>
|
||||
|
|
|
@ -109,3 +109,14 @@ mod_interval<Numeral> mod_interval<Numeral>::operator&(mod_interval const& other
|
|||
return mod_interval::empty();
|
||||
return mod_interval(l, h);
|
||||
}
|
||||
|
||||
template<typename Numeral>
|
||||
Numeral mod_interval<Numeral>::closest_value(Numeral const& n) const {
|
||||
if (contains(n))
|
||||
return n;
|
||||
if (is_empty())
|
||||
return n;
|
||||
if (lo - n < n - hi)
|
||||
return lo;
|
||||
return hi - 1;
|
||||
}
|
||||
|
|
|
@ -157,8 +157,7 @@ namespace polysat {
|
|||
m_var_eqs.reset();
|
||||
var_t var = row2base(r);
|
||||
m_vars[var].m_is_base = false;
|
||||
m_vars[var].lo = 0;
|
||||
m_vars[var].hi = 0;
|
||||
m_vars[var].set_free();
|
||||
m_rows[r.id()].m_base = null_var;
|
||||
M.del(r);
|
||||
SASSERT(M.col_begin(var) == M.col_end(var));
|
||||
|
@ -248,8 +247,9 @@ namespace polysat {
|
|||
lbool fixplex<Ext>::make_var_feasible(var_t x) {
|
||||
if (in_bounds(x))
|
||||
return l_true;
|
||||
auto val = value(x);
|
||||
numeral new_value = (lo(x) - val < val - hi(x)) ? lo(x) : hi(x) - 1;
|
||||
if (m_vars[x].is_empty())
|
||||
return l_false;
|
||||
numeral new_value = m_vars[x].closest_value(value(x));
|
||||
numeral b;
|
||||
var_t y = select_pivot_core(x, new_value, b);
|
||||
|
||||
|
@ -418,7 +418,6 @@ namespace polysat {
|
|||
return value - hi(v) - 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The the bounds of variable v.
|
||||
* If the current value of v, value(v), is in bounds, no further updates are made.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue