Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
NondeterministicModelBisimulationDecompositionTest.cpp
Go to the documentation of this file.
1#include "storm-config.h"
2#include "test/storm_gtest.h"
3
10
11TEST(NondeterministicModelBisimulationDecomposition, TwoDice) {
12#ifndef STORM_HAVE_Z3
13 GTEST_SKIP() << "Z3 not available.";
14#endif
15 storm::prism::Program program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/two_dice.nm");
16
17 // Build the die model without its reward model.
18 std::shared_ptr<storm::models::sparse::Model<double>> model =
20
21 ASSERT_EQ(model->getType(), storm::models::ModelType::Mdp);
22 std::shared_ptr<storm::models::sparse::Mdp<double>> mdp = model->as<storm::models::sparse::Mdp<double>>();
23
25 ASSERT_NO_THROW(bisim.computeBisimulationDecomposition());
26 std::shared_ptr<storm::models::sparse::Model<double>> result;
27 ASSERT_NO_THROW(result = bisim.getQuotient());
28
29 EXPECT_EQ(storm::models::ModelType::Mdp, result->getType());
30 EXPECT_EQ(77ul, result->getNumberOfStates());
31 EXPECT_EQ(183ul, result->getNumberOfTransitions());
32 EXPECT_EQ(97ul, result->as<storm::models::sparse::Mdp<double>>()->getNumberOfChoices());
33
35 options.respectedAtomicPropositions = std::set<std::string>({"two"});
36
38 ASSERT_NO_THROW(bisim2.computeBisimulationDecomposition());
39 ASSERT_NO_THROW(result = bisim2.getQuotient());
40
41 EXPECT_EQ(storm::models::ModelType::Mdp, result->getType());
42 EXPECT_EQ(11ul, result->getNumberOfStates());
43 EXPECT_EQ(26ul, result->getNumberOfTransitions());
44 EXPECT_EQ(14ul, result->as<storm::models::sparse::Mdp<double>>()->getNumberOfChoices());
45
46 // A parser that we use for conveniently constructing the formulas.
47 storm::parser::FormulaParser formulaParser;
48 std::shared_ptr<storm::logic::Formula const> formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F \"two\"]");
49
51
53 ASSERT_NO_THROW(bisim3.computeBisimulationDecomposition());
54 ASSERT_NO_THROW(result = bisim3.getQuotient());
55
56 EXPECT_EQ(storm::models::ModelType::Mdp, result->getType());
57 EXPECT_EQ(11ul, result->getNumberOfStates());
58 EXPECT_EQ(26ul, result->getNumberOfTransitions());
59 EXPECT_EQ(14ul, result->as<storm::models::sparse::Mdp<double>>()->getNumberOfChoices());
60}
TEST(NondeterministicModelBisimulationDecomposition, TwoDice)
std::shared_ptr< storm::models::sparse::Model< ValueType, RewardModelType > > build()
Convert the program given at construction time to an abstract model.
This class represents a (discrete-time) Markov decision process.
Definition Mdp.h:13
uint_fast64_t getNumberOfChoices(uint_fast64_t state) const
std::shared_ptr< storm::logic::Formula const > parseSingleFormulaFromString(std::string const &formulaString) const
Parses the formula given by the provided string.
static storm::prism::Program parse(std::string const &filename, bool prismCompatability=false)
Parses the given file into the PRISM storage classes assuming it complies with the PRISM syntax.
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 nondeterministic model into its bisimulation quotient.