mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 09:35:32 +00:00
reworking cancellation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
981f8226fe
commit
baee4225a7
145 changed files with 172 additions and 958 deletions
|
@ -52,6 +52,7 @@ public:
|
|||
virtual proof * get_proof() = 0;
|
||||
virtual std::string reason_unknown() const = 0;
|
||||
virtual void get_labels(svector<symbol> & r) = 0;
|
||||
virtual ast_manager& get_manager() = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -63,9 +64,11 @@ struct simple_check_sat_result : public check_sat_result {
|
|||
expr_ref_vector m_core;
|
||||
proof_ref m_proof;
|
||||
std::string m_unknown;
|
||||
|
||||
|
||||
simple_check_sat_result(ast_manager & m);
|
||||
virtual ~simple_check_sat_result();
|
||||
virtual ast_manager& get_manager() { return m_proof.get_manager(); }
|
||||
virtual void collect_statistics(statistics & st) const;
|
||||
virtual void get_unsat_core(ptr_vector<expr> & r);
|
||||
virtual void get_model(model_ref & m);
|
||||
|
|
|
@ -84,7 +84,7 @@ private:
|
|||
volatile bool m_canceled;
|
||||
aux_timeout_eh(solver * s):m_solver(s), m_canceled(false) {}
|
||||
virtual void operator()() {
|
||||
m_solver->cancel();
|
||||
m_solver->get_manager().cancel();
|
||||
m_canceled = true;
|
||||
}
|
||||
};
|
||||
|
@ -96,6 +96,8 @@ private:
|
|||
m_inc_unknown_behavior = static_cast<inc_unknown_behavior>(p.solver2_unknown());
|
||||
}
|
||||
|
||||
virtual ast_manager& get_manager() { return m_solver1->get_manager(); }
|
||||
|
||||
bool has_quantifiers() const {
|
||||
unsigned sz = get_num_assertions();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
|
@ -220,25 +222,18 @@ public:
|
|||
m_use_solver1_results = false;
|
||||
return r;
|
||||
}
|
||||
if (eh.m_canceled) {
|
||||
m_solver1->get_manager().limit().reset_cancel();
|
||||
}
|
||||
}
|
||||
IF_VERBOSE(PS_VB_LVL, verbose_stream() << "(combined-solver \"solver 2 failed, trying solver1\")\n";);
|
||||
IF_VERBOSE(PS_VB_LVL, verbose_stream() << "(combined-solver \"solver 2 failed, trying solver1\")\n";);
|
||||
|
||||
}
|
||||
|
||||
IF_VERBOSE(PS_VB_LVL, verbose_stream() << "(combined-solver \"using solver 1\")\n";);
|
||||
m_use_solver1_results = true;
|
||||
return m_solver1->check_sat(0, 0);
|
||||
}
|
||||
|
||||
virtual void set_cancel(bool f) {
|
||||
if (f) {
|
||||
m_solver1->cancel();
|
||||
m_solver2->cancel();
|
||||
}
|
||||
else {
|
||||
m_solver1->reset_cancel();
|
||||
m_solver2->reset_cancel();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void set_progress_callback(progress_callback * callback) {
|
||||
m_solver1->set_progress_callback(callback);
|
||||
|
|
|
@ -108,11 +108,11 @@ public:
|
|||
/**
|
||||
\brief Interrupt this solver.
|
||||
*/
|
||||
void cancel() { set_cancel(true); }
|
||||
//void cancel() { set_cancel(true); }
|
||||
/**
|
||||
\brief Reset the interruption.
|
||||
*/
|
||||
void reset_cancel() { set_cancel(false); }
|
||||
//void reset_cancel() { set_cancel(false); }
|
||||
|
||||
/**
|
||||
\brief Set a progress callback procedure that is invoked by this solver during check_sat.
|
||||
|
@ -158,7 +158,7 @@ public:
|
|||
};
|
||||
|
||||
protected:
|
||||
virtual void set_cancel(bool f) = 0;
|
||||
//virtual void set_cancel(bool f) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -59,7 +59,6 @@ public:
|
|||
virtual void pop_core(unsigned n);
|
||||
virtual lbool check_sat_core(unsigned num_assumptions, expr * const * assumptions);
|
||||
|
||||
virtual void set_cancel(bool f);
|
||||
|
||||
virtual void collect_statistics(statistics & st) const;
|
||||
virtual void get_unsat_core(ptr_vector<expr> & r);
|
||||
|
@ -74,8 +73,11 @@ public:
|
|||
virtual expr * get_assertion(unsigned idx) const;
|
||||
|
||||
virtual void display(std::ostream & out) const;
|
||||
virtual ast_manager& get_manager();
|
||||
};
|
||||
|
||||
ast_manager& tactic2solver::get_manager() { return m_assertions.get_manager(); }
|
||||
|
||||
tactic2solver::tactic2solver(ast_manager & m, tactic * t, params_ref const & p, bool produce_proofs, bool produce_models, bool produce_unsat_cores, symbol const & logic):
|
||||
solver_na2as(m),
|
||||
m_assertions(m) {
|
||||
|
@ -177,14 +179,6 @@ lbool tactic2solver::check_sat_core(unsigned num_assumptions, expr * const * ass
|
|||
return m_result->status();
|
||||
}
|
||||
|
||||
void tactic2solver::set_cancel(bool f) {
|
||||
if (m_tactic.get()) {
|
||||
if (f)
|
||||
m_tactic->cancel();
|
||||
else
|
||||
m_tactic->reset_cancel();
|
||||
}
|
||||
}
|
||||
|
||||
solver* tactic2solver::translate(ast_manager& m, params_ref const& p) {
|
||||
tactic* t = m_tactic->translate(m);
|
||||
|
|
|
@ -37,6 +37,7 @@ solver * mk_tactic2solver(ast_manager & m,
|
|||
bool produce_unsat_cores = false,
|
||||
symbol const & logic = symbol::null);
|
||||
|
||||
|
||||
solver_factory * mk_tactic2solver_factory(tactic * t);
|
||||
solver_factory * mk_tactic_factory2solver_factory(tactic_factory * f);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue