mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 09:35:32 +00:00
preparing for more efficient asymmetric branching
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
7e56d05dcf
commit
a4dc68766d
11 changed files with 47 additions and 27 deletions
|
@ -56,25 +56,8 @@ namespace sat {
|
|||
<< " :time " << std::fixed << std::setprecision(2) << m_watch.get_seconds() << ")\n";);
|
||||
}
|
||||
};
|
||||
|
||||
void asymm_branch::operator()(bool force) {
|
||||
++m_calls;
|
||||
if (m_calls <= 1)
|
||||
return;
|
||||
if (!m_asymm_branch && !m_asymm_branch_all)
|
||||
return;
|
||||
s.propagate(false); // must propagate, since it uses s.push()
|
||||
if (s.m_inconsistent)
|
||||
return;
|
||||
if (!force && m_counter > 0) {
|
||||
m_counter /= 100;
|
||||
return;
|
||||
}
|
||||
CASSERT("asymm_branch", s.check_invariant());
|
||||
TRACE("asymm_branch_detail", s.display(tout););
|
||||
report rpt(*this);
|
||||
svector<char> saved_phase(s.m_phase);
|
||||
m_counter = 0;
|
||||
|
||||
void asymm_branch::process(clause_vector& clauses) {
|
||||
int64 limit = -m_asymm_branch_limit;
|
||||
std::stable_sort(s.m_clauses.begin(), s.m_clauses.end(), clause_size_lt());
|
||||
m_counter -= s.m_clauses.size();
|
||||
|
@ -114,6 +97,27 @@ namespace sat {
|
|||
m_counter = -m_counter;
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
void asymm_branch::operator()(bool force) {
|
||||
++m_calls;
|
||||
if (m_calls <= 1)
|
||||
return;
|
||||
if (!m_asymm_branch && !m_asymm_branch_all)
|
||||
return;
|
||||
s.propagate(false); // must propagate, since it uses s.push()
|
||||
if (s.m_inconsistent)
|
||||
return;
|
||||
if (!force && m_counter > 0) {
|
||||
m_counter /= 100;
|
||||
return;
|
||||
}
|
||||
CASSERT("asymm_branch", s.check_invariant());
|
||||
TRACE("asymm_branch_detail", s.display(tout););
|
||||
report rpt(*this);
|
||||
svector<char> saved_phase(s.m_phase);
|
||||
m_counter = 0;
|
||||
process(s.m_clauses);
|
||||
m_counter = -m_counter;
|
||||
s.m_phase = saved_phase;
|
||||
m_asymm_branch_limit *= 2;
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace sat {
|
|||
unsigned m_elim_literals;
|
||||
|
||||
bool process(clause & c);
|
||||
|
||||
void process(clause_vector & c);
|
||||
|
||||
bool process_all(clause & c);
|
||||
|
||||
|
|
|
@ -176,6 +176,8 @@ namespace sat {
|
|||
m_reward_multiplier = 0.9;
|
||||
m_reward_offset = 1000000.0;
|
||||
|
||||
m_variable_decay = p.variable_decay();
|
||||
|
||||
// PB parameters
|
||||
s = p.pb_solver();
|
||||
if (s == symbol("circuit")) {
|
||||
|
|
|
@ -95,6 +95,8 @@ namespace sat {
|
|||
double m_simplify_mult2;
|
||||
unsigned m_simplify_max;
|
||||
|
||||
unsigned m_variable_decay;
|
||||
|
||||
gc_strategy m_gc_strategy;
|
||||
unsigned m_gc_initial;
|
||||
unsigned m_gc_increment;
|
||||
|
|
|
@ -2303,7 +2303,16 @@ namespace sat {
|
|||
*/
|
||||
|
||||
void lookahead::add_hyper_binary() {
|
||||
|
||||
std::cout << "binary trail size: " << m_binary_trail.size() << "\n";
|
||||
std::cout << "Are windfalls still on the trail at base level?\n";
|
||||
unsigned num_lits = m_s.num_vars() * 2;
|
||||
unsigned_vector bin_size(num_lits);
|
||||
for (unsigned idx : m_binary_trail) {
|
||||
bin_size[idx]++;
|
||||
}
|
||||
|
||||
|
||||
union_find_default_ctx ufctx;
|
||||
union_find<union_find_default_ctx> uf(ufctx);
|
||||
for (unsigned i = 0; i < num_lits; ++i) uf.mk_var();
|
||||
|
|
|
@ -9,6 +9,7 @@ def_module_params('sat',
|
|||
('restart.initial', UINT, 100, 'initial restart (number of conflicts)'),
|
||||
('restart.max', UINT, UINT_MAX, 'maximal number of restarts.'),
|
||||
('restart.factor', DOUBLE, 1.5, 'restart increment factor for geometric strategy'),
|
||||
('variable_decay', UINT, 120, 'multiplier (divided by 100) for the VSIDS activity increement'),
|
||||
('inprocess.max', UINT, UINT_MAX, 'maximal number of inprocessing passes'),
|
||||
('branching.heuristic', SYMBOL, 'vsids', 'branching heuristic vsids, lrb or chb'),
|
||||
('branching.anti_exploration', BOOL, False, 'apply anti-exploration heuristic for branch selection'),
|
||||
|
|
|
@ -1415,6 +1415,7 @@ namespace sat {
|
|||
m_next_simplify = 0;
|
||||
m_min_d_tk = 1.0;
|
||||
m_search_lvl = 0;
|
||||
m_conflicts_since_gc = 0;
|
||||
m_asymm_branch.init_search();
|
||||
m_stopwatch.reset();
|
||||
m_stopwatch.start();
|
||||
|
@ -1660,6 +1661,7 @@ namespace sat {
|
|||
void solver::gc() {
|
||||
if (m_conflicts_since_gc <= m_gc_threshold)
|
||||
return;
|
||||
IF_VERBOSE(1, verbose_stream() << "gc\n";);
|
||||
CASSERT("sat_gc_bug", check_invariant());
|
||||
switch (m_config.m_gc_strategy) {
|
||||
case GC_GLUE:
|
||||
|
|
|
@ -575,8 +575,8 @@ namespace sat {
|
|||
}
|
||||
|
||||
void decay_activity() {
|
||||
m_activity_inc *= 11;
|
||||
m_activity_inc /= 10;
|
||||
m_activity_inc *= m_config.m_variable_decay;
|
||||
m_activity_inc /= 100;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue