Fixing remaining issues

This commit is contained in:
Mate Soos 2022-03-21 18:04:01 +01:00
parent 3e0f4cd7bb
commit a7a6475f6f
2 changed files with 11 additions and 9 deletions

View File

@ -309,7 +309,9 @@ void CDCL::cancelUntil(size_t _backtrackLevel)
m_reason.erase(l);
// TODO maybe could do without.
m_levelForVariable.erase(l.variable);
order.insert((int)l.variable);
if (!order.inHeap((int)l.variable)) {
order.insert((int)l.variable);
}
}
m_decisionPoints.resize(_backtrackLevel);
m_assignmentQueuePointer = m_assignmentTrail.size();

View File

@ -98,6 +98,8 @@ std::pair<vector<vector<Literal>>, size_t> readCNFFile(const string& fname)
{
if (line.empty())
continue;
if (line[0] == 'c')
continue;
if (line[0] == 'p') {
assert(line.substr(0,6) == string("p cnf "));
line = line.substr(6);
@ -166,18 +168,16 @@ int main(int argc, char** argv)
if (model) {
const size_t line_break_after = 80;
size_t last_line_break = 0;
stringstream ss;
ss << "v";
for (size_t i = 0; i < model->size(); i++) {
if (ss.str().size() > line_break_after) {
cout << ss.str() << endl;
ss.clear();
for(auto const& m: *model) {
if (ss.str().size()-last_line_break > line_break_after) {
ss << endl;
last_line_break = ss.str().size();
ss << "v";
}
// if (model->at(i) != TriState::t_unset()) {
// ss << " " << (model->at(i) == TriState::t_true() ? "" : "-") << i+1;
// }
ss << " " << (m.second ? "" : "-") << m.first;
}
cout << ss.str() << " 0" << endl;
cout << "s SATISFIABLE" << endl;