5 changed files with 543 additions and 259 deletions
-
155resources/examples/testfiles/ma/chain_elimination1.drn
-
34resources/examples/testfiles/ma/chain_elimination2.drn
-
357src/storm/transformer/NonMarkovianChainTransformer.cpp
-
7src/storm/transformer/NonMarkovianChainTransformer.h
-
249src/test/storm/transformer/NonMarkovianChainTransformerTest.cpp
@ -0,0 +1,155 @@ |
|||||
|
// Exported by storm |
||||
|
// Original model type: Markov Automaton |
||||
|
@type: Markov Automaton |
||||
|
@parameters |
||||
|
|
||||
|
@reward_models |
||||
|
|
||||
|
@nr_states |
||||
|
43 |
||||
|
@model |
||||
|
state 0 !0 init |
||||
|
action 0 |
||||
|
1 : 1 |
||||
|
state 1 !0.0003 |
||||
|
action 0 |
||||
|
2 : 0.3333333333 |
||||
|
3 : 0.3333333333 |
||||
|
4 : 0.3333333333 |
||||
|
state 2 !0 |
||||
|
action 0 |
||||
|
5 : 1 |
||||
|
state 3 !0 |
||||
|
action 0 |
||||
|
6 : 1 |
||||
|
state 4 !0 |
||||
|
action 0 |
||||
|
7 : 1 |
||||
|
state 5 !0 |
||||
|
action 0 |
||||
|
8 : 1 |
||||
|
state 6 !0 |
||||
|
action 0 |
||||
|
9 : 1 |
||||
|
state 7 !0 |
||||
|
action 0 |
||||
|
10 : 1 |
||||
|
state 8 !0 |
||||
|
action 0 |
||||
|
12 : 1 |
||||
|
state 9 !0 |
||||
|
action 0 |
||||
|
14 : 1 |
||||
|
state 10 !0.1002 Fail |
||||
|
action 0 |
||||
|
11 : 0.000998003992 |
||||
|
13 : 0.000998003992 |
||||
|
15 : 0.998003992 |
||||
|
state 11 !0 Fail |
||||
|
action 0 |
||||
|
18 : 1 |
||||
|
state 12 !0.1002 Fail |
||||
|
action 0 |
||||
|
16 : 0.000998003992 |
||||
|
19 : 0.000998003992 |
||||
|
20 : 0.998003992 |
||||
|
state 13 !0 Fail |
||||
|
action 0 |
||||
|
21 : 1 |
||||
|
state 14 !0.1002 Fail |
||||
|
action 0 |
||||
|
17 : 0.000998003992 |
||||
|
22 : 0.000998003992 |
||||
|
23 : 0.998003992 |
||||
|
state 15 !0 Fail |
||||
|
action 0 |
||||
|
24 : 1 |
||||
|
state 16 !0 Fail |
||||
|
action 0 |
||||
|
25 : 1 |
||||
|
state 17 !0 Fail |
||||
|
action 0 |
||||
|
25 : 1 |
||||
|
state 18 !0 Fail |
||||
|
action 0 |
||||
|
26 : 1 |
||||
|
state 19 !0 Fail |
||||
|
action 0 |
||||
|
26 : 1 |
||||
|
state 20 !0 Fail |
||||
|
action 0 |
||||
|
27 : 1 |
||||
|
state 21 !0 Fail |
||||
|
action 0 |
||||
|
28 : 1 |
||||
|
state 22 !0 Fail |
||||
|
action 0 |
||||
|
28 : 1 |
||||
|
state 23 !0 Fail |
||||
|
action 0 |
||||
|
27 : 1 |
||||
|
state 24 !0 Fail |
||||
|
action 0 |
||||
|
1 : 1 |
||||
|
state 25 !0.2001 Fail |
||||
|
action 0 |
||||
|
31 : 0.0004997501249 |
||||
|
32 : 0.4997501249 |
||||
|
33 : 0.4997501249 |
||||
|
state 26 !0.2001 Fail |
||||
|
action 0 |
||||
|
29 : 0.0004997501249 |
||||
|
34 : 0.4997501249 |
||||
|
35 : 0.4997501249 |
||||
|
state 27 !0 Fail |
||||
|
action 0 |
||||
|
24 : 1 |
||||
|
state 28 !0.2001 Fail |
||||
|
action 0 |
||||
|
30 : 0.0004997501249 |
||||
|
36 : 0.4997501249 |
||||
|
37 : 0.4997501249 |
||||
|
state 29 !0 Fail |
||||
|
action 0 |
||||
|
38 : 1 |
||||
|
state 30 !0 Fail |
||||
|
action 0 |
||||
|
38 : 1 |
||||
|
state 31 !0 Fail |
||||
|
action 0 |
||||
|
38 : 1 |
||||
|
state 32 !0 Fail |
||||
|
action 0 |
||||
|
14 : 1 |
||||
|
state 33 !0 Fail |
||||
|
action 0 |
||||
|
12 : 1 |
||||
|
state 34 !0 Fail |
||||
|
action 0 |
||||
|
12 : 1 |
||||
|
state 35 !0 Fail |
||||
|
action 0 |
||||
|
39 : 1 |
||||
|
state 36 !0 Fail |
||||
|
action 0 |
||||
|
14 : 1 |
||||
|
state 37 !0 Fail |
||||
|
action 0 |
||||
|
39 : 1 |
||||
|
state 38 !0.3 Fail |
||||
|
action 0 |
||||
|
40 : 0.3333333333 |
||||
|
41 : 0.3333333333 |
||||
|
42 : 0.3333333333 |
||||
|
state 39 !0 Fail |
||||
|
action 0 |
||||
|
10 : 1 |
||||
|
state 40 !0 Fail |
||||
|
action 0 |
||||
|
25 : 1 |
||||
|
state 41 !0 Fail |
||||
|
action 0 |
||||
|
28 : 1 |
||||
|
state 42 !0 Fail |
||||
|
action 0 |
||||
|
26 : 1 |
@ -0,0 +1,34 @@ |
|||||
|
// Exported by storm |
||||
|
// Original model type: Markov Automaton |
||||
|
@type: Markov Automaton |
||||
|
@parameters |
||||
|
|
||||
|
@reward_models |
||||
|
|
||||
|
@nr_states |
||||
|
10 |
||||
|
@model |
||||
|
state 0 !0.1 init |
||||
|
1 : 1 |
||||
|
state 1 !0 |
||||
|
2 : 1 |
||||
|
state 2 !0 |
||||
|
3 : 1 |
||||
|
state 3 !0 |
||||
|
4 : 0.1 |
||||
|
5 : 0.9 |
||||
|
state 4 !0.2 Fail |
||||
|
5 : 0.5 |
||||
|
6 : 0.5 |
||||
|
state 5 !0.1 |
||||
|
0 : 1 |
||||
|
state 6 !0.2 |
||||
|
0 : 0.5 |
||||
|
7 : 0.5 |
||||
|
state 7 !0.2 Fail |
||||
|
6 : 0.5 |
||||
|
8 : 0.5 |
||||
|
state 8 !0 Fail |
||||
|
9 : 1 |
||||
|
state 9 !0 Fail |
||||
|
3 : 1 |
@ -0,0 +1,249 @@ |
|||||
|
#include "test/storm_gtest.h"
|
||||
|
#include "storm-config.h"
|
||||
|
#include "storm/api/storm.h"
|
||||
|
#include "storm/modelchecker/results/ExplicitQuantitativeCheckResult.h"
|
||||
|
#include "storm-parsers/api/storm-parsers.h"
|
||||
|
#include "storm-parsers/parser/PrismParser.h"
|
||||
|
#include "storm/storage/jani/Property.h"
|
||||
|
|
||||
|
|
||||
|
TEST(NonMarkovianChainTransformerTest, StreamExampleTest) { |
||||
|
storm::prism::Program program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/ma/stream2.ma"); |
||||
|
std::string formulasString = "Pmin=? [ F \"done\"];Pmin=? [ F<=1 \"done\"];Tmin=? [ F \"done\" ]"; |
||||
|
auto formulas = storm::api::extractFormulasFromProperties(storm::api::parsePropertiesForPrismProgram(formulasString, program)); |
||||
|
auto model = storm::api::buildSparseModel<double>(program, formulas)->template as<storm::models::sparse::MarkovAutomaton<double>>(); |
||||
|
|
||||
|
EXPECT_EQ(12ul, model->getNumberOfStates()); |
||||
|
EXPECT_EQ(14ul, model->getNumberOfTransitions()); |
||||
|
ASSERT_TRUE(model->isOfType(storm::models::ModelType::MarkovAutomaton)); |
||||
|
size_t initState = 0; |
||||
|
|
||||
|
auto labeling = model->getStateLabeling(); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("init", initState)); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("done", 10)); |
||||
|
|
||||
|
auto result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(formulas[0], true)); |
||||
|
EXPECT_EQ(1, result->asExplicitQuantitativeCheckResult<double>()[initState]); |
||||
|
result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(formulas[1], true)); |
||||
|
EXPECT_NEAR(0.6487584849, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6); |
||||
|
result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(formulas[2], true)); |
||||
|
EXPECT_NEAR(0.7888888889, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6); |
||||
|
|
||||
|
|
||||
|
// Keep labels
|
||||
|
auto transformed = storm::api::eliminateNonMarkovianChains(model, formulas, storm::transformer::EliminationLabelBehavior::KeepLabels); |
||||
|
ASSERT_EQ(9ul, transformed.first->getNumberOfStates()); |
||||
|
ASSERT_EQ(11ul, transformed.first->getNumberOfTransitions()); |
||||
|
labeling = transformed.first->getStateLabeling(); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("init", initState)); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("done", 8)); |
||||
|
EXPECT_EQ(2ul, transformed.second.size()); |
||||
|
|
||||
|
result = storm::api::verifyWithSparseEngine(transformed.first, storm::api::createTask<double>(transformed.second[0], true)); |
||||
|
EXPECT_EQ(1, result->asExplicitQuantitativeCheckResult<double>()[initState]); |
||||
|
result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[1], true)); |
||||
|
EXPECT_NEAR(0.6487584849, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6); |
||||
|
//result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[2], true));
|
||||
|
//EXPECT_NEAR(0.7888888889, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6);
|
||||
|
|
||||
|
|
||||
|
// Merge labels
|
||||
|
transformed = storm::api::eliminateNonMarkovianChains(model, formulas, storm::transformer::EliminationLabelBehavior::MergeLabels); |
||||
|
ASSERT_EQ(8ul, transformed.first->getNumberOfStates()); |
||||
|
ASSERT_EQ(10ul, transformed.first->getNumberOfTransitions()); |
||||
|
labeling = transformed.first->getStateLabeling(); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("init", initState)); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("done", 7)); |
||||
|
EXPECT_EQ(2ul, transformed.second.size()); |
||||
|
|
||||
|
result = storm::api::verifyWithSparseEngine(transformed.first, storm::api::createTask<double>(transformed.second[0], true)); |
||||
|
EXPECT_EQ(1, result->asExplicitQuantitativeCheckResult<double>()[initState]); |
||||
|
result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[1], true)); |
||||
|
EXPECT_NEAR(0.6487584849, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6); |
||||
|
//result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[2], true));
|
||||
|
//EXPECT_NEAR(0.7888888889, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6);
|
||||
|
|
||||
|
|
||||
|
// Delete labels
|
||||
|
transformed = storm::api::eliminateNonMarkovianChains(model, formulas, storm::transformer::EliminationLabelBehavior::DeleteLabels); |
||||
|
ASSERT_EQ(8ul, transformed.first->getNumberOfStates()); |
||||
|
ASSERT_EQ(10ul, transformed.first->getNumberOfTransitions()); |
||||
|
labeling = transformed.first->getStateLabeling(); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("init", initState)); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("done", 7)); |
||||
|
EXPECT_EQ(2ul, transformed.second.size()); |
||||
|
|
||||
|
result = storm::api::verifyWithSparseEngine(transformed.first, storm::api::createTask<double>(transformed.second[0], true)); |
||||
|
EXPECT_EQ(1, result->asExplicitQuantitativeCheckResult<double>()[initState]); |
||||
|
result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[1], true)); |
||||
|
EXPECT_NEAR(0.6487584849, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6); |
||||
|
//result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[2], true));
|
||||
|
//EXPECT_NEAR(0.7888888889, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6);
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
TEST(NonMarkovianChainTransformerTest, ChainElimination1ExampleTest) { |
||||
|
auto model = storm::parser::DirectEncodingParser<double>::parseModel(STORM_TEST_RESOURCES_DIR "/ma/chain_elimination1.drn")->template as<storm::models::sparse::MarkovAutomaton<double>>(); |
||||
|
std::string formulasString = "Pmin=? [ F \"Fail\"];Pmin=? [ F<=300 \"Fail\"];Tmin=? [ F \"Fail\" ]"; |
||||
|
auto formulas = storm::api::extractFormulasFromProperties(storm::api::parseProperties(formulasString)); |
||||
|
|
||||
|
EXPECT_EQ(43ul, model->getNumberOfStates()); |
||||
|
EXPECT_EQ(59ul, model->getNumberOfTransitions()); |
||||
|
ASSERT_TRUE(model->isOfType(storm::models::ModelType::MarkovAutomaton)); |
||||
|
size_t initState = 0; |
||||
|
|
||||
|
auto labeling = model->getStateLabeling(); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("init", initState)); |
||||
|
for (size_t i = 10; i < 43; ++i) { |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("Fail", i)); |
||||
|
} |
||||
|
|
||||
|
auto result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(formulas[0], true)); |
||||
|
EXPECT_EQ(1, result->asExplicitQuantitativeCheckResult<double>()[initState]); |
||||
|
result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(formulas[1], true)); |
||||
|
EXPECT_NEAR(0.08606881472, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6); |
||||
|
result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(formulas[2], true)); |
||||
|
EXPECT_NEAR(3333.333333, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6); |
||||
|
|
||||
|
|
||||
|
// Keep labels
|
||||
|
auto transformed = storm::api::eliminateNonMarkovianChains(model, formulas, storm::transformer::EliminationLabelBehavior::KeepLabels); |
||||
|
ASSERT_EQ(13ul, transformed.first->getNumberOfStates()); |
||||
|
ASSERT_EQ(29ul, transformed.first->getNumberOfTransitions()); |
||||
|
labeling = transformed.first->getStateLabeling(); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("init", initState)); |
||||
|
for (size_t i = 5; i < 13; ++i) { |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("Fail", i)); |
||||
|
} |
||||
|
EXPECT_EQ(2ul, transformed.second.size()); |
||||
|
|
||||
|
result = storm::api::verifyWithSparseEngine(transformed.first, storm::api::createTask<double>(transformed.second[0], true)); |
||||
|
EXPECT_EQ(1, result->asExplicitQuantitativeCheckResult<double>()[initState]); |
||||
|
result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[1], true)); |
||||
|
EXPECT_NEAR(0.08606881472, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6); |
||||
|
//result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[2], true));
|
||||
|
//EXPECT_NEAR(3333.333333, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6);
|
||||
|
|
||||
|
|
||||
|
// Merge labels
|
||||
|
transformed = storm::api::eliminateNonMarkovianChains(model, formulas, storm::transformer::EliminationLabelBehavior::MergeLabels); |
||||
|
ASSERT_EQ(8ul, transformed.first->getNumberOfStates()); |
||||
|
ASSERT_EQ(24ul, transformed.first->getNumberOfTransitions()); |
||||
|
labeling = transformed.first->getStateLabeling(); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("init", initState)); |
||||
|
for (size_t i = 0; i < 8; ++i) { |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("Fail", i)); |
||||
|
} |
||||
|
EXPECT_EQ(2ul, transformed.second.size()); |
||||
|
|
||||
|
result = storm::api::verifyWithSparseEngine(transformed.first, storm::api::createTask<double>(transformed.second[0], true)); |
||||
|
EXPECT_EQ(1, result->asExplicitQuantitativeCheckResult<double>()[initState]); |
||||
|
result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[1], true)); |
||||
|
EXPECT_NEAR(0.08606881472, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6); |
||||
|
//result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[2], true));
|
||||
|
//EXPECT_NEAR(3333.333333, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6);
|
||||
|
|
||||
|
|
||||
|
// Delete labels
|
||||
|
transformed = storm::api::eliminateNonMarkovianChains(model, formulas, storm::transformer::EliminationLabelBehavior::DeleteLabels); |
||||
|
ASSERT_EQ(8ul, transformed.first->getNumberOfStates()); |
||||
|
ASSERT_EQ(24ul, transformed.first->getNumberOfTransitions()); |
||||
|
labeling = transformed.first->getStateLabeling(); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("init", initState)); |
||||
|
ASSERT_FALSE(labeling.getStateHasLabel("Fail", 0)); |
||||
|
for (size_t i = 1; i < 8; ++i) { |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("Fail", i)); |
||||
|
} |
||||
|
EXPECT_EQ(2ul, transformed.second.size()); |
||||
|
|
||||
|
result = storm::api::verifyWithSparseEngine(transformed.first, storm::api::createTask<double>(transformed.second[0], true)); |
||||
|
EXPECT_EQ(1, result->asExplicitQuantitativeCheckResult<double>()[initState]); |
||||
|
result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[1], true)); |
||||
|
EXPECT_NEAR(0.08606881472, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6); |
||||
|
//result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[2], true));
|
||||
|
//EXPECT_NEAR(3333.333333, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6);
|
||||
|
} |
||||
|
|
||||
|
TEST(NonMarkovianChainTransformerTest, ChainElimination2ExampleTest) { |
||||
|
auto model = storm::parser::DirectEncodingParser<double>::parseModel(STORM_TEST_RESOURCES_DIR "/ma/chain_elimination2.drn")->template as<storm::models::sparse::MarkovAutomaton<double>>(); |
||||
|
std::string formulasString = "Pmin=? [ F \"Fail\"];Pmin=? [ F<=300 \"Fail\"];Tmin=? [ F \"Fail\" ]"; |
||||
|
auto formulas = storm::api::extractFormulasFromProperties(storm::api::parseProperties(formulasString)); |
||||
|
|
||||
|
EXPECT_EQ(10ul, model->getNumberOfStates()); |
||||
|
EXPECT_EQ(14ul, model->getNumberOfTransitions()); |
||||
|
ASSERT_TRUE(model->isOfType(storm::models::ModelType::MarkovAutomaton)); |
||||
|
size_t initState = 0; |
||||
|
|
||||
|
auto labeling = model->getStateLabeling(); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("init", initState)); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("Fail", 4)); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("Fail", 7)); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("Fail", 8)); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("Fail", 9)); |
||||
|
|
||||
|
auto result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(formulas[0], true)); |
||||
|
EXPECT_EQ(1, result->asExplicitQuantitativeCheckResult<double>()[initState]); |
||||
|
result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(formulas[1], true)); |
||||
|
EXPECT_NEAR(0.791015319, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6); |
||||
|
result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(formulas[2], true)); |
||||
|
EXPECT_NEAR(190, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6); |
||||
|
|
||||
|
|
||||
|
// Keep labels
|
||||
|
auto transformed = storm::api::eliminateNonMarkovianChains(model, formulas, storm::transformer::EliminationLabelBehavior::KeepLabels); |
||||
|
ASSERT_EQ(7ul, transformed.first->getNumberOfStates()); |
||||
|
ASSERT_EQ(11ul, transformed.first->getNumberOfTransitions()); |
||||
|
labeling = transformed.first->getStateLabeling(); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("init", initState)); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("Fail", 2)); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("Fail", 5)); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("Fail", 6)); |
||||
|
EXPECT_EQ(2ul, transformed.second.size()); |
||||
|
|
||||
|
result = storm::api::verifyWithSparseEngine(transformed.first, storm::api::createTask<double>(transformed.second[0], true)); |
||||
|
EXPECT_EQ(1, result->asExplicitQuantitativeCheckResult<double>()[initState]); |
||||
|
result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[1], true)); |
||||
|
EXPECT_NEAR(0.791015319, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6); |
||||
|
//result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[2], true));
|
||||
|
//EXPECT_NEAR(190, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6);
|
||||
|
|
||||
|
|
||||
|
// Merge labels
|
||||
|
transformed = storm::api::eliminateNonMarkovianChains(model, formulas, storm::transformer::EliminationLabelBehavior::MergeLabels); |
||||
|
ASSERT_EQ(5ul, transformed.first->getNumberOfStates()); |
||||
|
ASSERT_EQ(10ul, transformed.first->getNumberOfTransitions()); |
||||
|
labeling = transformed.first->getStateLabeling(); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("init", initState)); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("Fail", 1)); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("Fail", 2)); |
||||
|
ASSERT_FALSE(labeling.getStateHasLabel("Fail", 3)); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("Fail", 4)); |
||||
|
EXPECT_EQ(2ul, transformed.second.size()); |
||||
|
|
||||
|
result = storm::api::verifyWithSparseEngine(transformed.first, storm::api::createTask<double>(transformed.second[0], true)); |
||||
|
EXPECT_EQ(1, result->asExplicitQuantitativeCheckResult<double>()[initState]); |
||||
|
result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[1], true)); |
||||
|
EXPECT_NEAR(0.791015319, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6); |
||||
|
//result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[2], true));
|
||||
|
//EXPECT_NEAR(190, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6);
|
||||
|
|
||||
|
|
||||
|
// Delete labels
|
||||
|
transformed = storm::api::eliminateNonMarkovianChains(model, formulas, storm::transformer::EliminationLabelBehavior::DeleteLabels); |
||||
|
ASSERT_EQ(5ul, transformed.first->getNumberOfStates()); |
||||
|
ASSERT_EQ(10ul, transformed.first->getNumberOfTransitions()); |
||||
|
labeling = transformed.first->getStateLabeling(); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("init", initState)); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("Fail", 1)); |
||||
|
ASSERT_FALSE(labeling.getStateHasLabel("Fail", 2)); |
||||
|
ASSERT_FALSE(labeling.getStateHasLabel("Fail", 3)); |
||||
|
ASSERT_TRUE(labeling.getStateHasLabel("Fail", 4)); |
||||
|
EXPECT_EQ(2ul, transformed.second.size()); |
||||
|
|
||||
|
result = storm::api::verifyWithSparseEngine(transformed.first, storm::api::createTask<double>(transformed.second[0], true)); |
||||
|
EXPECT_EQ(1, result->asExplicitQuantitativeCheckResult<double>()[initState]); |
||||
|
result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[1], true)); |
||||
|
EXPECT_NEAR(0.791015319, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6); |
||||
|
//result = storm::api::verifyWithSparseEngine(model, storm::api::createTask<double>(transformed.second[2], true));
|
||||
|
//EXPECT_NEAR(190, result->asExplicitQuantitativeCheckResult<double>()[initState], 1e-6);
|
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue