mirror of
https://github.com/Z3Prover/z3
synced 2025-04-29 11:55:51 +00:00
redo bindings/fingerprints
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
281fb67d88
commit
33f4e65fa9
6 changed files with 145 additions and 180 deletions
|
@ -86,13 +86,13 @@ namespace q {
|
|||
m_parser.add_var("cs_factor");
|
||||
}
|
||||
|
||||
void queue::set_values(fingerprint& f, float cost) {
|
||||
void queue::set_values(binding& f, float cost) {
|
||||
quantifier_stat * stat = f.c->m_stat;
|
||||
quantifier* q = f.q();
|
||||
app* pat = f.b->m_pattern;
|
||||
app* pat = f.m_pattern;
|
||||
m_vals[COST] = cost;
|
||||
m_vals[MIN_TOP_GENERATION] = static_cast<float>(f.b->m_min_top_generation);
|
||||
m_vals[MAX_TOP_GENERATION] = static_cast<float>(f.b->m_max_top_generation);
|
||||
m_vals[MIN_TOP_GENERATION] = static_cast<float>(f.m_min_top_generation);
|
||||
m_vals[MAX_TOP_GENERATION] = static_cast<float>(f.m_max_top_generation);
|
||||
m_vals[INSTANCES] = static_cast<float>(stat->get_num_instances_curr_branch());
|
||||
m_vals[SIZE] = static_cast<float>(stat->get_size());
|
||||
m_vals[DEPTH] = static_cast<float>(stat->get_depth());
|
||||
|
@ -108,14 +108,14 @@ namespace q {
|
|||
TRACE("q_detail", for (unsigned i = 0; i < m_vals.size(); i++) { tout << m_vals[i] << " "; } tout << "\n";);
|
||||
}
|
||||
|
||||
float queue::get_cost(fingerprint& f) {
|
||||
float queue::get_cost(binding& f) {
|
||||
set_values(f, 0);
|
||||
float r = m_evaluator(m_cost_function, m_vals.size(), m_vals.data());
|
||||
f.c->m_stat->update_max_cost(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
unsigned queue::get_new_gen(fingerprint& f, float cost) {
|
||||
unsigned queue::get_new_gen(binding& f, float cost) {
|
||||
set_values(f, cost);
|
||||
float r = m_evaluator(m_new_gen_function, m_vals.size(), m_vals.data());
|
||||
return std::max(f.m_max_generation + 1, static_cast<unsigned>(r));
|
||||
|
@ -129,7 +129,7 @@ namespace q {
|
|||
}
|
||||
};
|
||||
|
||||
void queue::insert(fingerprint* f) {
|
||||
void queue::insert(binding* f) {
|
||||
float cost = get_cost(*f);
|
||||
if (m_new_entries.empty())
|
||||
ctx.push(reset_new_entries(m_new_entries));
|
||||
|
@ -137,7 +137,7 @@ namespace q {
|
|||
}
|
||||
|
||||
void queue::instantiate(entry& ent) {
|
||||
fingerprint & f = *ent.m_qb;
|
||||
binding& f = *ent.m_qb;
|
||||
quantifier * q = f.q();
|
||||
unsigned num_bindings = f.size();
|
||||
quantifier_stat * stat = f.c->m_stat;
|
||||
|
@ -151,7 +151,7 @@ namespace q {
|
|||
|
||||
auto* ebindings = m_subst(q, num_bindings);
|
||||
for (unsigned i = 0; i < num_bindings; ++i)
|
||||
ebindings[i] = f.nodes()[i]->get_expr();
|
||||
ebindings[i] = f[i]->get_expr();
|
||||
expr_ref instance = m_subst();
|
||||
ctx.get_rewriter()(instance);
|
||||
if (m.is_true(instance)) {
|
||||
|
@ -164,7 +164,7 @@ namespace q {
|
|||
|
||||
euf::solver::scoped_generation _sg(ctx, gen);
|
||||
sat::literal result_l = ctx.mk_literal(instance);
|
||||
em.add_instantiation(*f.c, *f.b, result_l);
|
||||
em.add_instantiation(*f.c, f, result_l);
|
||||
}
|
||||
|
||||
bool queue::propagate() {
|
||||
|
@ -178,7 +178,7 @@ namespace q {
|
|||
if (0 == since_last_check && ctx.resource_limits_exceeded())
|
||||
break;
|
||||
|
||||
fingerprint& f = *curr.m_qb;
|
||||
binding& f = *curr.m_qb;
|
||||
|
||||
if (curr.m_cost <= m_eager_cost_threshold)
|
||||
instantiate(curr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue