Matthias Volk
5 years ago
6 changed files with 101 additions and 5 deletions
-
14resources/examples/testfiles/ma/zeno.ma
-
2src/storm-cli-utilities/model-handling.h
-
28src/storm/models/sparse/MarkovAutomaton.cpp
-
22src/storm/models/sparse/MarkovAutomaton.h
-
2src/test/storm/CMakeLists.txt
-
38src/test/storm/model/MarkovAutomatonTest.cpp
@ -0,0 +1,14 @@ |
|||||
|
|
||||
|
ma |
||||
|
|
||||
|
module simple |
||||
|
|
||||
|
s : [0..4]; |
||||
|
|
||||
|
[alpha] (s=0) -> 1 : (s' = 1); |
||||
|
[beta] (s=0) -> 0.8 : (s'=0) + 0.2 : (s'=2); |
||||
|
<> (s=1) -> 9 : (s'=0) + 1 : (s'=3); |
||||
|
<> (s=2) -> 12 : (s'=4); |
||||
|
[gamma] (s>2) -> 1 : true; |
||||
|
|
||||
|
endmodule |
@ -0,0 +1,38 @@ |
|||||
|
#include "test/storm_gtest.h"
|
||||
|
#include "storm-config.h"
|
||||
|
#include "storm/models/sparse/StandardRewardModel.h"
|
||||
|
#include "storm/models/sparse/MarkovAutomaton.h"
|
||||
|
#include "storm-parsers/parser/PrismParser.h"
|
||||
|
#include "storm/builder/ExplicitModelBuilder.h"
|
||||
|
|
||||
|
|
||||
|
TEST(MarkovAutomatonTest, ZenoCycleCheck) { |
||||
|
storm::prism::Program program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/ma/simple.ma"); |
||||
|
|
||||
|
std::shared_ptr<storm::models::sparse::Model<double>> model = storm::builder::ExplicitModelBuilder<double>(program).build(); |
||||
|
EXPECT_EQ(5ul, model->getNumberOfStates()); |
||||
|
EXPECT_EQ(8ul, model->getNumberOfTransitions()); |
||||
|
ASSERT_TRUE(model->isOfType(storm::models::ModelType::MarkovAutomaton)); |
||||
|
EXPECT_FALSE(model->as<storm::models::sparse::MarkovAutomaton<double>>()->containsZenoCycle()); |
||||
|
|
||||
|
program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/ma/hybrid_states.ma"); |
||||
|
model = storm::builder::ExplicitModelBuilder<double>(program).build(); |
||||
|
EXPECT_EQ(5ul, model->getNumberOfStates()); |
||||
|
EXPECT_EQ(13ul, model->getNumberOfTransitions()); |
||||
|
ASSERT_TRUE(model->isOfType(storm::models::ModelType::MarkovAutomaton)); |
||||
|
EXPECT_FALSE(model->as<storm::models::sparse::MarkovAutomaton<double>>()->containsZenoCycle()); |
||||
|
|
||||
|
program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/ma/stream2.ma"); |
||||
|
model = storm::builder::ExplicitModelBuilder<double>(program).build(); |
||||
|
EXPECT_EQ(12ul, model->getNumberOfStates()); |
||||
|
EXPECT_EQ(14ul, model->getNumberOfTransitions()); |
||||
|
ASSERT_TRUE(model->isOfType(storm::models::ModelType::MarkovAutomaton)); |
||||
|
EXPECT_FALSE(model->as<storm::models::sparse::MarkovAutomaton<double>>()->containsZenoCycle()); |
||||
|
|
||||
|
program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/ma/zeno.ma"); |
||||
|
model = storm::builder::ExplicitModelBuilder<double>(program).build(); |
||||
|
EXPECT_EQ(5ul, model->getNumberOfStates()); |
||||
|
EXPECT_EQ(8ul, model->getNumberOfTransitions()); |
||||
|
ASSERT_TRUE(model->isOfType(storm::models::ModelType::MarkovAutomaton)); |
||||
|
EXPECT_TRUE(model->as<storm::models::sparse::MarkovAutomaton<double>>()->containsZenoCycle()); |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue