mirror of
https://github.com/Z3Prover/z3
synced 2025-04-15 21:38:44 +00:00
fix compiler errors and memory issue with drat
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
4831c45ad8
commit
66089a7aef
|
@ -58,7 +58,6 @@ namespace sat {
|
|||
}
|
||||
|
||||
void drat::dump(unsigned n, literal const* c, status st) {
|
||||
if (is_cleaned(n, c)) return;
|
||||
switch (st) {
|
||||
case status::asserted: return;
|
||||
case status::external: return; // requires extension to drat format.
|
||||
|
@ -69,8 +68,9 @@ namespace sat {
|
|||
(*m_out) << "0\n";
|
||||
}
|
||||
|
||||
bool drat::is_cleaned(unsigned n, literal const* c) const {
|
||||
bool drat::is_cleaned(clause& c) const {
|
||||
literal last = null_literal;
|
||||
unsigned n = c.size();
|
||||
for (unsigned i = 0; i < n; ++i) {
|
||||
if (c[i] == last) return true;
|
||||
last = c[i];
|
||||
|
@ -133,7 +133,6 @@ namespace sat {
|
|||
|
||||
void drat::append(clause& c, status st) {
|
||||
unsigned n = c.size();
|
||||
if (is_cleaned(n, c.begin())) return;
|
||||
trace(std::cout, n, c.begin(), st);
|
||||
|
||||
if (st == status::learned) {
|
||||
|
@ -394,10 +393,13 @@ namespace sat {
|
|||
void drat::del(literal l1, literal l2) {
|
||||
literal ls[2] = {l1, l2};
|
||||
if (m_out) dump(2, ls, status::deleted);
|
||||
if (s.m_config.m_drat_check) append(l1, l2, status::deleted);
|
||||
if (s.m_config.m_drat_check)
|
||||
append(l1, l2, status::deleted);
|
||||
}
|
||||
void drat::del(clause& c) {
|
||||
if (m_out) dump(c.size(), c.begin(), status::deleted);
|
||||
if (s.m_config.m_drat_check) append(c, status::deleted);
|
||||
if (s.m_config.m_drat_check)
|
||||
append(c, status::deleted);
|
||||
else s.m_cls_allocator.del_clause(&c);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,10 +28,10 @@ namespace sat {
|
|||
enum { t_clause, t_unit, t_ext } m_type;
|
||||
union {
|
||||
clause* m_clause;
|
||||
literal m_literal;
|
||||
unsigned m_literal;
|
||||
};
|
||||
premise(s_ext, literal l): m_type(t_ext), m_literal(l) {}
|
||||
premise(s_unit, literal l): m_type(t_unit), m_literal(l) {}
|
||||
premise(s_ext, literal l): m_type(t_ext), m_literal(l.index()) {}
|
||||
premise(s_unit, literal l): m_type(t_unit), m_literal(l.index()) {}
|
||||
premise(clause* c): m_type(t_clause), m_clause(c) {}
|
||||
};
|
||||
private:
|
||||
|
@ -52,7 +52,6 @@ namespace sat {
|
|||
void append(clause& c, status st);
|
||||
friend std::ostream& operator<<(std::ostream & out, status st);
|
||||
status get_status(bool learned) const;
|
||||
bool is_cleaned(unsigned n, literal const* lits) const;
|
||||
|
||||
void declare(literal l);
|
||||
void assign(literal l);
|
||||
|
@ -74,7 +73,8 @@ namespace sat {
|
|||
void add(literal l1, literal l2, bool learned);
|
||||
void add(clause& c, bool learned);
|
||||
void add(literal_vector const& c, svector<premise> const& premises);
|
||||
|
||||
|
||||
bool is_cleaned(clause& c) const;
|
||||
void del(literal l);
|
||||
void del(literal l1, literal l2);
|
||||
void del(clause& c);
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace sat {
|
|||
break;
|
||||
}
|
||||
SASSERT(head < m_size);
|
||||
IF_VERBOSE((iterations > m_size ? 0 : 3), verbose_stream() << owner << ": head: " << head << " tail: " << m_tail << "\n";);
|
||||
IF_VERBOSE(static_cast<unsigned>(iterations > m_size ? 0 : 3), verbose_stream() << owner << ": head: " << head << " tail: " << m_tail << "\n";);
|
||||
bool is_self = owner == get_owner(head);
|
||||
next(m_heads[owner]);
|
||||
if (!is_self) {
|
||||
|
|
|
@ -206,10 +206,10 @@ namespace sat {
|
|||
if (!c.is_learned()) {
|
||||
m_stats.m_non_learned_generation++;
|
||||
}
|
||||
if (m_config.m_drat) {
|
||||
if (m_config.m_drat && !m_drat.is_cleaned(c)) {
|
||||
m_drat.del(c);
|
||||
}
|
||||
else if (!m_config.m_drat || !m_config.m_drat_check) {
|
||||
else if (!m_config.m_drat || !m_config.m_drat_check || m_drat.is_cleaned(c)) {
|
||||
m_cls_allocator.del_clause(&c);
|
||||
}
|
||||
m_stats.m_del_clause++;
|
||||
|
|
Loading…
Reference in a new issue