1#include "storm-config.h"
14enum class PreprocessingType {
None, SelfloopReduction, QualitativeReduction, All };
20 storm::Environment env;
29 static void adaptOptions(storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType>&) { }
30 static PreprocessingType
const preprocessingType = PreprocessingType::None;
33class SelfloopReductionDefaultDoubleVIEnvironment {
35 typedef double ValueType;
36 static storm::Environment createEnvironment() {
37 storm::Environment env;
42 static bool const isExactModelChecking =
false;
43 static ValueType precision() {
46 static void adaptOptions(storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType>&) { }
47 static PreprocessingType
const preprocessingType = PreprocessingType::SelfloopReduction;
50class QualitativeReductionDefaultDoubleVIEnvironment {
52 typedef double ValueType;
53 static storm::Environment createEnvironment() {
54 storm::Environment env;
59 static bool const isExactModelChecking =
false;
60 static ValueType precision() {
63 static void adaptOptions(storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType>&) { }
64 static PreprocessingType
const preprocessingType = PreprocessingType::QualitativeReduction;
67class PreprocessedDefaultDoubleVIEnvironment {
69 typedef double ValueType;
70 static storm::Environment createEnvironment() {
71 storm::Environment env;
76 static bool const isExactModelChecking =
false;
77 static ValueType precision() {
80 static void adaptOptions(storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType>&) { }
81 static PreprocessingType
const preprocessingType = PreprocessingType::All;
84class FineDoubleVIEnvironment {
86 typedef double ValueType;
87 static storm::Environment createEnvironment() {
88 storm::Environment env;
93 static bool const isExactModelChecking =
false;
94 static ValueType precision() {
97 static void adaptOptions(storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType>& options) {
100 static PreprocessingType
const preprocessingType = PreprocessingType::None;
103class RefineDoubleVIEnvironment {
105 typedef double ValueType;
106 static storm::Environment createEnvironment() {
107 storm::Environment env;
112 static bool const isExactModelChecking =
false;
113 static ValueType precision() {
116 static PreprocessingType
const preprocessingType = PreprocessingType::None;
117 static void adaptOptions(storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType>& options) {
123class PreprocessedRefineDoubleVIEnvironment {
125 typedef double ValueType;
126 static storm::Environment createEnvironment() {
127 storm::Environment env;
132 static bool const isExactModelChecking =
false;
133 static ValueType precision() {
136 static PreprocessingType
const preprocessingType = PreprocessingType::All;
137 static void adaptOptions(storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType>& options) {
143class DefaultDoubleOVIEnvironment {
145 typedef double ValueType;
146 static storm::Environment createEnvironment() {
147 storm::Environment env;
153 static bool const isExactModelChecking =
false;
154 static ValueType precision() {
157 static void adaptOptions(storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType>&) { }
158 static PreprocessingType
const preprocessingType = PreprocessingType::None;
161class DefaultRationalPIEnvironment {
163 typedef storm::RationalNumber ValueType;
164 static storm::Environment createEnvironment() {
165 storm::Environment env;
170 static bool const isExactModelChecking =
true;
171 static ValueType precision() {
174 static void adaptOptions(storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType>&) { }
175 static PreprocessingType
const preprocessingType = PreprocessingType::None;
178class PreprocessedDefaultRationalPIEnvironment {
180 typedef storm::RationalNumber ValueType;
181 static storm::Environment createEnvironment() {
182 storm::Environment env;
187 static bool const isExactModelChecking =
true;
188 static ValueType precision() {
191 static void adaptOptions(storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType>&) { }
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.";
207 storm::Environment
const& env()
const {
210 storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType> options()
const {
211 storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType> opt(
true,
true);
212 opt.gapThresholdInit = 0;
213 TestType::adaptOptions(opt);
216 storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType> optionsWithStateElimination()
const {
217 storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType> opt(
true,
true);
218 opt.gapThresholdInit = 0;
219 TestType::adaptOptions(opt);
220 opt.useStateEliminationCutoff =
true;
223 storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType> optionsWithClipping()
const {
224 storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType> opt(
true,
true);
225 opt.gapThresholdInit = 0;
226 TestType::adaptOptions(opt);
227 opt.useClipping =
true;
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 {
240 program = program.
preprocess(constantsAsString);
246 storm::transformer::MakePOMDPCanonic<ValueType> makeCanonic(*input.model);
247 input.model = makeCanonic.transform();
248 EXPECT_TRUE(input.model->isCanonic());
249 if (TestType::preprocessingType == PreprocessingType::SelfloopReduction || TestType::preprocessingType == PreprocessingType::All) {
250 storm::transformer::GlobalPOMDPSelfLoopEliminator<ValueType> selfLoopEliminator(*input.model);
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())) {
266 storm::analysis::QualitativeAnalysisOnGraphs<ValueType> qualitativeAnalysis(*input.model);
267 storm::storage::BitVector prob0States = qualitativeAnalysis.analyseProb0(input.formula->asProbabilityOperatorFormula());
268 storm::storage::BitVector prob1States = qualitativeAnalysis.analyseProb1(input.formula->asProbabilityOperatorFormula());
269 storm::pomdp::transformer::KnownProbabilityTransformer<ValueType> kpt;
270 input.model = kpt.
transform(*input.model, prob0States, prob1States);
273 EXPECT_TRUE(input.model->isCanonic());
276 ValueType precision()
const {
277 return TestType::precision();
279 ValueType modelcheckingPrecision()
const {
280 if (TestType::isExactModelChecking) {
286 bool isExact()
const {
287 return TestType::isExactModelChecking;
291 storm::Environment _environment;
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()) {
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()) {
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";
743TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Pmax_Clip) {
744 typedef typename TestFixture::ValueType
ValueType;
746 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0");
748 auto result = checker.check(this->env(), *data.formula);
751 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
752 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
753 EXPECT_LE(result.diff(), this->precision())
754 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
755 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
758TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Pmin_Clip) {
759 typedef typename TestFixture::ValueType
ValueType;
761 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0");
763 auto result = checker.check(this->env(), *data.formula);
766 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
767 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
768 EXPECT_LE(result.diff(), this->precision())
769 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
770 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
773TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Pmax_Clip) {
774 typedef typename TestFixture::ValueType
ValueType;
776 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0.4");
778 auto result = checker.check(this->env(), *data.formula);
781 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
782 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
783 EXPECT_LE(result.diff(), this->precision())
784 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
785 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
788TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Pmin_Clip) {
789 typedef typename TestFixture::ValueType
ValueType;
791 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0.4");
793 auto result = checker.check(this->env(), *data.formula);
796 if (this->isExact()) {
800 EXPECT_LE(result.lowerBound, expected + approxPrecision);
801 EXPECT_GE(result.upperBound, expected - approxPrecision);
803 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision() * 10);
804 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision() * 10);
806 EXPECT_LE(result.diff(), this->precision())
807 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
808 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
811TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Rmax_Clip) {
812 typedef typename TestFixture::ValueType
ValueType;
814 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0");
816 auto result = checker.check(this->env(), *data.formula);
819 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
820 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
821 EXPECT_LE(result.diff(), this->precision())
822 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
823 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
826TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Rmin_Clip) {
827 typedef typename TestFixture::ValueType
ValueType;
829 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0");
831 auto result = checker.check(this->env(), *data.formula);
834 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
835 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
836 EXPECT_LE(result.diff(), this->precision())
837 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
838 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
841TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Rmax_Clip) {
842 typedef typename TestFixture::ValueType
ValueType;
844 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0.4");
846 auto result = checker.check(this->env(), *data.formula);
849 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
850 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
851 EXPECT_LE(result.diff(), this->precision())
852 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
853 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
856TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Rmin_Clip) {
857 typedef typename TestFixture::ValueType
ValueType;
859 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0.4");
861 auto result = checker.check(this->env(), *data.formula);
864 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
865 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
866 EXPECT_LE(result.diff(), this->precision())
867 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
868 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
871TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_Rmin_Clip) {
872 typedef typename TestFixture::ValueType
ValueType;
874 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0");
876 auto result = checker.check(this->env(), *data.formula);
879 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
880 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
882 EXPECT_LE(result.diff(), this->precision())
883 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
884 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
887TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_Rmax_Clip) {
888 typedef typename TestFixture::ValueType
ValueType;
890 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmax=? [F \"goal\"]",
"sl=0");
892 auto result = checker.check(this->env(), *data.formula);
898TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_slippery_Rmin_Clip) {
899 typedef typename TestFixture::ValueType
ValueType;
901 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0.075");
903 auto result = checker.check(this->env(), *data.formula);
906 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
907 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
909 EXPECT_LE(result.diff(), this->precision())
910 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
911 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
914TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_slippery_Rmax_Clip) {
915 typedef typename TestFixture::ValueType
ValueType;
917 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmax=? [F \"goal\"]",
"sl=0.075");
919 auto result = checker.check(this->env(), *data.formula);
925TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, refuel_Pmax_Clip) {
926 typedef typename TestFixture::ValueType
ValueType;
928 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmax=?[\"notbad\" U \"goal\"]",
"N=4");
930 auto result = checker.check(this->env(), *data.formula);
933 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
934 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
936 EXPECT_LE(result.diff(), this->precision())
937 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
938 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
941TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, refuel_Pmin_Clip) {
942 typedef typename TestFixture::ValueType
ValueType;
944 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmin=?[\"notbad\" U \"goal\"]",
"N=4");
946 auto result = checker.check(this->env(), *data.formula);
949 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
950 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
952 EXPECT_LE(result.diff(), this->precision())
953 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
954 <<
"] 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)
Model checker for checking reachability queries on POMDPs using approximations based on exploration o...
Program preprocess(std::map< storm::expressions::Variable, storm::expressions::Expression > const &constantDefinitions) const
Preprocesses the program by defining the given constant definitions, substituting constants and formu...
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)
std::shared_ptr< storm::models::sparse::Model< ValueType > > buildSparseModel(storm::storage::SymbolicModelDescription const &model, storm::builder::BuilderOptions const &options, typename storm::builder::ExplicitModelBuilder< ValueType >::Options const &explorationOptions=typename storm::builder::ExplicitModelBuilder< ValueType >::Options())
SFTBDDChecker::ValueType ValueType
NumberType parseNumber(std::string const &value)
Parse number from string.
bool constexpr maximize(OptimizationDirection d)
bool isInfinity(ValueType const &a)
TargetType convertNumber(SourceType const &number)
TYPED_TEST(GraphTestAR, SymbolicProb01StochasticGameDieSmall)
TYPED_TEST_SUITE(GraphTestAR, TestingTypes,)
::testing::Types< Cudd, Sylvan > TestingTypes
ValueType refinePrecision