3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-07 07:45:46 +00:00

add index option to 'eval' command for box objectives. Issue #955

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-03-31 09:22:56 -07:00
parent 8f798fef1a
commit 582880346e
2 changed files with 66 additions and 9 deletions

View file

@ -38,6 +38,7 @@ public:
virtual void init_pdescrs(cmd_context & ctx, param_descrs & p) {
model_evaluator::get_param_descrs(p);
insert_timeout(p);
p.insert("model_index", CPK_UINT, "(default: 0) index of model from box optimization objective");
}
virtual void prepare(cmd_context & ctx) {
@ -58,9 +59,15 @@ public:
if (!ctx.is_model_available())
throw cmd_exception("model is not available");
model_ref md;
unsigned index = m_params.get_uint("model_index", 0);
check_sat_result * last_result = ctx.get_check_sat_result();
SASSERT(last_result);
last_result->get_model(md);
if (index == 0 || !ctx.get_opt()) {
last_result->get_model(md);
}
else {
ctx.get_opt()->get_box_model(md, index);
}
expr_ref r(ctx.m());
unsigned timeout = m_params.get_uint("timeout", UINT_MAX);
unsigned rlimit = m_params.get_uint("rlimit", 0);