3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 09:05:31 +00:00

add separate get-objectives command #1107

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-06-23 16:34:38 -07:00
parent e3ec7e7d05
commit 9d1852343c
2 changed files with 24 additions and 2 deletions

View file

@ -143,12 +143,35 @@ public:
}
};
class get_objectives_cmd : public cmd {
opt::context* m_opt;
public:
get_objectives_cmd(opt::context* opt):
cmd("get-objectives"),
m_opt(opt)
{}
virtual void reset(cmd_context & ctx) { }
virtual char const * get_usage() const { return "(get-objectives)"; }
virtual char const * get_descr(cmd_context & ctx) const { return "retrieve the objective values (after optimization)"; }
virtual unsigned get_arity() const { return 0; }
virtual void prepare(cmd_context & ctx) {}
virtual void failure_cleanup(cmd_context & ctx) {
reset(ctx);
}
virtual void execute(cmd_context & ctx) {
get_opt(ctx, m_opt).display_assignment(ctx.regular_stream());
}
};
void install_opt_cmds(cmd_context & ctx, opt::context* opt) {
ctx.insert(alloc(assert_soft_cmd, opt));
ctx.insert(alloc(min_maximize_cmd, true, opt));
ctx.insert(alloc(min_maximize_cmd, false, opt));
ctx.insert(alloc(get_objectives_cmd, opt));
}