1#include "storm-config.h"
32enum class MdpEngine { PrismSparse, JaniSparse,
Hybrid, PrismDd, JaniDd };
34class SparseDoubleValueIterationViOpGaussSeidelMultEnvironment {
37 static const MdpEngine engine = MdpEngine::PrismSparse;
38 static const bool isExact =
false;
39 typedef double ValueType;
40 typedef storm::models::sparse::Mdp<ValueType> ModelType;
41 static storm::Environment createEnvironment() {
42 storm::Environment env;
51class SparseDoubleValueIterationViOpRegularMultEnvironment {
54 static const MdpEngine engine = MdpEngine::PrismSparse;
55 static const bool isExact =
false;
56 typedef double ValueType;
57 typedef storm::models::sparse::Mdp<ValueType> ModelType;
58 static storm::Environment createEnvironment() {
59 storm::Environment env;
68class SparseDoubleValueIterationNativeGaussSeidelMultEnvironment {
71 static const MdpEngine engine = MdpEngine::PrismSparse;
72 static const bool isExact =
false;
73 typedef double ValueType;
74 typedef storm::models::sparse::Mdp<ValueType> ModelType;
75 static storm::Environment createEnvironment() {
76 storm::Environment env;
85class SparseDoubleValueIterationNativeRegularMultEnvironment {
88 static const MdpEngine engine = MdpEngine::PrismSparse;
89 static const bool isExact =
false;
90 typedef double ValueType;
91 typedef storm::models::sparse::Mdp<ValueType> ModelType;
92 static storm::Environment createEnvironment() {
93 storm::Environment env;
102class JaniSparseDoubleValueIterationEnvironment {
105 static const MdpEngine engine = MdpEngine::JaniSparse;
106 static const bool isExact =
false;
107 typedef double ValueType;
108 typedef storm::models::sparse::Mdp<ValueType> ModelType;
109 static storm::Environment createEnvironment() {
110 storm::Environment env;
117class SparseDoubleIntervalIterationEnvironment {
120 static const MdpEngine engine = MdpEngine::PrismSparse;
121 static const bool isExact =
false;
122 typedef double ValueType;
123 typedef storm::models::sparse::Mdp<ValueType> ModelType;
124 static storm::Environment createEnvironment() {
125 storm::Environment env;
134class SparseDoubleSoundValueIterationEnvironment {
137 static const MdpEngine engine = MdpEngine::PrismSparse;
138 static const bool isExact =
false;
139 typedef double ValueType;
140 typedef storm::models::sparse::Mdp<ValueType> ModelType;
141 static storm::Environment createEnvironment() {
142 storm::Environment env;
151class SparseDoubleOptimisticValueIterationEnvironment {
154 static const MdpEngine engine = MdpEngine::PrismSparse;
155 static const bool isExact =
false;
156 typedef double ValueType;
157 typedef storm::models::sparse::Mdp<ValueType> ModelType;
158 static storm::Environment createEnvironment() {
159 storm::Environment env;
168class SparseDoubleGuessingValueIterationEnvironment {
171 static const MdpEngine engine = MdpEngine::PrismSparse;
172 static const bool isExact =
false;
173 typedef double ValueType;
174 typedef storm::models::sparse::Mdp<ValueType> ModelType;
175 static storm::Environment createEnvironment() {
176 storm::Environment env;
185class SparseDoubleTopologicalValueIterationEnvironment {
188 static const MdpEngine engine = MdpEngine::PrismSparse;
189 static const bool isExact =
false;
190 typedef double ValueType;
191 typedef storm::models::sparse::Mdp<ValueType> ModelType;
192 static storm::Environment createEnvironment() {
193 storm::Environment env;
202class SparseDoubleTopologicalSoundValueIterationEnvironment {
205 static const MdpEngine engine = MdpEngine::PrismSparse;
206 static const bool isExact =
false;
207 typedef double ValueType;
208 typedef storm::models::sparse::Mdp<ValueType> ModelType;
209 static storm::Environment createEnvironment() {
210 storm::Environment env;
220class SparseDoubleTopologicalGuessingValueIterationEnvironment {
223 static const MdpEngine engine = MdpEngine::PrismSparse;
224 static const bool isExact =
false;
225 typedef double ValueType;
226 typedef storm::models::sparse::Mdp<ValueType> ModelType;
227 static storm::Environment createEnvironment() {
228 storm::Environment env;
238class SparseDoubleLPEnvironment {
241 static const MdpEngine engine = MdpEngine::PrismSparse;
242 static const bool isExact =
false;
243 typedef double ValueType;
244 typedef storm::models::sparse::Mdp<ValueType> ModelType;
245 static storm::Environment createEnvironment() {
246 storm::Environment env;
253class SparseDoubleViToLPEnvironment {
256 static const MdpEngine engine = MdpEngine::PrismSparse;
257 static const bool isExact =
false;
258 typedef double ValueType;
259 typedef storm::models::sparse::Mdp<ValueType> ModelType;
260 static storm::Environment createEnvironment() {
261 storm::Environment env;
268class SparseRationalPolicyIterationEnvironment {
271 static const MdpEngine engine = MdpEngine::PrismSparse;
272 static const bool isExact =
true;
273 typedef storm::RationalNumber ValueType;
274 typedef storm::models::sparse::Mdp<ValueType> ModelType;
275 static storm::Environment createEnvironment() {
276 storm::Environment env;
282class SparseRationalViToPiEnvironment {
285 static const MdpEngine engine = MdpEngine::PrismSparse;
286 static const bool isExact =
true;
287 typedef storm::RationalNumber ValueType;
288 typedef storm::models::sparse::Mdp<ValueType> ModelType;
289 static storm::Environment createEnvironment() {
290 storm::Environment env;
296class SparseRationalRationalSearchEnvironment {
299 static const MdpEngine engine = MdpEngine::PrismSparse;
300 static const bool isExact =
true;
301 typedef storm::RationalNumber ValueType;
302 typedef storm::models::sparse::Mdp<ValueType> ModelType;
303 static storm::Environment createEnvironment() {
304 storm::Environment env;
309class HybridCuddDoubleValueIterationEnvironment {
312 static const MdpEngine engine = MdpEngine::Hybrid;
313 static const bool isExact =
false;
314 typedef double ValueType;
315 typedef storm::models::symbolic::Mdp<ddType, ValueType> ModelType;
317 static void checkLibraryAvailable() {
318#ifndef STORM_HAVE_CUDD
319 GTEST_SKIP() <<
"Library CUDD not available.";
323 static storm::Environment createEnvironment() {
324 storm::Environment env;
330class HybridSylvanDoubleValueIterationEnvironment {
333 static const MdpEngine engine = MdpEngine::Hybrid;
334 static const bool isExact =
false;
335 typedef double ValueType;
336 typedef storm::models::symbolic::Mdp<ddType, ValueType> ModelType;
338 static void checkLibraryAvailable() {
339#ifndef STORM_HAVE_SYLVAN
340 GTEST_SKIP() <<
"Library Sylvan not available.";
344 static storm::Environment createEnvironment() {
345 storm::Environment env;
351class HybridCuddDoubleSoundValueIterationEnvironment {
354 static const MdpEngine engine = MdpEngine::Hybrid;
355 static const bool isExact =
false;
356 typedef double ValueType;
357 typedef storm::models::symbolic::Mdp<ddType, ValueType> ModelType;
359 static void checkLibraryAvailable() {
360#ifndef STORM_HAVE_CUDD
361 GTEST_SKIP() <<
"Library CUDD not available.";
365 static storm::Environment createEnvironment() {
366 storm::Environment env;
374class HybridCuddDoubleOptimisticValueIterationEnvironment {
377 static const MdpEngine engine = MdpEngine::Hybrid;
378 static const bool isExact =
false;
379 typedef double ValueType;
380 typedef storm::models::symbolic::Mdp<ddType, ValueType> ModelType;
382 static void checkLibraryAvailable() {
383#ifndef STORM_HAVE_CUDD
384 GTEST_SKIP() <<
"Library CUDD not available.";
388 static storm::Environment createEnvironment() {
389 storm::Environment env;
397class HybridCuddDoubleGuessingValueIterationEnvironment {
400 static const MdpEngine engine = MdpEngine::Hybrid;
401 static const bool isExact =
false;
402 typedef double ValueType;
403 typedef storm::models::symbolic::Mdp<ddType, ValueType> ModelType;
405 static void checkLibraryAvailable() {
406#ifndef STORM_HAVE_CUDD
407 GTEST_SKIP() <<
"Library CUDD not available.";
411 static storm::Environment createEnvironment() {
412 storm::Environment env;
420class HybridSylvanRationalPolicyIterationEnvironment {
423 static const MdpEngine engine = MdpEngine::Hybrid;
424 static const bool isExact =
true;
425 typedef storm::RationalNumber ValueType;
426 typedef storm::models::symbolic::Mdp<ddType, ValueType> ModelType;
428 static void checkLibraryAvailable() {
429#ifndef STORM_HAVE_SYLVAN
430 GTEST_SKIP() <<
"Library Sylvan not available.";
434 static storm::Environment createEnvironment() {
435 storm::Environment env;
440class DdCuddDoubleValueIterationEnvironment {
443 static const MdpEngine engine = MdpEngine::PrismDd;
444 static const bool isExact =
false;
445 typedef double ValueType;
446 typedef storm::models::symbolic::Mdp<ddType, ValueType> ModelType;
448 static void checkLibraryAvailable() {
449#ifndef STORM_HAVE_CUDD
450 GTEST_SKIP() <<
"Library CUDD not available.";
454 static storm::Environment createEnvironment() {
455 storm::Environment env;
461class JaniDdCuddDoubleValueIterationEnvironment {
464 static const MdpEngine engine = MdpEngine::JaniDd;
465 static const bool isExact =
false;
466 typedef double ValueType;
467 typedef storm::models::symbolic::Mdp<ddType, ValueType> ModelType;
469 static void checkLibraryAvailable() {
470#ifndef STORM_HAVE_CUDD
471 GTEST_SKIP() <<
"Library CUDD not available.";
475 static storm::Environment createEnvironment() {
476 storm::Environment env;
482class DdSylvanDoubleValueIterationEnvironment {
485 static const MdpEngine engine = MdpEngine::PrismDd;
486 static const bool isExact =
false;
487 typedef double ValueType;
488 typedef storm::models::symbolic::Mdp<ddType, ValueType> ModelType;
490 static void checkLibraryAvailable() {
491#ifndef STORM_HAVE_SYLVAN
492 GTEST_SKIP() <<
"Library Sylvan not available.";
496 static storm::Environment createEnvironment() {
497 storm::Environment env;
503class DdCuddDoublePolicyIterationEnvironment {
506 static const MdpEngine engine = MdpEngine::PrismDd;
507 static const bool isExact =
false;
508 typedef double ValueType;
509 typedef storm::models::symbolic::Mdp<ddType, ValueType> ModelType;
511 static void checkLibraryAvailable() {
512#ifndef STORM_HAVE_CUDD
513 GTEST_SKIP() <<
"Library CUDD not available.";
517 static storm::Environment createEnvironment() {
518 storm::Environment env;
524class DdSylvanRationalRationalSearchEnvironment {
527 static const MdpEngine engine = MdpEngine::PrismDd;
528 static const bool isExact =
true;
529 typedef storm::RationalNumber ValueType;
530 typedef storm::models::symbolic::Mdp<ddType, ValueType> ModelType;
532 static void checkLibraryAvailable() {
533#ifndef STORM_HAVE_SYLVAN
534 GTEST_SKIP() <<
"Library Sylvan not available.";
538 static storm::Environment createEnvironment() {
539 storm::Environment env;
545template<
typename TestType>
546class MdpPrctlModelCheckerTest :
public ::testing::Test {
548 typedef typename TestType::ValueType ValueType;
549 typedef typename storm::models::sparse::Mdp<ValueType> SparseModelType;
550 typedef typename storm::models::symbolic::Mdp<TestType::ddType, ValueType> SymbolicModelType;
552 MdpPrctlModelCheckerTest() : _environment(TestType::createEnvironment()) {}
554 void SetUp()
override {
556 GTEST_SKIP() <<
"Z3 not available.";
558 if constexpr (TestType::engine == MdpEngine::Hybrid || TestType::engine == MdpEngine::PrismDd || TestType::engine == MdpEngine::JaniDd) {
559 TestType::checkLibraryAvailable();
563 storm::Environment
const& env()
const {
566 ValueType
parseNumber(std::string
const& input)
const {
569 ValueType precision()
const {
572 bool isSparseModel()
const {
573 return std::is_same<typename TestType::ModelType, SparseModelType>::value;
575 bool isSymbolicModel()
const {
576 return std::is_same<typename TestType::ModelType, SymbolicModelType>::value;
583 bool requiresUniqueFixedPointWithoutEcElimination()
const {
584 return TestType::engine == MdpEngine::PrismDd && env().
solver().
minMax().
getMethod() == storm::solver::MinMaxMethod::RationalSearch;
591 template<
typename ModelPtr,
typename CheckerPtr,
typename TaskType>
592 void checkTaskWithoutUniqueFixedPoint(ModelPtr
const& model, CheckerPtr& checker, TaskType
const& task, std::string
const& expected) {
593 if (requiresUniqueFixedPointWithoutEcElimination()) {
596 auto result = checker->check(env(), task);
597 expectQuantitativeResultAtInitialState(model, result,
parseNumber(expected));
601 template<
typename MT =
typename TestType::ModelType>
602 typename std::enable_if<std::is_same<MT, SparseModelType>::value,
603 std::pair<std::shared_ptr<MT>, std::vector<std::shared_ptr<storm::logic::Formula const>>>>::type
604 buildModelFormulas(std::string
const& pathToPrismFile, std::string
const& formulasAsString, std::string
const& constantDefinitionString =
"")
const {
605 std::pair<std::shared_ptr<MT>, std::vector<std::shared_ptr<storm::logic::Formula const>>> result;
607 program = program.
preprocess(constantDefinitionString);
608 if (TestType::engine == MdpEngine::PrismSparse) {
611 }
else if (TestType::engine == MdpEngine::JaniSparse) {
613 janiData.first.substituteFunctions();
620 template<
typename MT =
typename TestType::ModelType>
621 typename std::enable_if<std::is_same<MT, SymbolicModelType>::value,
622 std::pair<std::shared_ptr<MT>, std::vector<std::shared_ptr<storm::logic::Formula const>>>>::type
623 buildModelFormulas(std::string
const& pathToPrismFile, std::string
const& formulasAsString, std::string
const& constantDefinitionString =
"")
const {
624 std::pair<std::shared_ptr<MT>, std::vector<std::shared_ptr<storm::logic::Formula const>>> result;
626 program = program.
preprocess(constantDefinitionString);
627 if (TestType::engine == MdpEngine::Hybrid || TestType::engine == MdpEngine::PrismDd) {
630 }
else if (TestType::engine == MdpEngine::JaniDd) {
632 janiData.first.substituteFunctions();
639 std::vector<storm::modelchecker::CheckTask<storm::logic::Formula, ValueType>> getTasks(
640 std::vector<std::shared_ptr<storm::logic::Formula const>>
const& formulas)
const {
641 std::vector<storm::modelchecker::CheckTask<storm::logic::Formula, ValueType>> result;
642 for (
auto const& f : formulas) {
643 result.emplace_back(*f);
648 template<
typename MT =
typename TestType::ModelType>
649 typename std::enable_if<std::is_same<MT, SparseModelType>::value, std::shared_ptr<storm::modelchecker::AbstractModelChecker<MT>>>::type createModelChecker(
650 std::shared_ptr<MT>
const& model)
const {
651 if (TestType::engine == MdpEngine::PrismSparse || TestType::engine == MdpEngine::JaniSparse) {
652 return std::make_shared<storm::modelchecker::SparseMdpPrctlModelChecker<SparseModelType>>(*model);
656 template<
typename MT =
typename TestType::ModelType>
657 typename std::enable_if<std::is_same<MT, SymbolicModelType>::value, std::shared_ptr<storm::modelchecker::AbstractModelChecker<MT>>>::type
658 createModelChecker(std::shared_ptr<MT>
const& model)
const {
659 if (TestType::engine == MdpEngine::Hybrid) {
660 return std::make_shared<storm::modelchecker::HybridMdpPrctlModelChecker<SymbolicModelType>>(*model);
661 }
else if (TestType::engine == MdpEngine::PrismDd || TestType::engine == MdpEngine::JaniDd) {
662 return std::make_shared<storm::modelchecker::SymbolicMdpPrctlModelChecker<SymbolicModelType>>(*model);
666 template<
typename MT =
typename TestType::ModelType>
667 typename std::enable_if<std::is_same<MT, SparseModelType>::value,
void>::type execute(std::shared_ptr<MT>
const& model,
668 std::function<
void()>
const& f)
const {
672 template<
typename MT =
typename TestType::ModelType>
673 typename std::enable_if<std::is_same<MT, SymbolicModelType>::value,
void>::type execute(std::shared_ptr<MT>
const& model,
674 std::function<
void()>
const& f)
const {
675 model->getManager().execute(f);
678 bool getQualitativeResultAtInitialState(std::shared_ptr<storm::models::Model<ValueType>>
const& model,
679 std::unique_ptr<storm::modelchecker::CheckResult>& result) {
681 result->filter(*filter);
682 return result->asQualitativeCheckResult().forallTrue();
686 std::unique_ptr<storm::modelchecker::CheckResult>& result) {
688 result->filter(*filter);
689 return result->asQuantitativeCheckResult<ValueType>().getMin();
696 void expectQuantitativeResultAtInitialState(std::shared_ptr<storm::models::Model<ValueType>>
const& model,
697 std::unique_ptr<storm::modelchecker::CheckResult>& result, ValueType
const& expected) {
699 if (!result->isExplicitQuantitativeCheckResult()) {
703 auto const& explicitResult = result->template asExplicitQuantitativeCheckResult<ValueType>();
705 if (explicitResult.hasLowerBounds()) {
706 EXPECT_LE(explicitResult.getLowerBoundVector().front(), expected + tolerance) <<
"The lower bound exceeds the expected value.";
708 if (explicitResult.hasUpperBounds()) {
709 EXPECT_LE(expected, explicitResult.getUpperBoundVector().front() + tolerance) <<
"The upper bound falls below the expected value.";
716 void expectExactResultAtInitialState(std::shared_ptr<storm::models::Model<ValueType>>
const& model,
717 std::unique_ptr<storm::modelchecker::CheckResult>& result, ValueType
const& expected) {
718 expectQuantitativeResultAtInitialState(model, result, expected);
719 if (!result->isExplicitQuantitativeCheckResult()) {
722 auto const& explicitResult = result->template asExplicitQuantitativeCheckResult<ValueType>();
723 ASSERT_TRUE(explicitResult.hasLowerBounds()) <<
"No lower bound was reported although the values are exact.";
724 ASSERT_TRUE(explicitResult.hasUpperBounds()) <<
"No upper bound was reported although the values are exact.";
725 EXPECT_EQ(explicitResult.getLowerBoundVector(), explicitResult.getUpperBoundVector()) <<
"The bounds do not pin the values down.";
729 storm::Environment _environment;
731 std::unique_ptr<storm::modelchecker::QualitativeCheckResult>
getInitialStateFilter(std::shared_ptr<storm::models::Model<ValueType>>
const& model)
const {
732 if (isSparseModel()) {
733 return std::make_unique<storm::modelchecker::ExplicitQualitativeCheckResult<ValueType>>(model->template as<SparseModelType>()->getInitialStates());
735 return std::make_unique<storm::modelchecker::SymbolicQualitativeCheckResult<TestType::ddType>>(
736 model->template as<SymbolicModelType>()->getReachableStates(), model->template as<SymbolicModelType>()->getInitialStates());
741typedef ::testing::Types<SparseDoubleValueIterationViOpGaussSeidelMultEnvironment, SparseDoubleValueIterationViOpRegularMultEnvironment,
742 SparseDoubleValueIterationNativeGaussSeidelMultEnvironment, SparseDoubleValueIterationNativeRegularMultEnvironment,
743 JaniSparseDoubleValueIterationEnvironment, SparseDoubleIntervalIterationEnvironment, SparseDoubleSoundValueIterationEnvironment,
744 SparseDoubleOptimisticValueIterationEnvironment, SparseDoubleGuessingValueIterationEnvironment,
745 SparseDoubleTopologicalValueIterationEnvironment, SparseDoubleTopologicalSoundValueIterationEnvironment,
746 SparseDoubleTopologicalGuessingValueIterationEnvironment, SparseDoubleLPEnvironment, SparseDoubleViToLPEnvironment,
747 SparseRationalPolicyIterationEnvironment, SparseRationalViToPiEnvironment, SparseRationalRationalSearchEnvironment,
748 HybridCuddDoubleValueIterationEnvironment, HybridSylvanDoubleValueIterationEnvironment, HybridCuddDoubleSoundValueIterationEnvironment,
749 HybridCuddDoubleOptimisticValueIterationEnvironment, HybridCuddDoubleGuessingValueIterationEnvironment,
750 HybridSylvanRationalPolicyIterationEnvironment, DdCuddDoubleValueIterationEnvironment, JaniDdCuddDoubleValueIterationEnvironment,
751 DdSylvanDoubleValueIterationEnvironment, DdCuddDoublePolicyIterationEnvironment, DdSylvanRationalRationalSearchEnvironment>
757 std::string formulasString =
"Pmin=? [F \"two\"]";
758 formulasString +=
"; Pmax=? [F \"two\"]";
759 formulasString +=
"; Pmin=? [F \"three\"]";
760 formulasString +=
"; Pmax=? [F \"three\"]";
761 formulasString +=
"; Pmin=? [F \"four\"]";
762 formulasString +=
"; Pmax=? [F \"four\"]";
763 formulasString +=
"; Rmin=? [F \"done\"]";
764 formulasString +=
"; Rmax=? [F \"done\"]";
766 auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR
"/mdp/two_dice.nm", formulasString);
767 auto model = std::move(modelFormulas.first);
768 auto tasks = this->getTasks(modelFormulas.second);
769 this->execute(model, [&]() {
770 EXPECT_EQ(169ul, model->getNumberOfStates());
771 EXPECT_EQ(436ul, model->getNumberOfTransitions());
774 auto checker = this->createModelChecker(model);
775 std::unique_ptr<storm::modelchecker::CheckResult> result;
777 result = checker->check(this->env(), tasks[0]);
778 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"1/36"));
780 result = checker->check(this->env(), tasks[1]);
781 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"1/36"));
783 result = checker->check(this->env(), tasks[2]);
784 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"2/36"));
786 result = checker->check(this->env(), tasks[3]);
787 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"2/36"));
789 result = checker->check(this->env(), tasks[4]);
790 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"3/36"));
792 result = checker->check(this->env(), tasks[5]);
793 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"3/36"));
795 result = checker->check(this->env(), tasks[6]);
796 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"22/3"));
798 result = checker->check(this->env(), tasks[7]);
799 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"22/3"));
804 std::string formulasString =
"Pmin=? [F \"elected\"]";
805 formulasString +=
"; Pmax=? [F \"elected\"]";
806 formulasString +=
"; Pmin=? [F<=25 \"elected\"]";
807 formulasString +=
"; Pmax=? [F<=25 \"elected\"]";
808 formulasString +=
"; Rmin=? [F \"elected\"]";
809 formulasString +=
"; Rmax=? [F \"elected\"]";
811 auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR
"/mdp/leader4.nm", formulasString);
812 auto model = std::move(modelFormulas.first);
813 auto tasks = this->getTasks(modelFormulas.second);
814 this->execute(model, [&]() {
815 EXPECT_EQ(3172ul, model->getNumberOfStates());
816 EXPECT_EQ(7144ul, model->getNumberOfTransitions());
818 auto checker = this->createModelChecker(model);
819 std::unique_ptr<storm::modelchecker::CheckResult> result;
821 result = checker->check(this->env(), tasks[0]);
822 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"1"));
824 result = checker->check(this->env(), tasks[1]);
825 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"1"));
827 result = checker->check(this->env(), tasks[2]);
828 this->expectExactResultAtInitialState(model, result, this->parseNumber(
"1/16"));
830 result = checker->check(this->env(), tasks[3]);
831 this->expectExactResultAtInitialState(model, result, this->parseNumber(
"1/16"));
833 result = checker->check(this->env(), tasks[4]);
834 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"30/7"));
836 result = checker->check(this->env(), tasks[5]);
837 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"30/7"));
841TYPED_TEST(MdpPrctlModelCheckerTest, MaybeStateEndComponent) {
844 auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR
"/mdp/maybe_state_end_component.nm",
"Pmax=? [F \"target\"]");
845 auto model = std::move(modelFormulas.first);
846 auto tasks = this->getTasks(modelFormulas.second);
847 EXPECT_EQ(4ul, model->getNumberOfStates());
850 auto checker = this->createModelChecker(model);
851 this->checkTaskWithoutUniqueFixedPoint(model, checker, tasks[0],
"1/4");
855 std::string formulasString =
"Pmax=? [F \"finished\"]";
856 formulasString +=
"; Pmax=? [F \"all_coins_equal_1\"]";
857 formulasString +=
"; P<0.8 [F \"all_coins_equal_1\"]";
858 formulasString +=
"; P<0.9 [F \"all_coins_equal_1\"]";
859 formulasString +=
"; Rmax=? [F \"all_coins_equal_1\"]";
860 formulasString +=
"; Rmin=? [F \"all_coins_equal_1\"]";
861 formulasString +=
"; Rmax=? [F \"finished\"]";
862 formulasString +=
"; Rmin=? [F \"finished\"]";
864 auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR
"/mdp/coin2-2.nm", formulasString);
865 auto model = std::move(modelFormulas.first);
866 auto tasks = this->getTasks(modelFormulas.second);
867 this->execute(model, [&]() {
868 EXPECT_EQ(272ul, model->getNumberOfStates());
869 EXPECT_EQ(492ul, model->getNumberOfTransitions());
871 auto checker = this->createModelChecker(model);
872 std::unique_ptr<storm::modelchecker::CheckResult> result;
874 result = checker->check(this->env(), tasks[0]);
875 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"1"));
877 result = checker->check(this->env(), tasks[1]);
878 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"57/64"));
880 result = checker->check(this->env(), tasks[2]);
881 EXPECT_FALSE(this->getQualitativeResultAtInitialState(model, result));
883 result = checker->check(this->env(), tasks[3]);
884 EXPECT_TRUE(this->getQualitativeResultAtInitialState(model, result));
886 result = checker->check(this->env(), tasks[4]);
889 result = checker->check(this->env(), tasks[5]);
892 result = checker->check(this->env(), tasks[6]);
893 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"75"));
895 result = checker->check(this->env(), tasks[7]);
896 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"48"));
900TYPED_TEST(MdpPrctlModelCheckerTest, TinyRewards) {
901 std::string formulasString =
"Rmin=? [F \"target\"]";
902 auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR
"/mdp/tiny_rewards.nm", formulasString);
903 auto model = std::move(modelFormulas.first);
904 auto tasks = this->getTasks(modelFormulas.second);
905 this->execute(model, [&]() {
906 EXPECT_EQ(3ul, model->getNumberOfStates());
907 EXPECT_EQ(4ul, model->getNumberOfTransitions());
909 auto checker = this->createModelChecker(model);
913 this->checkTaskWithoutUniqueFixedPoint(model, checker, tasks[0],
"1");
917TYPED_TEST(MdpPrctlModelCheckerTest, SimpleProtocolMaybeStateEndComponent) {
919 std::string formulasString =
"Pmax=? [ (s<=1) U (s=3) ]";
920 formulasString +=
"; Pmax=? [ !(s=3) U (!(s<=1) & !(s=3)) ]";
921 auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR
"/mdp/simple_protocol.nm", formulasString);
922 auto model = std::move(modelFormulas.first);
923 auto tasks = this->getTasks(modelFormulas.second);
924 this->execute(model, [&]() {
925 EXPECT_EQ(4ul, model->getNumberOfStates());
927 auto checker = this->createModelChecker(model);
929 this->checkTaskWithoutUniqueFixedPoint(model, checker, tasks[0],
"99/100");
930 this->checkTaskWithoutUniqueFixedPoint(model, checker, tasks[1],
"1/100");
935 std::string formulasString =
"R{\"w_1_total\"}max=? [ C ]";
936 auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR
"/mdp/multiobj_team3.nm", formulasString);
937 auto model = std::move(modelFormulas.first);
938 auto tasks = this->getTasks(modelFormulas.second);
939 this->execute(model, [&]() {
940 EXPECT_EQ(12475ul, model->getNumberOfStates());
941 EXPECT_EQ(15228ul, model->getNumberOfTransitions());
943 auto checker = this->createModelChecker(model);
944 std::unique_ptr<storm::modelchecker::CheckResult> result;
948 if (TypeParam::engine == MdpEngine::PrismSparse || TypeParam::engine == MdpEngine::JaniSparse) {
949 result = checker->check(this->env(), tasks[0]);
950 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"114/49"));
952 EXPECT_FALSE(checker->canHandle(tasks[0]));
957TYPED_TEST(MdpPrctlModelCheckerTest, LtlProbabilitiesCoin) {
958#ifdef STORM_HAVE_LTL_MODELCHECKING_SUPPORT
959 std::string formulasString =
"Pmin=? [!(GF \"all_coins_equal_1\")]";
960 formulasString +=
"; Pmax=? [F \"all_coins_equal_1\" U \"finished\"]";
961 formulasString +=
"; P>0.4 [!(GF \"all_coins_equal_1\")]";
962 formulasString +=
"; P<0.6 [F \"all_coins_equal_1\" U \"finished\"]";
964 formulasString +=
"; Pmax=?[ (GF \"all_coins_equal_1\") & ((GF \"all_coins_equal_0\") | (FG \"finished\"))]";
966 auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR
"/mdp/coin2-2.nm", formulasString);
967 auto model = std::move(modelFormulas.first);
968 auto tasks = this->getTasks(modelFormulas.second);
969 this->execute(model, [&]() {
970 EXPECT_EQ(272ul, model->getNumberOfStates());
971 EXPECT_EQ(492ul, model->getNumberOfTransitions());
973 auto checker = this->createModelChecker(model);
974 std::unique_ptr<storm::modelchecker::CheckResult> result;
977 if (TypeParam::engine == MdpEngine::PrismSparse || TypeParam::engine == MdpEngine::JaniSparse) {
978 result = checker->check(this->env(), tasks[0]);
979 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"4/9"));
981 result = checker->check(this->env(), tasks[1]);
982 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"5/9"));
984 result = checker->check(this->env(), tasks[2]);
985 EXPECT_TRUE(this->getQualitativeResultAtInitialState(model, result));
987 result = checker->check(this->env(), tasks[3]);
988 EXPECT_TRUE(this->getQualitativeResultAtInitialState(model, result));
990 result = checker->check(this->env(), tasks[4]);
991 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"5/9"));
994 EXPECT_FALSE(checker->canHandle(tasks[0]));
1002TYPED_TEST(MdpPrctlModelCheckerTest, LtlDice) {
1003#ifdef STORM_HAVE_LTL_MODELCHECKING_SUPPORT
1004 std::string formulasString =
"Pmax=? [ X (((s1=1) U (s1=3)) U (s1=7))]";
1005 formulasString +=
"; Pmax=? [ (F (X (s1=6 & (XX s1=5)))) & (F G (d1!=5))]";
1006 formulasString +=
"; Pmax=? [ F s1=3 U (\"three\")]";
1007 formulasString +=
"; Pmin=? [! F (s2=6) & X \"done\"]";
1009 formulasString +=
"; Pmax=? [ ( (G F !(\"two\")) | F G (\"three\") ) & ( (G F !(\"five\") ) | F G (\"seven\") )]";
1011 auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR
"/mdp/two_dice.nm", formulasString);
1012 auto model = std::move(modelFormulas.first);
1013 auto tasks = this->getTasks(modelFormulas.second);
1014 this->execute(model, [&]() {
1015 EXPECT_EQ(169ul, model->getNumberOfStates());
1016 EXPECT_EQ(436ul, model->getNumberOfTransitions());
1018 auto checker = this->createModelChecker(model);
1019 std::unique_ptr<storm::modelchecker::CheckResult> result;
1022 if (TypeParam::engine == MdpEngine::PrismSparse || TypeParam::engine == MdpEngine::JaniSparse) {
1023 result = checker->check(this->env(), tasks[0]);
1024 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"1/6"));
1026 result = checker->check(this->env(), tasks[1]);
1027 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"1/24"));
1029 result = checker->check(this->env(), tasks[2]);
1030 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"1/36"));
1032 result = checker->check(this->env(), tasks[3]);
1033 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"5/6"));
1035 result = checker->check(this->env(), tasks[4]);
1036 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"31/36"));
1039 EXPECT_FALSE(checker->canHandle(tasks[0]));
1047TYPED_TEST(MdpPrctlModelCheckerTest, LtlCoinFlips) {
1048#ifdef STORM_HAVE_LTL_MODELCHECKING_SUPPORT
1049 std::string formulasString =
"Pmax=? [ G (true U (heads | \"done\")) ]";
1050 formulasString +=
"; Pmin=? [ G (true U (heads | \"done\")) ]";
1051 formulasString +=
"; Pmax=? [ G (true U<=10 (heads | \"done\")) ]";
1052 formulasString +=
"; Pmin=? [ G (true U<=10 (heads | \"done\")) ]";
1053 formulasString +=
"; Pmax=? [ X G (true U<=0 (heads | \"done\")) ]";
1054 formulasString +=
"; Pmax=? [ true U[10,12] heads ]";
1055 formulasString +=
"; Pmax=? [ X (true U[0,0] heads) ]";
1056 formulasString +=
"; Pmax=? [ G (!(P>=1 [\"done\"]) U<=10 (heads | P>=1 [ \"done\"])) ]";
1057 auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR
"/mdp/coin_flips.nm", formulasString);
1058 auto model = std::move(modelFormulas.first);
1059 auto tasks = this->getTasks(modelFormulas.second);
1060 this->execute(model, [&]() {
1061 EXPECT_EQ(61ul, model->getNumberOfStates());
1062 EXPECT_EQ(177ul, model->getNumberOfTransitions());
1064 auto checker = this->createModelChecker(model);
1065 std::unique_ptr<storm::modelchecker::CheckResult> result;
1068 if (TypeParam::engine == MdpEngine::PrismSparse || TypeParam::engine == MdpEngine::JaniSparse) {
1069 result = checker->check(this->env(), tasks[0]);
1070 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"1"));
1072 result = checker->check(this->env(), tasks[1]);
1073 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"0"));
1075 result = checker->check(this->env(), tasks[2]);
1076 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"1021/1024"));
1078 result = checker->check(this->env(), tasks[3]);
1079 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"0"));
1081 result = checker->check(this->env(), tasks[4]);
1082 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"1/524288"));
1084 result = checker->check(this->env(), tasks[5]);
1085 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"7/8"));
1087 result = checker->check(this->env(), tasks[6]);
1088 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"1/2"));
1090 result = checker->check(this->env(), tasks[7]);
1091 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"1021/1024"));
1094 EXPECT_FALSE(checker->canHandle(tasks[0]));
1102TYPED_TEST(MdpPrctlModelCheckerTest, HOADice) {
1104 std::string formulasString =
"; P=?[HOA: {\"" STORM_TEST_RESOURCES_DIR
"/hoa/automaton_Fandp0Xp1.hoa\", \"p0\" -> \"three\", \"p1\" -> s2=1 }]";
1106 formulasString +=
"; P=?[HOA: {\"" STORM_TEST_RESOURCES_DIR
"/hoa/automaton_UXp0p1.hoa\", \"p0\" -> !(s2=6), \"p1\" -> \"done\" }]";
1108 auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR
"/mdp/two_dice.nm", formulasString);
1109 auto model = std::move(modelFormulas.first);
1110 auto tasks = this->getTasks(modelFormulas.second);
1111 this->execute(model, [&]() {
1112 EXPECT_EQ(169ul, model->getNumberOfStates());
1113 EXPECT_EQ(436ul, model->getNumberOfTransitions());
1115 auto checker = this->createModelChecker(model);
1116 std::unique_ptr<storm::modelchecker::CheckResult> result;
1119 if (TypeParam::engine == MdpEngine::PrismSparse || TypeParam::engine == MdpEngine::JaniSparse) {
1120 result = checker->check(tasks[0]);
1121 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"0"));
1123 result = checker->check(tasks[1]);
1124 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"3/4"));
1126 EXPECT_FALSE(checker->canHandle(tasks[0]));
1131TYPED_TEST(MdpPrctlModelCheckerTest, SmallDiscount) {
1132 if (TypeParam::isExact || std::is_same<TypeParam, SparseDoubleLPEnvironment>::value || std::is_same<TypeParam, SparseDoubleViToLPEnvironment>::value) {
1133 GTEST_SKIP() <<
"Exact computations for discounted properties are not supported.";
1135 std::string formulasString =
"Rmax=? [ C ]";
1136 formulasString +=
"; Rmax=? [ Cdiscount=9/10 ]";
1137 formulasString +=
"; Rmax=? [ Cdiscount=15/16 ]";
1138 auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR
"/mdp/small_discount.nm", formulasString);
1139 auto model = std::move(modelFormulas.first);
1140 auto tasks = this->getTasks(modelFormulas.second);
1141 EXPECT_EQ(4ul, model->getNumberOfStates());
1142 EXPECT_EQ(6ul, model->getNumberOfTransitions());
1144 auto checker = this->createModelChecker(model);
1146 if (TypeParam::engine == MdpEngine::PrismSparse || TypeParam::engine == MdpEngine::JaniSparse) {
1147 std::unique_ptr<storm::modelchecker::CheckResult> result = checker->check(this->env(), tasks[0]);
1148 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"5"));
1149 result = checker->check(this->env(), tasks[1]);
1150 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"18/5"));
1151 result = checker->check(this->env(), tasks[2]);
1152 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"15/4"));
1154 EXPECT_FALSE(checker->canHandle(tasks[0]));
1155 EXPECT_FALSE(checker->canHandle(tasks[1]));
1156 EXPECT_FALSE(checker->canHandle(tasks[2]));
1160TYPED_TEST(MdpPrctlModelCheckerTest, OneStateDiscounting) {
1161 if (TypeParam::isExact || std::is_same<TypeParam, SparseDoubleLPEnvironment>::value || std::is_same<TypeParam, SparseDoubleViToLPEnvironment>::value) {
1162 GTEST_SKIP() <<
"Exact computations for discounted properties are not supported.";
1164 std::string formulasString =
"Rmax=? [ Cdiscount=9/10 ]";
1165 formulasString +=
"; Rmax=? [ C<=5discount=9/10 ]";
1166 formulasString +=
"; Rmax=? [ C<=10discount=9/10 ]";
1167 auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR
"/mdp/one_state.nm", formulasString);
1168 auto model = std::move(modelFormulas.first);
1169 auto tasks = this->getTasks(modelFormulas.second);
1170 EXPECT_EQ(1ul, model->getNumberOfStates());
1171 EXPECT_EQ(2ul, model->getNumberOfTransitions());
1173 auto checker = this->createModelChecker(model);
1175 if ((TypeParam::engine == MdpEngine::PrismSparse || TypeParam::engine == MdpEngine::JaniSparse)) {
1176 std::unique_ptr<storm::modelchecker::CheckResult> result = checker->check(this->env(), tasks[0]);
1177 this->expectQuantitativeResultAtInitialState(model, result, this->parseNumber(
"1000"));
1178 result = checker->check(this->env(), tasks[1]);
1179 this->expectExactResultAtInitialState(model, result, this->parseNumber(
"40951/100"));
1180 result = checker->check(this->env(), tasks[2]);
1181 this->expectExactResultAtInitialState(model, result, this->parseNumber(
"6513215599/10000000"));
1183 EXPECT_FALSE(checker->canHandle(tasks[0]));
1184 EXPECT_FALSE(checker->canHandle(tasks[1]));
1185 EXPECT_FALSE(checker->canHandle(tasks[2]));
1189TYPED_TEST(MdpPrctlModelCheckerTest, StepBoundedReachability) {
1190 std::string formulasString =
"Pmax=? [ F<=0 x=5];";
1191 formulasString +=
"Pmax=? [ F<=1 x=5];";
1192 formulasString +=
"Pmax=? [ F<=2 x=5];";
1193 formulasString +=
"Pmax=? [ F[2,2] x=5];";
1194 formulasString +=
"Pmax=? [ F[2,3] x=5];";
1195 formulasString +=
"Pmin=? [ F[2,3] x=5];";
1196 formulasString +=
"Pmax=? [ x<2 U[2,2] x=5];";
1197 formulasString +=
"Pmax=? [ x<2 U[2,3] x=5];";
1198 formulasString +=
"Pmax=? [ x<3 U[2,2] x=5];";
1199 formulasString +=
"Pmax=? [ x<3 U<=4 x=5];";
1200 auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR
"/mdp/chain.nm", formulasString);
1201 auto model = std::move(modelFormulas.first);
1202 auto tasks = this->getTasks(modelFormulas.second);
1203 EXPECT_EQ(7ul, model->getNumberOfStates());
1204 EXPECT_EQ(16ul, model->getNumberOfTransitions());
1206 auto checker = this->createModelChecker(model);
1208 if (TypeParam::engine == MdpEngine::PrismSparse || TypeParam::engine == MdpEngine::JaniSparse) {
1209 std::unique_ptr<storm::modelchecker::CheckResult> result = checker->check(this->env(), tasks[0]);
1210 this->expectExactResultAtInitialState(model, result, this->parseNumber(
"0"));
1211 result = checker->check(this->env(), tasks[1]);
1212 this->expectExactResultAtInitialState(model, result, this->parseNumber(
"1/2"));
1213 result = checker->check(this->env(), tasks[2]);
1214 this->expectExactResultAtInitialState(model, result, this->parseNumber(
"3/4"));
1215 result = checker->check(this->env(), tasks[3]);
1216 this->expectExactResultAtInitialState(model, result, this->parseNumber(
"1/4"));
1217 result = checker->check(this->env(), tasks[4]);
1218 this->expectExactResultAtInitialState(model, result, this->parseNumber(
"3/8"));
1219 result = checker->check(this->env(), tasks[5]);
1220 this->expectExactResultAtInitialState(model, result, this->parseNumber(
"0"));
1221 result = checker->check(this->env(), tasks[6]);
1222 this->expectExactResultAtInitialState(model, result, this->parseNumber(
"1/4"));
1223 result = checker->check(this->env(), tasks[7]);
1224 this->expectExactResultAtInitialState(model, result, this->parseNumber(
"1/4"));
1225 result = checker->check(this->env(), tasks[8]);
1226 this->expectExactResultAtInitialState(model, result, this->parseNumber(
"1/4"));
1227 result = checker->check(this->env(), tasks[9]);
1228 this->expectExactResultAtInitialState(model, result, this->parseNumber(
"7/8"));
1232TYPED_TEST(MdpPrctlModelCheckerTest, SimpleCommProtocol) {
1234 std::string formulasString =
"Pmax=? [ F (s = 3) ]; ";
1235 formulasString +=
"Pmax=? [ (s<=1) U (s=3) ]; ";
1236 formulasString +=
"Pmin=? [ (s<=1) U (s=3) ]; ";
1237 formulasString +=
"Pmax=? [ !(s=3) U (!(s<=1) & !(s=3)) ]; ";
1239 auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR
"/mdp/simple_comm_protocol.prism", formulasString);
1240 auto model = std::move(modelFormulas.first);
1241 auto tasks = this->getTasks(modelFormulas.second);
1243 ASSERT_EQ(4ul, tasks.size());
1244 this->execute(model, [&]() {
1245 EXPECT_EQ(4ul, model->getNumberOfStates());
1246 EXPECT_EQ(6ul, model->getNumberOfTransitions());
1248 auto checker = this->createModelChecker(model);
1249 std::unique_ptr<storm::modelchecker::CheckResult> result;
1251 result = checker->check(this->env(), tasks[0]);
1254 result = checker->check(this->env(), tasks[2]);
1258 if (!(TypeParam::engine == MdpEngine::PrismDd && this->env().solver().minMax().getMethod() == storm::solver::MinMaxMethod::RationalSearch)) {
1259 result = checker->check(this->env(), tasks[1]);
1262 result = checker->check(this->env(), tasks[3]);
1268TYPED_TEST(MdpPrctlModelCheckerTest, SimpleCommProtocolLTL) {
1269#ifdef STORM_HAVE_LTL_MODELCHECKING_SUPPORT
1271 std::string formulasString =
"Pmax=? [ (s<=1) W (s=3) ]; ";
1272 formulasString +=
"Pmin=? [ (s<=1) W (s=3) ]; ";
1273 formulasString +=
"Pmax=? [ !(s=3) U (!(s<=1) & !(s=3)) ]; ";
1274 formulasString +=
"Pmax=? [ !(s=2) W ((s=3 & !(s=2))) ]; ";
1275 formulasString +=
"Pmin=? [ !(s=2) W ((s=3 & !(s=2))) ]; ";
1276 formulasString +=
"Pmax=? [(!(s=2) W ((s=2) W (!(s=2) W ((s=2) W G !(s=2)))))]; ";
1277 formulasString +=
"Pmin=? [(!(s=2) W ((s=2) W (!(s=2) W ((s=2) W G !(s=2)))))]; ";
1278 formulasString +=
"Pmax=? [ (s=2) R !(s=3) ]; ";
1279 formulasString +=
"Pmin=? [ (s=2) R !(s=3) ]; ";
1281 auto modelFormulas = this->buildModelFormulas(STORM_TEST_RESOURCES_DIR
"/mdp/simple_comm_protocol.prism", formulasString);
1282 auto model = std::move(modelFormulas.first);
1283 auto tasks = this->getTasks(modelFormulas.second);
1285 ASSERT_EQ(9ul, tasks.size());
1286 this->execute(model, [&]() {
1287 EXPECT_EQ(4ul, model->getNumberOfStates());
1288 EXPECT_EQ(6ul, model->getNumberOfTransitions());
1290 auto checker = this->createModelChecker(model);
1291 std::unique_ptr<storm::modelchecker::CheckResult> result;
1294 if (TypeParam::engine == MdpEngine::PrismSparse || TypeParam::engine == MdpEngine::JaniSparse) {
1295 result = checker->check(this->env(), tasks[0]);
1298 result = checker->check(this->env(), tasks[1]);
1300 EXPECT_NEAR(this->parseNumber(
"99/100"), weakUntil, this->precision());
1302 result = checker->check(this->env(), tasks[2]);
1304 EXPECT_NEAR(this->parseNumber(
"1/100"), weakUntilDual, this->precision());
1306 EXPECT_NEAR(this->parseNumber(
"1"), weakUntil + weakUntilDual, this->precision());
1308 result = checker->check(this->env(), tasks[3]);
1311 result = checker->check(this->env(), tasks[4]);
1314 result = checker->check(this->env(), tasks[5]);
1317 result = checker->check(this->env(), tasks[6]);
1320 result = checker->check(this->env(), tasks[7]);
1323 result = checker->check(this->env(), tasks[8]);
1326 EXPECT_FALSE(checker->canHandle(tasks[0]));
1328 EXPECT_FALSE(checker->canHandle(tasks[8]));
1333 GTEST_SKIP() <<
"Spot not available.";
std::unique_ptr< storm::modelchecker::QualitativeCheckResult > getInitialStateFilter(std::shared_ptr< storm::models::sparse::Model< storm::Interval > > const &model)
double getQuantitativeResultAtInitialState(std::shared_ptr< storm::models::sparse::Model< storm::Interval > > const &model, std::unique_ptr< storm::modelchecker::CheckResult > &result)
SolverEnvironment & solver()
void setMultiplicationStyle(storm::solver::MultiplicationStyle value)
storm::solver::MinMaxMethod const & getMethod() const
void setPrecision(storm::RationalNumber value)
void setMethod(storm::solver::MinMaxMethod value, bool isSetFromDefault=false)
void setRelativeTerminationCriterion(bool value)
void setType(storm::solver::MultiplierType value, bool isSetFromDefault=false)
TopologicalSolverEnvironment & topological()
MinMaxSolverEnvironment & minMax()
void setForceSoundness(bool value)
MultiplierEnvironment & multiplier()
void setUnderlyingMinMaxMethod(storm::solver::MinMaxMethod value, bool isSetFromDefault=false)
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::shared_ptr< storm::models::symbolic::Model< LibraryType, ValueType > > buildSymbolicModel(storm::Environment const &env, storm::languages::SymbolicModelDescription const &model, std::vector< std::shared_ptr< storm::logic::Formula const > > const &formulas, bool buildFullModel=false, bool applyMaximumProgress=true, bool fixDeadlocks=true)
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::vector< std::shared_ptr< storm::logic::Formula const > > extractFormulasFromProperties(std::vector< storm::jani::Property > const &properties)
std::pair< storm::jani::Model, std::vector< storm::jani::Property > > convertPrismToJani(storm::prism::Program const &program, storm::converter::PrismToJaniConverterOptions options)
std::shared_ptr< storm::models::sparse::Model< ValueType > > buildSparseModel(storm::languages::SymbolicModelDescription const &model, storm::builder::BuilderOptions const &options, typename storm::builder::ExplicitModelBuilder< ValueType >::Options const &explorationOptions=typename storm::builder::ExplicitModelBuilder< ValueType >::Options())
NumberType parseNumber(std::string const &value)
Parse number from string.
storm::storage::BitVector filter(std::vector< T > const &values, std::function< bool(T const &value)> const &function)
Retrieves a bit vector containing all the indices for which the value at this position makes the give...
std::conditional_t< storm::NumberTraits< ValueType >::HasInfinity, ValueType, ExtendedNumber< ValueType > > ExtendedValueType
The type to use for values that may be infinite.
bool isInfinity(ValueType const &a)
TargetType convertNumber(SourceType const &number)
TYPED_TEST(GraphTestAR, SymbolicProb01StochasticGameDieSmall)
TYPED_TEST_SUITE(GraphTestAR, TestingTypes,)
::testing::Types< Cudd, Sylvan > TestingTypes
#define STORM_EXPENSIVE_TYPED_TEST(test_suite_name, test_name)
#define STORM_SILENT_EXPECT_THROW(statement, expected_exception)