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 {
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)
285 bool isExact()
const {
286 return TestType::isExactModelChecking;
290 storm::Environment _environment;
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()) {
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()) {
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";
742TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Pmax_Clip) {
743 typedef typename TestFixture::ValueType
ValueType;
745 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0");
747 auto result = checker.check(this->env(), *data.formula);
750 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
751 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
752 EXPECT_LE(result.diff(), this->precision())
753 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
754 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
757TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Pmin_Clip) {
758 typedef typename TestFixture::ValueType
ValueType;
760 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0");
762 auto result = checker.check(this->env(), *data.formula);
765 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
766 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
767 EXPECT_LE(result.diff(), this->precision())
768 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
769 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
772TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Pmax_Clip) {
773 typedef typename TestFixture::ValueType
ValueType;
775 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0.4");
777 auto result = checker.check(this->env(), *data.formula);
780 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
781 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
782 EXPECT_LE(result.diff(), this->precision())
783 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
784 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
787TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Pmin_Clip) {
788 typedef typename TestFixture::ValueType
ValueType;
790 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0.4");
792 auto result = checker.check(this->env(), *data.formula);
795 if (this->isExact()) {
799 EXPECT_LE(result.lowerBound, expected + approxPrecision);
800 EXPECT_GE(result.upperBound, expected - approxPrecision);
802 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision() * 10);
803 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision() * 10);
805 EXPECT_LE(result.diff(), this->precision())
806 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
807 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
810TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_Rmax_Clip) {
811 typedef typename TestFixture::ValueType
ValueType;
813 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0");
815 auto result = checker.check(this->env(), *data.formula);
818 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
819 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
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_Rmin_Clip) {
826 typedef typename TestFixture::ValueType
ValueType;
828 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0");
830 auto result = checker.check(this->env(), *data.formula);
833 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
834 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
835 EXPECT_LE(result.diff(), this->precision())
836 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
837 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
840TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Rmax_Clip) {
841 typedef typename TestFixture::ValueType
ValueType;
843 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0.4");
845 auto result = checker.check(this->env(), *data.formula);
848 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
849 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
850 EXPECT_LE(result.diff(), this->precision())
851 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
852 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
855TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, simple_slippery_Rmin_Clip) {
856 typedef typename TestFixture::ValueType
ValueType;
858 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0.4");
860 auto result = checker.check(this->env(), *data.formula);
863 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
864 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
865 EXPECT_LE(result.diff(), this->precision())
866 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
867 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
870TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_Rmin_Clip) {
871 typedef typename TestFixture::ValueType
ValueType;
873 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0");
875 auto result = checker.check(this->env(), *data.formula);
878 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
879 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
881 EXPECT_LE(result.diff(), this->precision())
882 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
883 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
886TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_Rmax_Clip) {
887 typedef typename TestFixture::ValueType
ValueType;
889 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmax=? [F \"goal\"]",
"sl=0");
891 auto result = checker.check(this->env(), *data.formula);
897TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_slippery_Rmin_Clip) {
898 typedef typename TestFixture::ValueType
ValueType;
900 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0.075");
902 auto result = checker.check(this->env(), *data.formula);
905 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
906 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
908 EXPECT_LE(result.diff(), this->precision())
909 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
910 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
913TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, maze2_slippery_Rmax_Clip) {
914 typedef typename TestFixture::ValueType
ValueType;
916 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmax=? [F \"goal\"]",
"sl=0.075");
918 auto result = checker.check(this->env(), *data.formula);
924TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, refuel_Pmax_Clip) {
925 typedef typename TestFixture::ValueType
ValueType;
927 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmax=?[\"notbad\" U \"goal\"]",
"N=4");
929 auto result = checker.check(this->env(), *data.formula);
932 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
933 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
935 EXPECT_LE(result.diff(), this->precision())
936 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
937 <<
"] is not precise enough. If (only) this fails, the result bounds are still correct, but they might be unexpectedly imprecise.\n";
940TYPED_TEST(BeliefExplorationPomdpModelCheckerTest, refuel_Pmin_Clip) {
941 typedef typename TestFixture::ValueType
ValueType;
943 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmin=?[\"notbad\" U \"goal\"]",
"N=4");
945 auto result = checker.check(this->env(), *data.formula);
948 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
949 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
951 EXPECT_LE(result.diff(), this->precision())
952 <<
"Result [" << result.lowerBound <<
", " << result.upperBound
953 <<
"] 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...
std::vector< storm::jani::Property > parsePropertiesForPrismProgram(std::string const &inputString, storm::prism::Program const &program, boost::optional< std::set< std::string > > const &propertyFilter)
std::shared_ptr< storm::models::sparse::Model< ValueType > > buildSparseModel(storm::storage::SymbolicModelDescription const &model, storm::builder::BuilderOptions const &options)
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)
TargetType convertNumber(SourceType const &number)
TYPED_TEST(GraphTestAR, SymbolicProb01StochasticGameDieSmall)
TYPED_TEST_SUITE(GraphTestAR, TestingTypes,)
::testing::Types< Cudd, Sylvan > TestingTypes
ValueType refinePrecision