3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-13 12:28:44 +00:00

fix #2114 introduced while working on #2095

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-01-29 08:18:03 -08:00
parent 4f988595c7
commit 58f5531cff
3 changed files with 72 additions and 61 deletions

View file

@ -1664,6 +1664,7 @@ namespace sat {
if (m_conflicts_since_init < m_next_simplify) {
return;
}
log_stats();
m_simplifications++;
IF_VERBOSE(2, verbose_stream() << "(sat.simplify :simplifications " << m_simplifications << ")\n";);
@ -1890,17 +1891,8 @@ namespace sat {
m_config.m_restart_margin * m_slow_glue_avg <= m_fast_glue_avg;
}
void solver::restart(bool to_base) {
m_stats.m_restart++;
m_restarts++;
if (m_conflicts_since_init >= m_restart_next_out && get_verbosity_level() >= 1) {
void solver::log_stats() {
m_restart_logs++;
if (0 == m_restart_next_out) {
m_restart_next_out = 1;
}
else {
m_restart_next_out = (3*m_restart_next_out)/2 + 1;
}
std::stringstream strm;
strm << "(sat.stats " << std::setw(6) << m_stats.m_conflict << " "
@ -1924,7 +1916,9 @@ namespace sat {
if (m_last_positions[i] > nums[i]) diff += m_last_positions[i] - nums[i];
if (m_last_positions[i] < nums[i]) diff += nums[i] - m_last_positions[i];
}
if (m_last_positions.empty() || m_restart_logs >= 20 + m_last_position_log || (m_restart_logs >= 6 + m_last_position_log && (!same || diff > 3))) {
if (m_last_positions.empty() ||
m_restart_logs >= 20 + m_last_position_log ||
(m_restart_logs >= 6 + m_last_position_log && (!same || diff > 3))) {
m_last_position_log = m_restart_logs;
// conflicts restarts learned gc time
// decisions clauses units memory
@ -1960,6 +1954,19 @@ namespace sat {
}
IF_VERBOSE(1, verbose_stream() << str);
}
void solver::restart(bool to_base) {
m_stats.m_restart++;
m_restarts++;
if (m_conflicts_since_init >= m_restart_next_out && get_verbosity_level() >= 1) {
if (0 == m_restart_next_out) {
m_restart_next_out = 1;
}
else {
m_restart_next_out = (3*m_restart_next_out)/2 + 1;
}
log_stats();
}
IF_VERBOSE(30, display_status(verbose_stream()););
pop_reinit(restart_level(to_base));
set_next_restart();

View file

@ -425,6 +425,7 @@ namespace sat {
unsigned m_last_position_log;
unsigned m_restart_logs;
unsigned restart_level(bool to_base);
void log_stats();
bool should_restart() const;
void set_next_restart();
bool reached_max_conflicts();

View file

@ -338,8 +338,11 @@ lbool solver::check_sat(unsigned num_assumptions, expr * const * assumptions) {
}
void solver::dump_state(unsigned sz, expr* const* assumptions) {
if ((symbol::null != m_cancel_backup_file) &&
!m_cancel_backup_file.is_numerical() &&
m_cancel_backup_file.c_ptr() &&
m_cancel_backup_file.bare_str()[0]) {
std::string file = m_cancel_backup_file.str();
if (file != "") {
std::ofstream ous(file);
display(ous, sz, assumptions);
}