diff --git a/src/main.cpp b/src/main.cpp index 4add1ca4ba62c5fd10be375617fd074a6c3e1acf..8c9b4d8ec31b8b1eb3e1f3134845677ca2dae5ee 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -88,9 +88,6 @@ void print_output(const net& model, MDGraph& g, const map<int, int>& obs_transitions, const paths_t& obs_paths, const paths_t& abstract_paths, float elapsed_time, const string& output_file) { - // save observable paths in the folder - save_observable_paths(obs_paths, output_file); - // print SOG information g.printCompleteInformation(); cout << "\n# transition: " << model.transitions.size() << endl; @@ -104,6 +101,9 @@ void print_output(const net& model, MDGraph& g, // print consumed time cout << "\nTime for computing all the paths: " << elapsed_time << " seconds" << endl; + + // save observable paths in the folder + save_observable_paths(obs_paths, output_file); } /** @@ -191,14 +191,15 @@ void find_observable_transitions(net& model, map<int, int>& obs_trans, void compute_abstract_paths(const string& net_file, int bound, const string& transitions_file, const string& output_folder) { + MDGraph g; + paths_t obs_paths; + paths_t abstract_paths; + set<int> unobs_trans; + map<int, int> obs_trans; net model = load_net(net_file); double d = getTime(); - // find observable transitions - set<int> unobs_trans; - map<int, int> obs_trans; - // if a path with transitions is not given, then we apply the algorithm to // find the needed observable transitions to cover all the behaviors if (transitions_file == "") { @@ -209,26 +210,24 @@ void compute_abstract_paths(const string& net_file, int bound, // build the SOG cout << "Building SOG ..."; - MDGraph g; RdPBDD SOG(model, obs_trans, unobs_trans, bound); cout << " done" << endl; // compute the observable paths - paths_t obs_paths = SOG.chem_obs(g, obs_trans); + obs_paths = SOG.chem_obs(g, obs_trans); // add abstract paths - paths_t abstract_paths; for (auto path : obs_paths) { abstract_paths.insert(SOG.chem_abs(path, g)); } // time for generating the paths - float tps = getTime() - d; + float elapsed_time = getTime() - d; // print output string model_name = get_model_name(net_file); string output_file = output_folder + "/no_optimal_" + model_name + ".txt"; - print_output(model, g, obs_trans, obs_paths, abstract_paths, tps, + print_output(model, g, obs_trans, obs_paths, abstract_paths, elapsed_time, output_file); }