cloud-sat/simplify/master.cpp

38 lines
886 B
C++
Raw Normal View History

2023-03-26 19:15:17 +08:00
#include <string>
#include <iostream>
#include <sstream>
2023-03-26 19:15:17 +08:00
#include "master.h"
2023-03-27 16:10:41 +08:00
#include "paras.hpp"
#include "preprocess/preprocess.hpp"
2023-03-26 19:15:17 +08:00
2023-03-27 16:10:41 +08:00
int main(int argc, char* argv[]) {
2023-03-27 15:44:39 +08:00
// read command line arguments
2023-03-27 16:10:41 +08:00
paras::parse(argc, argv);
opt->print_paras();
2023-03-27 15:44:39 +08:00
std::stringstream ss;
auto pre = new preprocess();
if(OPT(simplify)) {
char *filename = const_cast<char*>(opt->instance.c_str());
pre->do_preprocess(filename);
ss << "p cnf " << pre->vars << " " << pre->clause.size() << std::endl;
for (int i = 1; i <= pre->clauses; i++) {
int l = pre->clause[i].size();
for (int j = 0; j < l; j++)
ss << pre->clause[i][j] << " ";
ss << "0" << std::endl;
}
}
const auto& str_ref = ss.str();
const char* cstr = str_ref.c_str();
printf("%s\n", cstr);
2023-03-26 19:15:17 +08:00
return 0;
}