mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 11:25:51 +00:00
fixes in horner's heuristic
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
207c1c509f
commit
1b8b09cddb
6 changed files with 145 additions and 69 deletions
|
@ -2372,12 +2372,14 @@ void lar_solver::set_cut_strategy(unsigned cut_frequency) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void lar_solver::register_normalized_term(const lar_term& t, lpvar j) {
|
||||
lar_term normalized_t = t.get_normalized_by_min_var();
|
||||
mpq a;
|
||||
lar_term normalized_t = t.get_normalized_by_min_var(a);
|
||||
TRACE("lar_solver_terms", tout << "t="; print_term_as_indices(t, tout);
|
||||
tout << ", normalized_t="; print_term_as_indices(normalized_t, tout) << "\n";);
|
||||
if (m_normalized_terms_to_columns.find(normalized_t) == m_normalized_terms_to_columns.end()) {
|
||||
m_normalized_terms_to_columns[normalized_t] = j;
|
||||
m_normalized_terms_to_columns[normalized_t] = std::make_pair(a, j);
|
||||
} else {
|
||||
TRACE("lar_solver_terms", tout << "the term has been seen already\n";);
|
||||
}
|
||||
|
@ -2386,7 +2388,8 @@ void lar_solver::register_normalized_term(const lar_term& t, lpvar j) {
|
|||
void lar_solver::deregister_normalized_term(const lar_term& t) {
|
||||
TRACE("lar_solver_terms", tout << "deregister term ";
|
||||
print_term_as_indices(t, tout) << "\n";);
|
||||
lar_term normalized_t = t.get_normalized_by_min_var();
|
||||
mpq a;
|
||||
lar_term normalized_t = t.get_normalized_by_min_var(a);
|
||||
m_normalized_terms_to_columns.erase(normalized_t);
|
||||
}
|
||||
|
||||
|
@ -2397,18 +2400,20 @@ void lar_solver::register_existing_terms() {
|
|||
register_normalized_term(*m_terms[k], j);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned lar_solver::fetch_normalized_term_column(const lar_term& c) const {
|
||||
// a_j.first gives the normalised coefficient,
|
||||
// a_j.second givis the column
|
||||
bool lar_solver::fetch_normalized_term_column(const lar_term& c, std::pair<mpq, lpvar> & a_j) const {
|
||||
TRACE("lar_solver_terms", tout << "looking for term ";
|
||||
print_term_as_indices(c, tout) << "\n";);
|
||||
lp_assert(c.is_normalized());
|
||||
auto it = m_normalized_terms_to_columns.find(c);
|
||||
if (it != m_normalized_terms_to_columns.end()) {
|
||||
TRACE("lar_solver_terms", tout << "got " << it->second << "\n" ;);
|
||||
return it->second;
|
||||
a_j = it->second;
|
||||
return true;
|
||||
}
|
||||
TRACE("lar_solver_terms", tout << "have not found\n";);
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
} // namespace lp
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue