/* #include "gtest/gtest.h" #include "storm-config.h" #include "src/settings/Settings.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::property::Ap* apFormula = new storm::property::Ap("one"); storm::property::Eventually* eventuallyFormula = new storm::property::Eventually(apFormula); storm::property::ProbabilisticNoBoundOperator* probFormula = new storm::property::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::property::Ap("two"); eventuallyFormula = new storm::property::Eventually(apFormula); probFormula = new storm::property::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::property::Ap("three"); eventuallyFormula = new storm::property::Eventually(apFormula); probFormula = new storm::property::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::property::Ap* done = new storm::property::Ap("done"); storm::property::ReachabilityReward* reachabilityRewardFormula = new storm::property::ReachabilityReward(done); storm::property::RewardNoBoundOperator* rewardFormula = new storm::property::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::property::Ap* apFormula = new storm::property::Ap("observe0Greater1"); storm::property::Eventually* eventuallyFormula = new storm::property::Eventually(apFormula); storm::property::ProbabilisticNoBoundOperator* probFormula = new storm::property::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::property::Ap("observeIGreater1"); eventuallyFormula = new storm::property::Eventually(apFormula); probFormula = new storm::property::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::property::Ap("observeOnlyTrueSender"); eventuallyFormula = new storm::property::Eventually(apFormula); probFormula = new storm::property::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::property::Ap* apFormula = new storm::property::Ap("elected"); storm::property::Eventually* eventuallyFormula = new storm::property::Eventually(apFormula); storm::property::ProbabilisticNoBoundOperator* probFormula = new storm::property::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::property::Ap("elected"); storm::property::BoundedUntil* boundedUntilFormula = new storm::property::BoundedUntil(new storm::property::Ap("true"), apFormula, 20); probFormula = new storm::property::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::property::Ap("elected"); storm::property::ReachabilityReward* reachabilityRewardFormula = new storm::property::ReachabilityReward(apFormula); storm::property::RewardNoBoundOperator* rewardFormula = new storm::property::RewardNoBoundOperator(reachabilityRewardFormula); result = rewardFormula->check(mc); ASSERT_LT(std::abs((*result)[1] - 1.0448979591835938496), s->getOptionByLongName("precision").getArgument(0).getValueAsDouble()); delete rewardFormula; delete result; } */