diff --git a/scripts/nightly.yaml b/scripts/nightly.yaml index c91c01d62..dc17d42c5 100644 --- a/scripts/nightly.yaml +++ b/scripts/nightly.yaml @@ -100,7 +100,7 @@ stages: displayName: "$(name) build" pool: vmImage: "Ubuntu-18.04" - container: $(image) + container: $(image) variables: python: $(python) steps: diff --git a/src/sat/dimacs.cpp b/src/sat/dimacs.cpp index 4a818af6c..710cefe8a 100644 --- a/src/sat/dimacs.cpp +++ b/src/sat/dimacs.cpp @@ -113,8 +113,9 @@ static void read_clause(Buffer & in, std::ostream& err, sat::literal_vector & li } template -static void read_pragma(Buffer & in, std::ostream& err, std::string& p) { +static void read_pragma(Buffer & in, std::ostream& err, std::string& p, sat::proof_hint& h) { skip_whitespace(in); + h.reset(); if (*in != 'p') return; ++in; @@ -122,14 +123,16 @@ static void read_pragma(Buffer & in, std::ostream& err, std::string& p) { ++in; while (true) { if (*in == EOF) - return; + break; if (*in == '\n') { ++in; - return; + break; } p.push_back(*in); ++in; } + if (!p.empty()) + h.from_string(p); } @@ -177,7 +180,7 @@ namespace dimacs { sat::status_pp pp(r.m_status, p.th); switch (r.m_tag) { case drat_record::tag_t::is_clause: - if (!r.m_pragma.empty()) + if (!r.m_pragma.empty()) return out << pp << " " << r.m_lits << " 0 p " << r.m_pragma << "\n"; return out << pp << " " << r.m_lits << " 0\n"; case drat_record::tag_t::is_node: @@ -328,7 +331,7 @@ namespace dimacs { theory_id = read_theory_id(); skip_whitespace(in); read_clause(in, err, m_record.m_lits); - read_pragma(in, err, m_record.m_pragma); + read_pragma(in, err, m_record.m_pragma, m_record.m_hint); m_record.m_tag = drat_record::tag_t::is_clause; m_record.m_status = sat::status::th(false, theory_id); break; diff --git a/src/sat/dimacs.h b/src/sat/dimacs.h index 7b4e8557c..7a5a66283 100644 --- a/src/sat/dimacs.h +++ b/src/sat/dimacs.h @@ -64,6 +64,7 @@ namespace dimacs { std::string m_name; unsigned_vector m_args; std::string m_pragma; + sat::proof_hint m_hint; }; struct drat_pp { diff --git a/src/sat/sat_drat.cpp b/src/sat/sat_drat.cpp index 4ecb8ed1f..ac5cb272c 100644 --- a/src/sat/sat_drat.cpp +++ b/src/sat/sat_drat.cpp @@ -932,11 +932,12 @@ namespace sat { return ous.str(); } - proof_hint proof_hint::from_string(char const* s) { - proof_hint h; + void proof_hint::from_string(char const* s) { + proof_hint& h = *this; + h.reset(); h.m_ty = hint_type::null_h; if (!s) - return h; + return; auto ws = [&]() { while (*s == ' ' || *s == '\n' || *s == '\t') ++s; @@ -999,14 +1000,14 @@ namespace sat { ws(); if (!parse_type()) - return h; + return; ws(); while (*s) { if (!parse_coeff_literal()) - return h; + return; ws(); } - return h; + return; } } diff --git a/src/sat/sat_types.h b/src/sat/sat_types.h index 1adcbc6b6..bc7ea6ef9 100644 --- a/src/sat/sat_types.h +++ b/src/sat/sat_types.h @@ -102,11 +102,13 @@ namespace sat { }; struct proof_hint { - hint_type m_ty; + hint_type m_ty = hint_type::null_h; vector> m_literals; vector> m_eqs; + void reset() { m_ty = hint_type::null_h; m_literals.reset(); m_eqs.reset(); } std::string to_string() const; - static proof_hint from_string(char const* s); + void from_string(char const* s); + void from_string(std::string const& s) { from_string(s.c_str()); } }; class status {