This commit is contained in:
Laurent Perron
2025-04-07 15:59:20 +02:00
parent 694d406b8a
commit d3cf912277

View File

@@ -163,21 +163,24 @@ bool LoadProblem(const std::string& filename, absl::string_view hint_file,
default:
break;
}
std::string line;
for (int i = 0; i < num_variables; ++i) {
if (r.solution(i)) {
absl::StrAppend(&line, "x", i + 1, " ");
} else {
absl::StrAppend(&line, "-x", i + 1, " ");
if (r.status() == CpSolverStatus::OPTIMAL ||
r.status() == CpSolverStatus::FEASIBLE) {
std::string line;
for (int i = 0; i < num_variables; ++i) {
if (r.solution(i)) {
absl::StrAppend(&line, "x", i + 1, " ");
} else {
absl::StrAppend(&line, "-x", i + 1, " ");
}
if (line.size() >= 75) {
std::cout << "v " << line << std::endl;
line.clear();
}
}
if (line.size() >= 75) {
if (!line.empty()) {
std::cout << "v " << line << std::endl;
line.clear();
}
}
if (!line.empty()) {
std::cout << "v " << line << std::endl;
}
};
}
} else if (absl::EndsWith(filename, ".cnf") ||