Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/config/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace d4 {
config.float_precision = 128;
config.isFloat = false;
config.dump_ddnnf = "";
config.dump_gmap = "";
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 @@ -51,6 +51,7 @@ namespace d4 {
int float_precision;
bool isFloat;
string dump_ddnnf;
string dump_gmap;
string query;
bool projMC_refinement;
string keyword_output_format_solution;
Expand Down
6 changes: 6 additions & 0 deletions src/config/ConfigConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ namespace d4 {
config.dump_ddnnf = "";
}

if (vm.count("dump-gmap")) {
config.dump_gmap = vm["dump-gmap"].as<string>();
} else {
config.dump_gmap = "";
}

if (vm.count("query")) {
config.query = vm["query"].as<string>();
} else {
Expand Down
13 changes: 13 additions & 0 deletions src/methods/DecisionDNNFOperation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,19 @@ class DecisionDNNFOperation : public Operation<T, U> {
@param[in] out, the output stream.
*/
void manageResult(U &result, Config &config, std::ostream &out) {
if (!config.dump_gmap.empty()) {
std::string fileName = config.dump_gmap;

std::ofstream outFile;
outFile.open(fileName);

for (auto literal : m_problem->gmap()) {
outFile << literal << "\n";
}

outFile.close();
}

if (!config.dump_ddnnf.empty()) {
std::ofstream outFile;
std::string fileName = config.dump_ddnnf;
Expand Down
1 change: 1 addition & 0 deletions src/option.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
("float-precision,fp", boost::program_options::value<int>()->default_value(128), "The precision for the float.")
("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-gmap", boost::program_options::value<std::string>(), "Print out the variable mapping to the given file.")
("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
2 changes: 1 addition & 1 deletion src/preprocs/cnf/PreprocProj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PreprocProj::PreprocProj(Config &d4Config, std::ostream &out) {
config.ve_only_simpical = d4Config.preproc_ve_only_simpical;
config.ve_prefer_simpical = d4Config.preproc_ve_prefer_simpical;
config.ve_limit = d4Config.preproc_ve_limit;
keep_map = false;
keep_map = !d4Config.dump_gmap.empty();
} // constructor

/**
Expand Down