3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-01 12:58:54 +00:00

use bool_var instead of unsigned

This commit is contained in:
Nikolaj Bjorner 2026-06-11 15:53:44 -07:00
parent 49d725f477
commit deb9fe4240
2 changed files with 11 additions and 10 deletions

View file

@ -251,11 +251,11 @@ namespace {
return const_cast<smt::kernel&>(m_context).get_context().get_num_bool_vars(); return const_cast<smt::kernel&>(m_context).get_context().get_num_bool_vars();
} }
unsigned get_bool_var(expr* e) const override { sat::bool_var get_bool_var(expr* e) const override {
auto& ctx = const_cast<smt::kernel&>(m_context).get_context(); auto& ctx = const_cast<smt::kernel&>(m_context).get_context();
expr* atom = e; expr* atom = e;
get_manager().is_not(e, atom); get_manager().is_not(e, atom);
return ctx.b_internalized(atom) ? ctx.get_bool_var(atom) : UINT_MAX; return ctx.b_internalized(atom) ? ctx.get_bool_var(atom) : sat::null_bool_var;
} }
void pop_to_base_level() override { void pop_to_base_level() override {
@ -450,9 +450,9 @@ namespace {
ast_manager& m = get_manager(); ast_manager& m = get_manager();
if (!get_params().get_bool("cube.lookahead", false)) { if (!get_params().get_bool("cube.lookahead", false)) {
auto& ctx = m_context.get_context(); auto& ctx = m_context.get_context();
obj_hashtable<expr> selected_vars; expr_mark selected_vars;
for (expr* v : vars) for (expr* v : vars)
selected_vars.insert(v); selected_vars.mark(v);
expr_ref_vector candidates(m); expr_ref_vector candidates(m);
expr_ref result(m); expr_ref result(m);
double score = 0.0; double score = 0.0;
@ -465,7 +465,7 @@ namespace {
expr* e = ctx.bool_var2expr(v); expr* e = ctx.bool_var2expr(v);
if (!e) if (!e)
continue; continue;
if (!selected_vars.empty() && !selected_vars.contains(e)) if (!vars.empty() && !selected_vars.is_marked(e))
continue; continue;
candidates.push_back(e); candidates.push_back(e);
double new_score = ctx.get_activity(v); double new_score = ctx.get_activity(v);

View file

@ -22,6 +22,7 @@ Notes:
#include "solver/check_sat_result.h" #include "solver/check_sat_result.h"
#include "solver/progress_callback.h" #include "solver/progress_callback.h"
#include "util/params.h" #include "util/params.h"
#include "util/sat_literal.h"
class solver; class solver;
class model_converter; class model_converter;
@ -309,11 +310,11 @@ public:
virtual unsigned get_assign_level(expr* e) const { return UINT_MAX; } virtual unsigned get_assign_level(expr* e) const { return UINT_MAX; }
virtual bool is_relevant(expr* e) const { return true; } virtual bool is_relevant(expr* e) const { return true; }
virtual unsigned get_num_bool_vars() const { return UINT_MAX; } virtual unsigned get_num_bool_vars() const { return UINT_MAX; }
virtual unsigned get_bool_var(expr* e) const { return UINT_MAX; } virtual sat::bool_var get_bool_var(expr* e) const { return sat::null_bool_var; }
virtual expr* bool_var2expr(unsigned) const { return nullptr; } virtual expr* bool_var2expr(sat::bool_var) const { return nullptr; }
virtual lbool get_assignment(unsigned) const { return l_undef; } virtual lbool get_assignment(sat::bool_var) const { return l_undef; }
virtual double get_activity(unsigned) const { return 0.0; } virtual double get_activity(sat::bool_var) const { return 0.0; }
virtual bool was_eliminated(unsigned) const { return false; } virtual bool was_eliminated(sat::bool_var) const { return false; }
virtual void pop_to_base_level() {} virtual void pop_to_base_level() {}