3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-03 05:47:01 +00:00
z3/src/math/polysat/restart.cpp
Jakob Rath 618b3945c1 log
2022-08-05 11:23:02 +02:00

45 lines
1 KiB
C++

/*++
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()() {
LOG_H2("Restarting");
++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);
}
}