Storm 2.0.0.3
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
MilpPermissiveSchedulerTest.cpp
Go to the documentation of this file.
1#include "storm-config.h"
2#include "test/storm_gtest.h"
3
15
16// The default LP solver (HiGHS, GLPK or Z3) must support MILP; SoPlex does not.
17#if defined STORM_HAVE_HIGHS || defined STORM_HAVE_GLPK || defined STORM_HAVE_Z3
18
19TEST(MilpPermissiveSchedulerTest, DieSelection) {
21
22 storm::prism::Program program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/die_c1.nm");
24 std::string formulaString = "";
25 formulaString += "P>=0.10 [ F \"one\"];\n";
26 formulaString += "P>=0.17 [ F \"one\"];\n";
27 formulaString += "P<=0.10 [ F \"one\"];\n";
28 formulaString += "P<=0.17 [ F \"one\"];\n";
29 auto formulas = formulaParser.parseFromString(formulaString);
30
31 auto const& formula02 = formulas[0].getRawFormula()->asProbabilityOperatorFormula();
32 ASSERT_TRUE(storm::logic::isLowerBound(formula02.getComparisonType()));
33 auto const& formula001 = formulas[1].getRawFormula()->asProbabilityOperatorFormula();
34 auto const& formula02b = formulas[2].getRawFormula()->asProbabilityOperatorFormula();
35 auto const& formula001b = formulas[3].getRawFormula()->asProbabilityOperatorFormula();
36
37 // Customize and perform model-building.
40 std::shared_ptr<storm::models::sparse::Mdp<double>> mdp =
42
43 boost::optional<storm::ps::SubMDPPermissiveScheduler<>> perms = storm::ps::computePermissiveSchedulerViaMILP<>(env, *mdp, formula02);
44 EXPECT_TRUE(perms.is_initialized());
45 boost::optional<storm::ps::SubMDPPermissiveScheduler<>> perms2 = storm::ps::computePermissiveSchedulerViaMILP<>(env, *mdp, formula001);
46 EXPECT_FALSE(perms2.is_initialized());
47
48 boost::optional<storm::ps::SubMDPPermissiveScheduler<>> perms3 = storm::ps::computePermissiveSchedulerViaMILP<>(env, *mdp, formula02b);
49 EXPECT_FALSE(perms3.is_initialized());
50 boost::optional<storm::ps::SubMDPPermissiveScheduler<>> perms4 = storm::ps::computePermissiveSchedulerViaMILP<>(env, *mdp, formula001b);
51 EXPECT_TRUE(perms4.is_initialized());
52
54
55 std::unique_ptr<storm::modelchecker::CheckResult> result0 = checker0.check(env, formula02);
56 storm::modelchecker::ExplicitQualitativeCheckResult<double>& qualitativeResult0 = result0->template asExplicitQualitativeCheckResult<double>();
57
58 ASSERT_FALSE(qualitativeResult0[0]);
59
60 auto submdp = perms->apply();
62
63 std::unique_ptr<storm::modelchecker::CheckResult> result1 = checker1.check(env, formula02);
64 storm::modelchecker::ExplicitQualitativeCheckResult<double>& qualitativeResult1 = result1->template asExplicitQualitativeCheckResult<double>();
65
66 EXPECT_TRUE(qualitativeResult1[0]);
67}
68
69#endif
TEST(RegionConstraintCheckerTest, AffineConstraintHoldsThroughout)
BuilderOptions & setBuildAllLabels(bool newValue=true)
Should all reward models be built?
BuilderOptions & setBuildChoiceLabels(bool newValue=true)
Should the choice labels be built?
std::shared_ptr< storm::models::sparse::Model< ValueType, RewardModelType > > build()
Convert the program given at construction time to an abstract model.
std::shared_ptr< ExpressionManager > getSharedPointer()
Retrieves a shared pointer to the expression manager.
A qualitative check result over the states of a sparse model.
This class represents a (discrete-time) Markov decision process.
Definition Mdp.h:16
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.
storm::expressions::ExpressionManager & getManager() const
Retrieves the manager responsible for the expressions of this program.
Definition Program.cpp:2388
storm::builder::BuilderOptions NextStateGeneratorOptions
bool isLowerBound(ComparisonType t)
boost::optional< SubMDPPermissiveScheduler< RM > > computePermissiveSchedulerViaMILP(storm::Environment const &env, storm::models::sparse::Mdp< double, RM > const &mdp, storm::logic::ProbabilityOperatorFormula const &safeProp)