mirror of
https://github.com/Z3Prover/z3
synced 2025-06-20 21:03:39 +00:00
fix handling of global parameters, exceptions when optimization call gets cancelled
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
122a12c980
commit
77aac8d96f
3 changed files with 10 additions and 5 deletions
|
@ -113,13 +113,13 @@ namespace api {
|
||||||
~context();
|
~context();
|
||||||
ast_manager & m() const { return *(m_manager.get()); }
|
ast_manager & m() const { return *(m_manager.get()); }
|
||||||
|
|
||||||
context_params & params() { return m_params; }
|
context_params & params() { m_params.updt_params(); return m_params; }
|
||||||
bool produce_proofs() const { return m().proofs_enabled(); }
|
bool produce_proofs() const { return m().proofs_enabled(); }
|
||||||
bool produce_models() const { return m_params.m_model; }
|
bool produce_models() const { return m_params.m_model; }
|
||||||
bool produce_unsat_cores() const { return m_params.m_unsat_core; }
|
bool produce_unsat_cores() const { return m_params.m_unsat_core; }
|
||||||
bool use_auto_config() const { return m_params.m_auto_config; }
|
bool use_auto_config() const { return m_params.m_auto_config; }
|
||||||
unsigned get_timeout() const { return m_params.m_timeout; }
|
unsigned get_timeout() { return params().m_timeout; }
|
||||||
unsigned get_rlimit() const { return m_params.m_rlimit; }
|
unsigned get_rlimit() { return params().m_rlimit; }
|
||||||
arith_util & autil() { return m_arith_util; }
|
arith_util & autil() { return m_arith_util; }
|
||||||
bv_util & bvutil() { return m_bv_util; }
|
bv_util & bvutil() { return m_bv_util; }
|
||||||
datalog::dl_decl_util & datalog_util() { return m_datalog_util; }
|
datalog::dl_decl_util & datalog_util() { return m_datalog_util; }
|
||||||
|
|
|
@ -129,6 +129,7 @@ extern "C" {
|
||||||
cancel_eh<reslimit> eh(mk_c(c)->m().limit());
|
cancel_eh<reslimit> eh(mk_c(c)->m().limit());
|
||||||
unsigned timeout = to_optimize_ptr(o)->get_params().get_uint("timeout", mk_c(c)->get_timeout());
|
unsigned timeout = to_optimize_ptr(o)->get_params().get_uint("timeout", mk_c(c)->get_timeout());
|
||||||
unsigned rlimit = mk_c(c)->get_rlimit();
|
unsigned rlimit = mk_c(c)->get_rlimit();
|
||||||
|
std::cout << "Timeout: " << timeout << "\n";
|
||||||
api::context::set_interruptable si(*(mk_c(c)), eh);
|
api::context::set_interruptable si(*(mk_c(c)), eh);
|
||||||
{
|
{
|
||||||
scoped_timer timer(timeout, &eh);
|
scoped_timer timer(timeout, &eh);
|
||||||
|
@ -137,8 +138,13 @@ extern "C" {
|
||||||
r = to_optimize_ptr(o)->optimize();
|
r = to_optimize_ptr(o)->optimize();
|
||||||
}
|
}
|
||||||
catch (z3_exception& ex) {
|
catch (z3_exception& ex) {
|
||||||
mk_c(c)->handle_exception(ex);
|
|
||||||
r = l_undef;
|
r = l_undef;
|
||||||
|
if (ex.msg() == "canceled" && mk_c(c)->m().canceled()) {
|
||||||
|
to_optimize_ptr(o)->set_reason_unknown(ex.msg());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mk_c(c)->handle_exception(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// to_optimize_ref(d).cleanup();
|
// to_optimize_ref(d).cleanup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,6 @@ struct goal2sat::imp {
|
||||||
m_ite_extra = p.get_bool("ite_extra", true);
|
m_ite_extra = p.get_bool("ite_extra", true);
|
||||||
m_max_memory = megabytes_to_bytes(p.get_uint("max_memory", UINT_MAX));
|
m_max_memory = megabytes_to_bytes(p.get_uint("max_memory", UINT_MAX));
|
||||||
m_cardinality_solver = p.get_bool("cardinality_solver", false);
|
m_cardinality_solver = p.get_bool("cardinality_solver", false);
|
||||||
std::cout << p << "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void throw_op_not_handled(std::string const& s) {
|
void throw_op_not_handled(std::string const& s) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue