3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-13 14:40:55 +00:00

move common routines for quantifiers

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2021-01-28 13:23:40 -08:00
parent 5414030875
commit e3d634807b
12 changed files with 130 additions and 120 deletions

View file

@ -98,8 +98,8 @@ namespace smt {
m_parser.add_var("cs_factor");
}
quantifier_stat * qi_queue::set_values(quantifier * q, app * pat, unsigned generation, unsigned min_top_generation, unsigned max_top_generation, float cost) {
quantifier_stat * stat = m_qm.get_stat(q);
q::quantifier_stat * qi_queue::set_values(quantifier * q, app * pat, unsigned generation, unsigned min_top_generation, unsigned max_top_generation, float cost) {
q::quantifier_stat * stat = m_qm.get_stat(q);
m_vals[COST] = cost;
m_vals[MIN_TOP_GENERATION] = static_cast<float>(min_top_generation);
m_vals[MAX_TOP_GENERATION] = static_cast<float>(max_top_generation);
@ -120,7 +120,7 @@ namespace smt {
}
float qi_queue::get_cost(quantifier * q, app * pat, unsigned generation, unsigned min_top_generation, unsigned max_top_generation) {
quantifier_stat * stat = set_values(q, pat, generation, min_top_generation, max_top_generation, 0);
q::quantifier_stat * stat = set_values(q, pat, generation, min_top_generation, max_top_generation, 0);
float r = m_evaluator(m_cost_function, m_vals.size(), m_vals.c_ptr());
stat->update_max_cost(r);
return r;
@ -206,7 +206,7 @@ namespace smt {
TRACE("qi_queue_profile", tout << q->get_qid() << ", gen: " << generation << " " << *f << " cost: " << ent.m_cost << "\n";);
quantifier_stat * stat = m_qm.get_stat(q);
q::quantifier_stat * stat = m_qm.get_stat(q);
if (m_checker.is_sat(q->get_expr(), num_bindings, bindings)) {
TRACE("checker", tout << "instance already satisfied\n";);
@ -221,8 +221,10 @@ namespace smt {
STRACE("instance", tout << "### " << static_cast<void*>(f) <<", " << q->get_qid() << "\n";);
expr_ref instance(m);
m_subst(q, num_bindings, bindings, instance);
auto* ebindings = m_subst(q, num_bindings);
for (unsigned i = 0; i < num_bindings; ++i)
ebindings[i] = bindings[i]->get_owner();
expr_ref instance = m_subst();
TRACE("qi_queue", tout << "new instance:\n" << mk_pp(instance, m) << "\n";);
TRACE("qi_queue_instance", tout << "new instance:\n" << mk_pp(instance, m) << "\n";);