Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
DeterministicModelBisimulationDecompositionTest.cpp
Go to the documentation of this file.
1#include "storm-config.h"
2#include "test/storm_gtest.h"
3
9
10TEST(DeterministicModelBisimulationDecomposition, Die) {
11 std::shared_ptr<storm::models::sparse::Model<double>> abstractModel =
12 storm::parser::AutoParser<>::parseModel(STORM_TEST_RESOURCES_DIR "/tra/die.tra", STORM_TEST_RESOURCES_DIR "/lab/die.lab", "", "");
13
14 ASSERT_EQ(abstractModel->getType(), storm::models::ModelType::Dtmc);
15 std::shared_ptr<storm::models::sparse::Dtmc<double>> dtmc = abstractModel->as<storm::models::sparse::Dtmc<double>>();
16
18 ASSERT_NO_THROW(bisim.computeBisimulationDecomposition());
19 std::shared_ptr<storm::models::sparse::Model<double>> result;
20 ASSERT_NO_THROW(result = bisim.getQuotient());
21
22 EXPECT_EQ(storm::models::ModelType::Dtmc, result->getType());
23 EXPECT_EQ(13ul, result->getNumberOfStates());
24 EXPECT_EQ(20ul, result->getNumberOfTransitions());
25
27 options.respectedAtomicPropositions = std::set<std::string>({"one"});
28
30 ASSERT_NO_THROW(bisim2.computeBisimulationDecomposition());
31 ASSERT_NO_THROW(result = bisim2.getQuotient());
32
33 EXPECT_EQ(storm::models::ModelType::Dtmc, result->getType());
34 EXPECT_EQ(5ul, result->getNumberOfStates());
35 EXPECT_EQ(8ul, result->getNumberOfTransitions());
36
38
40 ASSERT_NO_THROW(bisim3.computeBisimulationDecomposition());
41 ASSERT_NO_THROW(result = bisim3.getQuotient());
42
43 EXPECT_EQ(storm::models::ModelType::Dtmc, result->getType());
44 EXPECT_EQ(5ul, result->getNumberOfStates());
45 EXPECT_EQ(8ul, result->getNumberOfTransitions());
46
47 storm::parser::FormulaParser formulaParser;
48 std::shared_ptr<storm::logic::Formula const> formula = formulaParser.parseSingleFormulaFromString("P=? [F \"one\"]");
49
51
53 ASSERT_NO_THROW(bisim4.computeBisimulationDecomposition());
54 ASSERT_NO_THROW(result = bisim4.getQuotient());
55 EXPECT_EQ(storm::models::ModelType::Dtmc, result->getType());
56 EXPECT_EQ(5ul, result->getNumberOfStates());
57 EXPECT_EQ(8ul, result->getNumberOfTransitions());
58}
59
60TEST(DeterministicModelBisimulationDecomposition, Crowds) {
61 std::shared_ptr<storm::models::sparse::Model<double>> abstractModel =
62 storm::parser::AutoParser<>::parseModel(STORM_TEST_RESOURCES_DIR "/tra/crowds5_5.tra", STORM_TEST_RESOURCES_DIR "/lab/crowds5_5.lab", "", "");
63
64 ASSERT_EQ(abstractModel->getType(), storm::models::ModelType::Dtmc);
65 std::shared_ptr<storm::models::sparse::Dtmc<double>> dtmc = abstractModel->as<storm::models::sparse::Dtmc<double>>();
66
68 std::shared_ptr<storm::models::sparse::Model<double>> result;
69 ASSERT_NO_THROW(bisim.computeBisimulationDecomposition());
70 ASSERT_NO_THROW(result = bisim.getQuotient());
71
72 EXPECT_EQ(storm::models::ModelType::Dtmc, result->getType());
73 EXPECT_EQ(334ul, result->getNumberOfStates());
74 EXPECT_EQ(546ul, result->getNumberOfTransitions());
75
77 options.respectedAtomicPropositions = std::set<std::string>({"observe0Greater1"});
78
80 ASSERT_NO_THROW(bisim2.computeBisimulationDecomposition());
81 ASSERT_NO_THROW(result = bisim2.getQuotient());
82
83 EXPECT_EQ(storm::models::ModelType::Dtmc, result->getType());
84 EXPECT_EQ(65ul, result->getNumberOfStates());
85 EXPECT_EQ(105ul, result->getNumberOfTransitions());
86
88
90 ASSERT_NO_THROW(bisim3.computeBisimulationDecomposition());
91 ASSERT_NO_THROW(result = bisim3.getQuotient());
92
93 EXPECT_EQ(storm::models::ModelType::Dtmc, result->getType());
94 EXPECT_EQ(43ul, result->getNumberOfStates());
95 EXPECT_EQ(83ul, result->getNumberOfTransitions());
96
97 storm::parser::FormulaParser formulaParser;
98 std::shared_ptr<storm::logic::Formula const> formula = formulaParser.parseSingleFormulaFromString("P=? [F \"observe0Greater1\"]");
99
101
103 ASSERT_NO_THROW(bisim5.computeBisimulationDecomposition());
104 ASSERT_NO_THROW(result = bisim5.getQuotient());
105
106 EXPECT_EQ(storm::models::ModelType::Dtmc, result->getType());
107 EXPECT_EQ(64ul, result->getNumberOfStates());
108 EXPECT_EQ(104ul, result->getNumberOfTransitions());
109
110 formula = formulaParser.parseSingleFormulaFromString("P=? [true U<=50 \"observe0Greater1\"] ");
111
113
115 ASSERT_NO_THROW(bisim6.computeBisimulationDecomposition());
116 ASSERT_NO_THROW(result = bisim6.getQuotient());
117
118 EXPECT_EQ(storm::models::ModelType::Dtmc, result->getType());
119 EXPECT_EQ(65ul, result->getNumberOfStates());
120 EXPECT_EQ(105ul, result->getNumberOfTransitions());
121}
TEST(DeterministicModelBisimulationDecomposition, Die)
This class represents a discrete-time Markov chain.
Definition Dtmc.h:13
static std::shared_ptr< storm::models::sparse::Model< ValueType, storm::models::sparse::StandardRewardModel< RewardValueType > > > parseModel(std::string const &transitionsFilename, std::string const &labelingFilename, std::string const &stateRewardFilename="", std::string const &transitionRewardFilename="", std::string const &choiceLabelingFilename="")
Checks the given files and parses the model within these files.
std::shared_ptr< storm::logic::Formula const > parseSingleFormulaFromString(std::string const &formulaString) const
Parses the formula given by the provided string.
std::shared_ptr< ModelType > getQuotient() const
Retrieves the quotient of the model under the computed bisimulation.
void computeBisimulationDecomposition()
Computes the decomposition of the model into bisimulation equivalence classes.
This class represents the decomposition of a deterministic model into its bisimulation quotient.