Skip to content

Commit

Permalink
feat: add preprocessing-only option
Browse files Browse the repository at this point in the history
  • Loading branch information
uulm-janbaudisch committed Feb 7, 2025
1 parent fbc93ac commit feaf162
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/config/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace d4 {
config.isFloat = false;
config.dump_ddnnf = "";
config.dump_preproc = "";
config.only_preproc = true;
config.query = "";
config.projMC_refinement = false;
config.keyword_output_format_solution = "s";
Expand Down
1 change: 1 addition & 0 deletions src/config/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace d4 {
bool isFloat;
string dump_ddnnf;
string dump_preproc;
bool only_preproc;
string query;
bool projMC_refinement;
string keyword_output_format_solution;
Expand Down
2 changes: 2 additions & 0 deletions src/config/ConfigConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ namespace d4 {
config.dump_preproc = "";
}

config.only_preproc = vm["only-preproc"].as<bool>();

if (vm.count("query")) {
config.query = vm["query"].as<string>();
} else {
Expand Down
9 changes: 7 additions & 2 deletions src/methods/MethodManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ MethodManager *MethodManager::makeMethodManager(Config &config,

LastBreathPreproc lastBreath;
ProblemManager *runProblem = runPreproc(config, problem, out, lastBreath);
displayInfoVariables(runProblem, out);
out << "c [MODE] Panic: " << lastBreath.panic << "\n";

if (!config.dump_preproc.empty()) {
std::ofstream outFile;
Expand All @@ -89,6 +87,13 @@ MethodManager *MethodManager::makeMethodManager(Config &config,
outFile.close();
}

if (config.only_preproc) {
exit(0);
}

displayInfoVariables(runProblem, out);
out << "c [MODE] Panic: " << lastBreath.panic << "\n";

if (meth == "counting") {
if (!isFloat)
return new DpllStyleMethod<mpz::mpz_int, mpz::mpz_int>(
Expand Down
1 change: 1 addition & 0 deletions src/option.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
("float,f", boost::program_options::value<bool>()->default_value(false), "If the count is computed as a float or not.")
("dump-ddnnf", boost::program_options::value<std::string>(), "Print out the decision DNNF formula in a given file.")
("dump-preproc", boost::program_options::value<std::string>(), "Print out the preprocessed CNF in a given file.")
("only-preproc", boost::program_options::value<bool>()->default_value(false), "Stop after preprocessing.")
("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).")
("projMC-refinement", boost::program_options::value<bool>()->default_value(false), "Try to reduce the set of selector by computing a MSS.")
("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.")
Expand Down

0 comments on commit feaf162

Please sign in to comment.