Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SmtPermissiveSchedulerTest.cpp
Go to the documentation of this file.
1#include "storm-config.h"
9#include "test/storm_gtest.h"
10
13
14TEST(SmtPermissiveSchedulerTest, DieSelection) {
15#ifndef STORM_HAVE_Z3
16 GTEST_SKIP() << "Z3 not available.";
17#endif
19 storm::prism::Program program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/die_c1.nm");
20 storm::parser::FormulaParser formulaParser(program);
21 std::string formulaString = "";
22 formulaString += "P<=0.16 [ F \"one\"];\n";
23 formulaString += "P<=0.05 [ F \"one\"];\n";
24 auto formulas = formulaParser.parseFromString(formulaString);
25
26 auto const& formula02b = formulas[0].getRawFormula()->asProbabilityOperatorFormula();
27 auto const& formula001b = formulas[1].getRawFormula()->asProbabilityOperatorFormula();
28
29 // auto formula02 = formulaParser.parseSingleFormulaFromString("P>=0.10 [ F \"one\"]")->asProbabilityOperatorFormula();
30 // ASSERT_TRUE(storm::logic::isLowerBound(formula02.getComparisonType()));
31 // auto formula001 = formulaParser.parseSingleFormulaFromString("P>=0.17 [ F \"one\"]")->asProbabilityOperatorFormula();
32
33 // Customize and perform model-building.
35
36 std::shared_ptr<storm::models::sparse::Mdp<double>> mdp =
38
39 // boost::optional<storm::ps::SubMDPPermissiveScheduler<>> perms = storm::ps::computePermissiveSchedulerViaSMT<>(*mdp, formula02);
40 // EXPECT_NE(perms, boost::none);
41 // boost::optional<storm::ps::SubMDPPermissiveScheduler<>> perms2 = storm::ps::computePermissiveSchedulerViaSMT<>(*mdp, formula001);
42 // EXPECT_EQ(perms2, boost::none);
43
44 boost::optional<storm::ps::SubMDPPermissiveScheduler<>> perms3 = storm::ps::computePermissiveSchedulerViaSMT<>(*mdp, formula02b);
45 EXPECT_TRUE(perms3.is_initialized());
46 boost::optional<storm::ps::SubMDPPermissiveScheduler<>> perms4 = storm::ps::computePermissiveSchedulerViaSMT<>(*mdp, formula001b);
47 EXPECT_FALSE(perms4.is_initialized());
48
50
51 std::unique_ptr<storm::modelchecker::CheckResult> result0 = checker0.check(env, formula02b);
53
54 ASSERT_FALSE(qualitativeResult0[0]);
55
56 auto submdp = perms3->apply();
58
59 std::unique_ptr<storm::modelchecker::CheckResult> result1 = checker1.check(env, formula02b);
61
62 EXPECT_TRUE(qualitativeResult1[0]);
63
64 //
65}
TEST(SmtPermissiveSchedulerTest, DieSelection)
std::shared_ptr< storm::models::sparse::Model< ValueType, RewardModelType > > build()
Convert the program given at construction time to an abstract model.
virtual std::unique_ptr< CheckResult > check(Environment const &env, CheckTask< storm::logic::Formula, SolutionType > const &checkTask)
Checks the provided formula.
ExplicitQualitativeCheckResult & asExplicitQualitativeCheckResult()
This class represents a (discrete-time) Markov decision process.
Definition Mdp.h:14
std::vector< storm::jani::Property > parseFromString(std::string const &propertyString) const
Parses the property 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.