3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-14 06:45:25 +00:00

enable answer generation

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2013-11-08 20:55:01 -08:00
parent 816029c862
commit 6e1c186017
9 changed files with 131 additions and 48 deletions

View file

@ -201,13 +201,14 @@ public:
for (; it != end; ++it) {
opt.add_hard_constraint(*it);
}
lbool r = l_undef;
cancel_eh<opt::context> eh(opt);
{
scoped_ctrl_c ctrlc(eh);
scoped_timer timer(timeout, &eh);
cmd_context::scoped_watch sw(ctx);
try {
opt.optimize();
r = opt.optimize();
}
catch (z3_error& ex) {
ctx.regular_stream() << "(error: " << ex.msg() << "\")" << std::endl;
@ -216,6 +217,19 @@ public:
ctx.regular_stream() << "(error: " << ex.msg() << "\")" << std::endl;
}
}
switch(r) {
case l_true:
ctx.regular_stream() << "sat\n";
opt.display_assignment(ctx.regular_stream());
break;
case l_false:
ctx.regular_stream() << "unsat\n";
break;
case l_undef:
ctx.regular_stream() << "unknown\n";
opt.display_range_assignment(ctx.regular_stream());
break;
}
if (p.get_bool("print_statistics", false)) {
display_statistics(ctx);
}