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