Browse Source

DTMC HOA tests

tempestpy_adaptions
hannah 3 years ago
committed by Stefan Pranger
parent
commit
a88b64bad3
  1. 27
      resources/examples/testfiles/hoa/automaton_Fandp0Xp1.hoa
  2. 32
      resources/examples/testfiles/hoa/automaton_UXp0p1.hoa
  3. 48
      src/test/storm/modelchecker/prctl/dtmc/DtmcPrctlModelCheckerTest.cpp

27
resources/examples/testfiles/hoa/automaton_Fandp0Xp1.hoa

@ -0,0 +1,27 @@
HOA: v1
States: 3
properties: implicit-labels trans-labels no-univ-branch deterministic complete
tool: "ltl2dstar" "0.5.4"
name: "F & p0 X p1"
comment: "DBA2DRA[NBA=3]"
acc-name: Rabin 1
Acceptance: 2 (Fin(0)&Inf(1))
Start: 2
AP: 2 "p0" "p1"
--BODY--
State: 0 {1}
0
0
0
0
State: 1 {}
2
1
0
0
State: 2 {}
2
1
2
1
--END--

32
resources/examples/testfiles/hoa/automaton_UXp0p1.hoa

@ -0,0 +1,32 @@
HOA: v1
States: 4
properties: implicit-labels trans-labels no-univ-branch deterministic complete
tool: "ltl2dstar" "0.5.4"
name: "U X p0 p1"
comment: "DBA2DRA[NBA=3]"
acc-name: Rabin 1
Acceptance: 2 (Fin(0)&Inf(1))
Start: 1
AP: 2 "p0" "p1"
--BODY--
State: 0 {1}
0
0
0
0
State: 1 {}
2
2
0
0
State: 2 {}
3
2
3
0
State: 3 {}
3
3
3
3
--END--

48
src/test/storm/modelchecker/prctl/dtmc/DtmcPrctlModelCheckerTest.cpp

@ -808,4 +808,52 @@ namespace {
#endif
}
TYPED_TEST(DtmcPrctlModelCheckerTest, HOAProbabilitiesDie) {
// "P=? [(X s>0) U (s=7 & d=2)]"
std::string formulasString = "P=?[HOA: {\"" STORM_TEST_RESOURCES_DIR "/hoa/automaton_UXp0p1.hoa\", \"p0\" -> (s>0), \"p1\" -> (s=7 & d=2) }]";
// "P=? [(X s>0) U (d=4 | d=2)]"
formulasString += "; P=?[HOA: {\"" STORM_TEST_RESOURCES_DIR "/hoa/automaton_UXp0p1.hoa\", \"p0\" -> (s>0), \"p1\" -> (d=4 | d=2) }]";
// "P=? [ (F s=4) & (X \"three\")]"
formulasString += "; P=?[HOA: {\"" STORM_TEST_RESOURCES_DIR "/hoa/automaton_Fandp0Xp1.hoa\", \"p0\" -> (s=4), \"p1\" -> \"three\" }]";
// "P=? [ (F s=6) & (X \"done\")]"
formulasString += "; P=?[HOA: {\"" STORM_TEST_RESOURCES_DIR "/hoa/automaton_Fandp0Xp1.hoa\", \"p0\" -> (s=6), \"p1\" -> \"done\" }]";
// "P=? [ (F s=6) & (X !\"done\")]"
formulasString += "; P=?[HOA: {\"" STORM_TEST_RESOURCES_DIR "/hoa/automaton_Fandp0Xp1.hoa\", \"p0\" -> (s=6), \"p1\" -> !\"done\" }]";
// "P=? [ (F (s=4 | s=5)) & (X (\"three\" | \"five\"))]"
formulasString += "; P=?[HOA: {\"" STORM_TEST_RESOURCES_DIR "/hoa/automaton_Fandp0Xp1.hoa\", \"p0\" -> (s=4 | s=5), \"p1\" -> s=7 & (d=3 | d=5) }]";
auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR "/dtmc/die.pm", formulasString);
auto model = std::move(modelFormulas.first);
auto tasks = this->getTasks(modelFormulas.second);
EXPECT_EQ(13ul, model->getNumberOfStates());
EXPECT_EQ(20ul, model->getNumberOfTransitions());
ASSERT_EQ(model->getType(), storm::models::ModelType::Dtmc);
auto checker = this->createModelChecker(model);
std::unique_ptr<storm::modelchecker::CheckResult> result;
// Not supported in all engines (Hybrid, PrismDd, JaniDd)
if (TypeParam::engine == DtmcEngine::PrismSparse || TypeParam::engine == DtmcEngine::JaniSparse || TypeParam::engine == DtmcEngine::JitSparse) {
result = checker->check(tasks[0]);
EXPECT_NEAR(this->parseNumber("1/6"), this->getQuantitativeResultAtInitialState(model, result), this->precision());
result = checker->check(tasks[1]);
EXPECT_NEAR(this->parseNumber("1/3"), this->getQuantitativeResultAtInitialState(model, result), this->precision());
result = checker->check(tasks[2]);
EXPECT_NEAR(this->parseNumber("1/6"), this->getQuantitativeResultAtInitialState(model, result), this->precision());
result = checker->check(tasks[3]);
EXPECT_NEAR(this->parseNumber("1/6"), this->getQuantitativeResultAtInitialState(model, result), this->precision());
result = checker->check(tasks[4]);
EXPECT_NEAR(this->parseNumber("1/8"), this->getQuantitativeResultAtInitialState(model, result), this->precision());
result = checker->check(tasks[5]);
EXPECT_NEAR(this->parseNumber("1/3"), this->getQuantitativeResultAtInitialState(model, result), this->precision());
} else {
EXPECT_FALSE(checker->canHandle(tasks[0]));
}
}
}
Loading…
Cancel
Save