1#include "storm-config.h"
15enum class PreprocessingType {
None, SelfloopReduction, QualitativeReduction, All };
28 return storm::utility::convertNumber<ValueType>(0.12);
31 static PreprocessingType
const preprocessingType = PreprocessingType::None;
34class SelfloopReductionDefaultDoubleVIEnvironment {
43 static bool const isExactModelChecking =
false;
45 return storm::utility::convertNumber<ValueType>(0.12);
48 static PreprocessingType
const preprocessingType = PreprocessingType::SelfloopReduction;
51class QualitativeReductionDefaultDoubleVIEnvironment {
60 static bool const isExactModelChecking =
false;
62 return storm::utility::convertNumber<ValueType>(0.12);
65 static PreprocessingType
const preprocessingType = PreprocessingType::QualitativeReduction;
68class PreprocessedDefaultDoubleVIEnvironment {
77 static bool const isExactModelChecking =
false;
79 return storm::utility::convertNumber<ValueType>(0.12);
82 static PreprocessingType
const preprocessingType = PreprocessingType::All;
85class FineDoubleVIEnvironment {
94 static bool const isExactModelChecking =
false;
96 return storm::utility::convertNumber<ValueType>(0.02);
101 static PreprocessingType
const preprocessingType = PreprocessingType::None;
104class RefineDoubleVIEnvironment {
113 static bool const isExactModelChecking =
false;
115 return storm::utility::convertNumber<ValueType>(0.005);
117 static PreprocessingType
const preprocessingType = PreprocessingType::None;
124class PreprocessedRefineDoubleVIEnvironment {
133 static bool const isExactModelChecking =
false;
135 return storm::utility::convertNumber<ValueType>(0.005);
137 static PreprocessingType
const preprocessingType = PreprocessingType::All;
144class DefaultDoubleOVIEnvironment {
154 static bool const isExactModelChecking =
false;
156 return storm::utility::convertNumber<ValueType>(0.12);
159 static PreprocessingType
const preprocessingType = PreprocessingType::None;
162class DefaultRationalPIEnvironment {
171 static bool const isExactModelChecking =
true;
173 return storm::utility::convertNumber<ValueType>(0.12);
176 static PreprocessingType
const preprocessingType = PreprocessingType::None;
179class PreprocessedDefaultRationalPIEnvironment {
188 static bool const isExactModelChecking =
true;
190 return storm::utility::convertNumber<ValueType>(0.12);
193 static PreprocessingType
const preprocessingType = PreprocessingType::All;
196template<
typename TestType>
197class BeliefExplorationPomdpModelCheckerTest :
public ::testing::Test {
199 typedef typename TestType::ValueType
ValueType;
200 BeliefExplorationPomdpModelCheckerTest() : _environment(TestType::createEnvironment()) {}
202 void SetUp()
override {
204 GTEST_SKIP() <<
"Z3 not available.";
213 opt.gapThresholdInit = 0;
214 TestType::adaptOptions(opt);
219 opt.gapThresholdInit = 0;
220 TestType::adaptOptions(opt);
221 opt.useStateEliminationCutoff =
true;
226 opt.gapThresholdInit = 0;
227 TestType::adaptOptions(opt);
228 opt.useClipping =
true;
232 return storm::utility::convertNumber<ValueType>(str);
235 std::shared_ptr<storm::models::sparse::Pomdp<ValueType>> model;
236 std::shared_ptr<storm::logic::Formula const> formula;
238 Input buildPrism(std::string
const& programFile, std::string
const& formulaAsString, std::string
const& constantsAsString =
"")
const {
248 input.model = makeCanonic.transform();
249 EXPECT_TRUE(input.model->isCanonic());
250 if (TestType::preprocessingType == PreprocessingType::SelfloopReduction || TestType::preprocessingType == PreprocessingType::All) {
252 if (selfLoopEliminator.preservesFormula(*input.formula)) {
253 input.model = selfLoopEliminator.transform();
255 EXPECT_TRUE(input.formula->isOperatorFormula());
256 EXPECT_TRUE(input.formula->asOperatorFormula().hasOptimalityType());
259 EXPECT_TRUE(maximizing || input.formula->isProbabilityOperatorFormula());
260 EXPECT_TRUE(!maximizing || input.formula->isRewardOperatorFormula());
263 if (TestType::preprocessingType == PreprocessingType::QualitativeReduction || TestType::preprocessingType == PreprocessingType::All) {
264 EXPECT_TRUE(input.formula->isOperatorFormula());
265 EXPECT_TRUE(input.formula->asOperatorFormula().hasOptimalityType());
266 if (input.formula->isProbabilityOperatorFormula() &&
storm::solver::maximize(input.formula->asOperatorFormula().getOptimalityType())) {
271 input.model = kpt.
transform(*input.model, prob0States, prob1States);
274 EXPECT_TRUE(input.model->isCanonic());
278 return TestType::precision();
280 ValueType modelcheckingPrecision()
const {
281 if (TestType::isExactModelChecking)
282 return storm::utility::zero<ValueType>();
284 return storm::utility::convertNumber<ValueType>(1e-6);
286 bool isExact()
const {
287 return TestType::isExactModelChecking;
294typedef ::testing::Types<
DefaultDoubleVIEnvironment, SelfloopReductionDefaultDoubleVIEnvironment, QualitativeReductionDefaultDoubleVIEnvironment,
295 PreprocessedDefaultDoubleVIEnvironment, FineDoubleVIEnvironment, RefineDoubleVIEnvironment, PreprocessedRefineDoubleVIEnvironment,
296 DefaultDoubleOVIEnvironment, DefaultRationalPIEnvironment, PreprocessedDefaultRationalPIEnvironment>
301TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Pmax) {
302 typedef typename TestFixture::ValueType
ValueType;
304 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0");
306 auto result = checker.check(this->env(), *data.formula);
309 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
310 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
311 EXPECT_LE(result.diff(), this->precision())
312 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
313 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
316TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Pmax_SE) {
317 typedef typename TestFixture::ValueType
ValueType;
319 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0");
321 this->optionsWithStateElimination());
322 auto result = checker.check(this->env(), *data.formula);
325 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
326 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
327 EXPECT_LE(result.diff(), this->precision())
328 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
329 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
332TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Pmin) {
333 typedef typename TestFixture::ValueType
ValueType;
335 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0");
337 auto result = checker.check(this->env(), *data.formula);
340 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
341 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
342 EXPECT_LE(result.diff(), this->precision())
343 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
344 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
347TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Pmin_SE) {
348 typedef typename TestFixture::ValueType
ValueType;
350 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0");
352 this->optionsWithStateElimination());
353 auto result = checker.check(this->env(), *data.formula);
356 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
357 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
358 EXPECT_LE(result.diff(), this->precision())
359 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
360 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
363TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Pmax) {
364 typedef typename TestFixture::ValueType
ValueType;
366 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0.4");
368 auto result = checker.check(this->env(), *data.formula);
371 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
372 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
373 EXPECT_LE(result.diff(), this->precision())
374 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
375 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
378TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Pmax_SE) {
379 typedef typename TestFixture::ValueType
ValueType;
381 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0.4");
383 this->optionsWithStateElimination());
384 auto result = checker.check(this->env(), *data.formula);
387 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
388 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
389 EXPECT_LE(result.diff(), this->precision())
390 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
391 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
394TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Pmin) {
395 typedef typename TestFixture::ValueType
ValueType;
397 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0.4");
399 auto result = checker.check(this->env(), *data.formula);
402 if (this->isExact()) {
405 ValueType approxPrecision = storm::utility::convertNumber<ValueType>(1e-5);
406 EXPECT_LE(result.lowerBound, expected + approxPrecision);
407 EXPECT_GE(result.upperBound, expected - approxPrecision);
409 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
410 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
412 EXPECT_LE(result.diff(), this->precision())
413 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
414 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
417TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Pmin_SE) {
418 typedef typename TestFixture::ValueType
ValueType;
420 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0.4");
422 this->optionsWithStateElimination());
423 auto result = checker.check(this->env(), *data.formula);
426 if (this->isExact()) {
429 ValueType approxPrecision = storm::utility::convertNumber<ValueType>(1e-5);
430 EXPECT_LE(result.lowerBound, expected + approxPrecision);
431 EXPECT_GE(result.upperBound, expected - approxPrecision);
433 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
434 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
436 EXPECT_LE(result.diff(), this->precision())
437 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
438 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
441TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Rmax) {
442 typedef typename TestFixture::ValueType
ValueType;
444 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0");
446 auto result = checker.check(this->env(), *data.formula);
449 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
450 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
451 EXPECT_LE(result.diff(), this->precision())
452 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
453 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
456TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Rmax_SE) {
457 typedef typename TestFixture::ValueType
ValueType;
459 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0");
461 this->optionsWithStateElimination());
462 auto result = checker.check(this->env(), *data.formula);
465 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
466 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
467 EXPECT_LE(result.diff(), this->precision())
468 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
469 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
472TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Rmin) {
473 typedef typename TestFixture::ValueType
ValueType;
475 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0");
477 auto result = checker.check(this->env(), *data.formula);
480 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
481 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
482 EXPECT_LE(result.diff(), this->precision())
483 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
484 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
487TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Rmin_SE) {
488 typedef typename TestFixture::ValueType
ValueType;
490 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0");
492 this->optionsWithStateElimination());
493 auto result = checker.check(this->env(), *data.formula);
496 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
497 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
498 EXPECT_LE(result.diff(), this->precision())
499 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
500 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
503TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Rmax) {
504 typedef typename TestFixture::ValueType
ValueType;
506 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0.4");
508 auto result = checker.check(this->env(), *data.formula);
511 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
512 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
513 EXPECT_LE(result.diff(), this->precision())
514 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
515 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
518TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Rmax_SE) {
519 typedef typename TestFixture::ValueType
ValueType;
521 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0.4");
523 this->optionsWithStateElimination());
524 auto result = checker.check(this->env(), *data.formula);
527 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
528 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
529 EXPECT_LE(result.diff(), this->precision())
530 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
531 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
534TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Rmin) {
535 typedef typename TestFixture::ValueType
ValueType;
537 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0.4");
539 auto result = checker.check(this->env(), *data.formula);
542 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
543 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
544 EXPECT_LE(result.diff(), this->precision())
545 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
546 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
549TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Rmin_SE) {
550 typedef typename TestFixture::ValueType
ValueType;
552 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0.4");
554 this->optionsWithStateElimination());
555 auto result = checker.check(this->env(), *data.formula);
558 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
559 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
560 EXPECT_LE(result.diff(), this->precision())
561 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
562 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
565TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_Rmin) {
566 typedef typename TestFixture::ValueType
ValueType;
568 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0");
570 auto result = checker.check(this->env(), *data.formula);
573 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
574 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
576 EXPECT_LE(result.diff(), this->precision())
577 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
578 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
581TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_Rmin_SE) {
582 typedef typename TestFixture::ValueType
ValueType;
584 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0");
586 this->optionsWithStateElimination());
587 auto result = checker.check(this->env(), *data.formula);
590 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
591 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
593 EXPECT_LE(result.diff(), this->precision())
594 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
595 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
598TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_Rmax) {
599 typedef typename TestFixture::ValueType
ValueType;
601 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmax=? [F \"goal\"]",
"sl=0");
603 auto result = checker.check(this->env(), *data.formula);
609TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_Rmax_SE) {
610 typedef typename TestFixture::ValueType
ValueType;
612 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmax=? [F \"goal\"]",
"sl=0");
614 this->optionsWithStateElimination());
615 auto result = checker.check(this->env(), *data.formula);
621TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_slippery_Rmin) {
622 typedef typename TestFixture::ValueType
ValueType;
624 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0.075");
626 auto result = checker.check(this->env(), *data.formula);
629 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
630 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
632 EXPECT_LE(result.diff(), this->precision())
633 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
634 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
637TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_slippery_Rmin_SE) {
638 typedef typename TestFixture::ValueType
ValueType;
640 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0.075");
642 this->optionsWithStateElimination());
643 auto result = checker.check(this->env(), *data.formula);
646 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
647 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
649 EXPECT_LE(result.diff(), this->precision())
650 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
651 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
654TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_slippery_Rmax) {
655 typedef typename TestFixture::ValueType
ValueType;
657 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmax=? [F \"goal\"]",
"sl=0.075");
659 auto result = checker.check(this->env(), *data.formula);
665TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_slippery_Rmax_SE) {
666 typedef typename TestFixture::ValueType
ValueType;
668 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmax=? [F \"goal\"]",
"sl=0.075");
670 this->optionsWithStateElimination());
671 auto result = checker.check(this->env(), *data.formula);
677TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, refuel_Pmax) {
678 typedef typename TestFixture::ValueType
ValueType;
680 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmax=?[\"notbad\" U \"goal\"]",
"N=4");
682 auto result = checker.check(this->env(), *data.formula);
685 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
686 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
688 EXPECT_LE(result.diff(), this->precision())
689 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
690 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
693TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, refuel_Pmax_SE) {
694 typedef typename TestFixture::ValueType
ValueType;
696 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmax=?[\"notbad\" U \"goal\"]",
"N=4");
698 this->optionsWithStateElimination());
699 auto result = checker.check(this->env(), *data.formula);
702 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
703 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
705 EXPECT_LE(result.diff(), this->precision())
706 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
707 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
710TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, refuel_Pmin) {
711 typedef typename TestFixture::ValueType
ValueType;
713 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmin=?[\"notbad\" U \"goal\"]",
"N=4");
715 auto result = checker.check(this->env(), *data.formula);
718 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
719 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
721 EXPECT_LE(result.diff(), this->precision())
722 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
723 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
726TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, refuel_Pmin_SE) {
727 typedef typename TestFixture::ValueType
ValueType;
729 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmin=?[\"notbad\" U \"goal\"]",
"N=4");
731 this->optionsWithStateElimination());
732 auto result = checker.check(this->env(), *data.formula);
735 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
736 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
738 EXPECT_LE(result.diff(), this->precision())
739 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
740 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
743#if defined STORM_HAVE_Z3_OPTIMIZE
745TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Pmax_Clip) {
746 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
747 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
749 typedef typename TestFixture::ValueType
ValueType;
751 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0");
753 auto result = checker.check(this->env(), *data.formula);
756 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
757 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
758 EXPECT_LE(result.diff(), this->precision())
759 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
760 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
763TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Pmin_Clip) {
764 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
765 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
767 typedef typename TestFixture::ValueType
ValueType;
769 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0");
771 auto result = checker.check(this->env(), *data.formula);
774 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
775 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
776 EXPECT_LE(result.diff(), this->precision())
777 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
778 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
781TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Pmax_Clip) {
782 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
783 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
785 typedef typename TestFixture::ValueType
ValueType;
787 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0.4");
789 auto result = checker.check(this->env(), *data.formula);
792 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
793 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
794 EXPECT_LE(result.diff(), this->precision())
795 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
796 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
799TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Pmin_Clip) {
800 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
801 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
803 typedef typename TestFixture::ValueType
ValueType;
805 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0.4");
807 auto result = checker.check(this->env(), *data.formula);
810 if (this->isExact()) {
813 ValueType approxPrecision = storm::utility::convertNumber<ValueType>(1e-4);
814 EXPECT_LE(result.lowerBound, expected + approxPrecision);
815 EXPECT_GE(result.upperBound, expected - approxPrecision);
817 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision() * 10);
818 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision() * 10);
820 EXPECT_LE(result.diff(), this->precision())
821 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
822 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
825TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Rmax_Clip) {
826 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
827 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
829 typedef typename TestFixture::ValueType
ValueType;
831 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0");
833 auto result = checker.check(this->env(), *data.formula);
836 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
837 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
838 EXPECT_LE(result.diff(), this->precision())
839 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
840 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
843TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Rmin_Clip) {
844 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
845 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
847 typedef typename TestFixture::ValueType
ValueType;
849 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0");
851 auto result = checker.check(this->env(), *data.formula);
854 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
855 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
856 EXPECT_LE(result.diff(), this->precision())
857 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
858 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
861TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Rmax_Clip) {
862 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
863 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
865 typedef typename TestFixture::ValueType
ValueType;
867 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0.4");
869 auto result = checker.check(this->env(), *data.formula);
872 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
873 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
874 EXPECT_LE(result.diff(), this->precision())
875 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
876 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
879TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Rmin_Clip) {
880 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
881 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
883 typedef typename TestFixture::ValueType
ValueType;
885 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0.4");
887 auto result = checker.check(this->env(), *data.formula);
890 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
891 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
892 EXPECT_LE(result.diff(), this->precision())
893 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
894 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
897TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_Rmin_Clip) {
898 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
899 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
901 typedef typename TestFixture::ValueType
ValueType;
903 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0");
905 auto result = checker.check(this->env(), *data.formula);
908 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
909 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
911 EXPECT_LE(result.diff(), this->precision())
912 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
913 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
916TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_Rmax_Clip) {
917 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
918 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
920 typedef typename TestFixture::ValueType
ValueType;
922 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmax=? [F \"goal\"]",
"sl=0");
924 auto result = checker.check(this->env(), *data.formula);
930TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_slippery_Rmin_Clip) {
931 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
932 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
934 typedef typename TestFixture::ValueType
ValueType;
936 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0.075");
938 auto result = checker.check(this->env(), *data.formula);
941 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
942 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
944 EXPECT_LE(result.diff(), this->precision())
945 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
946 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
949TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_slippery_Rmax_Clip) {
950 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
951 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
953 typedef typename TestFixture::ValueType
ValueType;
955 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmax=? [F \"goal\"]",
"sl=0.075");
957 auto result = checker.check(this->env(), *data.formula);
963TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, refuel_Pmax_Clip) {
964 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
965 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
967 typedef typename TestFixture::ValueType
ValueType;
969 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmax=?[\"notbad\" U \"goal\"]",
"N=4");
971 auto result = checker.check(this->env(), *data.formula);
974 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
975 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
977 EXPECT_LE(result.diff(), this->precision())
978 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
979 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
982TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, refuel_Pmin_Clip) {
983 if (!storm::test::z3AtLeastVersion(4, 8, 5)) {
984 GTEST_SKIP() <<
"Test disabled since it triggers a bug in the installed version of z3.";
986 typedef typename TestFixture::ValueType
ValueType;
988 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmin=?[\"notbad\" U \"goal\"]",
"N=4");
990 auto result = checker.check(this->env(), *data.formula);
993 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
994 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
996 EXPECT_LE(result.diff(), this->precision())
997 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
998 <<
"] 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