mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
bv and gc of literals (#4692)
* bv and gc of literals Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * overload Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * diseq Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * diseq Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
2d52367368
commit
549753845e
34 changed files with 1480 additions and 854 deletions
|
@ -2704,84 +2704,6 @@ namespace smt {
|
|||
SASSERT(check_clauses(m_lemmas) && check_clauses(m_aux_clauses));
|
||||
}
|
||||
|
||||
void context::log_stats() {
|
||||
size_t bin_clauses = 0, bin_lemmas = 0;
|
||||
for (watch_list const& w : m_watches) {
|
||||
bin_clauses += w.end_literals() - w.begin_literals();
|
||||
}
|
||||
bin_clauses /= 2;
|
||||
for (clause* cp : m_lemmas)
|
||||
if (cp->get_num_literals() == 2)
|
||||
++bin_lemmas;
|
||||
std::stringstream strm;
|
||||
strm << "(smt.stats "
|
||||
<< std::setw(4) << m_stats.m_num_restarts << " "
|
||||
<< std::setw(6) << m_stats.m_num_conflicts << " "
|
||||
<< std::setw(6) << m_stats.m_num_decisions << " "
|
||||
<< std::setw(6) << m_stats.m_num_propagations << " "
|
||||
<< std::setw(5) << (m_aux_clauses.size() + bin_clauses) << "/" << bin_clauses << " "
|
||||
<< std::setw(5) << m_lemmas.size(); if (bin_lemmas > 0) strm << "/" << bin_lemmas << " ";
|
||||
strm << std::setw(5) << m_stats.m_num_simplifications << " "
|
||||
<< std::setw(4) << m_stats.m_num_del_clauses << " "
|
||||
<< std::setw(7) << mem_stat() << ")\n";
|
||||
|
||||
std::string str(strm.str());
|
||||
svector<size_t> offsets;
|
||||
for (size_t i = 0; i < str.size(); ++i) {
|
||||
while (i < str.size() && str[i] != ' ') ++i;
|
||||
while (i < str.size() && str[i] == ' ') ++i;
|
||||
// position of first character after space
|
||||
if (i < str.size()) {
|
||||
offsets.push_back(i);
|
||||
}
|
||||
}
|
||||
bool same = m_last_positions.size() == offsets.size();
|
||||
size_t diff = 0;
|
||||
for (unsigned i = 0; i < offsets.size() && same; ++i) {
|
||||
if (m_last_positions[i] > offsets[i]) diff += m_last_positions[i] - offsets[i];
|
||||
if (m_last_positions[i] < offsets[i]) diff += offsets[i] - m_last_positions[i];
|
||||
}
|
||||
|
||||
if (m_last_positions.empty() ||
|
||||
m_stats.m_num_restarts >= 20 + m_last_position_log ||
|
||||
(m_stats.m_num_restarts >= 6 + m_last_position_log && (!same || diff > 3))) {
|
||||
m_last_position_log = m_stats.m_num_restarts;
|
||||
// restarts decisions clauses simplifications memory
|
||||
// conflicts propagations lemmas deletions
|
||||
int adjust[9] = { -3, -3, -3, -3, -3, -3, -4, -4, -1 };
|
||||
char const* tag[9] = { ":restarts ", ":conflicts ", ":decisions ", ":propagations ", ":clauses/bin ", ":lemmas ", ":simplify ", ":deletions", ":memory" };
|
||||
|
||||
std::stringstream l1, l2;
|
||||
l1 << "(smt.stats ";
|
||||
l2 << "(smt.stats ";
|
||||
size_t p1 = 11, p2 = 11;
|
||||
SASSERT(offsets.size() == 9);
|
||||
for (unsigned i = 0; i < offsets.size(); ++i) {
|
||||
size_t p = offsets[i];
|
||||
if (i & 0x1) {
|
||||
// odd positions
|
||||
for (; p2 < p + adjust[i]; ++p2) l2 << " ";
|
||||
p2 += strlen(tag[i]);
|
||||
l2 << tag[i];
|
||||
}
|
||||
else {
|
||||
// even positions
|
||||
for (; p1 < p + adjust[i]; ++p1) l1 << " ";
|
||||
p1 += strlen(tag[i]);
|
||||
l1 << tag[i];
|
||||
}
|
||||
}
|
||||
for (; p1 + 2 < str.size(); ++p1) l1 << " ";
|
||||
for (; p2 + 2 < str.size(); ++p2) l2 << " ";
|
||||
l1 << ")\n";
|
||||
l2 << ")\n";
|
||||
IF_VERBOSE(1, verbose_stream() << l1.str() << l2.str());
|
||||
m_last_positions.reset();
|
||||
m_last_positions.append(offsets);
|
||||
}
|
||||
IF_VERBOSE(1, verbose_stream() << str);
|
||||
}
|
||||
|
||||
struct clause_lt {
|
||||
bool operator()(clause * cls1, clause * cls2) const { return cls1->get_activity() > cls2->get_activity(); }
|
||||
};
|
||||
|
|
|
@ -661,7 +661,83 @@ namespace smt {
|
|||
return out << enode_pp(p.p.first, p.ctx) << " = " << enode_pp(p.p.second, p.ctx) << "\n";
|
||||
}
|
||||
|
||||
void context::log_stats() {
|
||||
size_t bin_clauses = 0, bin_lemmas = 0;
|
||||
for (watch_list const& w : m_watches) {
|
||||
bin_clauses += w.end_literals() - w.begin_literals();
|
||||
}
|
||||
bin_clauses /= 2;
|
||||
for (clause* cp : m_lemmas)
|
||||
if (cp->get_num_literals() == 2)
|
||||
++bin_lemmas;
|
||||
std::stringstream strm;
|
||||
strm << "(smt.stats "
|
||||
<< std::setw(4) << m_stats.m_num_restarts << " "
|
||||
<< std::setw(6) << m_stats.m_num_conflicts << " "
|
||||
<< std::setw(6) << m_stats.m_num_decisions << " "
|
||||
<< std::setw(6) << m_stats.m_num_propagations << " "
|
||||
<< std::setw(5) << (m_aux_clauses.size() + bin_clauses) << "/" << bin_clauses << " "
|
||||
<< std::setw(5) << m_lemmas.size(); if (bin_lemmas > 0) strm << "/" << bin_lemmas << " ";
|
||||
strm << std::setw(5) << m_stats.m_num_simplifications << " "
|
||||
<< std::setw(4) << m_stats.m_num_del_clauses << " "
|
||||
<< std::setw(7) << mem_stat() << ")\n";
|
||||
|
||||
std::string str(strm.str());
|
||||
svector<size_t> offsets;
|
||||
for (size_t i = 0; i < str.size(); ++i) {
|
||||
while (i < str.size() && str[i] != ' ') ++i;
|
||||
while (i < str.size() && str[i] == ' ') ++i;
|
||||
// position of first character after space
|
||||
if (i < str.size()) {
|
||||
offsets.push_back(i);
|
||||
}
|
||||
}
|
||||
bool same = m_last_positions.size() == offsets.size();
|
||||
size_t diff = 0;
|
||||
for (unsigned i = 0; i < offsets.size() && same; ++i) {
|
||||
if (m_last_positions[i] > offsets[i]) diff += m_last_positions[i] - offsets[i];
|
||||
if (m_last_positions[i] < offsets[i]) diff += offsets[i] - m_last_positions[i];
|
||||
}
|
||||
|
||||
if (m_last_positions.empty() ||
|
||||
m_stats.m_num_restarts >= 20 + m_last_position_log ||
|
||||
(m_stats.m_num_restarts >= 6 + m_last_position_log && (!same || diff > 3))) {
|
||||
m_last_position_log = m_stats.m_num_restarts;
|
||||
// restarts decisions clauses simplifications memory
|
||||
// conflicts propagations lemmas deletions
|
||||
int adjust[9] = { -3, -3, -3, -3, -3, -3, -4, -4, -1 };
|
||||
char const* tag[9] = { ":restarts ", ":conflicts ", ":decisions ", ":propagations ", ":clauses/bin ", ":lemmas ", ":simplify ", ":deletions", ":memory" };
|
||||
|
||||
std::stringstream l1, l2;
|
||||
l1 << "(smt.stats ";
|
||||
l2 << "(smt.stats ";
|
||||
size_t p1 = 11, p2 = 11;
|
||||
SASSERT(offsets.size() == 9);
|
||||
for (unsigned i = 0; i < offsets.size(); ++i) {
|
||||
size_t p = offsets[i];
|
||||
if (i & 0x1) {
|
||||
// odd positions
|
||||
for (; p2 < p + adjust[i]; ++p2) l2 << " ";
|
||||
p2 += strlen(tag[i]);
|
||||
l2 << tag[i];
|
||||
}
|
||||
else {
|
||||
// even positions
|
||||
for (; p1 < p + adjust[i]; ++p1) l1 << " ";
|
||||
p1 += strlen(tag[i]);
|
||||
l1 << tag[i];
|
||||
}
|
||||
}
|
||||
for (; p1 + 2 < str.size(); ++p1) l1 << " ";
|
||||
for (; p2 + 2 < str.size(); ++p2) l2 << " ";
|
||||
l1 << ")\n";
|
||||
l2 << ")\n";
|
||||
IF_VERBOSE(1, verbose_stream() << l1.str() << l2.str());
|
||||
m_last_positions.reset();
|
||||
m_last_positions.append(offsets);
|
||||
}
|
||||
IF_VERBOSE(1, verbose_stream() << str);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue