3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-25 04:26:00 +00:00
z3/src/math/polysat/restart.cpp
2021-12-12 17:27:30 -08:00

44 lines
1,013 B
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()() {
++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);
}
}