Storm
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
6
8
12
13TEST(NondeterministicModelBisimulationDecomposition, TwoDice) {
14#ifndef STORM_HAVE_Z3
15 GTEST_SKIP() << "Z3 not available.";
16#endif
17 storm::prism::Program program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/two_dice.nm");
18
19 // Build the die model without its reward model.
20 std::shared_ptr<storm::models::sparse::Model<double>> model =
22
23 ASSERT_EQ(model->getType(), storm::models::ModelType::Mdp);
24 std::shared_ptr<storm::models::sparse::Mdp<double>> mdp = model->as<storm::models::sparse::Mdp<double>>();
25
27 ASSERT_NO_THROW(bisim.computeBisimulationDecomposition());
28 std::shared_ptr<storm::models::sparse::Model<double>> result;
29 ASSERT_NO_THROW(result = bisim.getQuotient());
30
31 EXPECT_EQ(storm::models::ModelType::Mdp, result->getType());
32 EXPECT_EQ(77ul, result->getNumberOfStates());
33 EXPECT_EQ(183ul, result->getNumberOfTransitions());
34 EXPECT_EQ(97ul, result->as<storm::models::sparse::Mdp<double>>()->getNumberOfChoices());
35
37 options.respectedAtomicPropositions = std::set<std::string>({"two"});
38
40 ASSERT_NO_THROW(bisim2.computeBisimulationDecomposition());
41 ASSERT_NO_THROW(result = bisim2.getQuotient());
42
43 EXPECT_EQ(storm::models::ModelType::Mdp, result->getType());
44 EXPECT_EQ(11ul, result->getNumberOfStates());
45 EXPECT_EQ(26ul, result->getNumberOfTransitions());
46 EXPECT_EQ(14ul, result->as<storm::models::sparse::Mdp<double>>()->getNumberOfChoices());
47
48 // A parser that we use for conveniently constructing the formulas.
49 storm::parser::FormulaParser formulaParser;
50 std::shared_ptr<storm::logic::Formula const> formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F \"two\"]");
51
53
55 ASSERT_NO_THROW(bisim3.computeBisimulationDecomposition());
56 ASSERT_NO_THROW(result = bisim3.getQuotient());
57
58 EXPECT_EQ(storm::models::ModelType::Mdp, result->getType());
59 EXPECT_EQ(11ul, result->getNumberOfStates());
60 EXPECT_EQ(26ul, result->getNumberOfTransitions());
61 EXPECT_EQ(14ul, result->as<storm::models::sparse::Mdp<double>>()->getNumberOfChoices());
62}
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:14
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.