mirror of
https://github.com/Z3Prover/z3
synced 2025-04-08 02:15:19 +00:00
ensure parallel mode works under push/pop
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
69ca840ceb
commit
3da3b41786
|
@ -22,6 +22,9 @@ void lp_bound_propagator::try_add_bound(mpq const& v, unsigned j, bool is_low, b
|
|||
if (strict)
|
||||
kind = static_cast<lconstraint_kind>(kind / 2);
|
||||
|
||||
// static unsigned s_count = 0, a_count = 0;
|
||||
// ++a_count;
|
||||
// if ((a_count % 100000) == 0) std::cout << s_count << " / " << a_count << "\n";
|
||||
if (!bound_is_interesting(j, kind, v))
|
||||
return;
|
||||
unsigned k; // index to ibounds
|
||||
|
@ -29,10 +32,12 @@ void lp_bound_propagator::try_add_bound(mpq const& v, unsigned j, bool is_low, b
|
|||
if (try_get_value(m_improved_lower_bounds, j, k)) {
|
||||
auto & found_bound = m_ibounds[k];
|
||||
if (v > found_bound.m_bound || (v == found_bound.m_bound && found_bound.m_strict == false && strict)) {
|
||||
// ++s_count;
|
||||
found_bound = implied_bound(v, j, is_low, coeff_before_j_is_pos, row_or_term_index, strict);
|
||||
TRACE("try_add_bound", m_lar_solver.print_implied_bound(found_bound, tout););
|
||||
}
|
||||
} else {
|
||||
// ++s_count;
|
||||
m_improved_lower_bounds[j] = m_ibounds.size();
|
||||
m_ibounds.push_back(implied_bound(v, j, is_low, coeff_before_j_is_pos, row_or_term_index, strict));
|
||||
TRACE("try_add_bound", m_lar_solver.print_implied_bound(m_ibounds.back(), tout););
|
||||
|
@ -41,10 +46,12 @@ void lp_bound_propagator::try_add_bound(mpq const& v, unsigned j, bool is_low, b
|
|||
if (try_get_value(m_improved_upper_bounds, j, k)) {
|
||||
auto & found_bound = m_ibounds[k];
|
||||
if (v < found_bound.m_bound || (v == found_bound.m_bound && found_bound.m_strict == false && strict)) {
|
||||
// ++s_count;
|
||||
found_bound = implied_bound(v, j, is_low, coeff_before_j_is_pos, row_or_term_index, strict);
|
||||
TRACE("try_add_bound", m_lar_solver.print_implied_bound(found_bound, tout););
|
||||
}
|
||||
} else {
|
||||
// ++s_count;
|
||||
m_improved_upper_bounds[j] = m_ibounds.size();
|
||||
m_ibounds.push_back(implied_bound(v, j, is_low, coeff_before_j_is_pos, row_or_term_index, strict));
|
||||
TRACE("try_add_bound", m_lar_solver.print_implied_bound(m_ibounds.back(), tout););
|
||||
|
|
|
@ -155,15 +155,16 @@ namespace smt {
|
|||
return std::min(m_relevancy_lvl, m_fparams.m_relevancy_lvl);
|
||||
}
|
||||
|
||||
void context::copy(context& src_ctx, context& dst_ctx) {
|
||||
void context::copy(context& src_ctx, context& dst_ctx, bool override_base) {
|
||||
ast_manager& dst_m = dst_ctx.get_manager();
|
||||
ast_manager& src_m = src_ctx.get_manager();
|
||||
src_ctx.pop_to_base_lvl();
|
||||
|
||||
if (src_ctx.m_base_lvl > 0) {
|
||||
if (!override_base && src_ctx.m_base_lvl > 0) {
|
||||
INVOKE_DEBUGGER();
|
||||
throw default_exception("Cloning contexts within a user-scope is not allowed");
|
||||
}
|
||||
SASSERT(src_ctx.m_base_lvl == 0);
|
||||
SASSERT(src_ctx.m_base_lvl == 0 || override_base);
|
||||
|
||||
ast_translation tr(src_m, dst_m, false);
|
||||
|
||||
|
|
|
@ -1539,7 +1539,7 @@ namespace smt {
|
|||
*/
|
||||
context * mk_fresh(symbol const * l = nullptr, smt_params * smtp = nullptr, params_ref const & p = params_ref());
|
||||
|
||||
static void copy(context& src, context& dst);
|
||||
static void copy(context& src, context& dst, bool override_base = false);
|
||||
|
||||
/**
|
||||
\brief Translate context to use new manager m.
|
||||
|
|
|
@ -33,9 +33,9 @@ namespace smt {
|
|||
unsigned thread_max_conflicts = ctx.get_fparams().m_threads_max_conflicts;
|
||||
unsigned max_conflicts = ctx.get_fparams().m_max_conflicts;
|
||||
|
||||
#if 0
|
||||
// TBD: try first sequential with a low conflict budget to make super easy problems cheap
|
||||
ctx.get_fparams().m_max_conflicts = std::min(thread_max_conflicts, 20);
|
||||
#if 1
|
||||
// try first sequential with a low conflict budget to make super easy problems cheap
|
||||
ctx.get_fparams().m_max_conflicts = std::min(thread_max_conflicts, 40u);
|
||||
result = ctx.check(asms.size(), asms.c_ptr());
|
||||
if (result != l_undef || ctx.m_num_conflicts < max_conflicts) {
|
||||
return result;
|
||||
|
@ -65,7 +65,7 @@ namespace smt {
|
|||
pms.push_back(new_m);
|
||||
pctxs.push_back(alloc(context, *new_m, ctx.get_fparams(), ctx.get_params()));
|
||||
context& new_ctx = *pctxs.back();
|
||||
context::copy(ctx, new_ctx);
|
||||
context::copy(ctx, new_ctx, true);
|
||||
new_ctx.set_random_seed(i + ctx.get_fparams().m_random_seed);
|
||||
ast_translation tr(*new_m, m);
|
||||
pasms.push_back(tr(asms));
|
||||
|
|
Loading…
Reference in a new issue