Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SparseExplorationModelCheckerTest.cpp
Go to the documentation of this file.
1#include "storm-config.h"
2#include "test/storm_gtest.h"
3
14
15class SparseExplorationModelCheckerTest : public ::testing::Test {
16 protected:
17 void SetUp() override {
18#ifndef STORM_HAVE_Z3
19 GTEST_SKIP() << "Z3 not available.";
20#endif
21 }
22};
23
26 storm::prism::Program program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/two_dice.nm");
27
28 // A parser that we use for conveniently constructing the formulas.
29 storm::parser::FormulaParser formulaParser;
30
32
33 std::shared_ptr<storm::logic::Formula const> formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F \"two\"]");
34
35 std::unique_ptr<storm::modelchecker::CheckResult> result = checker.check(storm::modelchecker::CheckTask<>(*formula, true));
37
38 EXPECT_NEAR(0.0277777612209320068, quantitativeResult1[0], env.exploration().getPrecision());
39
40 formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F \"two\"]");
41
42 result = checker.check(storm::modelchecker::CheckTask<>(*formula, true));
44
45 EXPECT_NEAR(0.0277777612209320068, quantitativeResult2[0], env.exploration().getPrecision());
46
47 formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F \"three\"]");
48
49 result = checker.check(storm::modelchecker::CheckTask<>(*formula, true));
51
52 EXPECT_NEAR(0.0555555224418640136, quantitativeResult3[0], env.exploration().getPrecision());
53
54 formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F \"three\"]");
55
56 result = checker.check(storm::modelchecker::CheckTask<>(*formula, true));
58
59 EXPECT_NEAR(0.0555555224418640136, quantitativeResult4[0], env.exploration().getPrecision());
60
61 formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F \"four\"]");
62
63 result = checker.check(storm::modelchecker::CheckTask<>(*formula, true));
65
66 EXPECT_NEAR(0.083333283662796020508, quantitativeResult5[0], env.exploration().getPrecision());
67
68 formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F \"four\"]");
69
70 result = checker.check(storm::modelchecker::CheckTask<>(*formula, true));
72
73 EXPECT_NEAR(0.083333283662796020508, quantitativeResult6[0], env.exploration().getPrecision());
74}
75
78 storm::prism::Program program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/leader4.nm");
79
80 // A parser that we use for conveniently constructing the formulas.
81 storm::parser::FormulaParser formulaParser;
82
84
85 std::shared_ptr<storm::logic::Formula const> formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F \"elected\"]");
86
87 std::unique_ptr<storm::modelchecker::CheckResult> result = checker.check(storm::modelchecker::CheckTask<>(*formula, true));
89
90 EXPECT_NEAR(1, quantitativeResult1[0], env.exploration().getPrecision());
91
92 formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F \"elected\"]");
93
94 result = checker.check(storm::modelchecker::CheckTask<>(*formula, true));
96
97 EXPECT_NEAR(1, quantitativeResult2[0], env.exploration().getPrecision());
98}
99
102 storm::prism::Program program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/cicle.nm");
103
104 // A parser that we use for conveniently constructing the formulas.
105 storm::parser::FormulaParser formulaParser;
106
108
109 std::shared_ptr<storm::logic::Formula const> formula = formulaParser.parseSingleFormulaFromString("Pmax=? [ F \"done\"]");
110
111 std::unique_ptr<storm::modelchecker::CheckResult> result = checker.check(storm::modelchecker::CheckTask<>(*formula, true));
113
114 EXPECT_NEAR(0.875, quantitativeResult1[0], env.exploration().getPrecision());
115}
TEST_F(SparseExplorationModelCheckerTest, Dice)
ExplorationEnvironment & exploration()
virtual std::unique_ptr< CheckResult > check(Environment const &env, CheckTask< storm::logic::Formula, SolutionType > const &checkTask)
Checks the provided formula.
ExplicitQuantitativeCheckResult< ValueType > & asExplicitQuantitativeCheckResult()
A quantitative check result over the states of a sparse model.
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.