3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-13 03:00:19 +00:00

add score access and reset

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2025-07-23 15:32:49 -07:00
parent 20b9690b01
commit ac857aaf72
2 changed files with 19 additions and 0 deletions

View file

@ -928,6 +928,8 @@ namespace smt {
set_bool_var(id, v);
m_bdata.reserve(v+1);
m_activity.reserve(v+1);
m_scores.reserve(v + 1);
m_scores[v][0] = m_scores[v][1] = 0.0;
m_bool_var2expr.reserve(v+1);
m_bool_var2expr[v] = n;
literal l(v, false);
@ -1416,6 +1418,7 @@ namespace smt {
break;
case CLS_LEARNED:
dump_lemma(num_lits, lits);
add_scores(num_lits, lits);
break;
default:
break;
@ -1524,6 +1527,14 @@ namespace smt {
}}
}
void context::add_scores(unsigned n, literal const* lits) {
for (unsigned i = 0; i < n; ++i) {
auto lit = lits[i];
unsigned v = lit.var();
m_scores[v][lit.sign()] += 1.0 / n;
}
}
void context::dump_axiom(unsigned n, literal const* lits) {
if (m_fparams.m_axioms2files) {
literal_buffer tmp;