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.

62 lines
3.3 KiB

  1. #include "gtest/gtest.h"
  2. #include "storm-config.h"
  3. #include "src/parser/AutoParser.h"
  4. #include "storage/DeterministicModelBisimulationDecomposition.h"
  5. TEST(DeterministicModelBisimulationDecomposition, Die) {
  6. std::shared_ptr<storm::models::AbstractModel<double>> abstractModel = storm::parser::AutoParser::parseModel(STORM_CPP_BASE_PATH "/examples/dtmc/die/die.tra", STORM_CPP_BASE_PATH "/examples/dtmc/die/die.lab", "", "");
  7. ASSERT_EQ(abstractModel->getType(), storm::models::DTMC);
  8. std::shared_ptr<storm::models::Dtmc<double>> dtmc = abstractModel->as<storm::models::Dtmc<double>>();
  9. storm::storage::DeterministicModelBisimulationDecomposition<double> bisim(*dtmc, boost::optional<std::set<std::string>>(), true, false, true);
  10. std::shared_ptr<storm::models::AbstractModel<double>> result;
  11. ASSERT_NO_THROW(result = bisim.getQuotient());
  12. EXPECT_EQ(storm::models::DTMC, result->getType());
  13. EXPECT_EQ(13, result->getNumberOfStates());
  14. EXPECT_EQ(20, result->getNumberOfTransitions());
  15. storm::storage::DeterministicModelBisimulationDecomposition<double> bisim2(*dtmc, std::set<std::string>({"one"}), true, false, true);
  16. ASSERT_NO_THROW(result = bisim2.getQuotient());
  17. EXPECT_EQ(storm::models::DTMC, result->getType());
  18. EXPECT_EQ(5, result->getNumberOfStates());
  19. EXPECT_EQ(8, result->getNumberOfTransitions());
  20. storm::storage::DeterministicModelBisimulationDecomposition<double> bisim3(*dtmc, std::set<std::string>({"one"}), true, true, true);
  21. ASSERT_NO_THROW(result = bisim3.getQuotient());
  22. EXPECT_EQ(storm::models::DTMC, result->getType());
  23. EXPECT_EQ(5, result->getNumberOfStates());
  24. EXPECT_EQ(8, result->getNumberOfTransitions());
  25. }
  26. TEST(DeterministicModelBisimulationDecomposition, Crowds) {
  27. std::shared_ptr<storm::models::AbstractModel<double>> abstractModel = storm::parser::AutoParser::parseModel(STORM_CPP_BASE_PATH "/examples/dtmc/crowds/crowds5_5.tra", STORM_CPP_BASE_PATH "/examples/dtmc/crowds/crowds5_5.lab", "", "");
  28. ASSERT_EQ(abstractModel->getType(), storm::models::DTMC);
  29. std::shared_ptr<storm::models::Dtmc<double>> dtmc = abstractModel->as<storm::models::Dtmc<double>>();
  30. storm::storage::DeterministicModelBisimulationDecomposition<double> bisim(*dtmc, boost::optional<std::set<std::string>>(), true, false, true);
  31. std::shared_ptr<storm::models::AbstractModel<double>> result;
  32. ASSERT_NO_THROW(result = bisim.getQuotient());
  33. EXPECT_EQ(storm::models::DTMC, result->getType());
  34. EXPECT_EQ(334, result->getNumberOfStates());
  35. EXPECT_EQ(546, result->getNumberOfTransitions());
  36. storm::storage::DeterministicModelBisimulationDecomposition<double> bisim2(*dtmc, std::set<std::string>({"observe0Greater1"}), true, false, true);
  37. ASSERT_NO_THROW(result = bisim2.getQuotient());
  38. EXPECT_EQ(storm::models::DTMC, result->getType());
  39. EXPECT_EQ(65, result->getNumberOfStates());
  40. EXPECT_EQ(105, result->getNumberOfTransitions());
  41. storm::storage::DeterministicModelBisimulationDecomposition<double> bisim3(*dtmc, std::set<std::string>({"observe0Greater1"}), true, true, true);
  42. ASSERT_NO_THROW(result = bisim3.getQuotient());
  43. EXPECT_EQ(storm::models::DTMC, result->getType());
  44. EXPECT_EQ(43, result->getNumberOfStates());
  45. EXPECT_EQ(83, result->getNumberOfTransitions());
  46. }