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
4#ifdef STORM_HAVE_CARL
5
7
9#include "storm/api/storm.h"
10
12
18
19namespace {
20class DoubleViEnvironment {
21 public:
22 typedef double ValueType;
24 static storm::Environment createEnvironment() {
26 env.solver().minMax().setMethod(storm::solver::MinMaxMethod::ValueIteration);
27 env.solver().minMax().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8));
28 return env;
29 }
30};
31
32class DoubleSVIEnvironment {
33 public:
34 typedef double ValueType;
36 static storm::Environment createEnvironment() {
38 env.solver().minMax().setMethod(storm::solver::MinMaxMethod::SoundValueIteration);
39 env.solver().minMax().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-6));
40 return env;
41 }
42};
43
44class RationalPiEnvironment {
45 public:
46 typedef storm::RationalNumber ValueType;
48 static storm::Environment createEnvironment() {
50 env.solver().minMax().setMethod(storm::solver::MinMaxMethod::PolicyIteration);
51 return env;
52 }
53};
54template<typename TestType>
55class SparseDtmcParameterLiftingTest : public ::testing::Test {
56 public:
57 typedef typename TestType::ValueType ValueType;
58 SparseDtmcParameterLiftingTest() : _environment(TestType::createEnvironment()) {}
59 storm::Environment const& env() const {
60 return _environment;
61 }
62 std::unique_ptr<storm::modelchecker::RegionModelChecker<storm::RationalFunction>> initializeRegionModelChecker(
63 std::shared_ptr<storm::models::sparse::Model<storm::RationalFunction>> model, std::shared_ptr<const storm::logic::Formula> formula,
64 bool allowSimplify) {
65 return storm::api::initializeRegionModelChecker(env(), model, storm::api::createTask<storm::RationalFunction>(formula, true), TestType::regionEngine,
66 allowSimplify);
67 }
68 std::unique_ptr<storm::modelchecker::RegionModelChecker<storm::RationalFunction>> initializeValidatingRegionModelChecker(
69 std::shared_ptr<storm::models::sparse::Model<storm::RationalFunction>> model, std::shared_ptr<const storm::logic::Formula> formula) {
70 return storm::api::initializeRegionModelChecker(env(), model, storm::api::createTask<storm::RationalFunction>(formula, true),
72 }
73 virtual void SetUp() {
74#ifndef STORM_HAVE_Z3
75 GTEST_SKIP() << "Z3 not available.";
76#endif
77 carl::VariablePool::getInstance().clear();
78 }
79 virtual void TearDown() {
80 carl::VariablePool::getInstance().clear();
81 }
82
83 private:
84 storm::Environment _environment;
85};
86
87typedef ::testing::Types<DoubleViEnvironment, DoubleSVIEnvironment, RationalPiEnvironment> TestingTypes;
88
89TYPED_TEST_SUITE(SparseDtmcParameterLiftingTest, TestingTypes, );
90
91TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Prob) {
92 typedef typename TestFixture::ValueType ValueType;
93
94 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp16_2.pm";
95 std::string formulaAsString = "P<=0.84 [F s=5 ]";
96 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
97
98 // Program and formula
100 program = storm::utility::prism::preprocess(program, constantsAsString);
101 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
103 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
104 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
105
106 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
107 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
108 modelParameters.insert(rewParameters.begin(), rewParameters.end());
109
110 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
111
112 // start testing
113 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pL<=0.9,0.75<=pK<=0.95", modelParameters);
114 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.4<=pL<=0.65,0.75<=pK<=0.95", modelParameters);
115 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pL<=0.73,0.2<=pK<=0.715", modelParameters);
116
118 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
120 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
122 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
123}
124
125TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Prob_no_simplification) {
126 typedef typename TestFixture::ValueType ValueType;
127
128 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp16_2.pm";
129 std::string formulaAsString = "P<=0.84 [F s=5 ]";
130 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
131
132 // Program and formula
133 storm::prism::Program program = storm::api::parseProgram(programFile);
134 program = storm::utility::prism::preprocess(program, constantsAsString);
135 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
137 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
138 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
139
140 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
141 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
142 modelParameters.insert(rewParameters.begin(), rewParameters.end());
143
144 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], false);
145
146 // start testing
147 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pL<=0.9,0.75<=pK<=0.95", modelParameters);
148 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.4<=pL<=0.65,0.75<=pK<=0.95", modelParameters);
149 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pL<=0.73,0.2<=pK<=0.715", modelParameters);
150
152 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
154 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
156 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
157}
158
159TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew) {
160 typedef typename TestFixture::ValueType ValueType;
161 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
162 std::string formulaAsString = "R>2.5 [F ((s=5) | (s=0&srep=3)) ]";
163 std::string constantsAsString = "pL=0.9,TOAck=0.5";
164
165 storm::prism::Program program = storm::api::parseProgram(programFile);
166 program = storm::utility::prism::preprocess(program, constantsAsString);
167 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
169 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
170 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
171
172 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
173 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
174 modelParameters.insert(rewParameters.begin(), rewParameters.end());
175
176 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
177
178 // start testing
179 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters);
180 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters);
181 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters);
182
184 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
186 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
188 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
189}
190
191TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_Bounded) {
192 typedef typename TestFixture::ValueType ValueType;
193 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
194 std::string formulaAsString = "R>2.5 [ C<=300]";
195 std::string constantsAsString = "pL=0.9,TOAck=0.5";
196
197 storm::prism::Program program = storm::api::parseProgram(programFile);
198 program = storm::utility::prism::preprocess(program, constantsAsString);
199 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
201 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
202 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
203
204 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
205 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
206 modelParameters.insert(rewParameters.begin(), rewParameters.end());
207
208 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
209
210 // start testing
211 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters);
212 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters);
213 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters);
214
216 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
218 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
220 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
221}
222
223TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Prob_exactValidation) {
224 typedef typename TestFixture::ValueType ValueType;
225 if (!std::is_same<ValueType, storm::RationalNumber>::value) {
226 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp16_2.pm";
227 std::string formulaAsString = "P<=0.84 [F s=5 ]";
228 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
229
230 // Program and formula
231 storm::prism::Program program = storm::api::parseProgram(programFile);
232 program = storm::utility::prism::preprocess(program, constantsAsString);
233 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
235 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
236 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
237
238 auto regionChecker = this->initializeValidatingRegionModelChecker(model, formulas[0]);
239
240 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
241 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
242 modelParameters.insert(rewParameters.begin(), rewParameters.end());
243
244 // start testing
245 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pL<=0.9,0.75<=pK<=0.95", modelParameters);
246 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.4<=pL<=0.65,0.75<=pK<=0.95", modelParameters);
247 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pL<=0.73,0.2<=pK<=0.715", modelParameters);
248
250 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
252 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
254 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
255 }
256}
257
258TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_exactValidation) {
259 typedef typename TestFixture::ValueType ValueType;
260 if (!std::is_same<ValueType, storm::RationalNumber>::value) {
261 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
262 std::string formulaAsString = "R>2.5 [F ((s=5) | (s=0&srep=3)) ]";
263 std::string constantsAsString = "pL=0.9,TOAck=0.5";
264
265 storm::prism::Program program = storm::api::parseProgram(programFile);
266 program = storm::utility::prism::preprocess(program, constantsAsString);
267 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
269 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
270 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
271
272 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
273 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
274 modelParameters.insert(rewParameters.begin(), rewParameters.end());
275
276 auto regionChecker = this->initializeValidatingRegionModelChecker(model, formulas[0]);
277
278 // start testing
279 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters);
280 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters);
281 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters);
282
284 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
286 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
288 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
289 }
290}
291
292TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_Bounded_exactValidation) {
293 typedef typename TestFixture::ValueType ValueType;
294
295 if (!std::is_same<ValueType, storm::RationalNumber>::value) {
296 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
297 std::string formulaAsString = "R>2.5 [ C<=300]";
298 std::string constantsAsString = "pL=0.9,TOAck=0.5";
299
300 storm::prism::Program program = storm::api::parseProgram(programFile);
301 program = storm::utility::prism::preprocess(program, constantsAsString);
302 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
304 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
305 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
306
307 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
308 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
309 modelParameters.insert(rewParameters.begin(), rewParameters.end());
310
311 auto regionChecker = this->initializeValidatingRegionModelChecker(model, formulas[0]);
312
313 // start testing
314 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters);
315 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters);
316 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters);
317
319 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
321 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
323 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
324 }
325}
326
327TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_Infty) {
328 typedef typename TestFixture::ValueType ValueType;
329
330 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
331 std::string formulaAsString = "R>2.5 [F (s=0&srep=3) ]";
332 std::string constantsAsString = "";
333 storm::prism::Program program = storm::api::parseProgram(programFile);
334 program = storm::utility::prism::preprocess(program, constantsAsString);
335 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
337 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
338 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
339
340 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
341 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
342 modelParameters.insert(rewParameters.begin(), rewParameters.end());
343
344 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
345
346 // start testing
347 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);
348
350 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
351}
352
353TYPED_TEST(SparseDtmcParameterLiftingTest, Brp_Rew_4Par) {
354 typedef typename TestFixture::ValueType ValueType;
355
356 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm";
357 std::string formulaAsString = "R>2.5 [F ((s=5) | (s=0&srep=3)) ]";
358 std::string constantsAsString = "";
359 storm::prism::Program program = storm::api::parseProgram(programFile);
360 program = storm::utility::prism::preprocess(program, constantsAsString);
361 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
363 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
364 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
365
366 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
367 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
368 modelParameters.insert(rewParameters.begin(), rewParameters.end());
369
370 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
371
372 // start testing
373 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);
374 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);
375 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);
376
378 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
380 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
382 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
383}
384
385TYPED_TEST(SparseDtmcParameterLiftingTest, Crowds_Prob) {
386 typedef typename TestFixture::ValueType ValueType;
387
388 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm";
389 std::string formulaAsString = "P<0.5 [F \"observe0Greater1\" ]";
390 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
391
392 storm::prism::Program program = storm::api::parseProgram(programFile);
393 program = storm::utility::prism::preprocess(program, constantsAsString);
394 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
396 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
397 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
398
399 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
400 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
401 modelParameters.insert(rewParameters.begin(), rewParameters.end());
402
403 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
404
405 // start testing
406 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=PF<=0.75,0.15<=badC<=0.2", modelParameters);
407 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.75<=PF<=0.8,0.2<=badC<=0.3", modelParameters);
408 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.95,0.2<=badC<=0.2", modelParameters);
409 auto allVioHardRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.95,0.2<=badC<=0.9", modelParameters);
410
412 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
414 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
416 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
418 regionChecker->analyzeRegion(this->env(), allVioHardRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
419}
420
421TYPED_TEST(SparseDtmcParameterLiftingTest, Crowds_Prob_stepBounded) {
422 typedef typename TestFixture::ValueType ValueType;
423
424 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm";
425 std::string formulaAsString = "P<0.5 [F<=300 \"observe0Greater1\" ]";
426 std::string constantsAsString = ""; // e.g. pL=0.9,TOACK=0.5
427
428 storm::prism::Program program = storm::api::parseProgram(programFile);
429 program = storm::utility::prism::preprocess(program, constantsAsString);
430 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
432 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
433 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
434
435 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
436 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
437 modelParameters.insert(rewParameters.begin(), rewParameters.end());
438
439 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
440
441 // start testing
442 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=PF<=0.75,0.15<=badC<=0.2", modelParameters);
443 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.75<=PF<=0.8,0.2<=badC<=0.3", modelParameters);
444 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.95,0.2<=badC<=0.2", modelParameters);
445 auto allVioHardRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.95,0.2<=badC<=0.9", modelParameters);
446
448 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
450 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
452 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
454 regionChecker->analyzeRegion(this->env(), allVioHardRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
455}
456
457TYPED_TEST(SparseDtmcParameterLiftingTest, Crowds_Prob_1Par) {
458 typedef typename TestFixture::ValueType ValueType;
459
460 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm";
461 std::string formulaAsString = "P>0.75 [F \"observe0Greater1\" ]";
462 std::string constantsAsString = "badC=0.3"; // e.g. pL=0.9,TOACK=0.5
463
464 storm::prism::Program program = storm::api::parseProgram(programFile);
465 program = storm::utility::prism::preprocess(program, constantsAsString);
466 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
468 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
469 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
470
471 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
472 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
473 modelParameters.insert(rewParameters.begin(), rewParameters.end());
474
475 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
476
477 // start testing
478 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.9<=PF<=0.99", modelParameters);
479 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=PF<=0.9", modelParameters);
480 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.01<=PF<=0.8", modelParameters);
481
483 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
485 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
487 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
488}
489
490TYPED_TEST(SparseDtmcParameterLiftingTest, Crowds_Prob_Const) {
491 typedef typename TestFixture::ValueType ValueType;
492
493 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm";
494 std::string formulaAsString = "P>0.6 [F \"observe0Greater1\" ]";
495 std::string constantsAsString = "PF=0.9,badC=0.2";
496
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>("", modelParameters);
512
514 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
515}
516
517TYPED_TEST(SparseDtmcParameterLiftingTest, ZeroConf) {
518 typedef typename TestFixture::ValueType ValueType;
519
520 std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/zeroconf4.pm";
521 std::string formulaAsString = "P>0.5 [F s=5 ]";
522 std::string constantsAsString = " n = 4"; // e.g. pL=0.9,TOACK=0.5
523
524 // Program and formula
525 storm::prism::Program program = storm::api::parseProgram(programFile);
526 program = storm::utility::prism::preprocess(program, constantsAsString);
527 std::vector<std::shared_ptr<const storm::logic::Formula>> formulas =
529 std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model =
530 storm::api::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>();
531
532 auto modelParameters = storm::models::sparse::getProbabilityParameters(*model);
533 auto rewParameters = storm::models::sparse::getRewardParameters(*model);
534 modelParameters.insert(rewParameters.begin(), rewParameters.end());
535
536 auto regionChecker = this->initializeRegionModelChecker(model, formulas[0], true);
537
538 // start testing
539 auto allSatRegion = storm::api::parseRegion<storm::RationalFunction>("0.8<=pL<=0.95,0.8<=pK<=0.95", modelParameters);
540 auto exBothRegion = storm::api::parseRegion<storm::RationalFunction>("0.6<=pL<=0.9,0.6<=pK<=0.9", modelParameters);
541 auto allVioRegion = storm::api::parseRegion<storm::RationalFunction>("0.1<=pL<=0.7,0.1<=pK<=0.7", modelParameters);
542
544 regionChecker->analyzeRegion(this->env(), allSatRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
546 regionChecker->analyzeRegion(this->env(), exBothRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
548 regionChecker->analyzeRegion(this->env(), allVioRegion, storm::modelchecker::RegionResultHypothesis::Unknown, true));
549}
550} // namespace
551#endif
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:14
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:707
std::set< storm::RationalFunctionVariable > getProbabilityParameters(Model< storm::RationalFunction > const &model)
Get all probability parameters occurring on transitions.
Definition Model.cpp:703
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:49
TYPED_TEST_SUITE(GraphTestAR, TestingTypes,)
::testing::Types< Cudd, Sylvan > TestingTypes
Definition GraphTest.cpp:46