You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
3.1 KiB

  1. #include "src/modelchecker/results/ExplicitQualitativeCheckResult.h"
  2. #include "gtest/gtest.h"
  3. #include "storm-config.h"
  4. #include "src/parser/PrismParser.h"
  5. #include "src/parser/FormulaParser.h"
  6. #include "src/logic/Formulas.h"
  7. #include "src/permissivesched/PermissiveSchedulers.h"
  8. #include "src/builder/ExplicitModelBuilder.h"
  9. #include "src/models/sparse/StandardRewardModel.h"
  10. #include "src/modelchecker/prctl/SparseMdpPrctlModelChecker.h"
  11. #if defined(STORM_HAVE_MSAT) || defined(STORM_HAVE_Z3)
  12. TEST(SmtPermissiveSchedulerTest, DieSelection) {
  13. storm::prism::Program program = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/builder/die_c1.nm");
  14. storm::parser::FormulaParser formulaParser(program.getManager().getSharedPointer());
  15. // auto formula02 = formulaParser.parseSingleFormulaFromString("P>=0.10 [ F \"one\"]")->asProbabilityOperatorFormula();
  16. // ASSERT_TRUE(storm::logic::isLowerBound(formula02.getComparisonType()));
  17. // auto formula001 = formulaParser.parseSingleFormulaFromString("P>=0.17 [ F \"one\"]")->asProbabilityOperatorFormula();
  18. auto formula02b = formulaParser.parseSingleFormulaFromString("P<=0.16 [ F \"one\"]")->asProbabilityOperatorFormula();
  19. auto formula001b = formulaParser.parseSingleFormulaFromString("P<=0.05 [ F \"one\"]")->asProbabilityOperatorFormula();
  20. // Customize and perform model-building.
  21. storm::generator::NextStateGeneratorOptions options(formula02b);
  22. std::shared_ptr<storm::models::sparse::Mdp<double>> mdp = storm::builder::ExplicitModelBuilder<double>(program, options).build()->as<storm::models::sparse::Mdp<double>>();
  23. // boost::optional<storm::ps::SubMDPPermissiveScheduler<>> perms = storm::ps::computePermissiveSchedulerViaSMT<>(*mdp, formula02);
  24. // EXPECT_NE(perms, boost::none);
  25. // boost::optional<storm::ps::SubMDPPermissiveScheduler<>> perms2 = storm::ps::computePermissiveSchedulerViaSMT<>(*mdp, formula001);
  26. // EXPECT_EQ(perms2, boost::none);
  27. boost::optional<storm::ps::SubMDPPermissiveScheduler<>> perms3 = storm::ps::computePermissiveSchedulerViaSMT<>(*mdp, formula02b);
  28. EXPECT_NE(perms3, boost::none);
  29. boost::optional<storm::ps::SubMDPPermissiveScheduler<>> perms4 = storm::ps::computePermissiveSchedulerViaSMT<>(*mdp, formula001b);
  30. EXPECT_EQ(perms4, boost::none);
  31. storm::modelchecker::SparseMdpPrctlModelChecker<storm::models::sparse::Mdp<double>> checker0(*mdp);
  32. std::unique_ptr<storm::modelchecker::CheckResult> result0 = checker0.check(formula02b);
  33. storm::modelchecker::ExplicitQualitativeCheckResult& qualitativeResult0 = result0->asExplicitQualitativeCheckResult();
  34. ASSERT_FALSE(qualitativeResult0[0]);
  35. auto submdp = perms3->apply();
  36. storm::modelchecker::SparseMdpPrctlModelChecker<storm::models::sparse::Mdp<double>> checker1(submdp);
  37. std::unique_ptr<storm::modelchecker::CheckResult> result1 = checker1.check(formula02b);
  38. storm::modelchecker::ExplicitQualitativeCheckResult& qualitativeResult1 = result1->asExplicitQualitativeCheckResult();
  39. EXPECT_TRUE(qualitativeResult1[0]);
  40. //
  41. }
  42. #endif // STORM_HAVE_MSAT || STORM_HAVE_Z3