/* #include "gtest/gtest.h" #include "storm-config.h" #include "src/settings/SettingsManager.h" #include "src/modelchecker/EigenDtmcPrctlModelChecker.h" #include "src/parser/AutoParser.h" TEST(EigenDtmcPrctlModelCheckerTest, Die) { storm::settings::Settings* s = storm::settings::Settings::getInstance(); storm::settings::InternalOptionMemento deadlockOption("fixDeadlocks", true); ASSERT_TRUE(s->isSet("fixDeadlocks")); storm::parser::AutoParser parser(STORM_CPP_TESTS_BASE_PATH "/functional/modelchecker/die/die.tra", STORM_CPP_TESTS_BASE_PATH "/functional/modelchecker/die/die.lab", "", STORM_CPP_TESTS_BASE_PATH "/functional/modelchecker/die/die.coin_flips.trans.rew"); ASSERT_EQ(parser.getType(), storm::models::DTMC); std::shared_ptr> dtmc = parser.getModel>(); ASSERT_EQ(dtmc->getNumberOfStates(), 14); ASSERT_EQ(dtmc->getNumberOfTransitions(), 28); storm::modelChecker::EigenDtmcPrctlModelChecker mc(*dtmc); storm::properties::Ap* apFormula = new storm::properties::Ap("one"); storm::properties::Eventually* eventuallyFormula = new storm::properties::Eventually(apFormula); storm::properties::ProbabilisticNoBoundOperator* probFormula = new storm::properties::ProbabilisticNoBoundOperator(eventuallyFormula); std::vector* result = probFormula->check(mc); ASSERT_LT(std::abs((*result)[1] - ((double)1/6)), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble()); delete probFormula; delete result; apFormula = new storm::properties::Ap("two"); eventuallyFormula = new storm::properties::Eventually(apFormula); probFormula = new storm::properties::ProbabilisticNoBoundOperator(eventuallyFormula); result = probFormula->check(mc); ASSERT_LT(std::abs((*result)[1] - ((double)1/6)), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble()); delete probFormula; delete result; apFormula = new storm::properties::Ap("three"); eventuallyFormula = new storm::properties::Eventually(apFormula); probFormula = new storm::properties::ProbabilisticNoBoundOperator(eventuallyFormula); result = probFormula->check(mc); ASSERT_LT(std::abs((*result)[1] - ((double)1/6)), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble()); delete probFormula; delete result; storm::properties::Ap* done = new storm::properties::Ap("done"); storm::properties::ReachabilityReward* reachabilityRewardFormula = new storm::properties::ReachabilityReward(done); storm::properties::RewardNoBoundOperator* rewardFormula = new storm::properties::RewardNoBoundOperator(reachabilityRewardFormula); result = rewardFormula->check(mc); ASSERT_LT(std::abs((*result)[1] - ((double)11/3)), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble()); delete rewardFormula; delete result; } TEST(EigenDtmcPrctlModelCheckerTest, Crowds) { storm::settings::Settings* s = storm::settings::Settings::getInstance(); storm::settings::InternalOptionMemento deadlockOption("fixDeadlocks", true); ASSERT_TRUE(s->isSet("fixDeadlocks")); storm::parser::AutoParser parser(STORM_CPP_TESTS_BASE_PATH "/functional/modelchecker/crowds/crowds5_5.tra", STORM_CPP_TESTS_BASE_PATH "/functional/modelchecker/crowds/crowds5_5.lab", "", ""); ASSERT_EQ(parser.getType(), storm::models::DTMC); std::shared_ptr> dtmc = parser.getModel>(); ASSERT_EQ(dtmc->getNumberOfStates(), 8608); ASSERT_EQ(dtmc->getNumberOfTransitions(), 22461); storm::modelChecker::EigenDtmcPrctlModelChecker mc(*dtmc); storm::properties::Ap* apFormula = new storm::properties::Ap("observe0Greater1"); storm::properties::Eventually* eventuallyFormula = new storm::properties::Eventually(apFormula); storm::properties::ProbabilisticNoBoundOperator* probFormula = new storm::properties::ProbabilisticNoBoundOperator(eventuallyFormula); std::vector* result = probFormula->check(mc); ASSERT_LT(std::abs((*result)[1] - 0.3328800375801578281), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble()); delete probFormula; delete result; apFormula = new storm::properties::Ap("observeIGreater1"); eventuallyFormula = new storm::properties::Eventually(apFormula); probFormula = new storm::properties::ProbabilisticNoBoundOperator(eventuallyFormula); result = probFormula->check(mc); ASSERT_LT(std::abs((*result)[1] - 0.1522173670950556501), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble()); delete probFormula; delete result; apFormula = new storm::properties::Ap("observeOnlyTrueSender"); eventuallyFormula = new storm::properties::Eventually(apFormula); probFormula = new storm::properties::ProbabilisticNoBoundOperator(eventuallyFormula); result = probFormula->check(mc); ASSERT_LT(std::abs((*result)[1] - 0.32153724292835045), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble()); delete probFormula; delete result; } TEST(EigenDtmcPrctlModelCheckerTest, SynchronousLeader) { storm::settings::Settings* s = storm::settings::Settings::getInstance(); storm::settings::InternalOptionMemento deadlockOption("fixDeadlocks", true); ASSERT_TRUE(s->isSet("fixDeadlocks")); storm::parser::AutoParser parser(STORM_CPP_TESTS_BASE_PATH "/functional/modelchecker/synchronous_leader/leader4_8.tra", STORM_CPP_TESTS_BASE_PATH "/functional/modelchecker/synchronous_leader/leader4_8.lab", "", STORM_CPP_TESTS_BASE_PATH "/functional/modelchecker/synchronous_leader/leader4_8.pick.trans.rew"); ASSERT_EQ(parser.getType(), storm::models::DTMC); std::shared_ptr> dtmc = parser.getModel>(); ASSERT_EQ(dtmc->getNumberOfStates(), 12401); ASSERT_EQ(dtmc->getNumberOfTransitions(), 28895); storm::modelChecker::EigenDtmcPrctlModelChecker mc(*dtmc); storm::properties::Ap* apFormula = new storm::properties::Ap("elected"); storm::properties::Eventually* eventuallyFormula = new storm::properties::Eventually(apFormula); storm::properties::ProbabilisticNoBoundOperator* probFormula = new storm::properties::ProbabilisticNoBoundOperator(eventuallyFormula); std::vector* result = probFormula->check(mc); ASSERT_LT(std::abs((*result)[1] - 1), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble()); delete probFormula; delete result; apFormula = new storm::properties::Ap("elected"); storm::properties::BoundedUntil* boundedUntilFormula = new storm::properties::BoundedUntil(new storm::properties::Ap("true"), apFormula, 20); probFormula = new storm::properties::ProbabilisticNoBoundOperator(boundedUntilFormula); result = probFormula->check(mc); ASSERT_LT(std::abs((*result)[1] - 0.9999965911265462636), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble()); delete probFormula; delete result; apFormula = new storm::properties::Ap("elected"); storm::properties::ReachabilityReward* reachabilityRewardFormula = new storm::properties::ReachabilityReward(apFormula); storm::properties::RewardNoBoundOperator* rewardFormula = new storm::properties::RewardNoBoundOperator(reachabilityRewardFormula); result = rewardFormula->check(mc); ASSERT_LT(std::abs((*result)[1] - 1.0448979591835938496), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble()); delete rewardFormula; delete result; } */