Browse Source

DdPrismModelBuilder now errors in case it has a program with unbounded integer variables as input

tempestpy_adaptions
Tim Quatmann 4 years ago
parent
commit
1fe0254f5d
No known key found for this signature in database GPG Key ID: 6EDE19592731EEC3
  1. 8
      resources/examples/testfiles/mdp/unbounded.nm
  2. 3
      src/storm/builder/DdPrismModelBuilder.cpp
  3. 11
      src/test/storm/builder/DdPrismModelBuilderTest.cpp

8
resources/examples/testfiles/mdp/unbounded.nm

@ -0,0 +1,8 @@
mdp
const int N;
module main
x : int;
[] x<=0 -> (x'=x+1);
[] x>0 -> (x'=N*x);
endmodule

3
src/storm/builder/DdPrismModelBuilder.cpp

@ -541,7 +541,7 @@ namespace storm {
template <storm::dd::DdType Type, typename ValueType> template <storm::dd::DdType Type, typename ValueType>
bool DdPrismModelBuilder<Type, ValueType>::canHandle(storm::prism::Program const& program) { bool DdPrismModelBuilder<Type, ValueType>::canHandle(storm::prism::Program const& program) {
return program.getModelType() != storm::prism::Program::ModelType::PTA;
return !program.hasUnboundedVariables() && (program.getModelType() != storm::prism::Program::ModelType::PTA);
} }
template <storm::dd::DdType Type, typename ValueType> template <storm::dd::DdType Type, typename ValueType>
@ -1311,6 +1311,7 @@ namespace storm {
stream << "."; stream << ".";
STORM_LOG_THROW(false, storm::exceptions::InvalidArgumentException, "Program still contains these undefined constants: " + stream.str()); STORM_LOG_THROW(false, storm::exceptions::InvalidArgumentException, "Program still contains these undefined constants: " + stream.str());
} }
STORM_LOG_THROW(!program.hasUnboundedVariables(), storm::exceptions::InvalidArgumentException, "Program contains unbounded variables which is not supported by the DD engine.");
STORM_LOG_TRACE("Building representation of program:" << std::endl << program << std::endl); STORM_LOG_TRACE("Building representation of program:" << std::endl << program << std::endl);

11
src/test/storm/builder/DdPrismModelBuilderTest.cpp

@ -319,3 +319,14 @@ TEST(DdPrismModelBuilderTest_Cudd, Composition) {
EXPECT_EQ(21ul, mdp->getNumberOfChoices()); EXPECT_EQ(21ul, mdp->getNumberOfChoices());
} }
TEST(UnboundedTest_Sylvan, Mdp) {
storm::storage::SymbolicModelDescription modelDescription = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/unbounded.nm");
storm::prism::Program program = modelDescription.preprocess("N=1").asPrismProgram();
EXPECT_FALSE(storm::builder::DdPrismModelBuilder<storm::dd::DdType::Sylvan>().canHandle(program));
}
TEST(UnboundedTest_Cudd, Mdp) {
storm::storage::SymbolicModelDescription modelDescription = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/unbounded.nm");
storm::prism::Program program = modelDescription.preprocess("N=1").asPrismProgram();
EXPECT_FALSE(storm::builder::DdPrismModelBuilder<storm::dd::DdType::CUDD>().canHandle(program));
}
Loading…
Cancel
Save