mirror of
https://github.com/Z3Prover/z3
synced 2025-06-27 08:28:44 +00:00
align lengths of weights and soft constraints
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
ddbff6f77b
commit
1c56d6ee95
4 changed files with 14 additions and 6 deletions
|
@ -179,7 +179,7 @@ public:
|
||||||
lbool mus_mss_solver() {
|
lbool mus_mss_solver() {
|
||||||
init();
|
init();
|
||||||
init_local();
|
init_local();
|
||||||
enable_sls(m_asms);
|
sls();
|
||||||
ptr_vector<expr> mcs;
|
ptr_vector<expr> mcs;
|
||||||
vector<ptr_vector<expr> > cores;
|
vector<ptr_vector<expr> > cores;
|
||||||
while (m_lower < m_upper) {
|
while (m_lower < m_upper) {
|
||||||
|
@ -221,7 +221,7 @@ public:
|
||||||
lbool mss_solver() {
|
lbool mss_solver() {
|
||||||
init();
|
init();
|
||||||
init_local();
|
init_local();
|
||||||
enable_sls(m_asms);
|
sls();
|
||||||
set_mus(false);
|
set_mus(false);
|
||||||
ptr_vector<expr> mcs;
|
ptr_vector<expr> mcs;
|
||||||
lbool is_sat = l_true;
|
lbool is_sat = l_true;
|
||||||
|
@ -383,6 +383,14 @@ public:
|
||||||
return m_asm2weight.find(e);
|
return m_asm2weight.find(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sls() {
|
||||||
|
vector<rational> ws;
|
||||||
|
for (unsigned i = 0; i < m_asms.size(); ++i) {
|
||||||
|
ws.push_back(get_weight(m_asms[i].get()));
|
||||||
|
}
|
||||||
|
enable_sls(m_asms, ws);
|
||||||
|
}
|
||||||
|
|
||||||
rational split_core(ptr_vector<expr> const& core) {
|
rational split_core(ptr_vector<expr> const& core) {
|
||||||
|
|
||||||
// find the minimal weight:
|
// find the minimal weight:
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace opt {
|
||||||
lbool operator()() {
|
lbool operator()() {
|
||||||
IF_VERBOSE(1, verbose_stream() << "(opt.sls)\n";);
|
IF_VERBOSE(1, verbose_stream() << "(opt.sls)\n";);
|
||||||
init();
|
init();
|
||||||
enable_sls(m_soft);
|
enable_sls(m_soft, m_weights);
|
||||||
lbool is_sat = s().check_sat(0, 0);
|
lbool is_sat = s().check_sat(0, 0);
|
||||||
if (is_sat == l_true) {
|
if (is_sat == l_true) {
|
||||||
s().get_model(m_model);
|
s().get_model(m_model);
|
||||||
|
|
|
@ -94,8 +94,8 @@ namespace opt {
|
||||||
m_s.updt_params(p);
|
m_s.updt_params(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void maxsmt_solver_base::enable_sls(expr_ref_vector const& soft) {
|
void maxsmt_solver_base::enable_sls(expr_ref_vector const& soft, vector<rational> const& ws) {
|
||||||
m_c.enable_sls(soft, m_weights);
|
m_c.enable_sls(soft, ws);
|
||||||
}
|
}
|
||||||
|
|
||||||
app* maxsmt_solver_base::mk_fresh_bool(char const* name) {
|
app* maxsmt_solver_base::mk_fresh_bool(char const* name) {
|
||||||
|
|
|
@ -81,7 +81,7 @@ namespace opt {
|
||||||
void set_mus(bool f);
|
void set_mus(bool f);
|
||||||
app* mk_fresh_bool(char const* name);
|
app* mk_fresh_bool(char const* name);
|
||||||
protected:
|
protected:
|
||||||
void enable_sls(expr_ref_vector const& soft);
|
void enable_sls(expr_ref_vector const& soft, vector<rational> const& ws);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue