3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-15 13:28:47 +00:00

rebase with z3prover

Signed-off-by: Lev <levnach@hotmail.com>
This commit is contained in:
Lev 2018-09-24 13:42:20 -07:00 committed by Lev Nachmanson
parent 4ca0ca3ce8
commit d301a9c403
8 changed files with 77 additions and 92 deletions

View file

@ -1928,7 +1928,7 @@ void ast_manager::delete_node(ast * n) {
CTRACE("del_quantifier", is_quantifier(n), tout << "deleting quantifier " << n->m_id << " " << n << "\n";); CTRACE("del_quantifier", is_quantifier(n), tout << "deleting quantifier " << n->m_id << " " << n << "\n";);
TRACE("mk_var_bug", tout << "del_ast: " << " " << n->m_ref_count << "\n";); TRACE("mk_var_bug", tout << "del_ast: " << " " << n->m_ref_count << "\n";);
TRACE("ast_delete_node", tout << mk_bounded_pp(n, *this) << "\n";); TRACE("ast_delete_node", tout << mk_bounded_pp(n, *this) << "\n";);
TRACE("ast", tout << mk_pp(n, *this) << "\n";);
SASSERT(m_ast_table.contains(n)); SASSERT(m_ast_table.contains(n));
m_ast_table.erase(n); m_ast_table.erase(n);
SASSERT(!m_ast_table.contains(n)); SASSERT(!m_ast_table.contains(n));

View file

@ -159,6 +159,7 @@ class theory_lra::imp {
ast_manager& m; ast_manager& m;
theory_arith_params& m_arith_params; theory_arith_params& m_arith_params;
arith_util a; arith_util a;
bool m_has_int;
arith_eq_adapter m_arith_eq_adapter; arith_eq_adapter m_arith_eq_adapter;
vector<rational> m_columns; vector<rational> m_columns;
@ -225,10 +226,10 @@ class theory_lra::imp {
lp::var_index m_rzero_var; lp::var_index m_rzero_var;
enum constraint_source { enum constraint_source {
inequality_source, inequality_source,
equality_source, equality_source,
definition_source, definition_source,
null_source null_source
}; };
svector<constraint_source> m_constraint_sources; svector<constraint_source> m_constraint_sources;
svector<literal> m_inequalities; // asserted rows corresponding to inequality literals. svector<literal> m_inequalities; // asserted rows corresponding to inequality literals.
@ -363,7 +364,6 @@ class theory_lra::imp {
enode* get_enode(expr* e) const { return ctx().get_enode(e); } enode* get_enode(expr* e) const { return ctx().get_enode(e); }
expr* get_owner(theory_var v) const { return get_enode(v)->get_owner(); } expr* get_owner(theory_var v) const { return get_enode(v)->get_owner(); }
void init_solver() { void init_solver() {
if (m_solver) return; if (m_solver) return;
@ -427,10 +427,6 @@ class theory_lra::imp {
add_const(0, m_zero_var); add_const(0, m_zero_var);
return m_zero_var; return m_zero_var;
} }
void ensure_niil() {
if (!m_niil) {
m_niil = alloc(niil::solver, *m_solver.get(), m.limit(), ctx().get_params());
m_switcher.m_niil = &m_niil;
void ensure_nla() { void ensure_nla() {
if (!m_nla) { if (!m_nla) {
@ -724,6 +720,7 @@ class theory_lra::imp {
} }
if (result == UINT_MAX) { if (result == UINT_MAX) {
result = m_solver->add_var(v, is_int(v)); result = m_solver->add_var(v, is_int(v));
m_has_int |= is_int(v);
m_theory_var2var_index.setx(v, result, UINT_MAX); m_theory_var2var_index.setx(v, result, UINT_MAX);
m_var_index2theory_var.setx(result, v, UINT_MAX); m_var_index2theory_var.setx(result, v, UINT_MAX);
m_var_trail.push_back(v); m_var_trail.push_back(v);
@ -916,6 +913,7 @@ public:
th(th), m(m), th(th), m(m),
m_arith_params(ap), m_arith_params(ap),
a(m), a(m),
m_has_int(false),
m_arith_eq_adapter(th, ap, a), m_arith_eq_adapter(th, ap, a),
m_internalize_head(0), m_internalize_head(0),
m_one_var(UINT_MAX), m_one_var(UINT_MAX),
@ -1512,6 +1510,7 @@ public:
} }
void init_variable_values() { void init_variable_values() {
reset_variable_values();
if (!m.canceled() && m_solver.get() && th.get_num_vars() > 0) { if (!m.canceled() && m_solver.get() && th.get_num_vars() > 0) {
TRACE("arith", tout << "update variable values\n";); TRACE("arith", tout << "update variable values\n";);
m_solver->get_model(m_variable_values); m_solver->get_model(m_variable_values);
@ -1537,9 +1536,9 @@ public:
init_variable_values(); init_variable_values();
TRACE("arith", TRACE("arith",
for (theory_var v = 0; v < sz; ++v) { for (theory_var v = 0; v < sz; ++v) {
if (th.is_relevant_and_shared(get_enode(v))) { if (th.is_relevant_and_shared(get_enode(v))) {
tout << "v" << v << " "; tout << "v" << v << " ";
} }
} }
tout << "\n"; ); tout << "\n"; );
if (!m_use_nra_model) { if (!m_use_nra_model) {
@ -1752,7 +1751,7 @@ public:
return atom; return atom;
} }
/* bool make_sure_all_vars_have_bounds() { bool make_sure_all_vars_have_bounds() {
if (!m_has_int) { if (!m_has_int) {
return true; return true;
} }
@ -1764,7 +1763,7 @@ public:
continue; continue;
if (!m_solver->is_term(vi) && !var_has_bound(vi, true) && !var_has_bound(vi, false)) { if (!m_solver->is_term(vi) && !var_has_bound(vi, true) && !var_has_bound(vi, false)) {
lp::lar_term term; lp::lar_term term;
term.add_monomial(rational::one(), vi); term.add_coeff_var(rational::one(), vi);
app_ref b = mk_bound(term, rational::zero(), true); app_ref b = mk_bound(term, rational::zero(), true);
TRACE("arith", tout << "added bound " << b << "\n";); TRACE("arith", tout << "added bound " << b << "\n";);
IF_VERBOSE(2, verbose_stream() << "bound: " << b << "\n"); IF_VERBOSE(2, verbose_stream() << "bound: " << b << "\n");
@ -1772,7 +1771,7 @@ public:
} }
} }
return all_bounded; return all_bounded;
}*/ }
/** /**
* n = (div p q) * n = (div p q)
@ -1973,28 +1972,6 @@ public:
visitor.display_asserts(out, fmls, true); visitor.display_asserts(out, fmls, true);
out << "(check-sat)\n"; out << "(check-sat)\n";
} }
bool all_variables_have_bounds() {
if (!m_has_int) {
return true;
}
unsigned nv = th.get_num_vars();
bool added_bound = false;
for (unsigned v = 0; v < nv; ++v) {
lp::constraint_index ci;
rational bound;
lp::var_index vi = m_theory_var2var_index[v];
if (!has_upper_bound(vi, ci, bound) && !has_lower_bound(vi, ci, bound)) {
lp::lar_term term;
term.add_coeff_var(rational::one(), vi);
app_ref b = mk_bound(term, rational::zero(), false);
TRACE("arith", tout << "added bound " << b << "\n";);
added_bound = true;
}
}
return !added_bound;
}
lbool check_lia() { lbool check_lia() {
if (m.canceled()) { if (m.canceled()) {
@ -2005,11 +1982,6 @@ public:
if (!check_idiv_bounds()) { if (!check_idiv_bounds()) {
return l_false; return l_false;
} }
lp::lar_term term;
lp::mpq k;
lp::explanation ex; // TBD, this should be streamlined accross different explanations
bool upper;
m_explanation.reset(); m_explanation.reset();
switch (m_lia->check()) { switch (m_lia->check()) {
case lp::lia_move::sat: case lp::lia_move::sat:
@ -2048,7 +2020,7 @@ public:
m_eqs.reset(); m_eqs.reset();
m_core.reset(); m_core.reset();
m_params.reset(); m_params.reset();
for (auto const& ev : ex) { for (auto const& ev : m_explanation) {
if (!ev.first.is_zero()) { if (!ev.first.is_zero()) {
set_evidence(ev.second); set_evidence(ev.second);
} }
@ -2064,7 +2036,6 @@ public:
case lp::lia_move::conflict: case lp::lia_move::conflict:
TRACE("arith", tout << "conflict\n";); TRACE("arith", tout << "conflict\n";);
// ex contains unsat core // ex contains unsat core
m_explanation = ex;
set_conflict1(); set_conflict1();
lia_check = l_false; lia_check = l_false;
break; break;
@ -2365,7 +2336,7 @@ public:
); );
DEBUG_CODE( DEBUG_CODE(
for (auto& lit : m_core) { for (auto& lit : m_core) {
SASSERT(ctx().get_assignment(lit) == l_true); SASSERT(ctx().get_assignment(lit) == l_true);
}); });
++m_stats.m_bound_propagations1; ++m_stats.m_bound_propagations1;
assign(lit); assign(lit);
@ -2569,7 +2540,7 @@ public:
} }
CTRACE("arith_verbose", !atoms.empty(), CTRACE("arith_verbose", !atoms.empty(),
for (unsigned i = 0; i < atoms.size(); ++i) { for (unsigned i = 0; i < atoms.size(); ++i) {
atoms[i]->display(tout); tout << "\n"; atoms[i]->display(tout); tout << "\n";
}); });
lp_bounds occs(m_bounds[v]); lp_bounds occs(m_bounds[v]);
@ -3212,6 +3183,12 @@ public:
m_core.push_back(lit); m_core.push_back(lit);
} }
// m_solver->shrink_explanation_to_minimum(m_explanation); // todo, enable when perf is fixed // m_solver->shrink_explanation_to_minimum(m_explanation); // todo, enable when perf is fixed
/*
static unsigned cn = 0;
static unsigned num_l = 0;
num_l+=m_explanation.size();
std::cout << num_l / (++cn) << "\n";
*/
++m_num_conflicts; ++m_num_conflicts;
++m_stats.m_conflicts; ++m_stats.m_conflicts;
TRACE("arith", tout << "scope: " << ctx().get_scope_level() << "\n"; display_evidence(tout, m_explanation); ); TRACE("arith", tout << "scope: " << ctx().get_scope_level() << "\n"; display_evidence(tout, m_explanation); );
@ -3266,10 +3243,6 @@ public:
void init_model(model_generator & mg) { void init_model(model_generator & mg) {
init_variable_values(); init_variable_values();
DEBUG_CODE(
for (auto const& kv : m_variable_values) {
SASSERT(!m_solver->var_is_int(kv.first) || kv.second.is_int() || m.canceled());
});
m_factory = alloc(arith_factory, m); m_factory = alloc(arith_factory, m);
mg.register_factory(m_factory); mg.register_factory(m_factory);
TRACE("arith", display(tout);); TRACE("arith", display(tout););
@ -3572,7 +3545,7 @@ public:
app_ref coeffs2app(u_map<rational> const& coeffs, rational const& offset, bool is_int) { app_ref coeffs2app(u_map<rational> const& coeffs, rational const& offset, bool is_int) {
expr_ref_vector args(m); expr_ref_vector args(m);
for (auto const& kv : coeffs) { for (auto const& kv : coeffs) {
theory_var w = kv.m_key; theory_var w = kv.m_key;
expr* o = get_enode(w)->get_owner(); expr* o = get_enode(w)->get_owner();
if (kv.m_value.is_zero()) { if (kv.m_value.is_zero()) {

View file

@ -82,7 +82,7 @@ struct gomory_test {
expl.push_justification(column_upper_bound_constraint(x_j), new_a); expl.push_justification(column_upper_bound_constraint(x_j), new_a);
} }
TRACE("gomory_cut_detail_real", tout << a << "*v" << x_j << " k: " << k << "\n";); TRACE("gomory_cut_detail_real", tout << a << "*v" << x_j << " k: " << k << "\n";);
pol.add_monomial(new_a, x_j); pol.add_coeff_var(new_a, x_j);
} }
void int_case_in_gomory_cut(const mpq & a, unsigned x_j, mpq & k, lar_term & t, explanation& expl, mpq & lcm_den, const mpq& f_0, const mpq& one_minus_f_0) { void int_case_in_gomory_cut(const mpq & a, unsigned x_j, mpq & k, lar_term & t, explanation& expl, mpq & lcm_den, const mpq& f_0, const mpq& one_minus_f_0) {
@ -122,7 +122,7 @@ struct gomory_test {
expl.push_justification(column_upper_bound_constraint(x_j), new_a); expl.push_justification(column_upper_bound_constraint(x_j), new_a);
} }
TRACE("gomory_cut_detail", tout << "new_a: " << new_a << " k: " << k << "\n";); TRACE("gomory_cut_detail", tout << "new_a: " << new_a << " k: " << k << "\n";);
t.add_monomial(new_a, x_j); t.add_coeff_var(new_a, x_j);
lcm_den = lcm(lcm_den, denominator(new_a)); lcm_den = lcm(lcm_den, denominator(new_a));
} }
@ -145,12 +145,12 @@ struct gomory_test {
if (!k.is_int()) if (!k.is_int())
k = ceil(k); k = ceil(k);
// switch size // switch size
t.add_monomial(- mpq(1), v); t.add_coeff_var(- mpq(1), v);
k.neg(); k.neg();
} else { } else {
if (!k.is_int()) if (!k.is_int())
k = floor(k); k = floor(k);
t.add_monomial(mpq(1), v); t.add_coeff_var(mpq(1), v);
} }
} else { } else {
TRACE("gomory_cut_detail", tout << "pol.size() > 1" << std::endl;); TRACE("gomory_cut_detail", tout << "pol.size() > 1" << std::endl;);
@ -177,7 +177,7 @@ struct gomory_test {
// negate everything to return -pol <= -k // negate everything to return -pol <= -k
for (const auto & pi: pol) for (const auto & pi: pol)
t.add_monomial(-pi.first, pi.second); t.add_coeff_var(-pi.first, pi.second);
k.neg(); k.neg();
} }
TRACE("gomory_cut_detail", tout << "k = " << k << std::endl;); TRACE("gomory_cut_detail", tout << "k = " << k << std::endl;);

View file

@ -54,6 +54,7 @@
#include "util/lp/lu_def.h" #include "util/lp/lu_def.h"
#include "util/lp/general_matrix.h" #include "util/lp/general_matrix.h"
#include "util/lp/bound_propagator.h" #include "util/lp/bound_propagator.h"
#include "util/lp/nla_solver.h"
namespace lp { namespace lp {
unsigned seed = 1; unsigned seed = 1;
@ -1895,6 +1896,7 @@ void test_replace_column() {
void setup_args_parser(argument_parser & parser) { void setup_args_parser(argument_parser & parser) {
parser.add_option_with_help_string("-nla", "test nla_solver");
parser.add_option_with_help_string("-hnf", "test hermite normal form"); parser.add_option_with_help_string("-hnf", "test hermite normal form");
parser.add_option_with_help_string("-gomory", "gomory"); parser.add_option_with_help_string("-gomory", "gomory");
parser.add_option_with_help_string("-intd", "test integer_domain"); parser.add_option_with_help_string("-intd", "test integer_domain");
@ -2405,7 +2407,7 @@ void run_lar_solver(argument_parser & args_parser, lar_solver * solver, mps_read
lp_status status = solver->solve(); lp_status status = solver->solve();
std::cout << "status is " << lp_status_to_string(status) << ", processed for " << sw.get_current_seconds() <<" seconds, and " << solver->get_total_iterations() << " iterations" << std::endl; std::cout << "status is " << lp_status_to_string(status) << ", processed for " << sw.get_current_seconds() <<" seconds, and " << solver->get_total_iterations() << " iterations" << std::endl;
if (solver->get_status() == lp_status::INFEASIBLE) { if (solver->get_status() == lp_status::INFEASIBLE) {
vector<std::pair<lp::mpq, constraint_index>> evidence; explanation evidence;
solver->get_infeasibility_explanation(evidence); solver->get_infeasibility_explanation(evidence);
} }
if (args_parser.option_is_used("--randomize_lar")) { if (args_parser.option_is_used("--randomize_lar")) {
@ -3546,6 +3548,10 @@ void test_gomory_cut() {
test_gomory_cut_1(); test_gomory_cut_1();
} }
void test_nla() {
nla::solver::test();
}
void test_lp_local(int argn, char**argv) { void test_lp_local(int argn, char**argv) {
// initialize_util_module(); // initialize_util_module();
@ -3561,7 +3567,15 @@ void test_lp_local(int argn, char**argv) {
} }
args_parser.print(); args_parser.print();
if (args_parser.option_is_used("-nla")) {
#ifdef Z3DEBUG
test_nla();
#endif
return finalize(0);
}
if (args_parser.option_is_used("-hnf")) { if (args_parser.option_is_used("-hnf")) {
#ifdef Z3DEBUG #ifdef Z3DEBUG
test_hnf(); test_hnf();

View file

@ -69,8 +69,8 @@ class gomory::imp {
m_ex.push_justification(column_upper_bound_constraint(j)); m_ex.push_justification(column_upper_bound_constraint(j));
} }
m_t.add_coeff_var(new_a, j); m_t.add_coeff_var(new_a, j);
lcm_den = lcm(lcm_den, denominator(new_a)); m_lcm_den = lcm(m_lcm_den, denominator(new_a));
TRACE("gomory_cut_detail", tout << "new_a = " << new_a << ", k = " << m_k << ", lcm_den = " << lcm_den << "\n";); TRACE("gomory_cut_detail", tout << "new_a = " << new_a << ", k = " << m_k << ", lcm_den = " << m_lcm_den << "\n";);
} }
void real_case_in_gomory_cut(const mpq & a, unsigned j) { void real_case_in_gomory_cut(const mpq & a, unsigned j) {
@ -98,8 +98,8 @@ class gomory::imp {
m_k.addmul(new_a, upper_bound(j).x); // k += upper_bound(j).x * new_a; m_k.addmul(new_a, upper_bound(j).x); // k += upper_bound(j).x * new_a;
m_ex.push_justification(column_upper_bound_constraint(j)); m_ex.push_justification(column_upper_bound_constraint(j));
} }
TRACE("gomory_cut_detail_real", tout << a << "*v" << x_j << " k: " << m_k << "\n";); TRACE("gomory_cut_detail_real", tout << a << "*v" << j << " k: " << m_k << "\n";);
m_t.add_coeff_var(new_a, x_j); m_t.add_coeff_var(new_a, j);
} }
lia_move report_conflict_from_gomory_cut() { lia_move report_conflict_from_gomory_cut() {

View file

@ -118,21 +118,6 @@ constraint_index int_solver::column_upper_bound_constraint(unsigned j) const {
return m_lar_solver->get_column_upper_bound_witness(j); return m_lar_solver->get_column_upper_bound_witness(j);
} }
bool int_solver::current_solution_is_inf_on_cut() const {
const auto & x = m_lar_solver->m_mpq_lar_core_solver.m_r_x;
impq v = m_t->apply(x);
mpq sign = *m_upper ? one_of_type<mpq>() : -one_of_type<mpq>();
CTRACE("current_solution_is_inf_on_cut", v * sign <= (*m_k) * sign,
tout << "m_upper = " << *m_upper << std::endl;
tout << "v = " << v << ", k = " << (*m_k) << std::endl;
);
return v * sign > (*m_k) * sign;
}
constraint_index int_solver::column_lower_bound_constraint(unsigned j) const {
return m_lar_solver->get_column_lower_bound_witness(j);
}
bool int_solver::current_solution_is_inf_on_cut() const { bool int_solver::current_solution_is_inf_on_cut() const {
const auto & x = m_lar_solver->m_mpq_lar_core_solver.m_r_x; const auto & x = m_lar_solver->m_mpq_lar_core_solver.m_r_x;
impq v = m_t.apply(x); impq v = m_t.apply(x);
@ -144,6 +129,10 @@ bool int_solver::current_solution_is_inf_on_cut() const {
return v * sign > m_k * sign; return v * sign > m_k * sign;
} }
constraint_index int_solver::column_lower_bound_constraint(unsigned j) const {
return m_lar_solver->get_column_lower_bound_witness(j);
}
lia_move int_solver::mk_gomory_cut( unsigned inf_col, const row_strip<mpq> & row) { lia_move int_solver::mk_gomory_cut( unsigned inf_col, const row_strip<mpq> & row) {
lp_assert(column_is_int_inf(inf_col)); lp_assert(column_is_int_inf(inf_col));
@ -186,11 +175,9 @@ typedef monomial mono;
// this will allow to enable and disable tracking of the pivot rows // this will allow to enable and disable tracking of the pivot rows
struct check_return_helper { struct check_return_helper {
lar_solver * m_lar_solver; lar_solver * m_lar_solver;
const lia_move & m_r;
bool m_track_pivoted_rows; bool m_track_pivoted_rows;
check_return_helper(lar_solver* ls, const lia_move& r) : check_return_helper(lar_solver* ls) :
m_lar_solver(ls), m_lar_solver(ls),
m_r(r),
m_track_pivoted_rows(ls->get_track_pivoted_rows()) m_track_pivoted_rows(ls->get_track_pivoted_rows())
{ {
TRACE("pivoted_rows", tout << "pivoted rows = " << ls->m_mpq_lar_core_solver.m_r_solver.m_pivoted_rows->size() << std::endl;); TRACE("pivoted_rows", tout << "pivoted rows = " << ls->m_mpq_lar_core_solver.m_r_solver.m_pivoted_rows->size() << std::endl;);
@ -389,8 +376,8 @@ lia_move int_solver::make_hnf_cut() {
if (r == lia_move::cut) { if (r == lia_move::cut) {
TRACE("hnf_cut", TRACE("hnf_cut",
m_lar_solver->print_term(*m_t, tout << "cut:"); m_lar_solver->print_term(m_t, tout << "cut:");
tout << " <= " << *m_k << std::endl; tout << " <= " << m_k << std::endl;
for (unsigned i : m_hnf_cutter.constraints_for_explanation()) { for (unsigned i : m_hnf_cutter.constraints_for_explanation()) {
m_lar_solver->print_constraint(i, tout); m_lar_solver->print_constraint(i, tout);
} }
@ -433,7 +420,7 @@ lia_move int_solver::check() {
CHECK_RET(run_gcd_test()); CHECK_RET(run_gcd_test());
check_return_helper pc(m_lar_solver, r); check_return_helper pc(m_lar_solver);
if (settings().m_int_pivot_fixed_vars_from_basis) if (settings().m_int_pivot_fixed_vars_from_basis)
m_lar_solver->pivot_fixed_vars_from_basis(); m_lar_solver->pivot_fixed_vars_from_basis();
@ -611,8 +598,8 @@ bool int_solver::gcd_test_for_row(static_matrix<mpq, numeric_pair<mpq>> & A, uns
void int_solver::add_to_explanation_from_fixed_or_boxed_column(unsigned j) { void int_solver::add_to_explanation_from_fixed_or_boxed_column(unsigned j) {
constraint_index lc, uc; constraint_index lc, uc;
m_lar_solver->get_bound_constraint_witnesses_for_column(j, lc, uc); m_lar_solver->get_bound_constraint_witnesses_for_column(j, lc, uc);
m_ex->push_justification(lc); m_ex.push_justification(lc);
m_ex->push_justification(uc); m_ex.push_justification(uc);
} }
void int_solver::fill_explanation_from_fixed_columns(const row_strip<mpq> & row) { void int_solver::fill_explanation_from_fixed_columns(const row_strip<mpq> & row) {
for (const auto & c : row) { for (const auto & c : row) {
@ -1009,13 +996,13 @@ lia_move int_solver::create_branch_on_column(int j) {
TRACE("check_main_int", tout << "branching" << std::endl;); TRACE("check_main_int", tout << "branching" << std::endl;);
lp_assert(m_t.is_empty()); lp_assert(m_t.is_empty());
lp_assert(j != -1); lp_assert(j != -1);
m_t->add_coeff_var(mpq(1), m_lar_solver->adjust_column_index_to_term_index(j)); m_t.add_coeff_var(mpq(1), m_lar_solver->adjust_column_index_to_term_index(j));
if (is_free(j)) { if (is_free(j)) {
m_upper = true; m_upper = true;
m_k = mpq(0); m_k = mpq(0);
} else { } else {
m_upper = left_branch_is_more_narrow_than_right(j); m_upper = left_branch_is_more_narrow_than_right(j);
m_k = *m_upper? floor(get_value(j)) : ceil(get_value(j)); m_k = m_upper? floor(get_value(j)) : ceil(get_value(j));
} }
TRACE("int_solver", tout << "branching v" << j << " = " << get_value(j) << "\n"; TRACE("int_solver", tout << "branching v" << j << " = " << get_value(j) << "\n";

View file

@ -77,7 +77,8 @@ struct vars_equivalence {
unsigned size() const { return m_map.size(); } unsigned size() const { return m_map.size(); }
void add_equivalence_maybe(const lp::lar_term *t, lpci c0, lpci c1) { void add_equivalence_maybe(const lp::lar_term *t, lpci c0, lpci c1) {
if (t->size() != 2 || ! t->m_v.is_zero()) SASSERT(false); // check for new terms
if (t->size() != 2 || t->size() != 3)
return; return;
bool seen_minus = false; bool seen_minus = false;
bool seen_plus = false; bool seen_plus = false;
@ -489,7 +490,8 @@ struct solver::imp {
} }
lp::lar_term t; lp::lar_term t;
t.add_coeff_var(rational(1), m_monomials[i_mon].var()); t.add_coeff_var(rational(1), m_monomials[i_mon].var());
t.m_v = -rs; SASSERT(false); // figure out the change!!!!!!
// t.m_v = -rs;
ineq in(kind, t); ineq in(kind, t);
m_lemma->push_back(in); m_lemma->push_back(in);
TRACE("nla_solver", print_explanation_and_lemma(tout);); TRACE("nla_solver", print_explanation_and_lemma(tout););
@ -1274,6 +1276,9 @@ struct solver::imp {
return l_undef; return l_undef;
} }
void test() {
std::cout << "test called\n";
}
}; // end of imp }; // end of imp
void solver::add_monomial(lpvar v, unsigned sz, lpvar const* vs) { void solver::add_monomial(lpvar v, unsigned sz, lpvar const* vs) {
@ -1286,9 +1291,6 @@ lbool solver::check(lp::explanation & ex, lemma& l) {
return m_imp->check(ex, l); return m_imp->check(ex, l);
} }
}; // end of imp
void solver::add_monomial(lpvar v, unsigned sz, lpvar const* vs) { void solver::add_monomial(lpvar v, unsigned sz, lpvar const* vs) {
m_imp->add(v, sz, vs); m_imp->add(v, sz, vs);
} }
@ -1315,4 +1317,12 @@ solver::~solver() {
dealloc(m_imp); dealloc(m_imp);
} }
void solver::test() {
lp::lar_solver s;
reslimit l;
params_ref p;
imp i(s, l, p);
i.test();
}
} }

View file

@ -45,5 +45,6 @@ public:
void pop(unsigned scopes); void pop(unsigned scopes);
bool need_check(); bool need_check();
lbool check(lp::explanation&, lemma&); lbool check(lp::explanation&, lemma&);
static void test();
}; };
} }