33void testModelB(std::string programFile, std::string formulaAsString, std::string constantsAsString) {
36 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
38 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
48 auto simpleDtmc = binaryDtmcTransformer.transform(*dtmc,
true);
58 std::vector<std::map<storm::RationalFunctionVariable, storm::RationalFunctionCoefficient>> testInstantiations;
59 std::map<storm::RationalFunctionVariable, storm::RationalFunctionCoefficient> emptyInstantiation;
60 testInstantiations.push_back(emptyInstantiation);
61 for (
auto const& param : parameters) {
62 std::vector<std::map<storm::RationalFunctionVariable, storm::RationalFunctionCoefficient>> newInstantiations;
63 for (
auto point : testInstantiations) {
64 for (storm::RationalNumber x = storm::utility::convertNumber<storm::RationalNumber>(1e-6); x <= 1;
65 x += (1 - storm::utility::convertNumber<storm::RationalNumber>(1e-6)) / 10) {
66 std::map<storm::RationalFunctionVariable, storm::RationalFunctionCoefficient> newMap(point);
67 newMap[param] = storm::utility::convertNumber<storm::RationalFunctionCoefficient>(x);
68 newInstantiations.push_back(newMap);
71 testInstantiations = newInstantiations;
75 for (
auto const& instantiation : testInstantiations) {
76 auto result = modelChecker.
check(env, instantiation)->asExplicitQuantitativeCheckResult<
double>()[initialStateModel];
77 auto resultSimple = modelCheckerSimple.
check(env, instantiation)->asExplicitQuantitativeCheckResult<
double>()[initialStateModel];
79 <<
"Results " << result <<
" and " << resultSimple <<
" are not the same but should be.";
82 auto region = storm::api::createRegion<storm::RationalFunction>(
"0.4", *dtmc);
85 pla.
specify(env, dtmc, checkTask);
86 auto resultPLA = pla.
getBoundAtInitState(env, region[0], storm::OptimizationDirection::Minimize);
89 plaSimple.
specify(env, simpleDtmc, checkTask);
90 auto resultPLASimple = plaSimple.
getBoundAtInitState(env, region[0], storm::OptimizationDirection::Minimize);
93 ASSERT_TRUE(resultPLA < resultPLASimple || resultPLA == resultPLASimple) <<
"Worse PLA result with simplified DTMC";
96 for (uint64_t state = 0; state < simpleDtmc->getTransitionMatrix().getRowCount(); ++state) {
97 auto row = simpleDtmc->getTransitionMatrix().getRow(state);
99 std::set<storm::RationalFunctionVariable> variables;
101 for (
auto const& entry : row) {
102 for (
auto const& variable : entry.getValue().gatherVariables()) {
103 variables.emplace(variable);
107 if (variables.size() != 0) {
108 ASSERT_TRUE(variables.size() == 1);
109 auto parameter = *variables.begin();
114 auto oneMinusParameterRational =
storm::RationalFunction(carl::makePolynomial<storm::Polynomial>(oneMinusParameter));
117 uint64_t seenOneMinusP = 0;
119 for (
auto const& entry : row) {
121 if (entry.getValue() == parameterRational) {
123 }
else if (entry.getValue() == oneMinusParameterRational) {
126 ASSERT_TRUE(
false) <<
"Value " << entry.getValue() <<
" is not simple";
131 ASSERT_TRUE(seenP == 1 && seenOneMinusP == 1) <<
"State " << state <<
" not simple";