3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-06 23:35:46 +00:00

split out restart

This commit is contained in:
Nikolaj Bjorner 2021-12-12 17:27:30 -08:00
parent 30a2c32c3b
commit 33d433d742
6 changed files with 85 additions and 27 deletions

View file

@ -0,0 +1,44 @@
/*++
Copyright (c) 2021 Microsoft Corporation
Module Name:
Restart
Author:
Jakob Rath, Nikolaj Bjorner (nbjorner) 2021-12-12
--*/
#include "math/polysat/solver.h"
#include "math/polysat/restart.h"
#include "util/luby.h"
namespace polysat {
restart::restart(solver& s):
s(s)
{}
/*
* Basic restart functionality.
* restarts make more sense when the order of variable
* assignments and the values assigned to variables can be diversified.
*/
bool restart::should_apply() const {
if (s.m_stats.m_num_conflicts - m_conflicts_at_restart < m_restart_threshold)
return false;
if (s.base_level() + 2 > s.m_level)
return false;
return true;
}
void restart::operator()() {
++s.m_stats.m_num_restarts;
s.pop_levels(s.m_level - s.base_level());
m_conflicts_at_restart = s.m_stats.m_num_conflicts;
m_restart_threshold = m_restart_init * get_luby(++m_luby_idx);
}
}