1#include "storm-config.h"
14enum class PreprocessingType {
None, SelfloopReduction, QualitativeReduction, All };
27 return storm::utility::convertNumber<ValueType>(0.12);
30 static PreprocessingType
const preprocessingType = PreprocessingType::None;
33class SelfloopReductionDefaultDoubleVIEnvironment {
42 static bool const isExactModelChecking =
false;
44 return storm::utility::convertNumber<ValueType>(0.12);
47 static PreprocessingType
const preprocessingType = PreprocessingType::SelfloopReduction;
50class QualitativeReductionDefaultDoubleVIEnvironment {
59 static bool const isExactModelChecking =
false;
61 return storm::utility::convertNumber<ValueType>(0.12);
64 static PreprocessingType
const preprocessingType = PreprocessingType::QualitativeReduction;
67class PreprocessedDefaultDoubleVIEnvironment {
76 static bool const isExactModelChecking =
false;
78 return storm::utility::convertNumber<ValueType>(0.12);
81 static PreprocessingType
const preprocessingType = PreprocessingType::All;
84class FineDoubleVIEnvironment {
93 static bool const isExactModelChecking =
false;
95 return storm::utility::convertNumber<ValueType>(0.02);
100 static PreprocessingType
const preprocessingType = PreprocessingType::None;
103class RefineDoubleVIEnvironment {
112 static bool const isExactModelChecking =
false;
114 return storm::utility::convertNumber<ValueType>(0.005);
116 static PreprocessingType
const preprocessingType = PreprocessingType::None;
123class PreprocessedRefineDoubleVIEnvironment {
132 static bool const isExactModelChecking =
false;
134 return storm::utility::convertNumber<ValueType>(0.005);
136 static PreprocessingType
const preprocessingType = PreprocessingType::All;
143class DefaultDoubleOVIEnvironment {
153 static bool const isExactModelChecking =
false;
155 return storm::utility::convertNumber<ValueType>(0.12);
158 static PreprocessingType
const preprocessingType = PreprocessingType::None;
161class DefaultRationalPIEnvironment {
170 static bool const isExactModelChecking =
true;
172 return storm::utility::convertNumber<ValueType>(0.12);
175 static PreprocessingType
const preprocessingType = PreprocessingType::None;
178class PreprocessedDefaultRationalPIEnvironment {
187 static bool const isExactModelChecking =
true;
189 return storm::utility::convertNumber<ValueType>(0.12);
192 static PreprocessingType
const preprocessingType = PreprocessingType::All;
195template<
typename TestType>
196class BeliefExplorationPomdpModelCheckerTest :
public ::testing::Test {
198 typedef typename TestType::ValueType
ValueType;
199 BeliefExplorationPomdpModelCheckerTest() : _environment(TestType::createEnvironment()) {}
201 void SetUp()
override {
203 GTEST_SKIP() <<
"Z3 not available.";
212 opt.gapThresholdInit = 0;
213 TestType::adaptOptions(opt);
218 opt.gapThresholdInit = 0;
219 TestType::adaptOptions(opt);
220 opt.useStateEliminationCutoff =
true;
225 opt.gapThresholdInit = 0;
226 TestType::adaptOptions(opt);
227 opt.useClipping =
true;
231 return storm::utility::convertNumber<ValueType>(str);
234 std::shared_ptr<storm::models::sparse::Pomdp<ValueType>> model;
235 std::shared_ptr<storm::logic::Formula const> formula;
237 Input buildPrism(std::string
const& programFile, std::string
const& formulaAsString, std::string
const& constantsAsString =
"")
const {
247 input.model = makeCanonic.transform();
248 EXPECT_TRUE(input.model->isCanonic());
249 if (TestType::preprocessingType == PreprocessingType::SelfloopReduction || TestType::preprocessingType == PreprocessingType::All) {
251 if (selfLoopEliminator.preservesFormula(*input.formula)) {
252 input.model = selfLoopEliminator.transform();
254 EXPECT_TRUE(input.formula->isOperatorFormula());
255 EXPECT_TRUE(input.formula->asOperatorFormula().hasOptimalityType());
258 EXPECT_TRUE(maximizing || input.formula->isProbabilityOperatorFormula());
259 EXPECT_TRUE(!maximizing || input.formula->isRewardOperatorFormula());
262 if (TestType::preprocessingType == PreprocessingType::QualitativeReduction || TestType::preprocessingType == PreprocessingType::All) {
263 EXPECT_TRUE(input.formula->isOperatorFormula());
264 EXPECT_TRUE(input.formula->asOperatorFormula().hasOptimalityType());
265 if (input.formula->isProbabilityOperatorFormula() &&
storm::solver::maximize(input.formula->asOperatorFormula().getOptimalityType())) {
270 input.model = kpt.
transform(*input.model, prob0States, prob1States);
273 EXPECT_TRUE(input.model->isCanonic());
277 return TestType::precision();
279 ValueType modelcheckingPrecision()
const {
280 if (TestType::isExactModelChecking)
281 return storm::utility::zero<ValueType>();
283 return storm::utility::convertNumber<ValueType>(1e-6);
285 bool isExact()
const {
286 return TestType::isExactModelChecking;
293typedef ::testing::Types<
DefaultDoubleVIEnvironment, SelfloopReductionDefaultDoubleVIEnvironment, QualitativeReductionDefaultDoubleVIEnvironment,
294 PreprocessedDefaultDoubleVIEnvironment, FineDoubleVIEnvironment, RefineDoubleVIEnvironment, PreprocessedRefineDoubleVIEnvironment,
295 DefaultDoubleOVIEnvironment, DefaultRationalPIEnvironment, PreprocessedDefaultRationalPIEnvironment>
300TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Pmax) {
301 typedef typename TestFixture::ValueType
ValueType;
303 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0");
305 auto result = checker.check(this->env(), *data.formula);
308 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
309 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
310 EXPECT_LE(result.diff(), this->precision())
311 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
312 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
315TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Pmax_SE) {
316 typedef typename TestFixture::ValueType
ValueType;
318 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0");
320 this->optionsWithStateElimination());
321 auto result = checker.check(this->env(), *data.formula);
324 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
325 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
326 EXPECT_LE(result.diff(), this->precision())
327 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
328 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
331TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Pmin) {
332 typedef typename TestFixture::ValueType
ValueType;
334 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0");
336 auto result = checker.check(this->env(), *data.formula);
339 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
340 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
341 EXPECT_LE(result.diff(), this->precision())
342 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
343 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
346TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Pmin_SE) {
347 typedef typename TestFixture::ValueType
ValueType;
349 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0");
351 this->optionsWithStateElimination());
352 auto result = checker.check(this->env(), *data.formula);
355 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
356 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
357 EXPECT_LE(result.diff(), this->precision())
358 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
359 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
362TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Pmax) {
363 typedef typename TestFixture::ValueType
ValueType;
365 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0.4");
367 auto result = checker.check(this->env(), *data.formula);
370 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
371 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
372 EXPECT_LE(result.diff(), this->precision())
373 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
374 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
377TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Pmax_SE) {
378 typedef typename TestFixture::ValueType
ValueType;
380 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0.4");
382 this->optionsWithStateElimination());
383 auto result = checker.check(this->env(), *data.formula);
386 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
387 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
388 EXPECT_LE(result.diff(), this->precision())
389 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
390 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
393TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Pmin) {
394 typedef typename TestFixture::ValueType
ValueType;
396 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0.4");
398 auto result = checker.check(this->env(), *data.formula);
401 if (this->isExact()) {
404 ValueType approxPrecision = storm::utility::convertNumber<ValueType>(1e-5);
405 EXPECT_LE(result.lowerBound, expected + approxPrecision);
406 EXPECT_GE(result.upperBound, expected - approxPrecision);
408 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
409 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
411 EXPECT_LE(result.diff(), this->precision())
412 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
413 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
416TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Pmin_SE) {
417 typedef typename TestFixture::ValueType
ValueType;
419 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0.4");
421 this->optionsWithStateElimination());
422 auto result = checker.check(this->env(), *data.formula);
425 if (this->isExact()) {
428 ValueType approxPrecision = storm::utility::convertNumber<ValueType>(1e-5);
429 EXPECT_LE(result.lowerBound, expected + approxPrecision);
430 EXPECT_GE(result.upperBound, expected - approxPrecision);
432 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
433 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
435 EXPECT_LE(result.diff(), this->precision())
436 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
437 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
440TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Rmax) {
441 typedef typename TestFixture::ValueType
ValueType;
443 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0");
445 auto result = checker.check(this->env(), *data.formula);
448 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
449 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
450 EXPECT_LE(result.diff(), this->precision())
451 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
452 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
455TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Rmax_SE) {
456 typedef typename TestFixture::ValueType
ValueType;
458 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0");
460 this->optionsWithStateElimination());
461 auto result = checker.check(this->env(), *data.formula);
464 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
465 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
466 EXPECT_LE(result.diff(), this->precision())
467 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
468 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
471TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Rmin) {
472 typedef typename TestFixture::ValueType
ValueType;
474 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0");
476 auto result = checker.check(this->env(), *data.formula);
479 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
480 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
481 EXPECT_LE(result.diff(), this->precision())
482 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
483 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
486TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Rmin_SE) {
487 typedef typename TestFixture::ValueType
ValueType;
489 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0");
491 this->optionsWithStateElimination());
492 auto result = checker.check(this->env(), *data.formula);
495 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
496 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
497 EXPECT_LE(result.diff(), this->precision())
498 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
499 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
502TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Rmax) {
503 typedef typename TestFixture::ValueType
ValueType;
505 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0.4");
507 auto result = checker.check(this->env(), *data.formula);
510 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
511 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
512 EXPECT_LE(result.diff(), this->precision())
513 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
514 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
517TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Rmax_SE) {
518 typedef typename TestFixture::ValueType
ValueType;
520 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0.4");
522 this->optionsWithStateElimination());
523 auto result = checker.check(this->env(), *data.formula);
526 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
527 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
528 EXPECT_LE(result.diff(), this->precision())
529 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
530 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
533TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Rmin) {
534 typedef typename TestFixture::ValueType
ValueType;
536 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0.4");
538 auto result = checker.check(this->env(), *data.formula);
541 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
542 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
543 EXPECT_LE(result.diff(), this->precision())
544 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
545 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
548TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Rmin_SE) {
549 typedef typename TestFixture::ValueType
ValueType;
551 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0.4");
553 this->optionsWithStateElimination());
554 auto result = checker.check(this->env(), *data.formula);
557 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
558 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
559 EXPECT_LE(result.diff(), this->precision())
560 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
561 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
564TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_Rmin) {
565 typedef typename TestFixture::ValueType
ValueType;
567 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0");
569 auto result = checker.check(this->env(), *data.formula);
572 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
573 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
575 EXPECT_LE(result.diff(), this->precision())
576 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
577 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
580TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_Rmin_SE) {
581 typedef typename TestFixture::ValueType
ValueType;
583 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0");
585 this->optionsWithStateElimination());
586 auto result = checker.check(this->env(), *data.formula);
589 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
590 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
592 EXPECT_LE(result.diff(), this->precision())
593 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
594 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
597TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_Rmax) {
598 typedef typename TestFixture::ValueType
ValueType;
600 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmax=? [F \"goal\"]",
"sl=0");
602 auto result = checker.check(this->env(), *data.formula);
608TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_Rmax_SE) {
609 typedef typename TestFixture::ValueType
ValueType;
611 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmax=? [F \"goal\"]",
"sl=0");
613 this->optionsWithStateElimination());
614 auto result = checker.check(this->env(), *data.formula);
620TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_slippery_Rmin) {
621 typedef typename TestFixture::ValueType
ValueType;
623 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0.075");
625 auto result = checker.check(this->env(), *data.formula);
628 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
629 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
631 EXPECT_LE(result.diff(), this->precision())
632 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
633 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
636TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_slippery_Rmin_SE) {
637 typedef typename TestFixture::ValueType
ValueType;
639 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0.075");
641 this->optionsWithStateElimination());
642 auto result = checker.check(this->env(), *data.formula);
645 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
646 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
648 EXPECT_LE(result.diff(), this->precision())
649 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
650 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
653TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_slippery_Rmax) {
654 typedef typename TestFixture::ValueType
ValueType;
656 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmax=? [F \"goal\"]",
"sl=0.075");
658 auto result = checker.check(this->env(), *data.formula);
664TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_slippery_Rmax_SE) {
665 typedef typename TestFixture::ValueType
ValueType;
667 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmax=? [F \"goal\"]",
"sl=0.075");
669 this->optionsWithStateElimination());
670 auto result = checker.check(this->env(), *data.formula);
676TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, refuel_Pmax) {
677 typedef typename TestFixture::ValueType
ValueType;
679 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmax=?[\"notbad\" U \"goal\"]",
"N=4");
681 auto result = checker.check(this->env(), *data.formula);
684 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
685 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
687 EXPECT_LE(result.diff(), this->precision())
688 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
689 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
692TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, refuel_Pmax_SE) {
693 typedef typename TestFixture::ValueType
ValueType;
695 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmax=?[\"notbad\" U \"goal\"]",
"N=4");
697 this->optionsWithStateElimination());
698 auto result = checker.check(this->env(), *data.formula);
701 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
702 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
704 EXPECT_LE(result.diff(), this->precision())
705 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
706 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
709TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, refuel_Pmin) {
710 typedef typename TestFixture::ValueType
ValueType;
712 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmin=?[\"notbad\" U \"goal\"]",
"N=4");
714 auto result = checker.check(this->env(), *data.formula);
717 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
718 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
720 EXPECT_LE(result.diff(), this->precision())
721 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
722 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
725TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, refuel_Pmin_SE) {
726 typedef typename TestFixture::ValueType
ValueType;
728 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmin=?[\"notbad\" U \"goal\"]",
"N=4");
730 this->optionsWithStateElimination());
731 auto result = checker.check(this->env(), *data.formula);
734 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
735 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
737 EXPECT_LE(result.diff(), this->precision())
738 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
739 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
742#if defined STORM_HAVE_Z3_OPTIMIZE
744TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Pmax_Clip) {
745 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
746 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
748 typedef typename TestFixture::ValueType
ValueType;
750 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0");
752 auto result = checker.check(this->env(), *data.formula);
755 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
756 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
757 EXPECT_LE(result.diff(), this->precision())
758 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
759 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
762TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Pmin_Clip) {
763 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
764 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
766 typedef typename TestFixture::ValueType
ValueType;
768 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0");
770 auto result = checker.check(this->env(), *data.formula);
773 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
774 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
775 EXPECT_LE(result.diff(), this->precision())
776 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
777 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
780TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Pmax_Clip) {
781 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
782 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
784 typedef typename TestFixture::ValueType
ValueType;
786 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0.4");
788 auto result = checker.check(this->env(), *data.formula);
791 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
792 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
793 EXPECT_LE(result.diff(), this->precision())
794 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
795 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
798TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Pmin_Clip) {
799 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
800 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
802 typedef typename TestFixture::ValueType
ValueType;
804 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0.4");
806 auto result = checker.check(this->env(), *data.formula);
809 if (this->isExact()) {
812 ValueType approxPrecision = storm::utility::convertNumber<ValueType>(1e-4);
813 EXPECT_LE(result.lowerBound, expected + approxPrecision);
814 EXPECT_GE(result.upperBound, expected - approxPrecision);
816 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision() * 10);
817 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision() * 10);
819 EXPECT_LE(result.diff(), this->precision())
820 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
821 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
824TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Rmax_Clip) {
825 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
826 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
828 typedef typename TestFixture::ValueType
ValueType;
830 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0");
832 auto result = checker.check(this->env(), *data.formula);
835 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
836 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
837 EXPECT_LE(result.diff(), this->precision())
838 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
839 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
842TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Rmin_Clip) {
843 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
844 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
846 typedef typename TestFixture::ValueType
ValueType;
848 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0");
850 auto result = checker.check(this->env(), *data.formula);
853 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
854 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
855 EXPECT_LE(result.diff(), this->precision())
856 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
857 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
860TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Rmax_Clip) {
861 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
862 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
864 typedef typename TestFixture::ValueType
ValueType;
866 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0.4");
868 auto result = checker.check(this->env(), *data.formula);
871 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
872 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
873 EXPECT_LE(result.diff(), this->precision())
874 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
875 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
878TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Rmin_Clip) {
879 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
880 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
882 typedef typename TestFixture::ValueType
ValueType;
884 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0.4");
886 auto result = checker.check(this->env(), *data.formula);
889 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
890 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
891 EXPECT_LE(result.diff(), this->precision())
892 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
893 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
896TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_Rmin_Clip) {
897 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
898 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
900 typedef typename TestFixture::ValueType
ValueType;
902 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0");
904 auto result = checker.check(this->env(), *data.formula);
907 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
908 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
910 EXPECT_LE(result.diff(), this->precision())
911 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
912 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
915TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_Rmax_Clip) {
916 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
917 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
919 typedef typename TestFixture::ValueType
ValueType;
921 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmax=? [F \"goal\"]",
"sl=0");
923 auto result = checker.check(this->env(), *data.formula);
929TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_slippery_Rmin_Clip) {
930 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
931 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
933 typedef typename TestFixture::ValueType
ValueType;
935 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0.075");
937 auto result = checker.check(this->env(), *data.formula);
940 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
941 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
943 EXPECT_LE(result.diff(), this->precision())
944 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
945 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
948TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_slippery_Rmax_Clip) {
949 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
950 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
952 typedef typename TestFixture::ValueType
ValueType;
954 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmax=? [F \"goal\"]",
"sl=0.075");
956 auto result = checker.check(this->env(), *data.formula);
962TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, refuel_Pmax_Clip) {
963 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
964 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
966 typedef typename TestFixture::ValueType
ValueType;
968 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmax=?[\"notbad\" U \"goal\"]",
"N=4");
970 auto result = checker.check(this->env(), *data.formula);
973 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
974 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
976 EXPECT_LE(result.diff(), this->precision())
977 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
978 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
981TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, refuel_Pmin_Clip) {
982 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
983 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
985 typedef typename TestFixture::ValueType
ValueType;
987 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmin=?[\"notbad\" U \"goal\"]",
"N=4");
989 auto result = checker.check(this->env(), *data.formula);
992 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
993 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
995 EXPECT_LE(result.diff(), this->precision())
996 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
997 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
static void adaptOptions(storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions< ValueType > &)
static ValueType precision()
static storm::Environment createEnvironment()
static bool const isExactModelChecking
SolverEnvironment & solver()
void setPrecision(storm::RationalNumber value)
void setMethod(storm::solver::MinMaxMethod value, bool isSetFromDefault=false)
MinMaxSolverEnvironment & minMax()
void setForceSoundness(bool value)
void setForceExact(bool value)
This class represents a partially observable Markov decision process.
Model checker for checking reachability queries on POMDPs using approximations based on exploration o...
A bit vector that is internally represented as a vector of 64-bit values.
std::vector< storm::jani::Property > parsePropertiesForPrismProgram(std::string const &inputString, storm::prism::Program const &program, boost::optional< std::set< std::string > > const &propertyFilter)
storm::prism::Program parseProgram(std::string const &filename, bool prismCompatibility, bool simplify)
SFTBDDChecker::ValueType ValueType
NumberType parseNumber(std::string const &value)
Parse number from string.
bool constexpr maximize(OptimizationDirection d)
storm::prism::Program preprocess(storm::prism::Program const &program, std::map< storm::expressions::Variable, storm::expressions::Expression > const &constantDefinitions)
bool isInfinity(ValueType const &a)
TYPED_TEST(GraphTestAR, SymbolicProb01StochasticGameDieSmall)
TYPED_TEST_SUITE(GraphTestAR, TestingTypes,)
::testing::Types< Cudd, Sylvan > TestingTypes
ValueType refinePrecision