mirror of
https://github.com/Z3Prover/z3
synced 2025-10-10 17:58:06 +00:00
move to list of clauses
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
502e323678
commit
bfeb15b876
14 changed files with 104 additions and 83 deletions
|
@ -128,8 +128,8 @@ lbool iuc_solver::check_sat (unsigned num_assumptions, expr * const *assumptions
|
|||
}
|
||||
|
||||
lbool iuc_solver::check_sat_cc(const expr_ref_vector &cube,
|
||||
const expr_ref_vector &clause) {
|
||||
if (clause.empty()) {return check_sat(cube.size(), cube.c_ptr());}
|
||||
vector<expr_ref_vector> const & clauses) {
|
||||
if (clauses.empty()) {return check_sat(cube.size(), cube.c_ptr());}
|
||||
|
||||
// -- remove any old assumptions
|
||||
if (m_assumptions.size() > m_first_assumption)
|
||||
|
@ -144,7 +144,7 @@ lbool iuc_solver::check_sat_cc(const expr_ref_vector &cube,
|
|||
m_is_proxied = mk_proxies(m_assumptions, m_first_assumption);
|
||||
|
||||
lbool res;
|
||||
res = m_solver.check_sat_cc(m_assumptions, clause);
|
||||
res = m_solver.check_sat_cc(m_assumptions, clauses);
|
||||
set_status (res);
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
{return m_solver.get_scope_level();}
|
||||
|
||||
lbool check_sat(unsigned num_assumptions, expr * const *assumptions) override;
|
||||
lbool check_sat_cc(const expr_ref_vector &cube, const expr_ref_vector &clause) override;
|
||||
lbool check_sat_cc(const expr_ref_vector &cube, vector<expr_ref_vector> const & clauses) override;
|
||||
void set_progress_callback(progress_callback *callback) override
|
||||
{m_solver.set_progress_callback(callback);}
|
||||
unsigned get_num_assertions() const override
|
||||
|
|
|
@ -202,7 +202,7 @@ lbool prop_solver::mss(expr_ref_vector &hard, expr_ref_vector &soft) {
|
|||
res = m_ctx->check_sat(j+1, hard.c_ptr());
|
||||
if (res == l_false) {
|
||||
// -- flip non-true literal to be false
|
||||
hard[j] = m.mk_not(hard.get(j));
|
||||
hard[j] = mk_not(m, hard.get(j));
|
||||
}
|
||||
else if (res == l_true) {
|
||||
// -- get the model for the next iteration of the outer loop
|
||||
|
@ -218,7 +218,7 @@ lbool prop_solver::mss(expr_ref_vector &hard, expr_ref_vector &soft) {
|
|||
}
|
||||
|
||||
// move sat soft constraints to the output vector
|
||||
for (unsigned k = i; k < j; ++k) {soft.push_back(hard.get(k));}
|
||||
for (unsigned k = i; k < j; ++k) { soft.push_back(hard.get(k)); }
|
||||
// cleanup hard constraints
|
||||
hard.resize(hard_sz);
|
||||
return l_true;
|
||||
|
@ -228,7 +228,7 @@ lbool prop_solver::mss(expr_ref_vector &hard, expr_ref_vector &soft) {
|
|||
/// Runs maxsat loop on m_ctx Returns l_false if hard is unsat,
|
||||
/// otherwise reduces soft such that hard & soft is sat.
|
||||
lbool prop_solver::maxsmt(expr_ref_vector &hard, expr_ref_vector &soft,
|
||||
const expr_ref_vector &clause)
|
||||
vector<expr_ref_vector> const & clauses)
|
||||
{
|
||||
// replace expressions by assumption literals
|
||||
iuc_solver::scoped_mk_proxy _p_(*m_ctx, hard);
|
||||
|
@ -236,7 +236,7 @@ lbool prop_solver::maxsmt(expr_ref_vector &hard, expr_ref_vector &soft,
|
|||
// assume soft constraints are propositional literals (no need to proxy)
|
||||
hard.append(soft);
|
||||
|
||||
lbool res = m_ctx->check_sat_cc(hard, clause);
|
||||
lbool res = m_ctx->check_sat_cc(hard, clauses);
|
||||
// if hard constraints alone are unsat or there are no soft
|
||||
// constraints, we are done
|
||||
if (res != l_false || soft.empty()) { return res; }
|
||||
|
@ -270,7 +270,7 @@ lbool prop_solver::maxsmt(expr_ref_vector &hard, expr_ref_vector &soft,
|
|||
}
|
||||
|
||||
// check that the NEW constraints became sat
|
||||
res = m_ctx->check_sat_cc(hard, clause);
|
||||
res = m_ctx->check_sat_cc(hard, clauses);
|
||||
if (res != l_false) { break; }
|
||||
// still unsat, update the core and repeat
|
||||
core.reset();
|
||||
|
@ -290,7 +290,7 @@ lbool prop_solver::maxsmt(expr_ref_vector &hard, expr_ref_vector &soft,
|
|||
|
||||
lbool prop_solver::internal_check_assumptions(expr_ref_vector &hard_atoms,
|
||||
expr_ref_vector &soft_atoms,
|
||||
const expr_ref_vector &clause)
|
||||
vector<expr_ref_vector> const & clauses)
|
||||
{
|
||||
// XXX Turn model generation if m_model != 0
|
||||
SASSERT(m_ctx);
|
||||
|
@ -302,7 +302,7 @@ lbool prop_solver::internal_check_assumptions(expr_ref_vector &hard_atoms,
|
|||
}
|
||||
|
||||
if (m_in_level) { assert_level_atoms(m_current_level); }
|
||||
lbool result = maxsmt(hard_atoms, soft_atoms, clause);
|
||||
lbool result = maxsmt(hard_atoms, soft_atoms, clauses);
|
||||
if (result != l_false && m_model) { m_ctx->get_model(*m_model); }
|
||||
|
||||
SASSERT(result != l_false || soft_atoms.empty());
|
||||
|
@ -375,7 +375,9 @@ lbool prop_solver::check_assumptions(const expr_ref_vector & _hard,
|
|||
|
||||
unsigned soft_sz = soft.size();
|
||||
(void) soft_sz;
|
||||
lbool res = internal_check_assumptions(hard, soft, clause);
|
||||
vector<expr_ref_vector> clauses;
|
||||
clauses.push_back(clause);
|
||||
lbool res = internal_check_assumptions(hard, soft, clauses);
|
||||
if (!m_use_push_bg) { m_ctx->pop(1); }
|
||||
|
||||
TRACE("psolve_verbose",
|
||||
|
|
|
@ -67,10 +67,10 @@ private:
|
|||
|
||||
lbool internal_check_assumptions(expr_ref_vector &hard,
|
||||
expr_ref_vector &soft,
|
||||
const expr_ref_vector &clause);
|
||||
vector<expr_ref_vector> const & clause);
|
||||
|
||||
lbool maxsmt(expr_ref_vector &hard, expr_ref_vector &soft,
|
||||
const expr_ref_vector &clause);
|
||||
vector<expr_ref_vector> const & clauses);
|
||||
lbool mss(expr_ref_vector &hard, expr_ref_vector &soft);
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue