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 typedef typename TestFixture::ValueType ValueType;
85
86 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp16_2.pm";
87 std::string formulaAsString = "P<=0.84 [F s=5 ]";
88 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
89
90 // Program and formula
92 program = storm::utility::prism::preprocess(program, constantsAsString);
93 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
95 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
96 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
97
98 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
99 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
100 modelParameters.insert(rewParameters.begin(), rewParameters.end());
101
102 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
103
104 // start testing
105 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pL<=0.9,0.75<=pK<=0.95", modelParameters);
106 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.4<=pL<=0.65,0.75<=pK<=0.95", modelParameters);
107 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pL<=0.73,0.2<=pK<=0.715", modelParameters);
108
110 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
112 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
114 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
115}
116
117TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Prob_no_simplification) {
118 typedef typename TestFixture::ValueType ValueType;
119
120 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp16_2.pm";
121 std::string formulaAsString = "P<=0.84 [F s=5 ]";
122 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
123
124 // Program and formula
125 storm::prism::Program program = storm::api::parseProgram(programFile);
126 program = storm::utility::prism::preprocess(program, constantsAsString);
127 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
129 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
130 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
131
132 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
133 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
134 modelParameters.insert(rewParameters.begin(), rewParameters.end());
135
136 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], false);
137
138 // start testing
139 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pL<=0.9,0.75<=pK<=0.95", modelParameters);
140 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.4<=pL<=0.65,0.75<=pK<=0.95", modelParameters);
141 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pL<=0.73,0.2<=pK<=0.715", modelParameters);
142
144 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
146 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
148 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
149}
150
151TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew) {
152 typedef typename TestFixture::ValueType ValueType;
153 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
154 std::string formulaAsString = "R>2.5 [F ((s=5) | (s=0&srep=3)) ]";
155 std::string constantsAsString = "pL=0.9,TOAck=0.5";
156
157 storm::prism::Program program = storm::api::parseProgram(programFile);
158 program = storm::utility::prism::preprocess(program, constantsAsString);
159 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
161 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
162 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
163
164 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
165 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
166 modelParameters.insert(rewParameters.begin(), rewParameters.end());
167
168 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
169
170 // start testing
171 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters);
172 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters);
173 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters);
174
176 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
178 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
180 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
181}
182
183TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_Bounded) {
184 typedef typename TestFixture::ValueType ValueType;
185 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
186 std::string formulaAsString = "R>2.5 [ C<=300]";
187 std::string constantsAsString = "pL=0.9,TOAck=0.5";
188
189 storm::prism::Program program = storm::api::parseProgram(programFile);
190 program = storm::utility::prism::preprocess(program, constantsAsString);
191 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
193 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
194 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
195
196 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
197 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
198 modelParameters.insert(rewParameters.begin(), rewParameters.end());
199
200 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
201
202 // start testing
203 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters);
204 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters);
205 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters);
206
208 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
210 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
212 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
213}
214
215TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Prob_exactValidation) {
216 typedef typename TestFixture::ValueType ValueType;
217 if (!std::is_same<ValueType, storm::RationalNumber>::value) {
218 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp16_2.pm";
219 std::string formulaAsString = "P<=0.84 [F s=5 ]";
220 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
221
222 // Program and formula
223 storm::prism::Program program = storm::api::parseProgram(programFile);
224 program = storm::utility::prism::preprocess(program, constantsAsString);
225 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
227 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
228 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
229
230 auto regionChecker = this->initializeValidatingRegionModelChecker(model, formulas[0]);
231
232 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
233 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
234 modelParameters.insert(rewParameters.begin(), rewParameters.end());
235
236 // start testing
237 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pL<=0.9,0.75<=pK<=0.95", modelParameters);
238 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.4<=pL<=0.65,0.75<=pK<=0.95", modelParameters);
239 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pL<=0.73,0.2<=pK<=0.715", modelParameters);
240
242 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
244 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
246 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
247 }
248}
249
250TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_exactValidation) {
251 typedef typename TestFixture::ValueType ValueType;
252 if (!std::is_same<ValueType, storm::RationalNumber>::value) {
253 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
254 std::string formulaAsString = "R>2.5 [F ((s=5) | (s=0&srep=3)) ]";
255 std::string constantsAsString = "pL=0.9,TOAck=0.5";
256
257 storm::prism::Program program = storm::api::parseProgram(programFile);
258 program = storm::utility::prism::preprocess(program, constantsAsString);
259 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
261 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
262 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
263
264 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
265 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
266 modelParameters.insert(rewParameters.begin(), rewParameters.end());
267
268 auto regionChecker = this->initializeValidatingRegionModelChecker(model, formulas[0]);
269
270 // start testing
271 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters);
272 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters);
273 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters);
274
276 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
278 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
280 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
281 }
282}
283
284TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_Bounded_exactValidation) {
285 typedef typename TestFixture::ValueType ValueType;
286
287 if (!std::is_same<ValueType, storm::RationalNumber>::value) {
288 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
289 std::string formulaAsString = "R>2.5 [ C<=300]";
290 std::string constantsAsString = "pL=0.9,TOAck=0.5";
291
292 storm::prism::Program program = storm::api::parseProgram(programFile);
293 program = storm::utility::prism::preprocess(program, constantsAsString);
294 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
296 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
297 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
298
299 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
300 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
301 modelParameters.insert(rewParameters.begin(), rewParameters.end());
302
303 auto regionChecker = this->initializeValidatingRegionModelChecker(model, formulas[0]);
304
305 // start testing
306 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters);
307 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters);
308 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters);
309
311 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
313 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
315 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
316 }
317}
318
319TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_Infty) {
320 typedef typename TestFixture::ValueType ValueType;
321
322 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
323 std::string formulaAsString = "R>2.5 [F (s=0&srep=3) ]";
324 std::string constantsAsString = "";
325 storm::prism::Program program = storm::api::parseProgram(programFile);
326 program = storm::utility::prism::preprocess(program, constantsAsString);
327 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
329 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
330 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
331
332 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
333 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
334 modelParameters.insert(rewParameters.begin(), rewParameters.end());
335
336 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
337
338 // start testing
339 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);
340
342 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
343}
344
345TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_4Par) {
346 typedef typename TestFixture::ValueType ValueType;
347
348 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
349 std::string formulaAsString = "R>2.5 [F ((s=5) | (s=0&srep=3)) ]";
350 std::string constantsAsString = "";
351 storm::prism::Program program = storm::api::parseProgram(programFile);
352 program = storm::utility::prism::preprocess(program, constantsAsString);
353 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
355 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
356 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
357
358 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
359 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
360 modelParameters.insert(rewParameters.begin(), rewParameters.end());
361
362 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
363
364 // start testing
365 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);
366 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);
367 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);
368
370 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
372 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
374 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
375}
376
377TYPED_TEST(SparseDtmcParameterLiftingTest, Crowds_Prob) {
378 typedef typename TestFixture::ValueType ValueType;
379
380 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm";
381 std::string formulaAsString = "P<0.5 [F \"observe0Greater1\" ]";
382 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
383
384 storm::prism::Program program = storm::api::parseProgram(programFile);
385 program = storm::utility::prism::preprocess(program, constantsAsString);
386 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
388 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
389 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
390
391 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
392 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
393 modelParameters.insert(rewParameters.begin(), rewParameters.end());
394
395 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
396
397 // start testing
398 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=PF<=0.75,0.15<=badC<=0.2", modelParameters);
399 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.75<=PF<=0.8,0.2<=badC<=0.3", modelParameters);
400 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.95,0.2<=badC<=0.2", modelParameters);
401 auto allVioHardRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.95,0.2<=badC<=0.9", modelParameters);
402
404 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
406 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
408 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
410 regionChecker->analyzeRegion(this->env(), allVioHardRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
411}
412
413TYPED_TEST(SparseDtmcParameterLiftingTest, Crowds_Prob_stepBounded) {
414 typedef typename TestFixture::ValueType ValueType;
415
416 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm";
417 std::string formulaAsString = "P<0.5 [F<=300 \"observe0Greater1\" ]";
418 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
419
420 storm::prism::Program program = storm::api::parseProgram(programFile);
421 program = storm::utility::prism::preprocess(program, constantsAsString);
422 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
424 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
425 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
426
427 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
428 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
429 modelParameters.insert(rewParameters.begin(), rewParameters.end());
430
431 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
432
433 // start testing
434 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=PF<=0.75,0.15<=badC<=0.2", modelParameters);
435 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.75<=PF<=0.8,0.2<=badC<=0.3", modelParameters);
436 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.95,0.2<=badC<=0.2", modelParameters);
437 auto allVioHardRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.95,0.2<=badC<=0.9", modelParameters);
438
440 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
442 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
444 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
446 regionChecker->analyzeRegion(this->env(), allVioHardRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
447}
448
449TYPED_TEST(SparseDtmcParameterLiftingTest, Crowds_Prob_1Par) {
450 typedef typename TestFixture::ValueType ValueType;
451
452 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm";
453 std::string formulaAsString = "P>0.75 [F \"observe0Greater1\" ]";
454 std::string constantsAsString = "badC=0.3"; // e.g. pL=0.9,TOACK=0.5
455
456 storm::prism::Program program = storm::api::parseProgram(programFile);
457 program = storm::utility::prism::preprocess(program, constantsAsString);
458 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
460 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
461 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
462
463 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
464 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
465 modelParameters.insert(rewParameters.begin(), rewParameters.end());
466
467 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
468
469 // start testing
470 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.9<=PF<=0.99", modelParameters);
471 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.9", modelParameters);
472 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.01<=PF<=0.8", modelParameters);
473
475 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
477 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
479 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
480}
481
482TYPED_TEST(SparseDtmcParameterLiftingTest, Crowds_Prob_Const) {
483 typedef typename TestFixture::ValueType ValueType;
484
485 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm";
486 std::string formulaAsString = "P>0.6 [F \"observe0Greater1\" ]";
487 std::string constantsAsString = "PF=0.9,badC=0.2";
488
489 storm::prism::Program program = storm::api::parseProgram(programFile);
490 program = storm::utility::prism::preprocess(program, constantsAsString);
491 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
493 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
494 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
495
496 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
497 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
498 modelParameters.insert(rewParameters.begin(), rewParameters.end());
499
500 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
501
502 // start testing
503 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("", modelParameters);
504
506 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
507}
508
509TYPED_TEST(SparseDtmcParameterLiftingTest, ZeroConf) {
510 typedef typename TestFixture::ValueType ValueType;
511
512 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/zeroconf4.pm";
513 std::string formulaAsString = "P>0.5 [F s=5 ]";
514 std::string constantsAsString = " n = 4"; // e.g. pL=0.9,TOACK=0.5
515
516 // Program and formula
517 storm::prism::Program program = storm::api::parseProgram(programFile);
518 program = storm::utility::prism::preprocess(program, constantsAsString);
519 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
521 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
522 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
523
524 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
525 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
526 modelParameters.insert(rewParameters.begin(), rewParameters.end());
527
528 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
529
530 // start testing
531 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=pL<=0.95,0.8<=pK<=0.95", modelParameters);
532 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pL<=0.9,0.6<=pK<=0.9", modelParameters);
533 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pL<=0.7,0.1<=pK<=0.7", modelParameters);
534
536 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
538 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
540 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
541}
542} // 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