mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 09:35:32 +00:00
more aggressive patching
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
e5503cdc65
commit
b84585beeb
5 changed files with 27 additions and 26 deletions
|
@ -289,19 +289,6 @@ lia_move int_solver::hnf_cut() {
|
|||
return r;
|
||||
}
|
||||
|
||||
void int_solver::set_value_for_nbasic_column_ignore_old_values(unsigned j, const impq & new_val) {
|
||||
lp_assert(!is_base(j));
|
||||
auto & x = lrac.m_r_x[j];
|
||||
auto delta = new_val - x;
|
||||
x = new_val;
|
||||
TRACE("int_solver", tout << "x[" << j << "] = " << x << "\n";);
|
||||
lra.change_basic_columns_dependend_on_a_given_nb_column(j, delta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool int_solver::has_lower(unsigned j) const {
|
||||
switch (lrac.m_column_types()[j]) {
|
||||
case column_type::fixed:
|
||||
|
@ -530,7 +517,7 @@ bool int_solver::shift_var(unsigned j, unsigned range) {
|
|||
// x, the value of j column, might be shifted on a multiple of m
|
||||
if (inf_l && inf_u) {
|
||||
impq new_val = m * impq(random() % (range + 1)) + x;
|
||||
set_value_for_nbasic_column_ignore_old_values(j, new_val);
|
||||
lra.set_value_for_nbasic_column_ignore_old_values(j, new_val);
|
||||
return true;
|
||||
}
|
||||
if (column_is_int(j)) {
|
||||
|
@ -547,14 +534,14 @@ bool int_solver::shift_var(unsigned j, unsigned range) {
|
|||
if (inf_u) {
|
||||
SASSERT(!inf_l);
|
||||
impq new_val = x + m * impq(random() % (range + 1));
|
||||
set_value_for_nbasic_column_ignore_old_values(j, new_val);
|
||||
lra.set_value_for_nbasic_column_ignore_old_values(j, new_val);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (inf_l) {
|
||||
SASSERT(!inf_u);
|
||||
impq new_val = x - m * impq(random() % (range + 1));
|
||||
set_value_for_nbasic_column_ignore_old_values(j, new_val);
|
||||
lra.set_value_for_nbasic_column_ignore_old_values(j, new_val);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -576,7 +563,7 @@ bool int_solver::shift_var(unsigned j, unsigned range) {
|
|||
impq new_val = x + m * impq(s);
|
||||
TRACE("int_solver", tout << "new_val = " << new_val << "\n";);
|
||||
SASSERT(l <= new_val && new_val <= u);
|
||||
set_value_for_nbasic_column_ignore_old_values(j, new_val);
|
||||
lra.set_value_for_nbasic_column_ignore_old_values(j, new_val);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,6 @@ private:
|
|||
bool is_fixed(unsigned j) const;
|
||||
bool is_free(unsigned j) const;
|
||||
bool value_is_int(unsigned j) const;
|
||||
void set_value_for_nbasic_column_ignore_old_values(unsigned j, const impq & new_val);
|
||||
bool is_feasible() const;
|
||||
bool column_is_int_inf(unsigned j) const;
|
||||
std::ostream& display_inf_rows(std::ostream&) const;
|
||||
|
|
|
@ -2431,6 +2431,17 @@ bool lar_solver::inside_bounds(lpvar j, const impq& val) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
void lar_solver::set_value_for_nbasic_column_ignore_old_values(unsigned j, const impq & new_val) {
|
||||
lp_assert(!is_base(j));
|
||||
auto & x = m_mpq_lar_core_solver.m_r_x[j];
|
||||
auto delta = new_val - x;
|
||||
x = new_val;
|
||||
TRACE("int_solver", tout << "x[" << j << "] = " << x << "\n";);
|
||||
change_basic_columns_dependend_on_a_given_nb_column(j, delta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void lar_solver::pivot_column_tableau(unsigned j, unsigned row_index) {
|
||||
m_mpq_lar_core_solver.m_r_solver.pivot_column_tableau(j, row_index);
|
||||
m_mpq_lar_core_solver.m_r_solver.change_basis(j, r_basis()[row_index]);
|
||||
|
|
|
@ -323,19 +323,16 @@ public:
|
|||
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 (!inside_bounds(rj, rj_new_val) || blocker(rj))
|
||||
// if (column_is_int(rj) && !rj_new_val.is_int())
|
||||
// return false;
|
||||
if (blocker(rj))
|
||||
return false;
|
||||
}
|
||||
|
||||
set_column_value(j, ival);
|
||||
set_value_for_nbasic_column_ignore_old_values(j, ival);
|
||||
change_report(j);
|
||||
for (const auto &c : A_r().column(j)) {
|
||||
unsigned row_index = c.var();
|
||||
const mpq & a = c.coeff();
|
||||
unsigned rj = m_mpq_lar_core_solver.m_r_basis[row_index];
|
||||
m_mpq_lar_core_solver.m_r_solver.add_delta_to_x(rj, a * delta);
|
||||
unsigned rj = m_mpq_lar_core_solver.m_r_basis[c.var()];
|
||||
change_report(rj);
|
||||
}
|
||||
|
||||
|
@ -509,6 +506,7 @@ public:
|
|||
return 0;
|
||||
return m_usage_in_terms[j];
|
||||
}
|
||||
void set_value_for_nbasic_column_ignore_old_values(unsigned j, const impq & new_val);
|
||||
friend int_solver;
|
||||
friend int_branch;
|
||||
|
||||
|
|
|
@ -1392,6 +1392,12 @@ void core::patch_monomials() {
|
|||
if (m_to_refine.size() == 0)
|
||||
break;
|
||||
}
|
||||
NOT_IMPLEMENTED_YET();
|
||||
/*
|
||||
If the tableau is not feasible we need to fix all non-linear
|
||||
vars that do not satisfy var_breaks_correct_monic()
|
||||
and find a feasible solution, fix the integral values too.
|
||||
*/
|
||||
TRACE("nla_solver", tout << "sz = " << m_to_refine.size() << "\n";);
|
||||
SASSERT(m_lar_solver.ax_is_correct());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue