3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 09:05:31 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2016-05-05 14:11:13 -07:00
parent 9e4b9ea98b
commit 5b31f54501
4 changed files with 136 additions and 193 deletions

View file

@ -141,6 +141,13 @@ class alternate_min_max_cmd : public cmd {
app_ref_vector* m_vars;
svector<bool> m_is_max;
unsigned m_position;
app_ref_vector& vars(cmd_context& ctx) {
if (!m_vars) {
m_vars = alloc(app_ref_vector, ctx.m());
}
return *m_vars;
}
public:
alternate_min_max_cmd():
cmd("min-max"),
@ -150,6 +157,7 @@ public:
virtual void reset(cmd_context & ctx) {
dealloc(m_vars);
m_vars = 0;
m_is_max.reset();
m_position = 0;
}
@ -176,8 +184,7 @@ public:
}
else {
m_is_max.push_back(is_max);
if (!m_vars) m_vars = alloc(app_ref_vector, ctx.m());
m_vars->push_back(ctx.m().mk_const(ctx.find_func_decl(slist[i])));
vars(ctx).push_back(ctx.m().mk_const(ctx.find_func_decl(slist[i])));
}
}
++m_position;
@ -188,8 +195,8 @@ public:
throw cmd_exception("malformed objective term: it cannot be a quantifier or bound variable");
}
++m_position;
if (!m_vars) m_vars = alloc(app_ref_vector, ctx.m());
get_opt(ctx).min_max(to_app(t), *m_vars, m_is_max);
get_opt(ctx).min_max(to_app(t), vars(ctx), m_is_max);
reset(ctx);
}
virtual void failure_cleanup(cmd_context & ctx) {

View file

@ -218,11 +218,9 @@ namespace opt {
import_scoped_state();
normalize();
internalize();
update_solver();
solver& s = get_solver();
s.assert_expr(m_hard_constraints);
std::cout << "min-max is TBD\n";
return l_undef;
qe::max_min_opt max_min(m, m_params);
max_min.add(m_hard_constraints);
return max_min.check(is_max, vars, t);
}