Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SparseDtmcParameterLiftingTest.cpp
Go to the documentation of this file.
1#include "storm-config.h"
2#include "test/storm_gtest.h"
3
7#include "storm/api/storm.h"
10
11namespace {
12class DoubleViEnvironment {
13 public:
14 typedef double ValueType;
16 static storm::Environment createEnvironment() {
18 env.solver().minMax().setMethod(storm::solver::MinMaxMethod::ValueIteration);
19 env.solver().minMax().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8));
20 return env;
21 }
22};
23
24class DoubleSVIEnvironment {
25 public:
26 typedef double ValueType;
28 static storm::Environment createEnvironment() {
30 env.solver().minMax().setMethod(storm::solver::MinMaxMethod::SoundValueIteration);
31 env.solver().minMax().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-6));
32 return env;
33 }
34};
35
36class RationalPiEnvironment {
37 public:
38 typedef storm::RationalNumber ValueType;
40 static storm::Environment createEnvironment() {
42 env.solver().minMax().setMethod(storm::solver::MinMaxMethod::PolicyIteration);
43 return env;
44 }
45};
46template<typename TestType>
47class SparseDtmcParameterLiftingTest : public ::testing::Test {
48 public:
49 typedef typename TestType::ValueType ValueType;
50 SparseDtmcParameterLiftingTest() : _environment(TestType::createEnvironment()) {}
51 storm::Environment const& env() const {
52 return _environment;
53 }
54 std::unique_ptr<storm::modelchecker::RegionModelChecker<storm::RationalFunction>> initializeRegionModelChecker(
55 std::shared_ptr<storm::models::sparse::Model<storm::RationalFunction>> model, std::shared_ptr<const storm::logic::Formula> formula,
56 bool allowSimplify) {
57 return storm::api::initializeRegionModelChecker(env(), model, storm::api::createTask<storm::RationalFunction>(formula, true), TestType::regionEngine,
58 allowSimplify);
59 }
60 std::unique_ptr<storm::modelchecker::RegionModelChecker<storm::RationalFunction>> initializeValidatingRegionModelChecker(
61 std::shared_ptr<storm::models::sparse::Model<storm::RationalFunction>> model, std::shared_ptr<const storm::logic::Formula> formula) {
62 return storm::api::initializeRegionModelChecker(env(), model, storm::api::createTask<storm::RationalFunction>(formula, true),
64 }
65 virtual void SetUp() {
66#ifndef STORM_HAVE_Z3
67 GTEST_SKIP() << "Z3 not available.";
68#endif
69 carl::VariablePool::getInstance().clear();
70 }
71 virtual void TearDown() {
72 carl::VariablePool::getInstance().clear();
73 }
74
75 private:
76 storm::Environment _environment;
77};
78
79typedef ::testing::Types<DoubleViEnvironment, DoubleSVIEnvironment, RationalPiEnvironment> TestingTypes;
80
81TYPED_TEST_SUITE(SparseDtmcParameterLiftingTest, TestingTypes, );
82
83TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Prob) {
84 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp16_2.pm";
85 std::string formulaAsString = "P<=0.84 [F s=5 ]";
86 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
87
88 // Program and formula
90 program = storm::utility::prism::preprocess(program, constantsAsString);
91 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
93 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
94 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
95
96 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
97 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
98 modelParameters.insert(rewParameters.begin(), rewParameters.end());
99
100 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
101
102 // start testing
103 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pL<=0.9,0.75<=pK<=0.95", modelParameters);
104 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.4<=pL<=0.65,0.75<=pK<=0.95", modelParameters);
105 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pL<=0.73,0.2<=pK<=0.715", modelParameters);
106
108 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
110 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
112 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
113}
114
115TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Prob_no_simplification) {
116 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp16_2.pm";
117 std::string formulaAsString = "P<=0.84 [F s=5 ]";
118 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
119
120 // Program and formula
121 storm::prism::Program program = storm::api::parseProgram(programFile);
122 program = storm::utility::prism::preprocess(program, constantsAsString);
123 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
125 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
126 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
127
128 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
129 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
130 modelParameters.insert(rewParameters.begin(), rewParameters.end());
131
132 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], false);
133
134 // start testing
135 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pL<=0.9,0.75<=pK<=0.95", modelParameters);
136 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.4<=pL<=0.65,0.75<=pK<=0.95", modelParameters);
137 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pL<=0.73,0.2<=pK<=0.715", modelParameters);
138
140 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
142 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
144 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
145}
146
147TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew) {
148 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
149 std::string formulaAsString = "R>2.5 [F ((s=5) | (s=0&srep=3)) ]";
150 std::string constantsAsString = "pL=0.9,TOAck=0.5";
151
152 storm::prism::Program program = storm::api::parseProgram(programFile);
153 program = storm::utility::prism::preprocess(program, constantsAsString);
154 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
156 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
157 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
158
159 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
160 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
161 modelParameters.insert(rewParameters.begin(), rewParameters.end());
162
163 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
164
165 // start testing
166 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters);
167 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters);
168 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters);
169
171 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
173 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
175 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
176}
177
178TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_Bounded) {
179 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
180 std::string formulaAsString = "R>2.5 [ C<=300]";
181 std::string constantsAsString = "pL=0.9,TOAck=0.5";
182
183 storm::prism::Program program = storm::api::parseProgram(programFile);
184 program = storm::utility::prism::preprocess(program, constantsAsString);
185 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
187 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
188 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
189
190 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
191 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
192 modelParameters.insert(rewParameters.begin(), rewParameters.end());
193
194 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
195
196 // start testing
197 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters);
198 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters);
199 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters);
200
202 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
204 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
206 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
207}
208
209TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Prob_exactValidation) {
210 typedef typename TestFixture::ValueType ValueType;
211 if (!std::is_same<ValueType, storm::RationalNumber>::value) {
212 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp16_2.pm";
213 std::string formulaAsString = "P<=0.84 [F s=5 ]";
214 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
215
216 // Program and formula
217 storm::prism::Program program = storm::api::parseProgram(programFile);
218 program = storm::utility::prism::preprocess(program, constantsAsString);
219 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
221 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
222 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
223
224 auto regionChecker = this->initializeValidatingRegionModelChecker(model, formulas[0]);
225
226 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
227 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
228 modelParameters.insert(rewParameters.begin(), rewParameters.end());
229
230 // start testing
231 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pL<=0.9,0.75<=pK<=0.95", modelParameters);
232 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.4<=pL<=0.65,0.75<=pK<=0.95", modelParameters);
233 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pL<=0.73,0.2<=pK<=0.715", modelParameters);
234
236 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
238 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
240 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
241 }
242}
243
244TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_exactValidation) {
245 typedef typename TestFixture::ValueType ValueType;
246 if (!std::is_same<ValueType, storm::RationalNumber>::value) {
247 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
248 std::string formulaAsString = "R>2.5 [F ((s=5) | (s=0&srep=3)) ]";
249 std::string constantsAsString = "pL=0.9,TOAck=0.5";
250
251 storm::prism::Program program = storm::api::parseProgram(programFile);
252 program = storm::utility::prism::preprocess(program, constantsAsString);
253 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
255 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
256 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
257
258 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
259 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
260 modelParameters.insert(rewParameters.begin(), rewParameters.end());
261
262 auto regionChecker = this->initializeValidatingRegionModelChecker(model, formulas[0]);
263
264 // start testing
265 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters);
266 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters);
267 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters);
268
270 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
272 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
274 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
275 }
276}
277
278TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_Bounded_exactValidation) {
279 typedef typename TestFixture::ValueType ValueType;
280
281 if (!std::is_same<ValueType, storm::RationalNumber>::value) {
282 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
283 std::string formulaAsString = "R>2.5 [ C<=300]";
284 std::string constantsAsString = "pL=0.9,TOAck=0.5";
285
286 storm::prism::Program program = storm::api::parseProgram(programFile);
287 program = storm::utility::prism::preprocess(program, constantsAsString);
288 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
290 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
291 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
292
293 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
294 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
295 modelParameters.insert(rewParameters.begin(), rewParameters.end());
296
297 auto regionChecker = this->initializeValidatingRegionModelChecker(model, formulas[0]);
298
299 // start testing
300 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters);
301 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters);
302 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters);
303
305 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
307 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
309 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
310 }
311}
312
313TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_Infty) {
314 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
315 std::string formulaAsString = "R>2.5 [F (s=0&srep=3) ]";
316 std::string constantsAsString = "";
317 storm::prism::Program program = storm::api::parseProgram(programFile);
318 program = storm::utility::prism::preprocess(program, constantsAsString);
319 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
321 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
322 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
323
324 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
325 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
326 modelParameters.insert(rewParameters.begin(), rewParameters.end());
327
328 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
329
330 // start testing
331 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.9,0.6<=pL<=0.85,0.9<=TOMsg<=0.95,0.85<=TOAck<=0.9", modelParameters);
332
334 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
335}
336
337TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_4Par) {
338 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
339 std::string formulaAsString = "R>2.5 [F ((s=5) | (s=0&srep=3)) ]";
340 std::string constantsAsString = "";
341 storm::prism::Program program = storm::api::parseProgram(programFile);
342 program = storm::utility::prism::preprocess(program, constantsAsString);
343 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
345 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
346 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
347
348 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
349 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
350 modelParameters.insert(rewParameters.begin(), rewParameters.end());
351
352 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
353
354 // start testing
355 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.9,0.6<=pL<=0.85,0.9<=TOMsg<=0.95,0.85<=TOAck<=0.9", modelParameters);
356 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.7,0.2<=pL<=0.8,0.15<=TOMsg<=0.65,0.3<=TOAck<=0.9", modelParameters);
357 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.4,0.2<=pL<=0.3,0.15<=TOMsg<=0.3,0.1<=TOAck<=0.2", modelParameters);
358
360 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
362 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
364 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
365}
366
367TYPED_TEST(SparseDtmcParameterLiftingTest, Crowds_Prob) {
368 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm";
369 std::string formulaAsString = "P<0.5 [F \"observe0Greater1\" ]";
370 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
371
372 storm::prism::Program program = storm::api::parseProgram(programFile);
373 program = storm::utility::prism::preprocess(program, constantsAsString);
374 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
376 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
377 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
378
379 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
380 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
381 modelParameters.insert(rewParameters.begin(), rewParameters.end());
382
383 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
384
385 // start testing
386 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=PF<=0.75,0.15<=badC<=0.2", modelParameters);
387 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.75<=PF<=0.8,0.2<=badC<=0.3", modelParameters);
388 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.95,0.2<=badC<=0.2", modelParameters);
389 auto allVioHardRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.95,0.2<=badC<=0.9", modelParameters);
390
392 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
394 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
396 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
398 regionChecker->analyzeRegion(this->env(), allVioHardRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
399}
400
401TYPED_TEST(SparseDtmcParameterLiftingTest, Crowds_Prob_stepBounded) {
402 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm";
403 std::string formulaAsString = "P<0.5 [F<=300 \"observe0Greater1\" ]";
404 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
405
406 storm::prism::Program program = storm::api::parseProgram(programFile);
407 program = storm::utility::prism::preprocess(program, constantsAsString);
408 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
410 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
411 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
412
413 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
414 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
415 modelParameters.insert(rewParameters.begin(), rewParameters.end());
416
417 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
418
419 // start testing
420 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=PF<=0.75,0.15<=badC<=0.2", modelParameters);
421 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.75<=PF<=0.8,0.2<=badC<=0.3", modelParameters);
422 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.95,0.2<=badC<=0.2", modelParameters);
423 auto allVioHardRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.95,0.2<=badC<=0.9", modelParameters);
424
426 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
428 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
430 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
432 regionChecker->analyzeRegion(this->env(), allVioHardRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
433}
434
435TYPED_TEST(SparseDtmcParameterLiftingTest, Crowds_Prob_1Par) {
436 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm";
437 std::string formulaAsString = "P>0.75 [F \"observe0Greater1\" ]";
438 std::string constantsAsString = "badC=0.3"; // e.g. pL=0.9,TOACK=0.5
439
440 storm::prism::Program program = storm::api::parseProgram(programFile);
441 program = storm::utility::prism::preprocess(program, constantsAsString);
442 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
444 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
445 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
446
447 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
448 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
449 modelParameters.insert(rewParameters.begin(), rewParameters.end());
450
451 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
452
453 // start testing
454 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.9<=PF<=0.99", modelParameters);
455 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.9", modelParameters);
456 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.01<=PF<=0.8", modelParameters);
457
459 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
461 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
463 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
464}
465
466TYPED_TEST(SparseDtmcParameterLiftingTest, Crowds_Prob_Const) {
467 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm";
468 std::string formulaAsString = "P>0.6 [F \"observe0Greater1\" ]";
469 std::string constantsAsString = "PF=0.9,badC=0.2";
470
471 storm::prism::Program program = storm::api::parseProgram(programFile);
472 program = storm::utility::prism::preprocess(program, constantsAsString);
473 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
475 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
476 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
477
478 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
479 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
480 modelParameters.insert(rewParameters.begin(), rewParameters.end());
481
482 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
483
484 // start testing
485 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("", modelParameters);
486
488 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
489}
490
491TYPED_TEST(SparseDtmcParameterLiftingTest, ZeroConf) {
492 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/zeroconf4.pm";
493 std::string formulaAsString = "P>0.5 [F s=5 ]";
494 std::string constantsAsString = " n = 4"; // e.g. pL=0.9,TOACK=0.5
495
496 // Program and formula
497 storm::prism::Program program = storm::api::parseProgram(programFile);
498 program = storm::utility::prism::preprocess(program, constantsAsString);
499 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
501 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
502 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
503
504 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
505 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
506 modelParameters.insert(rewParameters.begin(), rewParameters.end());
507
508 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
509
510 // start testing
511 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=pL<=0.95,0.8<=pK<=0.95", modelParameters);
512 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pL<=0.9,0.6<=pK<=0.9", modelParameters);
513 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pL<=0.7,0.1<=pK<=0.7", modelParameters);
514
516 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
518 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
520 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
521}
522} // namespace
SolverEnvironment & solver()
void setPrecision(storm::RationalNumber value)
void setMethod(storm::solver::MinMaxMethod value, bool isSetFromDefault=false)
MinMaxSolverEnvironment & minMax()
This class represents a discrete-time Markov chain.
Definition Dtmc.h:13
Base class for all sparse models.
Definition Model.h:32
std::vector< storm::jani::Property > parsePropertiesForPrismProgram(std::string const &inputString, storm::prism::Program const &program, boost::optional< std::set< std::string > > const &propertyFilter)
storm::prism::Program parseProgram(std::string const &filename, bool prismCompatibility, bool simplify)
std::unique_ptr< storm::modelchecker::RegionModelChecker< ValueType > > initializeRegionModelChecker(Environment const &env, std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, storm::modelchecker::CheckTask< storm::logic::Formula, ValueType > const &task, storm::modelchecker::RegionCheckEngine engine, bool allowModelSimplification=true, bool graphPreserving=true, bool preconditionsValidated=false, MonotonicitySetting monotonicitySetting=MonotonicitySetting(), std::optional< std::pair< std::set< typename storm::storage::ParameterRegion< ValueType >::VariableType >, std::set< typename storm::storage::ParameterRegion< ValueType >::VariableType > > > monotoneParameters=std::nullopt)
Definition region.h:271
std::vector< std::shared_ptr< storm::logic::Formula const > > extractFormulasFromProperties(std::vector< storm::jani::Property > const &properties)
SFTBDDChecker::ValueType ValueType
@ AllSat
the formula is satisfied for all well-defined parameters in the given region
@ AllViolated
the formula is violated for all well-defined parameters in the given region
@ ExistsBoth
the formula is satisfied for some parameters but also violated for others
@ CenterViolated
the formula is violated for the parameter Valuation that corresponds to the center point of the regio...
RegionCheckEngine
The considered engine for region checking.
@ ParameterLifting
Parameter lifting approach.
@ ValidatingParameterLifting
Parameter lifting approach with a) inexact (and fast) computation first and b) exact validation of ob...
@ ExactParameterLifting
Parameter lifting approach with exact arithmethics.
std::set< storm::RationalFunctionVariable > getRewardParameters(Model< storm::RationalFunction > const &model)
Get all parameters occurring in rewards.
Definition Model.cpp:699
std::set< storm::RationalFunctionVariable > getProbabilityParameters(Model< storm::RationalFunction > const &model)
Get all probability parameters occurring on transitions.
Definition Model.cpp:695
storm::prism::Program preprocess(storm::prism::Program const &program, std::map< storm::expressions::Variable, storm::expressions::Expression > const &constantDefinitions)
Definition prism.cpp:13
TYPED_TEST(GraphTestAR, SymbolicProb01StochasticGameDieSmall)
Definition GraphTest.cpp:62
TYPED_TEST_SUITE(GraphTestAR, TestingTypes,)
::testing::Types< Cudd, Sylvan > TestingTypes
Definition GraphTest.cpp:59