You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.9 KiB

  1. #include <iostream>
  2. #include <src/builder/ExplicitGspnModelBuilder.h>
  3. #include "src/exceptions/BaseException.h"
  4. #include "src/parser/GspnParser.h"
  5. #include "src/storage/gspn/GSPN.h"
  6. #include "src/utility/macros.h"
  7. #include "src/utility/initialize.h"
  8. #include <fstream>
  9. int main(const int argc, const char** argv) {
  10. if (argc != 3) {
  11. std::cout << "Error: incorrect number of parameters!" << std::endl << std::endl;
  12. std::cout << "Usage:" << std::endl;
  13. std::cout << "storm-gspn <path to pnml file> <formular>" << std::endl;
  14. return 1;
  15. }
  16. try {
  17. storm::utility::setUp();
  18. // Parse GSPN from xml
  19. auto parser = storm::parser::GspnParser();
  20. auto gspn = parser.parse(argv[1]);
  21. //
  22. //std::ofstream file;
  23. //file.open("/Users/thomas/Desktop/storm.dot");
  24. //gspn.writeDotToStream(file);
  25. //file.close();
  26. std::cout << "Parsing complete!" << std::endl;
  27. // Construct MA
  28. auto builder = storm::builder::ExplicitGspnModelBuilder<>();
  29. auto ma = builder.translateGspn(gspn, argv[2]);
  30. std::cout << "Markov Automaton: " << std::endl;
  31. std::cout << "number of states: " << ma.getNumberOfStates() << std::endl;
  32. std::cout << "number of transitions: " << ma.getNumberOfTransitions() << std::endl << std::endl;
  33. // All operations have now been performed, so we clean up everything and terminate.
  34. storm::utility::cleanUp();
  35. return 0;
  36. } catch (storm::exceptions::BaseException const& exception) {
  37. STORM_LOG_ERROR("An exception caused StoRM to terminate. The message of the exception is: " << exception.what());
  38. } catch (std::exception const& exception) {
  39. STORM_LOG_ERROR("An unexpected exception occurred and caused StoRM to terminate. The message of this exception is: " << exception.what());
  40. }
  41. }