mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
fix #1577 again
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
44a0dbbc61
commit
c4829dfa22
12 changed files with 61 additions and 56 deletions
|
@ -79,13 +79,13 @@ namespace opt {
|
|||
m_hard.push_back(hard);
|
||||
}
|
||||
|
||||
bool context::scoped_state::set(ptr_vector<expr> & hard) {
|
||||
bool context::scoped_state::set(expr_ref_vector const & hard) {
|
||||
bool eq = hard.size() == m_hard.size();
|
||||
for (unsigned i = 0; eq && i < hard.size(); ++i) {
|
||||
eq = hard[i] == m_hard[i].get();
|
||||
eq = hard.get(i) == m_hard.get(i);
|
||||
}
|
||||
m_hard.reset();
|
||||
m_hard.append(hard.size(), hard.c_ptr());
|
||||
m_hard.append(hard);
|
||||
return !eq;
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ namespace opt {
|
|||
r.append(m_core);
|
||||
}
|
||||
|
||||
void context::set_hard_constraints(ptr_vector<expr>& fmls) {
|
||||
void context::set_hard_constraints(expr_ref_vector const& fmls) {
|
||||
if (m_scoped_state.set(fmls)) {
|
||||
clear_state();
|
||||
}
|
||||
|
@ -803,7 +803,20 @@ namespace opt {
|
|||
fmls.reset();
|
||||
expr_ref tmp(m);
|
||||
for (unsigned i = 0; i < r->size(); ++i) {
|
||||
fmls.push_back(r->form(i));
|
||||
if (asms.empty()) {
|
||||
fmls.push_back(r->form(i));
|
||||
continue;
|
||||
}
|
||||
|
||||
ptr_vector<expr> deps;
|
||||
expr_dependency_ref core(r->dep(i), m);
|
||||
m.linearize(core, deps);
|
||||
if (!deps.empty()) {
|
||||
fmls.push_back(m.mk_implies(m.mk_and(deps.size(), deps.c_ptr()), r->form(i)));
|
||||
}
|
||||
else {
|
||||
fmls.push_back(r->form(i));
|
||||
}
|
||||
}
|
||||
if (r->inconsistent()) {
|
||||
ptr_vector<expr> core_elems;
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace opt {
|
|||
void push();
|
||||
void pop();
|
||||
void add(expr* hard);
|
||||
bool set(ptr_vector<expr> & hard);
|
||||
bool set(expr_ref_vector const& hard);
|
||||
unsigned add(expr* soft, rational const& weight, symbol const& id);
|
||||
unsigned add(app* obj, bool is_max);
|
||||
unsigned get_index(symbol const& id) { return m_indices[id]; }
|
||||
|
@ -187,7 +187,7 @@ namespace opt {
|
|||
void push() override;
|
||||
void pop(unsigned n) override;
|
||||
bool empty() override { return m_scoped_state.m_objectives.empty(); }
|
||||
void set_hard_constraints(ptr_vector<expr> & hard) override;
|
||||
void set_hard_constraints(expr_ref_vector const& hard) override;
|
||||
lbool optimize(expr_ref_vector const& asms) override;
|
||||
void set_model(model_ref& _m) override { m_model = _m; }
|
||||
void get_model_core(model_ref& _m) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue