Пример #1
0
    lbool check_sat(unsigned sz, expr * const * assumptions, double const* weights, double max_weight) {
        m_weights.reset();
        if (weights != 0) {
            m_weights.append(sz, weights);
        }
        SASSERT(m_weights.empty() == (m_weights.c_ptr() == 0));
        m_solver.pop_to_base_level();
        dep2asm_t dep2asm;
        m_model = 0;
        lbool r = internalize_formulas();
        if (r != l_true) return r;
        r = internalize_assumptions(sz, assumptions, dep2asm);
        if (r != l_true) return r;

        r = m_solver.check(m_asms.size(), m_asms.c_ptr(), m_weights.c_ptr(), max_weight);
        switch (r) {
        case l_true:
            if (sz > 0 && !weights) {
                check_assumptions(dep2asm);
            }
            break;
        case l_false:
            // TBD: expr_dependency core is not accounted for.
            if (!m_asms.empty()) {
                extract_core(dep2asm);
            }
            break;
        default:
            break;
        }
        return r;
    }
Пример #2
0
 void display_weighted(std::ostream& out, unsigned sz, expr * const * assumptions, unsigned const* weights) {
     m_weights.reset();
     if (weights != 0) {
         for (unsigned i = 0; i < sz; ++i) m_weights.push_back(weights[i]);
     }
     m_solver.pop_to_base_level();
     dep2asm_t dep2asm;
     VERIFY(l_true == internalize_formulas());
     VERIFY(l_true == internalize_assumptions(sz, assumptions, dep2asm));
     svector<unsigned> nweights;
     for (unsigned i = 0; i < m_asms.size(); ++i) {
         nweights.push_back((unsigned) m_weights[i]);
     }
     m_solver.display_wcnf(out, m_asms.size(), m_asms.c_ptr(), nweights.c_ptr());
 }
Пример #3
0
 void display_weighted(std::ostream& out, unsigned sz, expr * const * assumptions, unsigned const* weights) {
     if (weights != nullptr) {
         for (unsigned i = 0; i < sz; ++i) m_weights.push_back(weights[i]);
     }
     init_preprocess();
     m_solver.pop_to_base_level();
     dep2asm_t dep2asm;
     expr_ref_vector asms(m);
     for (unsigned i = 0; i < sz; ++i) {
         expr_ref a(m.mk_fresh_const("s", m.mk_bool_sort()), m);
         expr_ref fml(m.mk_implies(a, assumptions[i]), m);
         assert_expr(fml);
         asms.push_back(a);
     }
     VERIFY(l_true == internalize_formulas());
     VERIFY(l_true == internalize_assumptions(sz, asms.c_ptr(), dep2asm));
     svector<unsigned> nweights;
     for (unsigned i = 0; i < m_asms.size(); ++i) {
         nweights.push_back((unsigned) m_weights[i]);
     }
     m_weights.reset();
     m_solver.display_wcnf(out, m_asms.size(), m_asms.c_ptr(), nweights.c_ptr());
 }