mirror of
https://github.com/Z3Prover/z3
synced 2025-07-30 16:03:16 +00:00
ensure generation is increased #2667
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
12819640b7
commit
5f90e72d85
4 changed files with 52 additions and 86 deletions
|
@ -20,30 +20,27 @@ Revision History:
|
|||
#include "util/warning.h"
|
||||
|
||||
cost_evaluator::cost_evaluator(ast_manager & m):
|
||||
m_manager(m),
|
||||
m(m),
|
||||
m_util(m) {
|
||||
}
|
||||
|
||||
float cost_evaluator::eval(expr * f) const {
|
||||
#define E(IDX) eval(to_app(f)->get_arg(IDX))
|
||||
if (is_app(f)) {
|
||||
unsigned num_args;
|
||||
family_id fid = to_app(f)->get_family_id();
|
||||
if (fid == m_manager.get_basic_family_id()) {
|
||||
if (fid == m.get_basic_family_id()) {
|
||||
switch (to_app(f)->get_decl_kind()) {
|
||||
case OP_TRUE: return 1.0f;
|
||||
case OP_FALSE: return 0.0f;
|
||||
case OP_NOT: return E(0) == 0.0f ? 1.0f : 0.0f;
|
||||
case OP_AND:
|
||||
num_args = to_app(f)->get_num_args();
|
||||
for (unsigned i = 0; i < num_args; i++)
|
||||
if (E(i) == 0.0f)
|
||||
case OP_AND:
|
||||
for (expr* arg : *to_app(f))
|
||||
if (eval(arg) == 0.0f)
|
||||
return 0.0f;
|
||||
return 1.0f;
|
||||
case OP_OR:
|
||||
num_args = to_app(f)->get_num_args();
|
||||
for (unsigned i = 0; i < num_args; i++)
|
||||
if (E(i) != 0.0f)
|
||||
for (expr* arg : *to_app(f))
|
||||
if (eval(arg) != 0.0f)
|
||||
return 1.0f;
|
||||
return 0.0f;
|
||||
case OP_ITE: return E(0) != 0.0f ? E(1) : E(2);
|
||||
|
|
|
@ -23,7 +23,7 @@ Revision History:
|
|||
#include "ast/arith_decl_plugin.h"
|
||||
|
||||
class cost_evaluator {
|
||||
ast_manager & m_manager;
|
||||
ast_manager & m;
|
||||
arith_util m_util;
|
||||
unsigned m_num_args;
|
||||
float const * m_args;
|
||||
|
|
|
@ -16,13 +16,13 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include "smt/smt_context.h"
|
||||
#include "smt/qi_queue.h"
|
||||
#include "util/warning.h"
|
||||
#include "util/stats.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/ast_ll_pp.h"
|
||||
#include "ast/rewriter/var_subst.h"
|
||||
#include "util/stats.h"
|
||||
#include "smt/smt_context.h"
|
||||
#include "smt/qi_queue.h"
|
||||
|
||||
namespace smt {
|
||||
|
||||
|
@ -130,7 +130,7 @@ namespace smt {
|
|||
// max_top_generation and min_top_generation are not available for computing inc_gen
|
||||
set_values(q, nullptr, generation, 0, 0, cost);
|
||||
float r = m_evaluator(m_new_gen_function, m_vals.size(), m_vals.c_ptr());
|
||||
return static_cast<unsigned>(r);
|
||||
return std::max(generation + 1, static_cast<unsigned>(r));
|
||||
}
|
||||
|
||||
void qi_queue::insert(fingerprint * f, app * pat, unsigned generation, unsigned min_top_generation, unsigned max_top_generation) {
|
||||
|
@ -140,7 +140,7 @@ namespace smt {
|
|||
tout << "new instance of " << q->get_qid() << ", weight " << q->get_weight()
|
||||
<< ", generation: " << generation << ", scope_level: " << m_context.get_scope_level() << ", cost: " << cost << "\n";
|
||||
for (unsigned i = 0; i < f->get_num_args(); i++) {
|
||||
tout << "#" << f->get_arg(i)->get_owner_id() << " ";
|
||||
tout << "#" << f->get_arg(i)->get_owner_id() << " d:" << f->get_arg(i)->get_owner()->get_depth() << " ";
|
||||
}
|
||||
tout << "\n";);
|
||||
TRACE("new_entries_bug", tout << "[qi:insert]\n";);
|
||||
|
@ -201,7 +201,7 @@ namespace smt {
|
|||
|
||||
ent.m_instantiated = true;
|
||||
|
||||
TRACE("qi_queue_profile", tout << q->get_qid() << ", gen: " << generation << " " << *f;);
|
||||
TRACE("qi_queue_profile", tout << q->get_qid() << ", gen: " << generation << " " << *f << " cost: " << ent.m_cost << "\n";);
|
||||
|
||||
if (m_checker.is_sat(q->get_expr(), num_bindings, bindings)) {
|
||||
TRACE("checker", tout << "instance already satisfied\n";);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue