mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
adding simplex
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
a594597906
commit
51cb63b6c0
8 changed files with 42 additions and 13 deletions
|
@ -30,6 +30,7 @@ namespace opt {
|
|||
lbool is_sat;
|
||||
m_msolver = 0;
|
||||
m_s = &s;
|
||||
IF_VERBOSE(1, verbose_stream() << "(maxsmt)\n";);
|
||||
if (m_soft_constraints.empty()) {
|
||||
TRACE("opt", tout << "no constraints\n";);
|
||||
m_msolver = 0;
|
||||
|
|
|
@ -29,6 +29,9 @@ Notes:
|
|||
#include "elim01_tactic.h"
|
||||
#include "solve_eqs_tactic.h"
|
||||
#include "simplify_tactic.h"
|
||||
#include "propagate_values_tactic.h"
|
||||
#include "solve_eqs_tactic.h"
|
||||
#include "elim_uncnstr_tactic.h"
|
||||
#include "tactical.h"
|
||||
#include "model_smt2_pp.h"
|
||||
|
||||
|
@ -93,11 +96,13 @@ namespace opt {
|
|||
s.assert_expr(m_hard_constraints[i].get());
|
||||
}
|
||||
|
||||
IF_VERBOSE(1, verbose_stream() << "(optimize:check-sat)\n";);
|
||||
lbool is_sat = s.check_sat_core(0,0);
|
||||
if (is_sat != l_true) {
|
||||
m_model = 0;
|
||||
return is_sat;
|
||||
}
|
||||
IF_VERBOSE(1, verbose_stream() << "(optimize:sat)\n";);
|
||||
s.get_model(m_model);
|
||||
m_optsmt.setup(s);
|
||||
update_lower();
|
||||
|
@ -299,7 +304,12 @@ namespace opt {
|
|||
for (unsigned i = 0; i < fmls.size(); ++i) {
|
||||
g->assert_expr(fmls[i].get());
|
||||
}
|
||||
tactic_ref tac0 = mk_simplify_tactic(m);
|
||||
tactic_ref tac0 =
|
||||
and_then(mk_simplify_tactic(m),
|
||||
mk_propagate_values_tactic(m),
|
||||
mk_solve_eqs_tactic(m),
|
||||
mk_elim_uncnstr_tactic(m),
|
||||
mk_simplify_tactic(m));
|
||||
tactic_ref tac2 = mk_elim01_tactic(m);
|
||||
tactic_ref tac3 = mk_lia2card_tactic(m);
|
||||
tactic_ref tac;
|
||||
|
@ -317,6 +327,7 @@ namespace opt {
|
|||
SASSERT(result.size() == 1);
|
||||
goal* r = result[0];
|
||||
fmls.reset();
|
||||
expr_ref tmp(m);
|
||||
for (unsigned i = 0; i < r->size(); ++i) {
|
||||
fmls.push_back(r->form(i));
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace opt {
|
|||
void optsmt::update_lower(unsigned idx, rational const& r) {
|
||||
inf_eps v(r);
|
||||
if (m_lower[idx] < v) {
|
||||
m_lower[idx] = v;
|
||||
m_lower[idx] = v;
|
||||
if (m_s) m_s->get_model(m_model);
|
||||
}
|
||||
}
|
||||
|
@ -229,6 +229,7 @@ namespace opt {
|
|||
}
|
||||
|
||||
lbool optsmt::lex(unsigned obj_index) {
|
||||
IF_VERBOSE(1, verbose_stream() << "(optsmt:lex)\n";);
|
||||
solver::scoped_push _push(*m_s);
|
||||
SASSERT(obj_index < m_vars.size());
|
||||
return basic_lex(obj_index);
|
||||
|
@ -238,6 +239,7 @@ namespace opt {
|
|||
lbool is_sat = l_true;
|
||||
expr_ref block(m);
|
||||
|
||||
|
||||
while (is_sat == l_true && !m_cancel) {
|
||||
is_sat = m_s->check_sat(0, 0);
|
||||
if (is_sat != l_true) break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue