Skip to content

Commit fbc93ac

Browse files
feat: enable to dump the preprocessed input
1 parent d41c00d commit fbc93ac

File tree

6 files changed

+17
-1
lines changed

6 files changed

+17
-1
lines changed

src/config/Config.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ namespace d4 {
4848
config.float_precision = 128;
4949
config.isFloat = false;
5050
config.dump_ddnnf = "";
51+
config.dump_preproc = "";
5152
config.query = "";
5253
config.projMC_refinement = false;
5354
config.keyword_output_format_solution = "s";

src/config/Config.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ namespace d4 {
5151
int float_precision;
5252
bool isFloat;
5353
string dump_ddnnf;
54+
string dump_preproc;
5455
string query;
5556
bool projMC_refinement;
5657
string keyword_output_format_solution;

src/config/ConfigConverter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ namespace d4 {
6060
config.dump_ddnnf = "";
6161
}
6262

63+
if (vm.count("dump-preproc")) {
64+
config.dump_preproc = vm["dump-preproc"].as<string>();
65+
} else {
66+
config.dump_preproc = "";
67+
}
68+
6369
if (vm.count("query")) {
6470
config.query = vm["query"].as<string>();
6571
} else {

src/methods/MethodManager.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ MethodManager *MethodManager::makeMethodManager(Config &config,
8282
displayInfoVariables(runProblem, out);
8383
out << "c [MODE] Panic: " << lastBreath.panic << "\n";
8484

85+
if (!config.dump_preproc.empty()) {
86+
std::ofstream outFile;
87+
outFile.open(config.dump_preproc);
88+
runProblem->display(outFile);
89+
outFile.close();
90+
}
91+
8592
if (meth == "counting") {
8693
if (!isFloat)
8794
return new DpllStyleMethod<mpz::mpz_int, mpz::mpz_int>(

src/option.dsc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
("float-precision,fp", boost::program_options::value<int>()->default_value(128), "The precision for the float.")
4444
("float,f", boost::program_options::value<bool>()->default_value(false), "If the count is computed as a float or not.")
4545
("dump-ddnnf", boost::program_options::value<std::string>(), "Print out the decision DNNF formula in a given file.")
46+
("dump-preproc", boost::program_options::value<std::string>(), "Print out the preprocessed CNF in a given file.")
4647
("query,q", boost::program_options::value<std::string>(), "Perform the queries given in a file (m l1 l2 ... ln 0 for a model counting query, and d l1 l2 ... ln 0 for a satisfiability query).")
4748
("projMC-refinement", boost::program_options::value<bool>()->default_value(false), "Try to reduce the set of selector by computing a MSS.")
4849
("keyword-output-format-solution", boost::program_options::value<std::string>()->default_value("s"), "The keyword prints in front of the solution when it is printed out.")

src/problem/cnf/ProblemManagerCnf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ ProblemManagerCnf::getConditionedFormula(std::vector<Lit> &units) {
197197
*/
198198

199199
void ProblemManagerCnf::display(std::ostream &out) {
200-
out << "weight list: ";
200+
out << "c weight list: ";
201201
for (unsigned i = 1; i <= m_nbVar; i++) {
202202
Lit l = Lit::makeLit(i, false);
203203
out << i << "[" << m_weightVar[i] << "] ";

0 commit comments

Comments
 (0)