Storm 1.13.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
RobustMdpPrctlModelCheckerTest.cpp
Go to the documentation of this file.
1#include "storm-config.h"
4#include "test/storm_gtest.h"
5
10#include "storm/api/builder.h"
20
21std::unique_ptr<storm::modelchecker::QualitativeCheckResult> getInitialStateFilter(
22 std::shared_ptr<storm::models::sparse::Model<storm::Interval>> const& model) {
23 return std::make_unique<storm::modelchecker::ExplicitQualitativeCheckResult<double>>(model->getInitialStates());
24}
25
26std::unique_ptr<storm::modelchecker::QualitativeCheckResult> getInitialStateFilter(std::shared_ptr<storm::models::sparse::Model<double>> const& model) {
27 return std::make_unique<storm::modelchecker::ExplicitQualitativeCheckResult<double>>(model->getInitialStates());
28}
29
30std::unique_ptr<storm::modelchecker::QualitativeCheckResult> getInitialStateFilter(
31 std::shared_ptr<storm::models::sparse::Model<storm::RationalNumber>> const& model) {
32 return std::make_unique<storm::modelchecker::ExplicitQualitativeCheckResult<storm::RationalNumber>>(model->getInitialStates());
33}
34
36 std::unique_ptr<storm::modelchecker::CheckResult>& result) {
37 auto filter = getInitialStateFilter(model);
38 result->filter(*filter);
39 return result->asQuantitativeCheckResult<storm::RationalNumber>().getMin();
40}
41
42std::unique_ptr<storm::modelchecker::QualitativeCheckResult> getInitialStateFilter(
43 std::shared_ptr<storm::models::sparse::Model<storm::RationalInterval>> const& model) {
44 return std::make_unique<storm::modelchecker::ExplicitQualitativeCheckResult<storm::RationalNumber>>(model->getInitialStates());
45}
46
48 std::unique_ptr<storm::modelchecker::CheckResult>& result) {
49 auto filter = getInitialStateFilter(model);
50 result->filter(*filter);
51 return result->asQuantitativeCheckResult<double>().getMin();
52}
53
55 std::unique_ptr<storm::modelchecker::CheckResult>& result) {
56 auto filter = getInitialStateFilter(model);
57 result->filter(*filter);
58 return result->asQuantitativeCheckResult<double>().getMin();
59}
60
62 std::unique_ptr<storm::modelchecker::CheckResult>& result) {
63 auto filter = getInitialStateFilter(model);
64 result->filter(*filter);
65 return result->asQuantitativeCheckResult<storm::RationalNumber>().getMin();
66}
67
68void expectThrow(std::string const& path, std::string const& formulaString) {
69 std::shared_ptr<storm::models::sparse::Model<storm::Interval>> modelPtr = storm::parser::parseDirectEncodingModel<storm::Interval>(path);
70 std::vector<std::shared_ptr<storm::logic::Formula const>> formulas = storm::api::extractFormulasFromProperties(storm::api::parseProperties(formulaString));
71
73 env.solver().minMax().setMethod(storm::solver::MinMaxMethod::ValueIteration);
74
75 std::shared_ptr<storm::models::sparse::Mdp<storm::Interval>> mdp = modelPtr->as<storm::models::sparse::Mdp<storm::Interval>>();
76 ASSERT_EQ(storm::models::ModelType::Mdp, modelPtr->getType());
78
80 STORM_SILENT_EXPECT_THROW(checker.check(env, task), storm::exceptions::NotImplementedException);
81}
82
83void checkModel(std::string const& path, std::string const& formulaString, double maxmin, double maxmax, double minmax, double minmin, bool produceScheduler) {
84 std::shared_ptr<storm::models::sparse::Model<storm::Interval>> modelPtr = storm::parser::parseDirectEncodingModel<storm::Interval>(path);
85 std::vector<std::shared_ptr<storm::logic::Formula const>> formulas = storm::api::extractFormulasFromProperties(storm::api::parseProperties(formulaString));
87 env.solver().minMax().setMethod(storm::solver::MinMaxMethod::ValueIteration);
88
89 std::shared_ptr<storm::models::sparse::Mdp<storm::Interval>> mdp = modelPtr->as<storm::models::sparse::Mdp<storm::Interval>>();
90 ASSERT_EQ(storm::models::ModelType::Mdp, modelPtr->getType());
92 taskMax.setUncertaintyResolutionMode(storm::UncertaintyResolutionMode::Robust);
93 taskMax.setProduceSchedulers(produceScheduler);
94
96 auto resultMax = checker.check(env, taskMax);
97 EXPECT_NEAR(maxmin, getQuantitativeResultAtInitialState(mdp, resultMax), 0.0001);
98 taskMax.setUncertaintyResolutionMode(storm::UncertaintyResolutionMode::Cooperative);
99 auto resultMaxNonRobust = checker.check(env, taskMax);
100 EXPECT_NEAR(maxmax, getQuantitativeResultAtInitialState(mdp, resultMaxNonRobust), 0.0001);
101
103 taskMin.setUncertaintyResolutionMode(storm::UncertaintyResolutionMode::Robust);
104 taskMin.setProduceSchedulers(produceScheduler);
105
106 auto resultMin = checker.check(env, taskMin);
107 EXPECT_NEAR(minmax, getQuantitativeResultAtInitialState(mdp, resultMin), 0.0001);
108 taskMin.setUncertaintyResolutionMode(storm::UncertaintyResolutionMode::Cooperative);
109 auto resultMinNonRobust = checker.check(env, taskMin);
110 EXPECT_NEAR(minmin, getQuantitativeResultAtInitialState(mdp, resultMinNonRobust), 0.0001);
111}
112
113void checkPrismModelForQuantitativeResult(std::string const& path, std::string const& formulaString, double minmin, double minmax, double maxmin, double maxmax,
114 std::string constantsString) {
116 program = storm::utility::prism::preprocess(program, constantsString);
117
118 std::vector<std::shared_ptr<storm::logic::Formula const>> formulas = storm::api::extractFormulasFromProperties(storm::api::parseProperties(formulaString));
119 std::shared_ptr<storm::models::sparse::Model<storm::Interval>> modelPtr = storm::api::buildSparseModel<storm::Interval>(program, formulas);
120
122 env.solver().minMax().setMethod(storm::solver::MinMaxMethod::ValueIteration);
123
124 std::shared_ptr<storm::models::sparse::Mdp<storm::Interval>> mdp = modelPtr->as<storm::models::sparse::Mdp<storm::Interval>>();
125 ASSERT_EQ(storm::models::ModelType::Mdp, modelPtr->getType());
126
128 taskMinMin.setUncertaintyResolutionMode(storm::UncertaintyResolutionMode::Minimize);
129
131 auto resultMinMin = checker.check(env, taskMinMin);
132 EXPECT_NEAR(minmin, getQuantitativeResultAtInitialState(mdp, resultMinMin), 0.0001);
133
135 taskMinMax.setUncertaintyResolutionMode(storm::UncertaintyResolutionMode::Maximize);
136
137 auto resultMinMax = checker.check(env, taskMinMax);
138 EXPECT_NEAR(minmax, getQuantitativeResultAtInitialState(mdp, resultMinMax), 0.0001);
139
141 taskMaxMin.setUncertaintyResolutionMode(storm::UncertaintyResolutionMode::Minimize);
142
143 auto resultMaxMin = checker.check(env, taskMaxMin);
144 EXPECT_NEAR(maxmin, getQuantitativeResultAtInitialState(mdp, resultMaxMin), 0.0001);
145
147 taskMaxMin.setUncertaintyResolutionMode(storm::UncertaintyResolutionMode::Maximize);
148
149 auto resultMaxMax = checker.check(env, taskMaxMax);
150 EXPECT_NEAR(maxmax, getQuantitativeResultAtInitialState(mdp, resultMaxMax), 0.0001);
151}
152
153void checkModelRational(std::string const& path, std::string const& formulaString, storm::RationalNumber maxmin, storm::RationalNumber maxmax,
154 storm::RationalNumber minmax, storm::RationalNumber minmin, bool produceScheduler) {
155 std::shared_ptr<storm::models::sparse::Model<storm::RationalInterval>> modelPtr = storm::parser::parseDirectEncodingModel<storm::RationalInterval>(path);
156
157 std::vector<std::shared_ptr<storm::logic::Formula const>> formulas = storm::api::extractFormulasFromProperties(storm::api::parseProperties(formulaString));
159 env.solver().minMax().setMethod(storm::solver::MinMaxMethod::ValueIteration);
160
161 std::shared_ptr<storm::models::sparse::Mdp<storm::RationalInterval>> mdp = modelPtr->as<storm::models::sparse::Mdp<storm::RationalInterval>>();
162 ASSERT_EQ(storm::models::ModelType::Mdp, modelPtr->getType());
164 taskMax.setProduceSchedulers(produceScheduler);
165
167 taskMax.setUncertaintyResolutionMode(storm::UncertaintyResolutionMode::Robust);
168 auto resultMax = checker.check(env, taskMax);
169 EXPECT_EQ(maxmin, getQuantitativeResultAtInitialState(mdp, resultMax));
170 taskMax.setUncertaintyResolutionMode(storm::UncertaintyResolutionMode::Cooperative);
171 auto resultMaxNonRobust = checker.check(env, taskMax);
172 EXPECT_EQ(maxmax, getQuantitativeResultAtInitialState(mdp, resultMaxNonRobust));
173
175 taskMin.setProduceSchedulers(produceScheduler);
176
177 taskMin.setUncertaintyResolutionMode(storm::UncertaintyResolutionMode::Robust);
178 auto resultMin = checker.check(env, taskMin);
179 EXPECT_EQ(minmax, getQuantitativeResultAtInitialState(mdp, resultMin));
180 taskMin.setUncertaintyResolutionMode(storm::UncertaintyResolutionMode::Cooperative);
181 auto resultMinNonRobust = checker.check(env, taskMin);
182 EXPECT_EQ(minmin, getQuantitativeResultAtInitialState(mdp, resultMinNonRobust));
183}
184
185TEST(RobustMdpModelCheckerTest, RobotMinMaxTest) {
186#ifndef STORM_HAVE_Z3
187 GTEST_SKIP() << "Z3 not available.";
188#endif
189 // Maxima reachability rewards using PRISM format.
190 checkPrismModelForQuantitativeResult(STORM_TEST_RESOURCES_DIR "/imdp/robot.prism",
191 "Pmin=? [ F \"goal2\"];Pmin=? [ F \"goal2\"];Pmax=? [ F \"goal2\"];Pmax=? [ F \"goal2\"]", 0.4, 0.6, 1.0, 1.0,
192 "delta=0.1");
193}
194
195void makeUncertainAndCheck(std::string const& path, std::string const& formulaString, double amountOfUncertainty) {
197 program = storm::utility::prism::preprocess(program, "");
198 std::vector<std::shared_ptr<storm::logic::Formula const>> formulas =
200 std::shared_ptr<storm::models::sparse::Model<double>> modelPtr = storm::api::buildSparseModel<double>(program, formulas);
201
202 auto mdp = modelPtr->as<storm::models::sparse::Mdp<double>>();
203
204 ASSERT_TRUE(formulas[0]->isProbabilityOperatorFormula());
205 // These tests cases where written with max in mind.
206 ASSERT_TRUE(formulas[0]->asProbabilityOperatorFormula().getOptimalityType() == storm::solver::OptimizationDirection::Maximize);
209
210 // First compute certain value
212 auto exresult = checker.check(env, task);
213 double certainValue = getQuantitativeResultAtInitialState(mdp, exresult);
214
215 storm::Environment envIntervals;
216 envIntervals.solver().minMax().setMethod(storm::solver::MinMaxMethod::ValueIteration);
217 auto transformer = storm::transformer::AddUncertainty(modelPtr);
218 auto imdp = transformer.transform(amountOfUncertainty)->as<storm::models::sparse::Mdp<storm::Interval>>();
220 auto iresultMin = checker.check(env, task);
221 double minValue = getQuantitativeResultAtInitialState(mdp, iresultMin);
222 EXPECT_LE(minValue, certainValue);
223 task.setUncertaintyResolutionMode(storm::UncertaintyResolutionMode::Cooperative);
224 auto iresultMax = checker.check(env, task);
225 double maxValue = getQuantitativeResultAtInitialState(mdp, iresultMax);
226 EXPECT_LE(certainValue, maxValue);
227}
228
229void makeUncertainAndCheckRational(std::string const& path, std::string const& formulaString, storm::RationalNumber amountOfUncertainty) {
231 program = storm::utility::prism::preprocess(program, "");
232 std::vector<std::shared_ptr<storm::logic::Formula const>> formulas =
234 std::shared_ptr<storm::models::sparse::Model<storm::RationalNumber>> modelPtr = storm::api::buildSparseModel<storm::RationalNumber>(program, formulas);
235 auto mdp = modelPtr->as<storm::models::sparse::Mdp<storm::RationalNumber>>();
236
237 ASSERT_TRUE(formulas[0]->isProbabilityOperatorFormula());
238 ASSERT_TRUE(formulas[0]->asProbabilityOperatorFormula().getOptimalityType() == storm::solver::OptimizationDirection::Maximize);
239
243 auto exresult = checker.check(env, taskCertain);
244 storm::RationalNumber certainValue = getQuantitativeResultAtInitialState(modelPtr, exresult);
245
246 storm::Environment envIntervals;
247 envIntervals.solver().minMax().setMethod(storm::solver::MinMaxMethod::ValueIteration);
249 auto imdp = transformer.transform(amountOfUncertainty)->as<storm::models::sparse::Mdp<storm::RationalInterval>>();
251
253 taskMin.setUncertaintyResolutionMode(storm::UncertaintyResolutionMode::Minimize);
254 auto iresultMin = ichecker.check(envIntervals, taskMin);
255 storm::RationalNumber minValue = getQuantitativeResultAtInitialState(imdp, iresultMin);
256 EXPECT_LE(minValue, certainValue);
257
259 taskMax.setUncertaintyResolutionMode(storm::UncertaintyResolutionMode::Maximize);
260 auto iresultMax = ichecker.check(envIntervals, taskMax);
261 storm::RationalNumber maxValue = getQuantitativeResultAtInitialState(imdp, iresultMax);
262 EXPECT_LE(certainValue, maxValue);
263}
264
265// TODO: Add next properties
266
267TEST(RobustMDPModelCheckingTest, Tiny01maxmin) {
268 checkModel(STORM_TEST_RESOURCES_DIR "/imdp/tiny-01.drn", "Pmax=? [ F \"target\"];Pmin=? [ F \"target\"]", 0.4, 0.5, 0.5, 0.4, false);
269}
270
271TEST(RobustMDPModelCheckingTest, Tiny03maxmin) {
272 checkModel(STORM_TEST_RESOURCES_DIR "/imdp/tiny-03.drn", "Pmax=? [ F \"target\"];Pmin=? [ F \"target\"]", 0.4, 0.6, 0.5, 0.3, true);
273}
274
275TEST(RobustMDPModelCheckingTest, BoundedTiny03maxmin) {
276 checkModel(STORM_TEST_RESOURCES_DIR "/imdp/tiny-03.drn", "Pmax=? [ F<=1 \"target\"];Pmin=? [ F<=1 \"target\"]", 0.4, 0.6, 0.5, 0.3, true);
277 checkModel(STORM_TEST_RESOURCES_DIR "/imdp/tiny-03.drn", "Pmax=? [ F[1,1] \"target\"];Pmin=? [ F[1,1] \"target\"]", 0.4, 0.6, 0.5, 0.3, true);
278}
279
280TEST(RobustMDPModelCheckingTest, BoundedMaxmin) {
281 checkModel(STORM_TEST_RESOURCES_DIR "/imdp/tiny-bounded.drn", "Pmax=? [ F<=4 \"target\"];Pmin=? [ F<=4 \"target\"]", 0.6528, 0.81, 0.81, 0.6528, true);
282 checkModel(STORM_TEST_RESOURCES_DIR "/imdp/tiny-bounded.drn", "Pmax=? [ F[0,4] \"target\"];Pmin=? [ F[0,4] \"target\"]", 0.6528, 0.81, 0.81, 0.6528, true);
283 checkModel(STORM_TEST_RESOURCES_DIR "/imdp/tiny-bounded.drn", "Pmax=? [ F[4,4] \"target\"];Pmin=? [ F[4,4] \"target\"]", 0.1952, 0.324, 0.324, 0.1952,
284 true);
285 checkModel(STORM_TEST_RESOURCES_DIR "/imdp/tiny-bounded.drn", "Pmax=? [ F[4,5] \"target\"];Pmin=? [ F[4,5] \"target\"]", 0.3236, 0.50292, 0.50292, 0.3236,
286 true);
287 checkModel(STORM_TEST_RESOURCES_DIR "/imdp/tiny-bounded.drn", "Pmax=? [ F[4,6] \"target\"];Pmin=? [ F[4,6] \"target\"]", 0.37928, 0.57888, 0.57888, 0.37928,
288 true);
289 checkModel(STORM_TEST_RESOURCES_DIR "/imdp/tiny-bounded.drn", "Pmax=? [ F[2,2] \"target\"];Pmin=? [ F[2,2] \"target\"]", 0.32, 0.45, 0.45, 0.32, true);
290 checkModel(STORM_TEST_RESOURCES_DIR "/imdp/tiny-bounded.drn", "Pmax=? [ F<=2 \"target\"];Pmin=? [ F<=2 \"target\"]", 0.32, 0.45, 0.45, 0.32, true);
291}
292
293TEST(RobustMDPModelCheckingTest, Tiny04maxmin) {
294 checkModel(STORM_TEST_RESOURCES_DIR "/imdp/tiny-04.drn", "Pmax=? [ F \"target\"];Pmin=? [ F \"target\"]", 1, 1, 0.42857, 0.42, false);
295}
296
297TEST(RobustMDPModelCheckingTest, Tiny05maxmin) {
298 checkModel(STORM_TEST_RESOURCES_DIR "/imdp/tiny-05.drn", "Pmax=? [ F \"target\"];Pmin=? [ F \"target\"]", 0.3, 0.4, 0.4, 0.3, false);
299}
300
301TEST(RobustMDPModelCheckingTest, Tiny04maxmin_rewards) {
302 expectThrow(STORM_TEST_RESOURCES_DIR "/imdp/tiny-04.drn", "Rmin=? [ F \"target\"]");
303}
304
305TEST(RobustMDPModelCheckingTest, CrowdsQuotientIMDP) {
306 // Ensuring equivalent behavior when checking identical model as IDTMC and IMDP (cf. CrowdsQuotientIDTMC)
307 checkModel(STORM_TEST_RESOURCES_DIR "/imdp/crowds-quotient-3-5.drn", "Pmax=? [ F \"observe0Greater1\"]; Pmin=? [ F \"observe0Greater1\"]", 0.1383409,
308 0.1383409, 0.1383409, 0.1383409, false);
309}
310
311// ---- RationalInterval tests (exact arithmetic) ----
312
313TEST(RobustRationalMDPModelCheckingTest, Tiny01maxmin) {
314 checkModelRational(STORM_TEST_RESOURCES_DIR "/imdp/tiny-01.drn", "Pmax=? [ F \"target\"];Pmin=? [ F \"target\"]", storm::RationalNumber("2/5"),
315 storm::RationalNumber("1/2"), storm::RationalNumber("1/2"), storm::RationalNumber("2/5"), false);
316}
317
318TEST(RobustRationalMDPModelCheckingTest, Tiny03maxmin) {
319 checkModelRational(STORM_TEST_RESOURCES_DIR "/imdp/tiny-03.drn", "Pmax=? [ F \"target\"];Pmin=? [ F \"target\"]", storm::RationalNumber("2/5"),
320 storm::RationalNumber("3/5"), storm::RationalNumber("1/2"), storm::RationalNumber("3/10"), true);
321}
322
323TEST(RobustRationalMDPModelCheckingTest, BoundedTiny03maxmin) {
324 checkModelRational(STORM_TEST_RESOURCES_DIR "/imdp/tiny-03.drn", "Pmax=? [ F<=1 \"target\"];Pmin=? [ F<=1 \"target\"]", storm::RationalNumber("2/5"),
325 storm::RationalNumber("3/5"), storm::RationalNumber("1/2"), storm::RationalNumber("3/10"), true);
326 checkModelRational(STORM_TEST_RESOURCES_DIR "/imdp/tiny-03.drn", "Pmax=? [ F[1,1] \"target\"];Pmin=? [ F[1,1] \"target\"]", storm::RationalNumber("2/5"),
327 storm::RationalNumber("3/5"), storm::RationalNumber("1/2"), storm::RationalNumber("3/10"), true);
328}
329
330TEST(RobustRationalMDPModelCheckingTest, BoundedMaxmin) {
331 checkModelRational(STORM_TEST_RESOURCES_DIR "/imdp/tiny-bounded.drn", "Pmax=? [ F<=4 \"target\"];Pmin=? [ F<=4 \"target\"]",
332 storm::RationalNumber("408/625"), storm::RationalNumber("81/100"), storm::RationalNumber("81/100"), storm::RationalNumber("408/625"),
333 true);
334 checkModelRational(STORM_TEST_RESOURCES_DIR "/imdp/tiny-bounded.drn", "Pmax=? [ F[0,4] \"target\"];Pmin=? [ F[0,4] \"target\"]",
335 storm::RationalNumber("408/625"), storm::RationalNumber("81/100"), storm::RationalNumber("81/100"), storm::RationalNumber("408/625"),
336 true);
337 checkModelRational(STORM_TEST_RESOURCES_DIR "/imdp/tiny-bounded.drn", "Pmax=? [ F[4,4] \"target\"];Pmin=? [ F[4,4] \"target\"]",
338 storm::RationalNumber("122/625"), storm::RationalNumber("81/250"), storm::RationalNumber("81/250"), storm::RationalNumber("122/625"),
339 true);
340 checkModelRational(STORM_TEST_RESOURCES_DIR "/imdp/tiny-bounded.drn", "Pmax=? [ F[4,5] \"target\"];Pmin=? [ F[4,5] \"target\"]",
341 storm::RationalNumber("809/2500"), storm::RationalNumber("12573/25000"), storm::RationalNumber("12573/25000"),
342 storm::RationalNumber("809/2500"), true);
343 checkModelRational(STORM_TEST_RESOURCES_DIR "/imdp/tiny-bounded.drn", "Pmax=? [ F[4,6] \"target\"];Pmin=? [ F[4,6] \"target\"]",
344 storm::RationalNumber("4741/12500"), storm::RationalNumber("1809/3125"), storm::RationalNumber("1809/3125"),
345 storm::RationalNumber("4741/12500"), true);
346 checkModelRational(STORM_TEST_RESOURCES_DIR "/imdp/tiny-bounded.drn", "Pmax=? [ F[2,2] \"target\"];Pmin=? [ F[2,2] \"target\"]",
347 storm::RationalNumber("8/25"), storm::RationalNumber("9/20"), storm::RationalNumber("9/20"), storm::RationalNumber("8/25"), true);
348 checkModelRational(STORM_TEST_RESOURCES_DIR "/imdp/tiny-bounded.drn", "Pmax=? [ F<=2 \"target\"];Pmin=? [ F<=2 \"target\"]", storm::RationalNumber("8/25"),
349 storm::RationalNumber("9/20"), storm::RationalNumber("9/20"), storm::RationalNumber("8/25"), true);
350}
351
352TEST(RobustRationalMDPModelCheckingTest, Tiny04maxmin) {
353 // Fill in exact rational values once test output is known.
354 checkModelRational(STORM_TEST_RESOURCES_DIR "/imdp/tiny-04.drn", "Pmax=? [ F \"target\"];Pmin=? [ F \"target\"]", storm::RationalNumber(1),
355 storm::RationalNumber(1), storm::RationalNumber("42857140807299/100000000000000"), storm::RationalNumber("21/50"), false);
356}
357
358TEST(RobustRationalMDPModelCheckingTest, Tiny05maxmin) {
359 checkModelRational(STORM_TEST_RESOURCES_DIR "/imdp/tiny-05.drn", "Pmax=? [ F \"target\"];Pmin=? [ F \"target\"]", storm::RationalNumber("3/10"),
360 storm::RationalNumber("2/5"), storm::RationalNumber("2/5"), storm::RationalNumber("3/10"), false);
361}
362
363TEST(RobustMDPModelCheckingTest, AddUncertaintyCoin22max) {
364#ifndef STORM_HAVE_Z3
365 GTEST_SKIP() << "Z3 not available.";
366#endif
367 makeUncertainAndCheck(STORM_TEST_RESOURCES_DIR "/mdp/coin2-2.nm", "Pmax=? [F \"all_coins_equal_1\"]", 0.1);
368 makeUncertainAndCheck(STORM_TEST_RESOURCES_DIR "/mdp/coin2-2.nm", "Pmax=? [F \"all_coins_equal_1\"]", 0.2);
369}
370
371TEST(RobustRationalMDPModelCheckingTest, AddUncertaintyCoin22max) {
372#ifndef STORM_HAVE_Z3
373 GTEST_SKIP() << "Z3 not available.";
374#endif
375 makeUncertainAndCheckRational(STORM_TEST_RESOURCES_DIR "/mdp/coin2-2.nm", "Pmax=? [F \"all_coins_equal_1\"]", storm::RationalNumber("1/10"));
376 makeUncertainAndCheckRational(STORM_TEST_RESOURCES_DIR "/mdp/coin2-2.nm", "Pmax=? [F \"all_coins_equal_1\"]", storm::RationalNumber("1/5"));
377}
TEST(RobustMdpModelCheckerTest, RobotMinMaxTest)
std::unique_ptr< storm::modelchecker::QualitativeCheckResult > getInitialStateFilter(std::shared_ptr< storm::models::sparse::Model< storm::Interval > > const &model)
void checkPrismModelForQuantitativeResult(std::string const &path, std::string const &formulaString, double minmin, double minmax, double maxmin, double maxmax, std::string constantsString)
void expectThrow(std::string const &path, std::string const &formulaString)
storm::RationalNumber getQuantitativeResultAtInitialState(std::shared_ptr< storm::models::sparse::Model< storm::RationalNumber > > const &model, std::unique_ptr< storm::modelchecker::CheckResult > &result)
void checkModel(std::string const &path, std::string const &formulaString, double maxmin, double maxmax, double minmax, double minmin, bool produceScheduler)
void checkModelRational(std::string const &path, std::string const &formulaString, storm::RationalNumber maxmin, storm::RationalNumber maxmax, storm::RationalNumber minmax, storm::RationalNumber minmin, bool produceScheduler)
void makeUncertainAndCheckRational(std::string const &path, std::string const &formulaString, storm::RationalNumber amountOfUncertainty)
void makeUncertainAndCheck(std::string const &path, std::string const &formulaString, double amountOfUncertainty)
SolverEnvironment & solver()
void setMethod(storm::solver::MinMaxMethod value, bool isSetFromDefault=false)
MinMaxSolverEnvironment & minMax()
virtual std::unique_ptr< CheckResult > check(Environment const &env, CheckTask< storm::logic::Formula, SolutionType > const &checkTask)
Checks the provided formula.
This class represents a (discrete-time) Markov decision process.
Definition Mdp.h:13
Base class for all sparse models.
Definition Model.h:30
This class is a convenience transformer to add uncertainty.
std::vector< storm::jani::Property > parsePropertiesForPrismProgram(std::string const &inputString, storm::prism::Program const &program, boost::optional< std::set< std::string > > const &propertyFilter)
std::shared_ptr< storm::models::sparse::Model< ValueType > > buildSparseModel(storm::storage::SymbolicModelDescription const &model, storm::builder::BuilderOptions const &options)
Definition builder.h:109
storm::prism::Program parseProgram(std::string const &filename, bool prismCompatibility, bool simplify)
std::vector< storm::jani::Property > parseProperties(storm::parser::FormulaParser &formulaParser, std::string const &inputString, boost::optional< std::set< std::string > > const &propertyFilter)
std::vector< std::shared_ptr< storm::logic::Formula const > > extractFormulasFromProperties(std::vector< storm::jani::Property > const &properties)
template std::shared_ptr< storm::models::sparse::Model< storm::RationalInterval > > parseDirectEncodingModel< storm::RationalInterval >(std::filesystem::path const &file, DirectEncodingParserOptions const &options)
template std::shared_ptr< storm::models::sparse::Model< storm::Interval > > parseDirectEncodingModel< storm::Interval >(std::filesystem::path const &file, DirectEncodingParserOptions const &options)
storm::prism::Program preprocess(storm::prism::Program const &program, std::map< storm::expressions::Variable, storm::expressions::Expression > const &constantDefinitions)
Definition prism.cpp:13
#define STORM_SILENT_EXPECT_THROW(statement, expected_exception)
Definition storm_gtest.h:31