#include "src/modelchecker/results/ExplicitQualitativeCheckResult.h" #include "gtest/gtest.h" #include "storm-config.h" #include "src/parser/PrismParser.h" #include "src/parser/FormulaParser.h" #include "src/logic/Formulas.h" #include "src/permissivesched/PermissiveSchedulers.h" #include "src/builder/ExplicitModelBuilder.h" #include "src/models/sparse/StandardRewardModel.h" #include "src/modelchecker/prctl/SparseMdpPrctlModelChecker.h" #ifdef STORM_HAVE_GUROBI TEST(MilpPermissiveSchedulerTest, DieSelection) { storm::prism::Program program = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/builder/die_c1.nm"); storm::parser::FormulaParser formulaParser(program.getManager().getSharedPointer()); auto formula02 = formulaParser.parseSingleFormulaFromString("P>=0.10 [ F \"one\"]")->asProbabilityOperatorFormula(); ASSERT_TRUE(storm::logic::isLowerBound(formula02.getComparisonType())); auto formula001 = formulaParser.parseSingleFormulaFromString("P>=0.17 [ F \"one\"]")->asProbabilityOperatorFormula(); auto formula02b = formulaParser.parseSingleFormulaFromString("P<=0.10 [ F \"one\"]")->asProbabilityOperatorFormula(); auto formula001b = formulaParser.parseSingleFormulaFromString("P<=0.17 [ F \"one\"]")->asProbabilityOperatorFormula(); // Customize and perform model-building. storm::generator::NextStateGeneratorOptions options; options.setBuildAllLabels().setBuildChoiceLabels(true); std::shared_ptr> mdp = storm::builder::ExplicitModelBuilder(program, options).build()->as>(); boost::optional> perms = storm::ps::computePermissiveSchedulerViaMILP<>(*mdp, formula02); EXPECT_NE(perms, boost::none); boost::optional> perms2 = storm::ps::computePermissiveSchedulerViaMILP<>(*mdp, formula001); EXPECT_EQ(perms2, boost::none); boost::optional> perms3 = storm::ps::computePermissiveSchedulerViaMILP<>(*mdp, formula02b); EXPECT_EQ(perms3, boost::none); boost::optional> perms4 = storm::ps::computePermissiveSchedulerViaMILP<>(*mdp, formula001b); EXPECT_NE(perms4, boost::none); storm::modelchecker::SparseMdpPrctlModelChecker> checker0(*mdp, std::unique_ptr>(new storm::solver::MinMaxLinearEquationSolverFactory(storm::solver::EquationSolverTypeSelection::Native))); std::unique_ptr result0 = checker0.check(formula02); storm::modelchecker::ExplicitQualitativeCheckResult& qualitativeResult0 = result0->asExplicitQualitativeCheckResult(); ASSERT_FALSE(qualitativeResult0[0]); auto submdp = perms->apply(); storm::modelchecker::SparseMdpPrctlModelChecker> checker1(submdp, std::unique_ptr>(new storm::solver::MinMaxLinearEquationSolverFactory(storm::solver::EquationSolverTypeSelection::Native))); std::unique_ptr result1 = checker1.check(formula02); storm::modelchecker::ExplicitQualitativeCheckResult& qualitativeResult1 = result1->asExplicitQualitativeCheckResult(); EXPECT_TRUE(qualitativeResult1[0]); // } #endif