mirror of
https://github.com/Z3Prover/z3
synced 2025-06-04 21:31:22 +00:00
Merge branch 'master' of https://github.com/Z3Prover/z3
This commit is contained in:
commit
46ff4ae40d
3 changed files with 38 additions and 4 deletions
|
@ -273,7 +273,8 @@ namespace opt {
|
||||||
display_benchmark();
|
display_benchmark();
|
||||||
IF_VERBOSE(1, verbose_stream() << "(optimize:check-sat)\n";);
|
IF_VERBOSE(1, verbose_stream() << "(optimize:check-sat)\n";);
|
||||||
lbool is_sat = s.check_sat(0,0);
|
lbool is_sat = s.check_sat(0,0);
|
||||||
TRACE("opt", tout << "initial search result: " << is_sat << "\n";);
|
TRACE("opt", tout << "initial search result: " << is_sat << "\n";
|
||||||
|
s.display(tout););
|
||||||
if (is_sat != l_false) {
|
if (is_sat != l_false) {
|
||||||
s.get_model(m_model);
|
s.get_model(m_model);
|
||||||
s.get_labels(m_labels);
|
s.get_labels(m_labels);
|
||||||
|
@ -1037,6 +1038,10 @@ namespace opt {
|
||||||
TRACE("opt", tout << "Purifying " << term << "\n";);
|
TRACE("opt", tout << "Purifying " << term << "\n";);
|
||||||
term = purify(fm, term);
|
term = purify(fm, term);
|
||||||
}
|
}
|
||||||
|
else if (m.is_ite(term)) {
|
||||||
|
TRACE("opt", tout << "Purifying " << term << "\n";);
|
||||||
|
term = purify(fm, term);
|
||||||
|
}
|
||||||
if (fm) {
|
if (fm) {
|
||||||
m_model_converter = concat(m_model_converter.get(), fm.get());
|
m_model_converter = concat(m_model_converter.get(), fm.get());
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,6 +358,7 @@ namespace opt {
|
||||||
}
|
}
|
||||||
smt::theory_opt& opt = get_optimizer();
|
smt::theory_opt& opt = get_optimizer();
|
||||||
smt::theory_var v = m_objective_vars[var];
|
smt::theory_var v = m_objective_vars[var];
|
||||||
|
TRACE("opt", tout << "v" << var << " " << val << "\n";);
|
||||||
|
|
||||||
if (typeid(smt::theory_inf_arith) == typeid(opt)) {
|
if (typeid(smt::theory_inf_arith) == typeid(opt)) {
|
||||||
smt::theory_inf_arith& th = dynamic_cast<smt::theory_inf_arith&>(opt);
|
smt::theory_inf_arith& th = dynamic_cast<smt::theory_inf_arith&>(opt);
|
||||||
|
@ -387,8 +388,32 @@ namespace opt {
|
||||||
smt::theory_rdl& th = dynamic_cast<smt::theory_rdl&>(opt);
|
smt::theory_rdl& th = dynamic_cast<smt::theory_rdl&>(opt);
|
||||||
return th.mk_ge(m_fm, v, val);
|
return th.mk_ge(m_fm, v, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeid(smt::theory_dense_i) == typeid(opt) &&
|
||||||
|
val.get_infinitesimal().is_zero()) {
|
||||||
|
smt::theory_dense_i& th = dynamic_cast<smt::theory_dense_i&>(opt);
|
||||||
|
return th.mk_ge(m_fm, v, val);
|
||||||
|
}
|
||||||
|
|
||||||
// difference logic?
|
if (typeid(smt::theory_dense_mi) == typeid(opt) &&
|
||||||
|
val.get_infinitesimal().is_zero()) {
|
||||||
|
smt::theory_dense_mi& th = dynamic_cast<smt::theory_dense_mi&>(opt);
|
||||||
|
return th.mk_ge(m_fm, v, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeid(smt::theory_dense_si) == typeid(opt) &&
|
||||||
|
val.get_infinitesimal().is_zero()) {
|
||||||
|
smt::theory_dense_si& th = dynamic_cast<smt::theory_dense_si&>(opt);
|
||||||
|
return th.mk_ge(m_fm, v, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeid(smt::theory_dense_smi) == typeid(opt) &&
|
||||||
|
val.get_infinitesimal().is_zero()) {
|
||||||
|
smt::theory_dense_smi& th = dynamic_cast<smt::theory_dense_smi&>(opt);
|
||||||
|
return th.mk_ge(m_fm, v, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
IF_VERBOSE(0, verbose_stream() << "WARNING: unhandled theory " << typeid(opt).name() << "\n";);
|
||||||
return expr_ref(m.mk_true(), m);
|
return expr_ref(m.mk_true(), m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -868,7 +868,8 @@ namespace smt {
|
||||||
e = ctx.get_enode(to_app(n));
|
e = ctx.get_enode(to_app(n));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
e = ctx.mk_enode(to_app(n), false, false, true);
|
ctx.internalize(n, false);
|
||||||
|
e = ctx.get_enode(n);
|
||||||
}
|
}
|
||||||
v = e->get_th_var(get_id());
|
v = e->get_th_var(get_id());
|
||||||
if (v == null_theory_var) {
|
if (v == null_theory_var) {
|
||||||
|
@ -1008,7 +1009,8 @@ namespace smt {
|
||||||
inf_eps result(rational(0), r);
|
inf_eps result(rational(0), r);
|
||||||
blocker = mk_gt(v, result);
|
blocker = mk_gt(v, result);
|
||||||
IF_VERBOSE(10, verbose_stream() << blocker << "\n";);
|
IF_VERBOSE(10, verbose_stream() << blocker << "\n";);
|
||||||
return result;
|
r += m_objective_consts[v];
|
||||||
|
return inf_eps(rational(0), r);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
TRACE("opt", tout << "unbounded\n"; );
|
TRACE("opt", tout << "unbounded\n"; );
|
||||||
|
@ -1019,6 +1021,7 @@ namespace smt {
|
||||||
|
|
||||||
template<typename Ext>
|
template<typename Ext>
|
||||||
theory_var theory_dense_diff_logic<Ext>::add_objective(app* term) {
|
theory_var theory_dense_diff_logic<Ext>::add_objective(app* term) {
|
||||||
|
TRACE("opt", tout << mk_pp(term, get_manager()) << "\n";);
|
||||||
objective_term objective;
|
objective_term objective;
|
||||||
theory_var result = m_objectives.size();
|
theory_var result = m_objectives.size();
|
||||||
rational q(1), r(0);
|
rational q(1), r(0);
|
||||||
|
@ -1053,6 +1056,7 @@ namespace smt {
|
||||||
ast_manager& m = get_manager();
|
ast_manager& m = get_manager();
|
||||||
objective_term const& t = m_objectives[v];
|
objective_term const& t = m_objectives[v];
|
||||||
expr_ref e(m), f(m), f2(m);
|
expr_ref e(m), f(m), f2(m);
|
||||||
|
TRACE("opt", tout << "mk_ineq " << v << " " << val << "\n";);
|
||||||
if (t.size() == 1 && t[0].second.is_one()) {
|
if (t.size() == 1 && t[0].second.is_one()) {
|
||||||
f = get_enode(t[0].first)->get_owner();
|
f = get_enode(t[0].first)->get_owner();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue