mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
Merge branch 'unstable' of https://github.com/Z3Prover/z3 into unstable
This commit is contained in:
commit
6f0d76a62e
172 changed files with 5110 additions and 22752 deletions
|
@ -31,6 +31,7 @@ Notes:
|
|||
#include "propagate_values_tactic.h"
|
||||
#include "solve_eqs_tactic.h"
|
||||
#include "elim_uncnstr_tactic.h"
|
||||
#include "elim_term_ite_tactic.h"
|
||||
#include "tactical.h"
|
||||
#include "model_smt2_pp.h"
|
||||
#include "card2bv_tactic.h"
|
||||
|
@ -650,17 +651,19 @@ namespace opt {
|
|||
and_then(mk_simplify_tactic(m),
|
||||
mk_propagate_values_tactic(m),
|
||||
mk_solve_eqs_tactic(m),
|
||||
mk_elim_term_ite_tactic(m),
|
||||
// NB: mk_elim_uncstr_tactic(m) is not sound with soft constraints
|
||||
mk_simplify_tactic(m));
|
||||
opt_params optp(m_params);
|
||||
tactic_ref tac2, tac3;
|
||||
tactic_ref tac2, tac3, tac4;
|
||||
if (optp.elim_01()) {
|
||||
tac2 = mk_elim01_tactic(m);
|
||||
tac3 = mk_lia2card_tactic(m);
|
||||
tac4 = mk_elim_term_ite_tactic(m);
|
||||
params_ref lia_p;
|
||||
lia_p.set_bool("compile_equality", optp.pb_compile_equality());
|
||||
tac3->updt_params(lia_p);
|
||||
set_simplify(and_then(tac0.get(), tac2.get(), tac3.get()));
|
||||
set_simplify(and_then(tac0.get(), tac2.get(), tac3.get(), tac4.get()));
|
||||
}
|
||||
else {
|
||||
set_simplify(tac0.get());
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace opt {
|
|||
m_context(mgr, m_params),
|
||||
m(mgr),
|
||||
m_fm(fm),
|
||||
m_objective_sorts(m),
|
||||
m_objective_terms(m),
|
||||
m_dump_benchmarks(false),
|
||||
m_first(true) {
|
||||
m_params.updt_params(p);
|
||||
|
@ -213,11 +213,13 @@ namespace opt {
|
|||
}
|
||||
else {
|
||||
SASSERT(has_shared);
|
||||
decrement_value(i, val);
|
||||
decrement_value(i, val);
|
||||
}
|
||||
m_objective_values[i] = val;
|
||||
TRACE("opt", { tout << val << "\n";
|
||||
tout << blocker << "\n";
|
||||
TRACE("opt", {
|
||||
tout << "objective: " << mk_pp(m_objective_terms[i].get(), m) << "\n";
|
||||
tout << "maximal value: " << val << "\n";
|
||||
tout << "new condition: " << blocker << "\n";
|
||||
model_smt2_pp(tout << "update model:\n", m, *m_models[i], 0); });
|
||||
}
|
||||
|
||||
|
@ -240,7 +242,7 @@ namespace opt {
|
|||
TRACE("opt", tout << is_sat << "\n";);
|
||||
if (is_sat != l_true) {
|
||||
// cop-out approximation
|
||||
if (arith_util(m).is_real(m_objective_sorts[i].get())) {
|
||||
if (arith_util(m).is_real(m_objective_terms[i].get())) {
|
||||
val -= inf_eps(inf_rational(rational(0), true));
|
||||
}
|
||||
else {
|
||||
|
@ -304,7 +306,7 @@ namespace opt {
|
|||
smt::theory_var v = get_optimizer().add_objective(term);
|
||||
m_objective_vars.push_back(v);
|
||||
m_objective_values.push_back(inf_eps(rational(-1), inf_rational()));
|
||||
m_objective_sorts.push_back(m.get_sort(term));
|
||||
m_objective_terms.push_back(term);
|
||||
m_valid_objectives.push_back(true);
|
||||
m_models.push_back(0);
|
||||
return v;
|
||||
|
@ -363,7 +365,7 @@ namespace opt {
|
|||
void opt_solver::reset_objectives() {
|
||||
m_objective_vars.reset();
|
||||
m_objective_values.reset();
|
||||
m_objective_sorts.reset();
|
||||
m_objective_terms.reset();
|
||||
m_valid_objectives.reset();
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace opt {
|
|||
svector<smt::theory_var> m_objective_vars;
|
||||
vector<inf_eps> m_objective_values;
|
||||
sref_vector<model> m_models;
|
||||
sort_ref_vector m_objective_sorts;
|
||||
expr_ref_vector m_objective_terms;
|
||||
svector<bool> m_valid_objectives;
|
||||
bool m_dump_benchmarks;
|
||||
static unsigned m_dump_count;
|
||||
|
|
|
@ -141,6 +141,7 @@ namespace opt {
|
|||
ors.push_back(m_s->mk_ge(i, m_upper[i]));
|
||||
}
|
||||
|
||||
|
||||
fml = m.mk_or(ors.size(), ors.c_ptr());
|
||||
tmp = m.mk_fresh_const("b", m.mk_bool_sort());
|
||||
fml = m.mk_implies(tmp, fml);
|
||||
|
@ -150,6 +151,7 @@ namespace opt {
|
|||
solver::scoped_push _push(*m_s);
|
||||
while (!m_cancel) {
|
||||
m_s->assert_expr(fml);
|
||||
TRACE("opt", tout << fml << "\n";);
|
||||
is_sat = m_s->check_sat(1,vars);
|
||||
if (is_sat == l_true) {
|
||||
disj.reset();
|
||||
|
@ -343,6 +345,7 @@ namespace opt {
|
|||
m_lower[i] = m_s->saved_objective_value(i);
|
||||
}
|
||||
}
|
||||
TRACE("opt", tout << "strengthen bound: " << block << "\n";);
|
||||
m_s->assert_expr(block);
|
||||
|
||||
// TBD: only works for simplex
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue