3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

roll back add_var api

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2018-11-08 11:00:12 -08:00
parent 4fa38b5aa2
commit 1d51c5689e
6 changed files with 122 additions and 138 deletions

View file

@ -422,9 +422,8 @@ class theory_lra::imp {
m_theory_var2var_index.setx(v, var, UINT_MAX);
m_var_index2theory_var.setx(var, v, UINT_MAX);
m_var_trail.push_back(v);
lp::explanation e;
add_def_constraint(m_solver->add_var_bound(var, lp::GE, rational(c), e));
add_def_constraint(m_solver->add_var_bound(var, lp::LE, rational(c), e));
add_def_constraint(m_solver->add_var_bound(var, lp::GE, rational(c)));
add_def_constraint(m_solver->add_var_bound(var, lp::LE, rational(c)));
return var;
}
@ -801,9 +800,6 @@ class theory_lra::imp {
++m_stats.m_add_rows;
}
void process_conflict() {
NOT_IMPLEMENTED_YET();
}
bool is_infeasible() const {
return m_solver->get_status() == lp::lp_status::INFEASIBLE;
@ -818,14 +814,14 @@ class theory_lra::imp {
st.coeffs().push_back(rational::minus_one());
theory_var z = internalize_linearized_def(term, st);
lp::var_index vi = register_theory_var_in_lar_solver(z);
add_def_constraint(m_solver->add_var_bound(vi, lp::LE, rational::zero(), m_explanation));
if (is_infeasible()) {
process_conflict(); // exit here?
}
add_def_constraint(m_solver->add_var_bound(vi, lp::GE, rational::zero(), m_explanation));
if (is_infeasible()) {
process_conflict();
}
add_def_constraint(m_solver->add_var_bound(vi, lp::LE, rational::zero()));
// if (is_infeasible()) {
// process_conflict(); // exit here?
// }
add_def_constraint(m_solver->add_var_bound(vi, lp::GE, rational::zero()));
// if (is_infeasible()) {
// process_conflict();
// }
TRACE("arith",
{
expr* o1 = get_enode(v1)->get_owner();
@ -1241,12 +1237,11 @@ public:
get_enode(w)->get_owner())));
theory_var z = internalize_def(term);
lp::var_index vi = register_theory_var_in_lar_solver(z);
lp::explanation e;
add_def_constraint(m_solver->add_var_bound(vi, lp::GE, rational::zero(), e));
add_def_constraint(m_solver->add_var_bound(vi, lp::LE, rational::zero(), e));
add_def_constraint(m_solver->add_var_bound(register_theory_var_in_lar_solver(v), lp::GE, rational::zero(), e));
add_def_constraint(m_solver->add_var_bound(register_theory_var_in_lar_solver(v), lp::LT, abs(r), e));
SASSERT(m_solver->get_status() != lp::lp_status::INFEASIBLE);
add_def_constraint(m_solver->add_var_bound(vi, lp::GE, rational::zero()));
add_def_constraint(m_solver->add_var_bound(vi, lp::LE, rational::zero()));
add_def_constraint(m_solver->add_var_bound(register_theory_var_in_lar_solver(v), lp::GE, rational::zero()));
add_def_constraint(m_solver->add_var_bound(register_theory_var_in_lar_solver(v), lp::LT, abs(r)));
SASSERT(!is_infeasible());
TRACE("arith", m_solver->print_constraints(tout << term << "\n"););
}
@ -2988,13 +2983,12 @@ public:
lp::constraint_index ci;
if (is_int && !is_true) {
rational bound = b.get_value(false).get_rational();
ci = m_solver->add_var_bound(vi, k, bound, m_explanation);
ci = m_solver->add_var_bound(vi, k, bound);
}
else {
ci = m_solver->add_var_bound(vi, k, b.get_value(), m_explanation);
ci = m_solver->add_var_bound(vi, k, b.get_value());
}
if (is_infeasible()) {
set_conflict1();
return;
}
TRACE("arith", tout << "v" << b.get_var() << "\n";);