mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
adding rlimit resource limit facility to provide platform and architecture independent method for canceling activities
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
ad16cc0ce2
commit
9b3e242990
26 changed files with 165 additions and 14 deletions
|
@ -497,7 +497,7 @@ namespace sat {
|
|||
flet<unsigned> _bound_maxc(m_solver.m_config.m_max_conflicts, 1500);
|
||||
|
||||
use_list ul;
|
||||
solver s(m_solver.m_params, 0);
|
||||
solver s(m_solver.m_params, m_solver.rlimit(), 0);
|
||||
s.m_config.m_bcd = false;
|
||||
s.m_config.m_minimize_core = false;
|
||||
s.m_config.m_optimize_model = false;
|
||||
|
|
|
@ -31,8 +31,9 @@ Revision History:
|
|||
|
||||
namespace sat {
|
||||
|
||||
solver::solver(params_ref const & p, extension * ext):
|
||||
solver::solver(params_ref const & p, reslimit& l, extension * ext):
|
||||
m_cancel(false),
|
||||
m_rlimit(l),
|
||||
m_config(p),
|
||||
m_ext(ext),
|
||||
m_cleaner(*this),
|
||||
|
|
|
@ -38,6 +38,7 @@ Revision History:
|
|||
#include"statistics.h"
|
||||
#include"stopwatch.h"
|
||||
#include"trace.h"
|
||||
#include"rlimit.h"
|
||||
|
||||
namespace sat {
|
||||
|
||||
|
@ -71,6 +72,7 @@ namespace sat {
|
|||
struct abort_solver {};
|
||||
protected:
|
||||
volatile bool m_cancel;
|
||||
reslimit& m_rlimit;
|
||||
config m_config;
|
||||
stats m_stats;
|
||||
extension * m_ext;
|
||||
|
@ -145,7 +147,7 @@ namespace sat {
|
|||
friend class bceq;
|
||||
friend struct mk_stat;
|
||||
public:
|
||||
solver(params_ref const & p, extension * ext);
|
||||
solver(params_ref const & p, reslimit& l, extension * ext);
|
||||
~solver();
|
||||
|
||||
// -----------------------
|
||||
|
@ -238,6 +240,7 @@ namespace sat {
|
|||
clause_offset get_offset(clause const & c) const { return m_cls_allocator.get_offset(&c); }
|
||||
void checkpoint() {
|
||||
if (m_cancel) throw solver_exception(Z3_CANCELED_MSG);
|
||||
if (!m_rlimit.inc()) { m_cancel = true; throw solver_exception(Z3_CANCELED_MSG); }
|
||||
++m_num_checkpoints;
|
||||
if (m_num_checkpoints < 10) return;
|
||||
m_num_checkpoints = 0;
|
||||
|
@ -415,6 +418,7 @@ namespace sat {
|
|||
void user_push();
|
||||
void user_pop(unsigned num_scopes);
|
||||
void pop_to_base_level();
|
||||
reslimit& rlimit() { return m_rlimit; }
|
||||
// -----------------------
|
||||
//
|
||||
// Simplification
|
||||
|
|
|
@ -63,7 +63,7 @@ class inc_sat_solver : public solver {
|
|||
typedef obj_map<expr, sat::literal> dep2asm_t;
|
||||
public:
|
||||
inc_sat_solver(ast_manager& m, params_ref const& p):
|
||||
m(m), m_solver(p,0),
|
||||
m(m), m_solver(p, m.limit(), 0),
|
||||
m_params(p), m_optimize_model(false),
|
||||
m_fmls(m),
|
||||
m_asmsf(m),
|
||||
|
|
|
@ -34,7 +34,7 @@ class sat_tactic : public tactic {
|
|||
|
||||
imp(ast_manager & _m, params_ref const & p):
|
||||
m(_m),
|
||||
m_solver(p, 0),
|
||||
m_solver(p, m.limit(), 0),
|
||||
m_params(p) {
|
||||
SASSERT(!m.proofs_enabled());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue