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

allow adding constraints during on_model

This commit is contained in:
Nikolaj Bjorner 2022-04-09 09:55:02 +02:00
parent 005b8e3cf8
commit 405a26c585
5 changed files with 36 additions and 11 deletions

View file

@ -195,13 +195,22 @@ namespace opt {
}
void context::add_hard_constraint(expr* f) {
if (m_calling_on_model)
if (m_calling_on_model) {
get_solver().assert_expr(f);
for (auto const& [k, v] : m_maxsmts)
v->reset_upper();
for (unsigned i = 0; i < num_objectives(); ++i) {
auto const& o = m_scoped_state.m_objectives[i];
if (o.m_type != O_MAXSMT)
m_optsmt.update_upper(o.m_index, inf_eps::infinity());
}
}
else {
m_scoped_state.add(f);
clear_state();
}
}
void context::add_hard_constraint(expr* f, expr* t) {
if (m_calling_on_model)