3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 03:45:51 +00:00

added facility to persist model transformations

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-11-02 00:05:52 -05:00
commit fd49a0c89c
195 changed files with 3601 additions and 2139 deletions

View file

@ -315,14 +315,13 @@ public:
void found_optimum() {
IF_VERBOSE(1, verbose_stream() << "found optimum\n";);
rational upper(0);
m_lower.reset();
for (unsigned i = 0; i < m_soft.size(); ++i) {
m_assignment[i] = is_true(m_soft[i]);
if (!m_assignment[i]) {
upper += m_weights[i];
m_lower += m_weights[i];
}
}
SASSERT(upper == m_lower);
m_upper = m_lower;
m_found_feasible_optimum = true;
}
@ -399,10 +398,11 @@ public:
void get_current_correction_set(model* mdl, exprs& cs) {
cs.reset();
if (!mdl) return;
for (unsigned i = 0; i < m_asms.size(); ++i) {
if (is_false(mdl, m_asms[i].get())) {
cs.push_back(m_asms[i].get());
for (expr* a : m_asms) {
if (is_false(mdl, a)) {
cs.push_back(a);
}
TRACE("opt", expr_ref tmp(m); mdl->eval(a, tmp, true); tout << mk_pp(a, m) << ": " << tmp << "\n";);
}
TRACE("opt", display_vec(tout << "new correction set: ", cs););
}
@ -511,6 +511,7 @@ public:
trace();
if (m_c.num_objectives() == 1 && m_pivot_on_cs && m_csmodel.get() && m_correction_set_size < core.size()) {
exprs cs;
TRACE("opt", tout << "cs " << m_correction_set_size << " " << core.size() << "\n";);
get_current_correction_set(m_csmodel.get(), cs);
m_correction_set_size = cs.size();
if (m_correction_set_size < core.size()) {