32void testModel(std::string programFile, std::string formulaAsString, std::string constantsAsString) {
35 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
37 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
47 auto timeTravelledDtmc = timeTravelling.timeTravel(*dtmc, checkTask);
57 std::vector<std::map<storm::RationalFunctionVariable, storm::RationalFunctionCoefficient>> testInstantiations;
58 std::map<storm::RationalFunctionVariable, storm::RationalFunctionCoefficient> emptyInstantiation;
59 testInstantiations.push_back(emptyInstantiation);
60 for (
auto const& param : parameters) {
61 std::vector<std::map<storm::RationalFunctionVariable, storm::RationalFunctionCoefficient>> newInstantiations;
62 for (
auto point : testInstantiations) {
63 for (storm::RationalNumber x = storm::utility::convertNumber<storm::RationalNumber>(1e-6); x <= 1;
64 x += (1 - storm::utility::convertNumber<storm::RationalNumber>(1e-6)) / 10) {
65 std::map<storm::RationalFunctionVariable, storm::RationalFunctionCoefficient> newMap(point);
66 newMap[param] = storm::utility::convertNumber<storm::RationalFunctionCoefficient>(x);
67 newInstantiations.push_back(newMap);
70 testInstantiations = newInstantiations;
74 for (
auto const& instantiation : testInstantiations) {
75 auto result = modelChecker.
check(env, instantiation)->asExplicitQuantitativeCheckResult<
double>()[initialStateModel];
76 auto resultTT = modelCheckerTT.
check(env, instantiation)->asExplicitQuantitativeCheckResult<
double>()[initialStateModel];
77 ASSERT_TRUE(
storm::utility::isAlmostZero(result - resultTT)) <<
"Results " << result <<
" and " << resultTT <<
" are not the same but should be.";
80 auto region = storm::api::createRegion<storm::RationalFunction>(
"0.4", *dtmc);
83 pla.
specify(env, dtmc, checkTask);
84 auto resultPLA = pla.
getBoundAtInitState(env, region[0], storm::OptimizationDirection::Minimize);
87 auto sharedDtmc = std::make_shared<storm::models::sparse::Dtmc<storm::RationalFunction>>(timeTravelledDtmc);
88 plaTT.
specify(env, sharedDtmc, checkTask);
89 auto resultPLATT = plaTT.
getBoundAtInitState(env, region[0], storm::OptimizationDirection::Minimize);
91 ASSERT_TRUE(resultPLA < resultPLATT) <<
"Time-Travelling did not make bound better";
virtual void specify(Environment const &env, std::shared_ptr< storm::models::ModelBase > parametricModel, CheckTask< storm::logic::Formula, ValueType > const &checkTask, bool generateRegionSplitEstimates=false, bool allowModelSimplification=true) override
std::set< storm::RationalFunctionVariable > getAllParameters(Model< storm::RationalFunction > const &model)
Get all parameters (probability, rewards, and rates) occurring in the model.