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
8#include "storm/api/storm.h"
13
14namespace {
15class DoubleViEnvironment {
16 public:
17 typedef double ValueType;
19 static storm::Environment createEnvironment() {
21 env.solver().minMax().setMethod(storm::solver::MinMaxMethod::ValueIteration);
22 env.solver().minMax().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8));
23 return env;
24 }
25};
26
27class DoubleSVIEnvironment {
28 public:
29 typedef double ValueType;
31 static storm::Environment createEnvironment() {
33 env.solver().minMax().setMethod(storm::solver::MinMaxMethod::SoundValueIteration);
34 env.solver().minMax().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-6));
35 return env;
36 }
37};
38
39class RationalPiEnvironment {
40 public:
41 typedef storm::RationalNumber ValueType;
43 static storm::Environment createEnvironment() {
45 env.solver().minMax().setMethod(storm::solver::MinMaxMethod::PolicyIteration);
46 return env;
47 }
48};
49template<typename TestType>
50class SparseDtmcParameterLiftingTest : public ::testing::Test {
51 public:
52 typedef typename TestType::ValueType ValueType;
53 SparseDtmcParameterLiftingTest() : _environment(TestType::createEnvironment()) {}
54 storm::Environment const& env() const {
55 return _environment;
56 }
57 std::unique_ptr<storm::modelchecker::RegionModelChecker<storm::RationalFunction>> initializeRegionModelChecker(
58 std::shared_ptr<storm::models::sparse::Model<storm::RationalFunction>> model, std::shared_ptr<const storm::logic::Formula> formula,
59 bool allowSimplify) {
60 return storm::api::initializeRegionModelChecker(env(), model, storm::api::createTask<storm::RationalFunction>(formula, true), TestType::regionEngine,
61 allowSimplify);
62 }
63 std::unique_ptr<storm::modelchecker::RegionModelChecker<storm::RationalFunction>> initializeValidatingRegionModelChecker(
64 std::shared_ptr<storm::models::sparse::Model<storm::RationalFunction>> model, std::shared_ptr<const storm::logic::Formula> formula) {
65 return storm::api::initializeRegionModelChecker(env(), model, storm::api::createTask<storm::RationalFunction>(formula, true),
67 }
68 virtual void SetUp() {
69#ifndef STORM_HAVE_Z3
70 GTEST_SKIP() << "Z3 not available.";
71#endif
72 carl::VariablePool::getInstance().clear();
73 }
74 virtual void TearDown() {
75 carl::VariablePool::getInstance().clear();
76 }
77
78 private:
79 storm::Environment _environment;
80};
81
82typedef ::testing::Types<DoubleViEnvironment, DoubleSVIEnvironment, RationalPiEnvironment> TestingTypes;
83
84TYPED_TEST_SUITE(SparseDtmcParameterLiftingTest, TestingTypes, );
85
86TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Prob) {
87 typedef typename TestFixture::ValueType ValueType;
88
89 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp16_2.pm";
90 std::string formulaAsString = "P<=0.84 [F s=5 ]";
91 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
92
93 // Program and formula
95 program = storm::utility::prism::preprocess(program, constantsAsString);
96 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
98 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
99 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
100
101 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
102 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
103 modelParameters.insert(rewParameters.begin(), rewParameters.end());
104
105 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
106
107 // start testing
108 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pL<=0.9,0.75<=pK<=0.95", modelParameters);
109 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.4<=pL<=0.65,0.75<=pK<=0.95", modelParameters);
110 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pL<=0.73,0.2<=pK<=0.715", modelParameters);
111
113 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
115 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
117 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
118}
119
120TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Prob_no_simplification) {
121 typedef typename TestFixture::ValueType ValueType;
122
123 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp16_2.pm";
124 std::string formulaAsString = "P<=0.84 [F s=5 ]";
125 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
126
127 // Program and formula
128 storm::prism::Program program = storm::api::parseProgram(programFile);
129 program = storm::utility::prism::preprocess(program, constantsAsString);
130 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
132 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
133 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
134
135 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
136 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
137 modelParameters.insert(rewParameters.begin(), rewParameters.end());
138
139 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], false);
140
141 // start testing
142 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pL<=0.9,0.75<=pK<=0.95", modelParameters);
143 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.4<=pL<=0.65,0.75<=pK<=0.95", modelParameters);
144 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pL<=0.73,0.2<=pK<=0.715", modelParameters);
145
147 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
149 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
151 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
152}
153
154TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew) {
155 typedef typename TestFixture::ValueType ValueType;
156 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
157 std::string formulaAsString = "R>2.5 [F ((s=5) | (s=0&srep=3)) ]";
158 std::string constantsAsString = "pL=0.9,TOAck=0.5";
159
160 storm::prism::Program program = storm::api::parseProgram(programFile);
161 program = storm::utility::prism::preprocess(program, constantsAsString);
162 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
164 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
165 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
166
167 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
168 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
169 modelParameters.insert(rewParameters.begin(), rewParameters.end());
170
171 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
172
173 // start testing
174 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters);
175 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters);
176 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters);
177
179 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
181 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
183 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
184}
185
186TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_Bounded) {
187 typedef typename TestFixture::ValueType ValueType;
188 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
189 std::string formulaAsString = "R>2.5 [ C<=300]";
190 std::string constantsAsString = "pL=0.9,TOAck=0.5";
191
192 storm::prism::Program program = storm::api::parseProgram(programFile);
193 program = storm::utility::prism::preprocess(program, constantsAsString);
194 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
196 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
197 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
198
199 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
200 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
201 modelParameters.insert(rewParameters.begin(), rewParameters.end());
202
203 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
204
205 // start testing
206 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters);
207 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters);
208 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters);
209
211 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
213 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
215 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
216}
217
218TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Prob_exactValidation) {
219 typedef typename TestFixture::ValueType ValueType;
220 if (!std::is_same<ValueType, storm::RationalNumber>::value) {
221 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp16_2.pm";
222 std::string formulaAsString = "P<=0.84 [F s=5 ]";
223 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
224
225 // Program and formula
226 storm::prism::Program program = storm::api::parseProgram(programFile);
227 program = storm::utility::prism::preprocess(program, constantsAsString);
228 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
230 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
231 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
232
233 auto regionChecker = this->initializeValidatingRegionModelChecker(model, formulas[0]);
234
235 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
236 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
237 modelParameters.insert(rewParameters.begin(), rewParameters.end());
238
239 // start testing
240 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pL<=0.9,0.75<=pK<=0.95", modelParameters);
241 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.4<=pL<=0.65,0.75<=pK<=0.95", modelParameters);
242 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pL<=0.73,0.2<=pK<=0.715", modelParameters);
243
245 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
247 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
249 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
250 }
251}
252
253TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_exactValidation) {
254 typedef typename TestFixture::ValueType ValueType;
255 if (!std::is_same<ValueType, storm::RationalNumber>::value) {
256 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
257 std::string formulaAsString = "R>2.5 [F ((s=5) | (s=0&srep=3)) ]";
258 std::string constantsAsString = "pL=0.9,TOAck=0.5";
259
260 storm::prism::Program program = storm::api::parseProgram(programFile);
261 program = storm::utility::prism::preprocess(program, constantsAsString);
262 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
264 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
265 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
266
267 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
268 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
269 modelParameters.insert(rewParameters.begin(), rewParameters.end());
270
271 auto regionChecker = this->initializeValidatingRegionModelChecker(model, formulas[0]);
272
273 // start testing
274 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters);
275 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters);
276 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters);
277
279 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
281 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
283 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
284 }
285}
286
287TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_Bounded_exactValidation) {
288 typedef typename TestFixture::ValueType ValueType;
289
290 if (!std::is_same<ValueType, storm::RationalNumber>::value) {
291 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
292 std::string formulaAsString = "R>2.5 [ C<=300]";
293 std::string constantsAsString = "pL=0.9,TOAck=0.5";
294
295 storm::prism::Program program = storm::api::parseProgram(programFile);
296 program = storm::utility::prism::preprocess(program, constantsAsString);
297 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
299 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
300 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
301
302 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
303 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
304 modelParameters.insert(rewParameters.begin(), rewParameters.end());
305
306 auto regionChecker = this->initializeValidatingRegionModelChecker(model, formulas[0]);
307
308 // start testing
309 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters);
310 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters);
311 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters);
312
314 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
316 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
318 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
319 }
320}
321
322TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_Infty) {
323 typedef typename TestFixture::ValueType ValueType;
324
325 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
326 std::string formulaAsString = "R>2.5 [F (s=0&srep=3) ]";
327 std::string constantsAsString = "";
328 storm::prism::Program program = storm::api::parseProgram(programFile);
329 program = storm::utility::prism::preprocess(program, constantsAsString);
330 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
332 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
333 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
334
335 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
336 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
337 modelParameters.insert(rewParameters.begin(), rewParameters.end());
338
339 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
340
341 // start testing
342 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);
343
345 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
346}
347
348TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_4Par) {
349 typedef typename TestFixture::ValueType ValueType;
350
351 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
352 std::string formulaAsString = "R>2.5 [F ((s=5) | (s=0&srep=3)) ]";
353 std::string constantsAsString = "";
354 storm::prism::Program program = storm::api::parseProgram(programFile);
355 program = storm::utility::prism::preprocess(program, constantsAsString);
356 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
358 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
359 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
360
361 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
362 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
363 modelParameters.insert(rewParameters.begin(), rewParameters.end());
364
365 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
366
367 // start testing
368 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);
369 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);
370 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);
371
373 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
375 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
377 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
378}
379
380TYPED_TEST(SparseDtmcParameterLiftingTest, Crowds_Prob) {
381 typedef typename TestFixture::ValueType ValueType;
382
383 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm";
384 std::string formulaAsString = "P<0.5 [F \"observe0Greater1\" ]";
385 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
386
387 storm::prism::Program program = storm::api::parseProgram(programFile);
388 program = storm::utility::prism::preprocess(program, constantsAsString);
389 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
391 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
392 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
393
394 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
395 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
396 modelParameters.insert(rewParameters.begin(), rewParameters.end());
397
398 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
399
400 // start testing
401 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=PF<=0.75,0.15<=badC<=0.2", modelParameters);
402 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.75<=PF<=0.8,0.2<=badC<=0.3", modelParameters);
403 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.95,0.2<=badC<=0.2", modelParameters);
404 auto allVioHardRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.95,0.2<=badC<=0.9", modelParameters);
405
407 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
409 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
411 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
413 regionChecker->analyzeRegion(this->env(), allVioHardRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
414}
415
416TYPED_TEST(SparseDtmcParameterLiftingTest, Crowds_Prob_stepBounded) {
417 typedef typename TestFixture::ValueType ValueType;
418
419 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm";
420 std::string formulaAsString = "P<0.5 [F<=300 \"observe0Greater1\" ]";
421 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
422
423 storm::prism::Program program = storm::api::parseProgram(programFile);
424 program = storm::utility::prism::preprocess(program, constantsAsString);
425 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
427 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
428 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
429
430 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
431 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
432 modelParameters.insert(rewParameters.begin(), rewParameters.end());
433
434 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
435
436 // start testing
437 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=PF<=0.75,0.15<=badC<=0.2", modelParameters);
438 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.75<=PF<=0.8,0.2<=badC<=0.3", modelParameters);
439 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.95,0.2<=badC<=0.2", modelParameters);
440 auto allVioHardRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.95,0.2<=badC<=0.9", modelParameters);
441
443 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
445 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
447 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
449 regionChecker->analyzeRegion(this->env(), allVioHardRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
450}
451
452TYPED_TEST(SparseDtmcParameterLiftingTest, Crowds_Prob_1Par) {
453 typedef typename TestFixture::ValueType ValueType;
454
455 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm";
456 std::string formulaAsString = "P>0.75 [F \"observe0Greater1\" ]";
457 std::string constantsAsString = "badC=0.3"; // e.g. pL=0.9,TOACK=0.5
458
459 storm::prism::Program program = storm::api::parseProgram(programFile);
460 program = storm::utility::prism::preprocess(program, constantsAsString);
461 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
463 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
464 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
465
466 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
467 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
468 modelParameters.insert(rewParameters.begin(), rewParameters.end());
469
470 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
471
472 // start testing
473 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.9<=PF<=0.99", modelParameters);
474 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.9", modelParameters);
475 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.01<=PF<=0.8", modelParameters);
476
478 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
480 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
482 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
483}
484
485TYPED_TEST(SparseDtmcParameterLiftingTest, Crowds_Prob_Const) {
486 typedef typename TestFixture::ValueType ValueType;
487
488 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm";
489 std::string formulaAsString = "P>0.6 [F \"observe0Greater1\" ]";
490 std::string constantsAsString = "PF=0.9,badC=0.2";
491
492 storm::prism::Program program = storm::api::parseProgram(programFile);
493 program = storm::utility::prism::preprocess(program, constantsAsString);
494 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
496 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
497 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
498
499 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
500 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
501 modelParameters.insert(rewParameters.begin(), rewParameters.end());
502
503 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
504
505 // start testing
506 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("", modelParameters);
507
509 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
510}
511
512TYPED_TEST(SparseDtmcParameterLiftingTest, ZeroConf) {
513 typedef typename TestFixture::ValueType ValueType;
514
515 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/zeroconf4.pm";
516 std::string formulaAsString = "P>0.5 [F s=5 ]";
517 std::string constantsAsString = " n = 4"; // e.g. pL=0.9,TOACK=0.5
518
519 // Program and formula
520 storm::prism::Program program = storm::api::parseProgram(programFile);
521 program = storm::utility::prism::preprocess(program, constantsAsString);
522 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
524 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
525 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
526
527 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
528 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
529 modelParameters.insert(rewParameters.begin(), rewParameters.end());
530
531 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
532
533 // start testing
534 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=pL<=0.95,0.8<=pK<=0.95", modelParameters);
535 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pL<=0.9,0.6<=pK<=0.9", modelParameters);
536 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pL<=0.7,0.1<=pK<=0.7", modelParameters);
537
539 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
541 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
543 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
544}
545} // 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:697
std::set< storm::RationalFunctionVariable > getProbabilityParameters(Model< storm::RationalFunction > const &model)
Get all probability parameters occurring on transitions.
Definition Model.cpp:693
storm::prism::Program preprocess(storm::prism::Program const &program, std::map< storm::expressions::Variable, storm::expressions::Expression > const &constantDefinitions)
Definition prism.cpp:19
TYPED_TEST(GraphTestAR, SymbolicProb01StochasticGameDieSmall)
Definition GraphTest.cpp:62
TYPED_TEST_SUITE(GraphTestAR, TestingTypes,)
::testing::Types< Cudd, Sylvan > TestingTypes
Definition GraphTest.cpp:59