3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 01:25:31 +00:00

review of network flow

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2013-11-04 16:00:50 -08:00
parent 89989627d0
commit acb26d0cf9
5 changed files with 111 additions and 54 deletions

View file

@ -140,28 +140,28 @@ namespace opt {
s.push();
fu_malik fm(m, s, soft_constraints);
lbool is_sat = l_true;
lbool is_sat = l_true;
do {
is_sat = fm.step();
}
while (is_sat == l_false);
if (is_sat == l_true) {
// Get a list of satisfying soft_constraints
model_ref model;
s.get_model(model);
expr_ref_vector result(m);
for (unsigned i = 0; i < soft_constraints.size(); ++i) {
expr_ref val(m);
VERIFY(model->eval(soft_constraints[i].get(), val));
if (!m.is_false(val)) {
result.push_back(soft_constraints[i].get());
}
}
soft_constraints.reset();
soft_constraints.append(result);
}
is_sat = fm.step();
}
while (is_sat == l_false);
if (is_sat == l_true) {
// Get a list of satisfying soft_constraints
model_ref model;
s.get_model(model);
expr_ref_vector result(m);
for (unsigned i = 0; i < soft_constraints.size(); ++i) {
expr_ref val(m);
VERIFY(model->eval(soft_constraints[i].get(), val));
if (!m.is_false(val)) {
result.push_back(soft_constraints[i].get());
}
}
soft_constraints.reset();
soft_constraints.append(result);
}
s.pop(1);
}
// We are done and soft_constraints has

View file

@ -60,6 +60,7 @@ namespace opt {
expr_ref_vector fmls_copy(fmls);
lbool is_sat;
if (!fmls.empty()) {
// TBD: bug when cancel flag is set, fu_malik returns is_sat == l_true instead of l_undef
if (is_maxsat_problem()) {
is_sat = opt::fu_malik_maxsat(*s, fmls_copy);
}