Skip to content
Snippets Groups Projects
Commit 47e9c3fd authored by Jaime Arias's avatar Jaime Arias
Browse files

feat: save generated sog at the end of the pipeline

parent e8c4d60a
No related branches found
No related tags found
No related merge requests found
Pipeline #9284 passed with stage
......@@ -38,7 +38,7 @@ bool ValidTransitionName(const std::string& str) {
* @param obs_paths Set of observable paths
*/
void SaveObservablePaths(const Paths& obs_paths, const string& output_file) {
cout << "\nSaving results in " << output_file << '\n';
cout << "\nSaving results in " << output_file << '\n';
ofstream my_file(output_file);
my_file << "# paths: " << obs_paths.size() << '\n';
......@@ -88,11 +88,12 @@ void PrintStats(const Paths& abstract_paths) {
* @param obs_transitions observable transitions
* @param obs_paths set of observable paths
* @param abstract_paths set of abstract paths
* @param output_file file where the information will be saved
* @param output_file_prefix file where the information will be saved
*/
void PrintOutput(const net& model, SOG& sog,
const map<int, int>& obs_transitions, const Paths& obs_paths,
const Paths& abstract_paths, const string& output_file) {
const Paths& abstract_paths,
const string& output_file_prefix) {
// print SOG information
sog.PrintCompleteInformation();
cout << "\n# transition: " << model.transitions.size() << '\n';
......@@ -103,7 +104,12 @@ void PrintOutput(const net& model, SOG& sog,
PrintStats(abstract_paths);
// save observable paths in the folder
SaveObservablePaths(obs_paths, output_file);
SaveObservablePaths(obs_paths, output_file_prefix + "_obs_paths.txt");
// save generate SOG
const string sog_file = output_file_prefix + "_sog.dot";
cout << "Saving generated SOG in " << sog_file << '\n';
sog.ExportGraphToDotFile(sog_file);
}
/**
......@@ -193,7 +199,8 @@ void FindObservableTransitions(net& model, map<int, int>& obs_trans,
*/
void ComputeAbstractPaths(const string& net_file, int bound,
const string& transitions_file,
const string& output_folder) {
const string& output_folder,
const bool save_sog = false) {
SOG sog;
Paths obs_paths;
Paths abstract_paths;
......@@ -234,7 +241,6 @@ void ComputeAbstractPaths(const string& net_file, int bound,
auto paths_time = GetTime() - start_paths_time;
cout << " done\nTime for computing observable paths: " << paths_time
<< " seconds\n";
sog.ExportGraphToDotFile("./sog.dot");
// add abstract paths
cout << "\nComputing abstract paths ...";
......@@ -252,8 +258,9 @@ void ComputeAbstractPaths(const string& net_file, int bound,
// print output
string model_name = GetModelName(net_file);
string output_file = output_folder + "/obs_paths_" + model_name + ".txt";
PrintOutput(model, sog, obs_trans, obs_paths, abstract_paths, output_file);
string output_file_prefix = output_folder + "/" + model_name;
PrintOutput(model, sog, obs_trans, obs_paths, abstract_paths,
output_file_prefix);
}
/******************************************************************************
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment