|
|
@ -68,7 +68,36 @@ TEST(SparseDtmcParameterLiftingTest, Brp_Rew) { |
|
|
|
EXPECT_EQ(storm::modelchecker::parametric::RegionCheckResult::AllViolated, parameterLiftingContext.analyzeRegion(allVioRegion, storm::modelchecker::parametric::RegionCheckResult::Unknown, true)); |
|
|
|
|
|
|
|
carl::VariablePool::getInstance().clear(); |
|
|
|
} |
|
|
|
|
|
|
|
TEST(SparseDtmcParameterLiftingTest, Brp_Rew_Bounded) { |
|
|
|
std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/brp_rewards16_2.pm"; |
|
|
|
std::string formulaAsString = "R>2.5 [ C<=300]"; |
|
|
|
std::string constantsAsString = "pL=0.9,TOAck=0.5"; |
|
|
|
carl::VariablePool::getInstance().clear(); |
|
|
|
|
|
|
|
storm::prism::Program program = storm::parseProgram(programFile); |
|
|
|
program = storm::utility::prism::preprocess(program, constantsAsString); |
|
|
|
std::vector<std::shared_ptr<const storm::logic::Formula>> formulas = storm::extractFormulasFromProperties(storm::parsePropertiesForPrismProgram(formulaAsString, program)); |
|
|
|
std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model = storm::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>(); |
|
|
|
|
|
|
|
auto modelParameters = storm::models::sparse::getProbabilityParameters(*model); |
|
|
|
auto rewParameters = storm::models::sparse::getRewardParameters(*model); |
|
|
|
modelParameters.insert(rewParameters.begin(), rewParameters.end()); |
|
|
|
|
|
|
|
storm::modelchecker::parametric::ParameterLifting<storm::models::sparse::Dtmc<storm::RationalFunction>, double> parameterLiftingContext(*model); |
|
|
|
parameterLiftingContext.specifyFormula(storm::modelchecker::CheckTask<storm::logic::Formula, storm::RationalFunction>(*formulas[0], true)); |
|
|
|
|
|
|
|
//start testing
|
|
|
|
auto allSatRegion=storm::storage::ParameterRegion<storm::RationalFunction>::parseRegion("0.7<=pK<=0.875,0.75<=TOMsg<=0.95", modelParameters); |
|
|
|
auto exBothRegion=storm::storage::ParameterRegion<storm::RationalFunction>::parseRegion("0.6<=pK<=0.9,0.5<=TOMsg<=0.95", modelParameters); |
|
|
|
auto allVioRegion=storm::storage::ParameterRegion<storm::RationalFunction>::parseRegion("0.1<=pK<=0.3,0.2<=TOMsg<=0.3", modelParameters); |
|
|
|
|
|
|
|
EXPECT_EQ(storm::modelchecker::parametric::RegionCheckResult::AllSat, parameterLiftingContext.analyzeRegion(allSatRegion, storm::modelchecker::parametric::RegionCheckResult::Unknown, true)); |
|
|
|
EXPECT_EQ(storm::modelchecker::parametric::RegionCheckResult::ExistsBoth, parameterLiftingContext.analyzeRegion(exBothRegion, storm::modelchecker::parametric::RegionCheckResult::Unknown, true)); |
|
|
|
EXPECT_EQ(storm::modelchecker::parametric::RegionCheckResult::AllViolated, parameterLiftingContext.analyzeRegion(allVioRegion, storm::modelchecker::parametric::RegionCheckResult::Unknown, true)); |
|
|
|
|
|
|
|
carl::VariablePool::getInstance().clear(); |
|
|
|
} |
|
|
|
|
|
|
|
TEST(SparseDtmcParameterLiftingTest, Brp_Rew_Infty) { |
|
|
@ -160,6 +189,39 @@ TEST(SparseDtmcParameterLiftingTest, Crowds_Prob) { |
|
|
|
carl::VariablePool::getInstance().clear(); |
|
|
|
} |
|
|
|
|
|
|
|
TEST(SparseDtmcParameterLiftingTest, Crowds_Prob_stepBounded) { |
|
|
|
|
|
|
|
std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm"; |
|
|
|
std::string formulaAsString = "P<0.5 [F<=300 \"observe0Greater1\" ]"; |
|
|
|
std::string constantsAsString = ""; //e.g. pL=0.9,TOACK=0.5
|
|
|
|
carl::VariablePool::getInstance().clear(); |
|
|
|
|
|
|
|
storm::prism::Program program = storm::parseProgram(programFile); |
|
|
|
program = storm::utility::prism::preprocess(program, constantsAsString); |
|
|
|
std::vector<std::shared_ptr<const storm::logic::Formula>> formulas = storm::extractFormulasFromProperties(storm::parsePropertiesForPrismProgram(formulaAsString, program)); |
|
|
|
std::shared_ptr<storm::models::sparse::Dtmc<storm::RationalFunction>> model = storm::buildSparseModel<storm::RationalFunction>(program, formulas)->as<storm::models::sparse::Dtmc<storm::RationalFunction>>(); |
|
|
|
|
|
|
|
auto modelParameters = storm::models::sparse::getProbabilityParameters(*model); |
|
|
|
auto rewParameters = storm::models::sparse::getRewardParameters(*model); |
|
|
|
modelParameters.insert(rewParameters.begin(), rewParameters.end()); |
|
|
|
|
|
|
|
storm::modelchecker::parametric::ParameterLifting<storm::models::sparse::Dtmc<storm::RationalFunction>, double> parameterLiftingContext(*model); |
|
|
|
parameterLiftingContext.specifyFormula(storm::modelchecker::CheckTask<storm::logic::Formula, storm::RationalFunction>(*formulas[0], true)); |
|
|
|
|
|
|
|
//start testing
|
|
|
|
auto allSatRegion=storm::storage::ParameterRegion<storm::RationalFunction>::parseRegion("0.1<=PF<=0.75,0.15<=badC<=0.2", modelParameters); |
|
|
|
auto exBothRegion=storm::storage::ParameterRegion<storm::RationalFunction>::parseRegion("0.75<=PF<=0.8,0.2<=badC<=0.3", modelParameters); |
|
|
|
auto allVioRegion=storm::storage::ParameterRegion<storm::RationalFunction>::parseRegion("0.8<=PF<=0.95,0.2<=badC<=0.2", modelParameters); |
|
|
|
auto allVioHardRegion=storm::storage::ParameterRegion<storm::RationalFunction>::parseRegion("0.8<=PF<=0.95,0.2<=badC<=0.9", modelParameters); |
|
|
|
|
|
|
|
EXPECT_EQ(storm::modelchecker::parametric::RegionCheckResult::AllSat, parameterLiftingContext.analyzeRegion(allSatRegion, storm::modelchecker::parametric::RegionCheckResult::Unknown, true)); |
|
|
|
EXPECT_EQ(storm::modelchecker::parametric::RegionCheckResult::ExistsBoth, parameterLiftingContext.analyzeRegion(exBothRegion, storm::modelchecker::parametric::RegionCheckResult::Unknown, true)); |
|
|
|
EXPECT_EQ(storm::modelchecker::parametric::RegionCheckResult::AllViolated, parameterLiftingContext.analyzeRegion(allVioRegion, storm::modelchecker::parametric::RegionCheckResult::Unknown, true)); |
|
|
|
EXPECT_EQ(storm::modelchecker::parametric::RegionCheckResult::CenterViolated, parameterLiftingContext.analyzeRegion(allVioHardRegion, storm::modelchecker::parametric::RegionCheckResult::Unknown, true)); |
|
|
|
|
|
|
|
carl::VariablePool::getInstance().clear(); |
|
|
|
} |
|
|
|
|
|
|
|
TEST(SparseDtmcParameterLiftingTest, Crowds_Prob_1Par) { |
|
|
|
|
|
|
|
std::string programFile = STORM_TEST_RESOURCES_DIR "/pdtmc/crowds3_5.pm"; |
|
|
|