mirror of
https://github.com/Z3Prover/z3
synced 2025-04-10 03:07:07 +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
|
@ -179,7 +179,7 @@ public:
|
|||
lbool mus_mss_solver() {
|
||||
init();
|
||||
init_local();
|
||||
enable_sls(m_asms);
|
||||
sls();
|
||||
ptr_vector<expr> mcs;
|
||||
vector<ptr_vector<expr> > cores;
|
||||
while (m_lower < m_upper) {
|
||||
|
@ -221,7 +221,7 @@ public:
|
|||
lbool mss_solver() {
|
||||
init();
|
||||
init_local();
|
||||
enable_sls(m_asms);
|
||||
sls();
|
||||
set_mus(false);
|
||||
ptr_vector<expr> mcs;
|
||||
lbool is_sat = l_true;
|
||||
|
@ -383,6 +383,14 @@ public:
|
|||
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) {
|
||||
|
||||
// find the minimal weight:
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace opt {
|
|||
lbool operator()() {
|
||||
IF_VERBOSE(1, verbose_stream() << "(opt.sls)\n";);
|
||||
init();
|
||||
enable_sls(m_soft);
|
||||
enable_sls(m_soft, m_weights);
|
||||
lbool is_sat = s().check_sat(0, 0);
|
||||
if (is_sat == l_true) {
|
||||
s().get_model(m_model);
|
||||
|
|
|
@ -94,8 +94,8 @@ namespace opt {
|
|||
m_s.updt_params(p);
|
||||
}
|
||||
|
||||
void maxsmt_solver_base::enable_sls(expr_ref_vector const& soft) {
|
||||
m_c.enable_sls(soft, m_weights);
|
||||
void maxsmt_solver_base::enable_sls(expr_ref_vector const& soft, vector<rational> const& ws) {
|
||||
m_c.enable_sls(soft, ws);
|
||||
}
|
||||
|
||||
app* maxsmt_solver_base::mk_fresh_bool(char const* name) {
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace opt {
|
|||
void set_mus(bool f);
|
||||
app* mk_fresh_bool(char const* name);
|
||||
protected:
|
||||
void enable_sls(expr_ref_vector const& soft);
|
||||
void enable_sls(expr_ref_vector const& soft, vector<rational> const& ws);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue