3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 17:45:32 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2021-05-06 19:00:51 -07:00
parent a1ded7f1ec
commit b5d1b0336a
3 changed files with 32 additions and 10 deletions

View file

@ -133,6 +133,7 @@ namespace polysat {
void set_max_iterations(unsigned n) { m_max_iterations = n; }
unsigned get_num_vars() const { return m_vars.size(); }
void reset();
void propagate_bounds();
lbool make_feasible();
row add_row(var_t base, unsigned num_vars, var_t const* vars, numeral const* coeffs);
std::ostream& display(std::ostream& out) const;

View file

@ -727,6 +727,11 @@ namespace polysat {
}
template<typename Ext>
void fixplex<Ext>::propagate_bounds() {
for (unsigned i = 0; i < m_rows.size(); ++i)
propagate_bounds(row(i));
}
template<typename Ext>
void fixplex<Ext>::propagate_bounds(row const& r) {
@ -753,17 +758,20 @@ namespace polysat {
return;
}
std::cout << "bounds " << free_v << "\n";
if (free_v != null_var) {
if (free_c == 1) {
//
// free_v in [lo_sum, hi_sum[
// new_bound(r, free_v, lo_sum, hi_sum);
}
else {
// c = -1
// free_v in [1 - hi_sum, 1 - lo_sum[
// new_bound(r, free_v, 1 - hi_sum, 1 - lo_sum);
}
//
// c = 1:
// free_v in [lo_sum, hi_sum[
// c = -1:
// free_v in [1 - hi_sum, 1 - lo_sum[
//
if (free_c == 1)
new_bound(r, free_v, lo_sum, hi_sum);
else
new_bound(r, free_v, 1 - hi_sum, 1 - lo_sum);
return;
}
for (auto const& e : M.row_entries(r)) {

View file

@ -54,10 +54,23 @@ namespace polysat {
fp.run();
}
static void test4() {
scoped_fp fp;
var_t x = 0, y = 1, z = 2;
var_t ys[3] = { x, y, z };
numeral coeffs[3] = { 1, 1, 1 };
fp.add_row(x, 3, ys, coeffs);
fp.set_bounds(x, 3, 4);
fp.set_bounds(y, 3, 6);
fp.run();
fp.propagate_bounds();
}
}
void tst_fixplex() {
polysat::test1();
polysat::test2();
polysat::test3();
polysat::test4();
}