360 changed files with 5924 additions and 2945 deletions
-
63.travis.yml
-
28CHANGELOG.md
-
74CMakeLists.txt
-
2doc/checklist_new_release.md
-
23resources/3rdparty/CMakeLists.txt
-
6resources/3rdparty/carl/CMakeLists.txt
-
20resources/cmake/macros/export.cmake
-
11resources/cmake/stormConfigVersion.cmake.in
-
28resources/examples/testfiles/ctmc/simple2.sm
-
71resources/examples/testfiles/dft/and.json
-
42resources/examples/testfiles/ma/simple2.ma
-
12resources/examples/testfiles/mdp/prism-mec-example1.nm
-
13resources/examples/testfiles/mdp/prism-mec-example2.nm
-
5src/CMakeLists.txt
-
4src/storm-cli-utilities/CMakeLists.txt
-
29src/storm-cli-utilities/cli.cpp
-
7src/storm-cli-utilities/cli.h
-
56src/storm-cli-utilities/model-handling.h
-
9src/storm-conv-cli/CMakeLists.txt
-
207src/storm-conv-cli/storm-conv.cpp
-
40src/storm-conv/CMakeLists.txt
-
71src/storm-conv/api/storm-conv.cpp
-
28src/storm-conv/api/storm-conv.h
-
15src/storm-conv/converter/options/JaniConversionOptions.cpp
-
32src/storm-conv/converter/options/JaniConversionOptions.h
-
12src/storm-conv/converter/options/PrismToJaniConverterOptions.cpp
-
21src/storm-conv/converter/options/PrismToJaniConverterOptions.h
-
24src/storm-conv/settings/ConvSettings.cpp
-
11src/storm-conv/settings/ConvSettings.h
-
77src/storm-conv/settings/modules/ConversionGeneralSettings.cpp
-
88src/storm-conv/settings/modules/ConversionGeneralSettings.h
-
80src/storm-conv/settings/modules/ConversionInputSettings.cpp
-
86src/storm-conv/settings/modules/ConversionInputSettings.h
-
57src/storm-conv/settings/modules/ConversionOutputSettings.cpp
-
49src/storm-conv/settings/modules/ConversionOutputSettings.h
-
78src/storm-conv/settings/modules/JaniExportSettings.cpp
-
14src/storm-conv/settings/modules/JaniExportSettings.h
-
40src/storm-counterexamples/CMakeLists.txt
-
2src/storm-counterexamples/api/counterexamples.cpp
-
4src/storm-counterexamples/api/counterexamples.h
-
2src/storm-counterexamples/counterexamples/Counterexample.cpp
-
0src/storm-counterexamples/counterexamples/Counterexample.h
-
2src/storm-counterexamples/counterexamples/HighLevelCounterexample.cpp
-
2src/storm-counterexamples/counterexamples/HighLevelCounterexample.h
-
4src/storm-counterexamples/counterexamples/MILPMinimalLabelSetGenerator.h
-
754src/storm-counterexamples/counterexamples/SMTMinimalLabelSetGenerator.h
-
4src/storm-counterexamples/settings/modules/CounterexampleGeneratorSettings.cpp
-
0src/storm-counterexamples/settings/modules/CounterexampleGeneratorSettings.h
-
2src/storm-dft-cli/CMakeLists.txt
-
9src/storm-dft-cli/storm-dft.cpp
-
4src/storm-dft/CMakeLists.txt
-
16src/storm-dft/api/storm-dft.cpp
-
33src/storm-dft/api/storm-dft.h
-
3src/storm-dft/modelchecker/dft/DFTModelChecker.cpp
-
4src/storm-dft/parser/DFTGalileoParser.h
-
126src/storm-dft/parser/DFTJsonParser.cpp
-
12src/storm-dft/parser/DFTJsonParser.h
-
2src/storm-dft/settings/DftSettings.cpp
-
50src/storm-dft/storage/dft/DftJsonExporter.cpp
-
6src/storm-dft/storage/dft/DftJsonExporter.h
-
3src/storm-gspn-cli/CMakeLists.txt
-
66src/storm-gspn-cli/storm-gspn.cpp
-
26src/storm-gspn/CMakeLists.txt
-
56src/storm-gspn/api/storm-gspn.cpp
-
8src/storm-gspn/api/storm-gspn.h
-
2src/storm-gspn/builder/ExplicitGspnModelBuilder.cpp
-
157src/storm-gspn/builder/JaniGSPNBuilder.cpp
-
11src/storm-gspn/builder/JaniGSPNBuilder.h
-
153src/storm-gspn/parser/GreatSpnEditorProjectParser.cpp
-
13src/storm-gspn/parser/GreatSpnEditorProjectParser.h
-
5src/storm-gspn/parser/GspnParser.cpp
-
2src/storm-gspn/parser/GspnParser.h
-
17src/storm-gspn/settings/modules/GSPNExportSettings.cpp
-
17src/storm-gspn/settings/modules/GSPNExportSettings.h
-
37src/storm-gspn/settings/modules/GSPNSettings.cpp
-
31src/storm-gspn/settings/modules/GSPNSettings.h
-
20src/storm-gspn/storage/gspn/GSPN.cpp
-
11src/storm-gspn/storage/gspn/GSPN.h
-
24src/storm-gspn/storage/gspn/GspnBuilder.cpp
-
15src/storm-gspn/storage/gspn/GspnBuilder.h
-
11src/storm-gspn/storage/gspn/GspnJsonExporter.cpp
-
47src/storm-gspn/storage/gspn/TimedTransition.h
-
2src/storm-pars-cli/CMakeLists.txt
-
256src/storm-pars-cli/storm-pars.cpp
-
2src/storm-pars/CMakeLists.txt
-
27src/storm-pars/modelchecker/instantiation/SparseCtmcInstantiationModelChecker.cpp
-
28src/storm-pars/modelchecker/instantiation/SparseCtmcInstantiationModelChecker.h
-
6src/storm-pars/modelchecker/instantiation/SparseDtmcInstantiationModelChecker.cpp
-
6src/storm-pars/modelchecker/instantiation/SparseInstantiationModelChecker.cpp
-
2src/storm-pars/modelchecker/instantiation/SparseMdpInstantiationModelChecker.cpp
-
4src/storm-pars/settings/ParsSettings.cpp
-
23src/storm-pars/settings/modules/ParametricSettings.cpp
-
20src/storm-pars/settings/modules/ParametricSettings.h
-
42src/storm-parsers/CMakeLists.txt
-
6src/storm-parsers/api/model_descriptions.cpp
-
0src/storm-parsers/api/model_descriptions.h
-
71src/storm-parsers/api/properties.cpp
-
43src/storm-parsers/api/properties.h
-
4src/storm-parsers/api/storm-parsers.h
-
4src/storm-parsers/parser/AtomicPropositionLabelingParser.cpp
@ -0,0 +1,11 @@ |
|||
set(PACKAGE_VERSION "@storm_VERSION@") |
|||
|
|||
# Check whether the requested PACKAGE_FIND_VERSION is compatible |
|||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") |
|||
set(PACKAGE_VERSION_COMPATIBLE FALSE) |
|||
else() |
|||
set(PACKAGE_VERSION_COMPATIBLE TRUE) |
|||
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") |
|||
set(PACKAGE_VERSION_EXACT TRUE) |
|||
endif() |
|||
endif() |
@ -0,0 +1,28 @@ |
|||
|
|||
ctmc |
|||
|
|||
|
|||
module main |
|||
|
|||
s : [0..4]; // current state: |
|||
|
|||
|
|||
<> s=0 -> 4 : (s'=1) + 4 : (s'=2); |
|||
<> s=1 -> 0.3 : (s'=2) + 0.7 : (s'=1); |
|||
<> s=2 -> 0.5 : (s'=2) + 0.5 : (s'=3); |
|||
<> s=3 -> 1 : (s'=4); |
|||
<> s=4 -> 1 : (s'=3); |
|||
|
|||
endmodule |
|||
|
|||
rewards "rew1" |
|||
s=0 : 7; |
|||
[] s=2 : 1; |
|||
endrewards |
|||
|
|||
|
|||
rewards "rew2" |
|||
s=0 : 7; |
|||
[] s=2 : 1; |
|||
[] s=4 : 100; |
|||
endrewards |
@ -0,0 +1,71 @@ |
|||
{ |
|||
"toplevel": "2", |
|||
"parameters": {}, |
|||
"nodes": [ |
|||
{ |
|||
"data": { |
|||
"id": "0", |
|||
"name": "A", |
|||
"type": "be", |
|||
"rate": "1", |
|||
"dorm": "1", |
|||
"label": "A (1)" |
|||
}, |
|||
"position": { |
|||
"x": 440, |
|||
"y": 260 |
|||
}, |
|||
"group": "nodes", |
|||
"removed": false, |
|||
"selected": false, |
|||
"selectable": true, |
|||
"locked": false, |
|||
"grabbable": true, |
|||
"classes": "be" |
|||
}, |
|||
{ |
|||
"data": { |
|||
"id": "1", |
|||
"name": "B", |
|||
"type": "be", |
|||
"rate": "1", |
|||
"dorm": "1", |
|||
"label": "B (1)" |
|||
}, |
|||
"position": { |
|||
"x": 548, |
|||
"y": 265 |
|||
}, |
|||
"group": "nodes", |
|||
"removed": false, |
|||
"selected": false, |
|||
"selectable": true, |
|||
"locked": false, |
|||
"grabbable": true, |
|||
"classes": "be" |
|||
}, |
|||
{ |
|||
"data": { |
|||
"id": "2", |
|||
"name": "Z", |
|||
"type": "and", |
|||
"children": [ |
|||
"0", |
|||
"1" |
|||
], |
|||
"label": "Z" |
|||
}, |
|||
"position": { |
|||
"x": 505, |
|||
"y": 119 |
|||
}, |
|||
"group": "nodes", |
|||
"removed": false, |
|||
"selected": false, |
|||
"selectable": true, |
|||
"locked": false, |
|||
"grabbable": true, |
|||
"classes": "and" |
|||
} |
|||
] |
|||
} |
@ -0,0 +1,42 @@ |
|||
|
|||
ma |
|||
|
|||
|
|||
module main |
|||
|
|||
s : [0..5]; // current state: |
|||
|
|||
|
|||
<> s=0 -> 4 : (s'=1) + 4 : (s'=2); |
|||
[alpha] s=1 -> 1 : (s'=0); |
|||
[beta] s=1 -> 0.3 : (s'=5) + 0.7 : (s'=1); |
|||
<> s=5 -> 1 : (s'=2); |
|||
[gamma] s=2 -> 1 : (s'=1); |
|||
[delta] s=2 -> 0.5 : (s'=2) + 0.5 : (s'=3); |
|||
<> s=3 -> 1 : (s'=4); |
|||
[lambda] s=4 -> 1 : (s'=3); |
|||
|
|||
endmodule |
|||
|
|||
rewards "rew0" |
|||
[delta] s=2 : 1; |
|||
endrewards |
|||
|
|||
rewards "rew1" |
|||
s=0 : 7; |
|||
[delta] s=2 : 1; |
|||
endrewards |
|||
|
|||
|
|||
rewards "rew2" |
|||
s=0 : 7; |
|||
[delta] s=2 : 1; |
|||
[lambda] s=4 : 100; |
|||
endrewards |
|||
|
|||
rewards "rew3" |
|||
s=0 : 7; |
|||
[delta] s=2 : 1; |
|||
[gamma] s=2 : 100; |
|||
[lambda] s=4 : 27; |
|||
endrewards |
@ -0,0 +1,12 @@ |
|||
mdp |
|||
|
|||
module test |
|||
|
|||
x : [0..2]; |
|||
|
|||
[] x=0 -> true; |
|||
[] x=0 -> 0.5 : (x'=1) + 0.5: (x'=2); |
|||
[] x=1 -> (x'=0); |
|||
[] x=2 -> true; |
|||
|
|||
endmodule |
@ -0,0 +1,13 @@ |
|||
mdp |
|||
|
|||
module test |
|||
|
|||
x : [0..2]; |
|||
|
|||
[] x=0 -> true; |
|||
[] x=0 -> 0.5 : (x'=1) + 0.5: (x'=1); |
|||
[] x=0 -> (x'=2); |
|||
[] x=1 -> (x'=0); |
|||
[] x=2 -> true; |
|||
|
|||
endmodule |
@ -0,0 +1,9 @@ |
|||
# Create storm-conv. |
|||
add_executable(storm-conv-cli ${PROJECT_SOURCE_DIR}/src/storm-conv-cli/storm-conv.cpp) |
|||
target_link_libraries(storm-conv-cli storm-conv storm-cli-utilities) # Adding headers for xcode |
|||
set_target_properties(storm-conv-cli PROPERTIES OUTPUT_NAME "storm-conv") |
|||
|
|||
add_dependencies(binaries storm-conv-cli) |
|||
|
|||
# installation |
|||
install(TARGETS storm-conv-cli EXPORT storm_Targets RUNTIME DESTINATION bin LIBRARY DESTINATION lib OPTIONAL) |
@ -0,0 +1,207 @@ |
|||
|
|||
#include "storm-conv/api/storm-conv.h"
|
|||
|
|||
#include "storm/settings/SettingsManager.h"
|
|||
#include "storm-conv/settings/ConvSettings.h"
|
|||
#include "storm-conv/settings/modules/ConversionGeneralSettings.h"
|
|||
#include "storm-conv/settings/modules/ConversionInputSettings.h"
|
|||
#include "storm-conv/settings/modules/ConversionOutputSettings.h"
|
|||
|
|||
#include "storm/api/storm.h"
|
|||
#include "storm-parsers/api/storm-parsers.h"
|
|||
#include "storm/utility/initialize.h"
|
|||
#include "storm/utility/macros.h"
|
|||
|
|||
#include "storm/storage/SymbolicModelDescription.h"
|
|||
#include "storm/storage/jani/Model.h"
|
|||
#include "storm/storage/jani/Property.h"
|
|||
|
|||
|
|||
#include "storm-cli-utilities/cli.h"
|
|||
#include "storm/exceptions/OptionParserException.h"
|
|||
|
|||
namespace storm { |
|||
namespace conv { |
|||
|
|||
void setUrgentOptions() { |
|||
|
|||
// Set the correct log level
|
|||
if (storm::settings::getModule<storm::settings::modules::ConversionOutputSettings>().isStdOutOutputEnabled()) { |
|||
storm::utility::setLogLevel(l3pp::LogLevel::OFF); |
|||
} else { |
|||
auto const& general = storm::settings::getModule<storm::settings::modules::ConversionGeneralSettings>(); |
|||
if (general.isVerboseSet()) { |
|||
storm::utility::setLogLevel(l3pp::LogLevel::INFO); |
|||
} |
|||
if (general.isDebugOutputSet()) { |
|||
storm::utility::setLogLevel(l3pp::LogLevel::DEBUG); |
|||
} |
|||
if (general.isTraceOutputSet()) { |
|||
storm::utility::setLogLevel(l3pp::LogLevel::TRACE); |
|||
} |
|||
} |
|||
} |
|||
|
|||
void processPrismInputJaniOutput(storm::prism::Program const& prismProg, std::vector<storm::jani::Property> const& properties) { |
|||
auto const& output = storm::settings::getModule<storm::settings::modules::ConversionOutputSettings>(); |
|||
auto const& input = storm::settings::getModule<storm::settings::modules::ConversionInputSettings>(); |
|||
auto const& jani = storm::settings::getModule<storm::settings::modules::JaniExportSettings>(); |
|||
|
|||
storm::converter::PrismToJaniConverterOptions options; |
|||
options.allVariablesGlobal = jani.isGlobalVarsSet(); |
|||
options.suffix = ""; |
|||
options.janiOptions = storm::converter::JaniConversionOptions(jani); |
|||
|
|||
std::string outputFilename = ""; |
|||
if (output.isJaniOutputFilenameSet()) { |
|||
outputFilename = output.getJaniOutputFilename(); |
|||
} else if (input.isPrismInputSet() && !output.isStdOutOutputEnabled()) { |
|||
outputFilename = input.getPrismInputFilename(); |
|||
// Remove extension if present
|
|||
auto dotPos = outputFilename.rfind('.'); |
|||
if (dotPos != std::string::npos) { |
|||
outputFilename.erase(dotPos); |
|||
} |
|||
std::string suffix = ""; |
|||
if (input.isConstantsSet()) { |
|||
suffix = input.getConstantDefinitionString(); |
|||
std::replace(suffix.begin(), suffix.end(), ',', '_'); |
|||
std::replace(suffix.begin(), suffix.end(), '=', '-'); |
|||
} |
|||
suffix = suffix + ".jani"; |
|||
outputFilename += suffix; |
|||
} |
|||
auto startOfFilename = outputFilename.rfind("/"); |
|||
if (startOfFilename == std::string::npos) { |
|||
startOfFilename = 0; |
|||
} else { |
|||
++startOfFilename; |
|||
} |
|||
auto endOfFilename = outputFilename.rfind("."); |
|||
if (endOfFilename == std::string::npos) { |
|||
endOfFilename = outputFilename.size(); |
|||
} |
|||
options.janiOptions.modelName = outputFilename.substr(startOfFilename, endOfFilename - startOfFilename); |
|||
|
|||
auto janiModelProperties = storm::api::convertPrismToJani(prismProg, properties, options); |
|||
|
|||
if (outputFilename != "") { |
|||
storm::api::exportJaniToFile(janiModelProperties.first, janiModelProperties.second, outputFilename, jani.isCompactJsonSet()); |
|||
} |
|||
|
|||
if (output.isStdOutOutputEnabled()) { |
|||
storm::api::printJaniToStream(janiModelProperties.first, janiModelProperties.second, std::cout, jani.isCompactJsonSet()); |
|||
} |
|||
} |
|||
|
|||
void processPrismInput() { |
|||
auto const& input = storm::settings::getModule<storm::settings::modules::ConversionInputSettings>(); |
|||
|
|||
// Parse the prism program
|
|||
storm::storage::SymbolicModelDescription prismProg = storm::api::parseProgram(input.getPrismInputFilename(), input.isPrismCompatibilityEnabled()); |
|||
|
|||
// Parse properties (if available)
|
|||
std::vector<storm::jani::Property> properties; |
|||
if (input.isPropertyInputSet()) { |
|||
boost::optional<std::set<std::string>> propertyFilter = storm::api::parsePropertyFilter(input.getPropertyInputFilter()); |
|||
properties = storm::api::parsePropertiesForSymbolicModelDescription(input.getPropertyInput(), prismProg, propertyFilter); |
|||
} |
|||
|
|||
// Substitute constant definitions in program and properties.
|
|||
std::string constantDefinitionString = input.getConstantDefinitionString(); |
|||
auto constantDefinitions = prismProg.parseConstantDefinitions(constantDefinitionString); |
|||
prismProg = prismProg.preprocess(constantDefinitions); |
|||
if (!properties.empty()) { |
|||
properties = storm::api::substituteConstantsInProperties(properties, constantDefinitions); |
|||
} |
|||
|
|||
// Branch on the type of output
|
|||
auto const& output = storm::settings::getModule<storm::settings::modules::ConversionOutputSettings>(); |
|||
if (output.isJaniOutputSet()) { |
|||
processPrismInputJaniOutput(prismProg.asPrismProgram(), properties); |
|||
} else { |
|||
STORM_LOG_THROW(false, storm::exceptions::InvalidSettingsException, "There is either no outputformat specified or the provided combination of input and output format is not compatible."); |
|||
} |
|||
} |
|||
|
|||
void processOptions() { |
|||
// Start by setting some urgent options (log levels, etc.)
|
|||
setUrgentOptions(); |
|||
|
|||
// Branch on the type of input
|
|||
auto const& input = storm::settings::getModule<storm::settings::modules::ConversionInputSettings>(); |
|||
if (input.isPrismInputSet()) { |
|||
processPrismInput(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
bool parseOptions(const int argc, const char* argv[]) { |
|||
try { |
|||
storm::settings::mutableManager().setFromCommandLine(argc, argv); |
|||
} catch (storm::exceptions::OptionParserException& e) { |
|||
storm::settings::manager().printHelp(); |
|||
throw e; |
|||
return false; |
|||
} |
|||
|
|||
auto const& general = storm::settings::getModule<storm::settings::modules::ConversionGeneralSettings>(); |
|||
|
|||
// Set options from config file (if given)
|
|||
if (general.isConfigSet()) { |
|||
storm::settings::mutableManager().setFromConfigurationFile(general.getConfigFilename()); |
|||
} |
|||
|
|||
bool result = true; |
|||
if (general.isHelpSet()) { |
|||
storm::settings::manager().printHelp(general.getHelpModuleName()); |
|||
result = false; |
|||
} |
|||
|
|||
if (general.isVersionSet()) { |
|||
storm::cli::printVersion("storm-conv"); |
|||
result = false;; |
|||
} |
|||
|
|||
return result; |
|||
} |
|||
|
|||
/*!
|
|||
* Main entry point of the executable storm-conv. |
|||
*/ |
|||
int main(const int argc, const char** argv) { |
|||
|
|||
try { |
|||
storm::utility::setUp(); |
|||
|
|||
// Print header info only if output to sdtout is disabled
|
|||
bool outputToStdOut = false; |
|||
for (int i = 1; i < argc; ++i) { |
|||
if (std::string(argv[i]) == "--" + storm::settings::modules::ConversionOutputSettings::stdoutOptionName) { |
|||
outputToStdOut = true; |
|||
} |
|||
} |
|||
if (outputToStdOut) { |
|||
storm::utility::setLogLevel(l3pp::LogLevel::OFF); |
|||
} else { |
|||
storm::cli::printHeader("Storm-conv", argc, argv); |
|||
} |
|||
|
|||
storm::settings::initializeConvSettings("Storm-conv", "storm-conv"); |
|||
if (!parseOptions(argc, argv)) { |
|||
return -1; |
|||
} |
|||
|
|||
storm::conv::processOptions(); |
|||
|
|||
storm::utility::cleanUp(); |
|||
return 0; |
|||
} catch (storm::exceptions::BaseException const& exception) { |
|||
STORM_LOG_ERROR("An exception caused Storm-conv to terminate. The message of the exception is: " << exception.what()); |
|||
return 1; |
|||
} catch (std::exception const& exception) { |
|||
STORM_LOG_ERROR("An unexpected exception occurred and caused Storm-conv to terminate. The message of this exception is: " << exception.what()); |
|||
return 2; |
|||
} |
|||
} |
@ -0,0 +1,40 @@ |
|||
file(GLOB_RECURSE ALL_FILES ${PROJECT_SOURCE_DIR}/src/storm-conv/*.h ${PROJECT_SOURCE_DIR}/src/storm-conv/*.cpp) |
|||
|
|||
register_source_groups_from_filestructure("${ALL_FILES}" storm-conv) |
|||
|
|||
|
|||
|
|||
file(GLOB_RECURSE STORM_CONV_SOURCES ${PROJECT_SOURCE_DIR}/src/storm-conv/*/*.cpp) |
|||
file(GLOB_RECURSE STORM_CONV_HEADERS ${PROJECT_SOURCE_DIR}/src/storm-conv/*/*.h) |
|||
|
|||
|
|||
# Create storm-conv. |
|||
add_library(storm-conv SHARED ${STORM_CONV_SOURCES} ${STORM_CONV_HEADERS}) |
|||
|
|||
# Remove define symbol for shared libstorm. |
|||
set_target_properties(storm-conv PROPERTIES DEFINE_SYMBOL "") |
|||
#add_dependencies(storm resources) |
|||
list(APPEND STORM_TARGETS storm-conv) |
|||
set(STORM_TARGETS ${STORM_TARGETS} PARENT_SCOPE) |
|||
|
|||
target_link_libraries(storm-conv PUBLIC storm ${STORM_CONV_LINK_LIBRARIES}) |
|||
|
|||
# Install storm headers to include directory. |
|||
foreach(HEADER ${STORM_CONV_HEADERS}) |
|||
string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/src/?" "" RELATIVE_HEADER_PATH ${HEADER}) |
|||
string(REGEX MATCH "(.*)[/\\]" RELATIVE_DIRECTORY ${RELATIVE_HEADER_PATH}) |
|||
string(REGEX REPLACE "${RELATIVE_DIRECTORY}/?" "" HEADER_FILENAME ${RELATIVE_HEADER_PATH}) |
|||
add_custom_command( |
|||
OUTPUT ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME} |
|||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY} |
|||
COMMAND ${CMAKE_COMMAND} -E copy ${HEADER} ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME} |
|||
DEPENDS ${HEADER} |
|||
) |
|||
list(APPEND STORM_CONV_OUTPUT_HEADERS "${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME}") |
|||
endforeach() |
|||
add_custom_target(copy_storm_conv_headers DEPENDS ${STORM_CONV_OUTPUT_HEADERS} ${STORM_CONV_HEADERS}) |
|||
add_dependencies(storm-conv copy_storm_conv_headers) |
|||
|
|||
# installation |
|||
install(TARGETS storm-conv EXPORT storm_Targets RUNTIME DESTINATION bin LIBRARY DESTINATION lib OPTIONAL) |
|||
|
@ -0,0 +1,71 @@ |
|||
#include "storm-conv/api/storm-conv.h"
|
|||
|
|||
#include "storm/storage/prism/Program.h"
|
|||
#include "storm/storage/jani/Property.h"
|
|||
#include "storm/storage/jani/JaniLocationExpander.h"
|
|||
#include "storm/storage/jani/JSONExporter.h"
|
|||
|
|||
#include "storm/settings/SettingsManager.h"
|
|||
#include "storm/settings/modules/CoreSettings.h"
|
|||
|
|||
namespace storm { |
|||
namespace api { |
|||
|
|||
void postprocessJani(storm::jani::Model& janiModel, storm::converter::JaniConversionOptions options) { |
|||
|
|||
if (!options.locationVariables.empty()) { |
|||
for (auto const& pair : options.locationVariables) { |
|||
storm::jani::JaniLocationExpander expander(janiModel); |
|||
expander.transform(pair.first, pair.second); |
|||
janiModel = expander.getResult(); |
|||
} |
|||
} |
|||
|
|||
if (options.exportFlattened) { |
|||
std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory; |
|||
if (storm::settings::hasModule<storm::settings::modules::CoreSettings>()) { |
|||
smtSolverFactory = std::make_shared<storm::utility::solver::SmtSolverFactory>(); |
|||
} else { |
|||
smtSolverFactory = std::make_shared<storm::utility::solver::Z3SmtSolverFactory>(); |
|||
} |
|||
janiModel = janiModel.flattenComposition(smtSolverFactory); |
|||
} |
|||
|
|||
if (options.standardCompliant) { |
|||
janiModel.makeStandardJaniCompliant(); |
|||
} |
|||
|
|||
if (options.modelName) { |
|||
janiModel.setName(options.modelName.get()); |
|||
} |
|||
} |
|||
|
|||
std::pair<storm::jani::Model, std::vector<storm::jani::Property>> convertPrismToJani(storm::prism::Program const& program, std::vector<storm::jani::Property> const& properties, storm::converter::PrismToJaniConverterOptions options) { |
|||
std::pair<storm::jani::Model, std::vector<storm::jani::Property>> res; |
|||
|
|||
// Perform conversion
|
|||
auto modelAndRenaming = program.toJaniWithLabelRenaming(options.allVariablesGlobal, options.suffix, options.janiOptions.standardCompliant); |
|||
res.first = std::move(modelAndRenaming.first); |
|||
|
|||
// Amend properties to potentially changed labels
|
|||
for (auto const& property : properties) { |
|||
res.second.emplace_back(property.substituteLabels(modelAndRenaming.second)); |
|||
} |
|||
|
|||
// Postprocess Jani model based on the options
|
|||
postprocessJani(res.first, options.janiOptions); |
|||
|
|||
return res; |
|||
} |
|||
|
|||
void exportJaniToFile(storm::jani::Model const& model, std::vector<storm::jani::Property> const& properties, std::string const& filename, bool compact) { |
|||
storm::jani::JsonExporter::toFile(model, properties, filename, true, compact); |
|||
} |
|||
|
|||
void printJaniToStream(storm::jani::Model const& model, std::vector<storm::jani::Property> const& properties, std::ostream& ostream, bool compact) { |
|||
storm::jani::JsonExporter::toStream(model, properties, ostream, true, compact); |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
#pragma once |
|||
|
|||
#include "storm-conv/converter/options/PrismToJaniConverterOptions.h" |
|||
#include "storm-conv/converter/options/JaniConversionOptions.h" |
|||
|
|||
namespace storm { |
|||
|
|||
namespace prism { |
|||
class Program; |
|||
} |
|||
namespace jani { |
|||
class Model; |
|||
class Property; |
|||
} |
|||
|
|||
namespace api { |
|||
|
|||
void postprocessJani(storm::jani::Model& janiModel, storm::converter::JaniConversionOptions options); |
|||
|
|||
std::pair<storm::jani::Model, std::vector<storm::jani::Property>> convertPrismToJani(storm::prism::Program const& program, std::vector<storm::jani::Property> const& properties = std::vector<storm::jani::Property>(), storm::converter::PrismToJaniConverterOptions options = storm::converter::PrismToJaniConverterOptions()); |
|||
|
|||
void exportJaniToFile(storm::jani::Model const& model, std::vector<storm::jani::Property> const& properties, std::string const& filename, bool compact = false); |
|||
|
|||
void printJaniToStream(storm::jani::Model const& model, std::vector<storm::jani::Property> const& properties, std::ostream& ostream, bool compact = false); |
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,15 @@ |
|||
#include "storm-conv/converter/options/PrismToJaniConverterOptions.h"
|
|||
|
|||
namespace storm { |
|||
namespace converter { |
|||
|
|||
JaniConversionOptions::JaniConversionOptions() : standardCompliant(false), exportFlattened(false) { |
|||
// Intentionally left empty
|
|||
}; |
|||
|
|||
JaniConversionOptions::JaniConversionOptions(storm::settings::modules::JaniExportSettings const& settings) : locationVariables(settings.getLocationVariables()), standardCompliant(settings.isExportAsStandardJaniSet()), exportFlattened(settings.isExportFlattenedSet()) { |
|||
// Intentionally left empty
|
|||
}; |
|||
} |
|||
} |
|||
|
@ -0,0 +1,32 @@ |
|||
#pragma once |
|||
|
|||
#include <string> |
|||
#include <vector> |
|||
#include <boost/optional.hpp> |
|||
|
|||
#include "storm-conv/settings/modules/JaniExportSettings.h" |
|||
|
|||
namespace storm { |
|||
namespace converter { |
|||
|
|||
struct JaniConversionOptions { |
|||
|
|||
JaniConversionOptions(); |
|||
JaniConversionOptions(storm::settings::modules::JaniExportSettings const& settings); |
|||
|
|||
/// (Automaton,Variable)-pairs that will be transformed to location variables of the respective automaton. |
|||
std::vector<std::pair<std::string, std::string>> locationVariables; |
|||
|
|||
/// If set, the model will be made standard compliant (e.g. no state rewards for discrete time models) |
|||
bool standardCompliant; |
|||
|
|||
/// If set, the model is transformed into a single automaton |
|||
bool exportFlattened; |
|||
|
|||
/// If given, the model will get this name |
|||
boost::optional<std::string> modelName; |
|||
|
|||
}; |
|||
} |
|||
} |
|||
|
@ -0,0 +1,12 @@ |
|||
#include "storm-conv/converter/options/PrismToJaniConverterOptions.h"
|
|||
|
|||
|
|||
namespace storm { |
|||
namespace converter { |
|||
|
|||
PrismToJaniConverterOptions::PrismToJaniConverterOptions() : allVariablesGlobal(false), suffix("") { |
|||
// Intentionally left empty
|
|||
}; |
|||
} |
|||
} |
|||
|
@ -0,0 +1,21 @@ |
|||
#pragma once |
|||
|
|||
#include <string> |
|||
#include "storm-conv/converter/options/JaniConversionOptions.h" |
|||
|
|||
|
|||
namespace storm { |
|||
namespace converter { |
|||
|
|||
|
|||
struct PrismToJaniConverterOptions { |
|||
|
|||
PrismToJaniConverterOptions(); |
|||
|
|||
bool allVariablesGlobal; |
|||
std::string suffix; |
|||
JaniConversionOptions janiOptions; |
|||
}; |
|||
} |
|||
} |
|||
|
@ -0,0 +1,24 @@ |
|||
#include "storm-conv/settings/ConvSettings.h"
|
|||
|
|||
#include "storm-conv/settings/modules/ConversionGeneralSettings.h"
|
|||
#include "storm-conv/settings/modules/ConversionInputSettings.h"
|
|||
#include "storm-conv/settings/modules/ConversionOutputSettings.h"
|
|||
#include "storm-conv/settings/modules/JaniExportSettings.h"
|
|||
|
|||
#include "storm/settings/SettingsManager.h"
|
|||
|
|||
|
|||
namespace storm { |
|||
namespace settings { |
|||
void initializeConvSettings(std::string const& name, std::string const& executableName) { |
|||
storm::settings::mutableManager().setName(name, executableName); |
|||
|
|||
// Register relevant settings modules.
|
|||
storm::settings::addModule<storm::settings::modules::ConversionGeneralSettings>(); |
|||
storm::settings::addModule<storm::settings::modules::ConversionInputSettings>(); |
|||
storm::settings::addModule<storm::settings::modules::ConversionOutputSettings>(); |
|||
storm::settings::addModule<storm::settings::modules::JaniExportSettings>(); |
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,11 @@ |
|||
#pragma once |
|||
|
|||
#include <string> |
|||
|
|||
namespace storm { |
|||
namespace settings { |
|||
|
|||
void initializeConvSettings(std::string const& name, std::string const& executableName); |
|||
|
|||
} |
|||
} |
@ -0,0 +1,77 @@ |
|||
#include "storm-conv/settings/modules/ConversionGeneralSettings.h"
|
|||
|
|||
#include "storm/settings/SettingsManager.h"
|
|||
#include "storm/settings/Option.h"
|
|||
#include "storm/settings/OptionBuilder.h"
|
|||
#include "storm/settings/ArgumentBuilder.h"
|
|||
#include "storm/settings/Argument.h"
|
|||
|
|||
namespace storm { |
|||
namespace settings { |
|||
namespace modules { |
|||
|
|||
const std::string ConversionGeneralSettings::moduleName = "general"; |
|||
const std::string ConversionGeneralSettings::helpOptionName = "help"; |
|||
const std::string ConversionGeneralSettings::helpOptionShortName = "h"; |
|||
const std::string ConversionGeneralSettings::versionOptionName = "version"; |
|||
const std::string ConversionGeneralSettings::verboseOptionName = "verbose"; |
|||
const std::string ConversionGeneralSettings::verboseOptionShortName = "v"; |
|||
const std::string ConversionGeneralSettings::debugOptionName = "debug"; |
|||
const std::string ConversionGeneralSettings::traceOptionName = "trace"; |
|||
const std::string ConversionGeneralSettings::configOptionName = "config"; |
|||
const std::string ConversionGeneralSettings::configOptionShortName = "c"; |
|||
|
|||
ConversionGeneralSettings::ConversionGeneralSettings() : ModuleSettings(moduleName) { |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, helpOptionName, false, "Shows all available options, arguments and descriptions.").setShortName(helpOptionShortName) |
|||
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("hint", "A regular expression to show help for all matching entities or 'all' for the complete help.").setDefaultValueString("all").build()).build()); |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, versionOptionName, false, "Prints the version information.").build()); |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, verboseOptionName, false, "Enables more verbose output.").setShortName(verboseOptionShortName).build()); |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, debugOptionName, false, "Enables verbose and debug output.").build()); |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, traceOptionName, false, "Enables verbose and debug and trace output.").build()); |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, configOptionName, false, "If given, this file will be read and parsed for additional configuration settings.").setShortName(configOptionShortName) |
|||
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The name of the file from which to read the configuration.").addValidatorString(ArgumentValidatorFactory::createExistingFileValidator()).build()).build()); |
|||
} |
|||
|
|||
bool ConversionGeneralSettings::isHelpSet() const { |
|||
return this->getOption(helpOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
bool ConversionGeneralSettings::isVersionSet() const { |
|||
return this->getOption(versionOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
std::string ConversionGeneralSettings::getHelpModuleName() const { |
|||
return this->getOption(helpOptionName).getArgumentByName("hint").getValueAsString(); |
|||
} |
|||
|
|||
bool ConversionGeneralSettings::isVerboseSet() const { |
|||
return this->getOption(verboseOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
bool ConversionGeneralSettings::isDebugOutputSet() const { |
|||
return this->getOption(debugOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
bool ConversionGeneralSettings::isTraceOutputSet() const { |
|||
return this->getOption(traceOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
bool ConversionGeneralSettings::isConfigSet() const { |
|||
return this->getOption(configOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
std::string ConversionGeneralSettings::getConfigFilename() const { |
|||
return this->getOption(configOptionName).getArgumentByName("filename").getValueAsString(); |
|||
} |
|||
|
|||
void ConversionGeneralSettings::finalize() { |
|||
// Intentionally left empty.
|
|||
} |
|||
|
|||
bool ConversionGeneralSettings::check() const { |
|||
return true; |
|||
} |
|||
|
|||
} // namespace modules
|
|||
} // namespace settings
|
|||
} // namespace storm
|
@ -0,0 +1,88 @@ |
|||
#pragma once |
|||
#include "storm/settings/modules/ModuleSettings.h" |
|||
|
|||
namespace storm { |
|||
namespace settings { |
|||
namespace modules { |
|||
|
|||
class ConversionGeneralSettings : public ModuleSettings { |
|||
public: |
|||
|
|||
ConversionGeneralSettings(); |
|||
|
|||
/*! |
|||
* Retrieves whether the help option was set. |
|||
* |
|||
* @return True if the help option was set. |
|||
*/ |
|||
bool isHelpSet() const; |
|||
|
|||
/*! |
|||
* Retrieves whether the version option was set. |
|||
* |
|||
* @return True if the version option was set. |
|||
*/ |
|||
bool isVersionSet() const; |
|||
|
|||
/*! |
|||
* Retrieves the name of the module for which to show the help or "all" to indicate that the full help |
|||
* needs to be shown. |
|||
* |
|||
* @return The name of the module for which to show the help or "all". |
|||
*/ |
|||
std::string getHelpModuleName() const; |
|||
|
|||
/*! |
|||
* Retrieves whether the verbose option was set. |
|||
* |
|||
* @return True if the verbose option was set. |
|||
*/ |
|||
bool isVerboseSet() const; |
|||
|
|||
/*! |
|||
* Retrieves whether the debug output option was set. |
|||
* |
|||
*/ |
|||
bool isDebugOutputSet() const; |
|||
|
|||
/*! |
|||
* Retrieves whether the trace output option was set. |
|||
* |
|||
*/ |
|||
bool isTraceOutputSet() const; |
|||
|
|||
/*! |
|||
* Retrieves whether the config option was set. |
|||
* |
|||
* @return True if the config option was set. |
|||
*/ |
|||
bool isConfigSet() const; |
|||
|
|||
/*! |
|||
* Retrieves the name of the file that is to be scanned for settings. |
|||
* |
|||
* @return The name of the file that is to be scanned for settings. |
|||
*/ |
|||
std::string getConfigFilename() const; |
|||
|
|||
bool check() const override; |
|||
void finalize() override; |
|||
|
|||
// The name of the module. |
|||
static const std::string moduleName; |
|||
|
|||
private: |
|||
// Define the string names of the options as constants. |
|||
static const std::string helpOptionName; |
|||
static const std::string helpOptionShortName; |
|||
static const std::string versionOptionName; |
|||
static const std::string verboseOptionName; |
|||
static const std::string verboseOptionShortName; |
|||
static const std::string debugOptionName; |
|||
static const std::string traceOptionName; |
|||
static const std::string configOptionName; |
|||
static const std::string configOptionShortName; |
|||
}; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,80 @@ |
|||
#include "storm-conv/settings/modules/ConversionInputSettings.h"
|
|||
|
|||
#include "storm/settings/SettingsManager.h"
|
|||
#include "storm/settings/Option.h"
|
|||
#include "storm/settings/OptionBuilder.h"
|
|||
#include "storm/settings/ArgumentBuilder.h"
|
|||
#include "storm/settings/Argument.h"
|
|||
|
|||
#include "storm/exceptions/InvalidSettingsException.h"
|
|||
|
|||
namespace storm { |
|||
namespace settings { |
|||
namespace modules { |
|||
|
|||
const std::string ConversionInputSettings::moduleName = "input"; |
|||
const std::string ConversionInputSettings::propertyOptionName = "prop"; |
|||
const std::string ConversionInputSettings::propertyOptionShortName = "prop"; |
|||
const std::string ConversionInputSettings::constantsOptionName = "constants"; |
|||
const std::string ConversionInputSettings::constantsOptionShortName = "const"; |
|||
const std::string ConversionInputSettings::prismInputOptionName = "prism"; |
|||
const std::string ConversionInputSettings::prismCompatibilityOptionName = "prismcompat"; |
|||
const std::string ConversionInputSettings::prismCompatibilityOptionShortName = "pc"; |
|||
|
|||
|
|||
ConversionInputSettings::ConversionInputSettings() : ModuleSettings(moduleName) { |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, propertyOptionName, false, "Specifies the properties to be checked on the model.").setShortName(propertyOptionShortName) |
|||
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("property or filename", "The formula or the file containing the formulas.").build()) |
|||
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("filter", "The names of the properties to check.").setDefaultValueString("all").build()) |
|||
.build()); |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, constantsOptionName, false, "Specifies the constant replacements to use in symbolic models. Note that this requires the model to be given as an symbolic model (i.e., via --" + prismInputOptionName + ").").setShortName(constantsOptionShortName) |
|||
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("values", "A comma separated list of constants and their value, e.g. a=1,b=2,c=3.").setDefaultValueString("").build()).build()); |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, prismInputOptionName, false, "Parses the model given in the PRISM format.") |
|||
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The name of the file from which to read the PRISM input.").addValidatorString(ArgumentValidatorFactory::createExistingFileValidator()).build()).build()); |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, prismCompatibilityOptionName, false, "Enables PRISM compatibility. This may be necessary to process some PRISM models.").setShortName(prismCompatibilityOptionShortName).build()); |
|||
} |
|||
|
|||
bool ConversionInputSettings::isPrismInputSet() const { |
|||
return this->getOption(prismInputOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
std::string ConversionInputSettings::getPrismInputFilename() const { |
|||
return this->getOption(prismInputOptionName).getArgumentByName("filename").getValueAsString(); |
|||
} |
|||
|
|||
bool ConversionInputSettings::isPrismCompatibilityEnabled() const { |
|||
return this->getOption(prismCompatibilityOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
bool ConversionInputSettings::isConstantsSet() const { |
|||
return this->getOption(constantsOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
std::string ConversionInputSettings::getConstantDefinitionString() const { |
|||
return this->getOption(constantsOptionName).getArgumentByName("values").getValueAsString(); |
|||
} |
|||
|
|||
bool ConversionInputSettings::isPropertyInputSet() const { |
|||
return this->getOption(propertyOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
std::string ConversionInputSettings::getPropertyInput() const { |
|||
return this->getOption(propertyOptionName).getArgumentByName("property or filename").getValueAsString(); |
|||
} |
|||
|
|||
std::string ConversionInputSettings::getPropertyInputFilter() const { |
|||
return this->getOption(propertyOptionName).getArgumentByName("filter").getValueAsString(); |
|||
} |
|||
|
|||
void ConversionInputSettings::finalize() { |
|||
// Intentionally left empty.
|
|||
} |
|||
|
|||
bool ConversionInputSettings::check() const { |
|||
return true; |
|||
} |
|||
|
|||
|
|||
} // namespace modules
|
|||
} // namespace settings
|
|||
} // namespace storm
|
@ -0,0 +1,86 @@ |
|||
#pragma once |
|||
#include "storm/settings/modules/ModuleSettings.h" |
|||
|
|||
namespace storm { |
|||
namespace settings { |
|||
namespace modules { |
|||
|
|||
class ConversionInputSettings : public ModuleSettings { |
|||
public: |
|||
|
|||
ConversionInputSettings(); |
|||
|
|||
/*! |
|||
* Retrieves whether the property option was set. |
|||
* |
|||
* @return True if the property option was set. |
|||
*/ |
|||
bool isPropertyInputSet() const; |
|||
|
|||
/*! |
|||
* Retrieves the property specified with the property option. |
|||
* |
|||
* @return The property specified with the property option. |
|||
*/ |
|||
std::string getPropertyInput() const; |
|||
|
|||
/*! |
|||
* Retrieves the property filter. |
|||
* |
|||
* @return The property filter. |
|||
*/ |
|||
std::string getPropertyInputFilter() const; |
|||
|
|||
/*! |
|||
* Retrieves whether constant definition option was set. |
|||
* |
|||
* @return True if the constant definition option was set. |
|||
*/ |
|||
bool isConstantsSet() const; |
|||
|
|||
/*! |
|||
* Retrieves the string that defines the constants of a symbolic model (given via the symbolic option). |
|||
* |
|||
* @return The string that defines the constants of a symbolic model. |
|||
*/ |
|||
std::string getConstantDefinitionString() const; |
|||
|
|||
/*! |
|||
* Retrieves whether the PRISM language option was set. |
|||
*/ |
|||
bool isPrismInputSet() const; |
|||
|
|||
/*! |
|||
* Retrieves the name of the file that contains the PRISM model specification if the model was given |
|||
* using the PRISM input option. |
|||
*/ |
|||
std::string getPrismInputFilename() const; |
|||
|
|||
/*! |
|||
* Retrieves whether the PRISM compatibility mode was enabled. |
|||
* |
|||
* @return True iff the PRISM compatibility mode was enabled. |
|||
*/ |
|||
bool isPrismCompatibilityEnabled() const; |
|||
|
|||
bool check() const override; |
|||
void finalize() override; |
|||
|
|||
// The name of the module. |
|||
static const std::string moduleName; |
|||
|
|||
private: |
|||
// Define the string names of the options as constants. |
|||
static const std::string propertyOptionName; |
|||
static const std::string propertyOptionShortName; |
|||
static const std::string constantsOptionName; |
|||
static const std::string constantsOptionShortName; |
|||
static const std::string prismInputOptionName; |
|||
static const std::string prismCompatibilityOptionName; |
|||
static const std::string prismCompatibilityOptionShortName; |
|||
}; |
|||
|
|||
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,57 @@ |
|||
#include "storm-conv/settings/modules/ConversionOutputSettings.h"
|
|||
|
|||
#include "storm/settings/SettingsManager.h"
|
|||
#include "storm/settings/Option.h"
|
|||
#include "storm/settings/OptionBuilder.h"
|
|||
#include "storm/settings/ArgumentBuilder.h"
|
|||
#include "storm/settings/Argument.h"
|
|||
|
|||
#include "storm/exceptions/InvalidSettingsException.h"
|
|||
#include "storm/exceptions/InvalidOperationException.h"
|
|||
|
|||
namespace storm { |
|||
namespace settings { |
|||
namespace modules { |
|||
|
|||
const std::string ConversionOutputSettings::moduleName = "output"; |
|||
const std::string ConversionOutputSettings::stdoutOptionName = "stdout"; |
|||
const std::string ConversionOutputSettings::janiOutputOptionName = "tojani"; |
|||
|
|||
ConversionOutputSettings::ConversionOutputSettings() : ModuleSettings(moduleName) { |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, stdoutOptionName, false, "If set, the output will be printed to stdout.").build()); |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, janiOutputOptionName, false, "converts the input model to Jani.") |
|||
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "the name of the output file (if not empty).").setDefaultValueString("").build()).build()); |
|||
} |
|||
|
|||
bool ConversionOutputSettings::isStdOutOutputEnabled() const { |
|||
return this->getOption(stdoutOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
bool ConversionOutputSettings::isJaniOutputSet() const { |
|||
return this->getOption(janiOutputOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
bool ConversionOutputSettings::isJaniOutputFilenameSet() const { |
|||
return isJaniOutputSet() |
|||
&& !this->getOption(janiOutputOptionName).getArgumentByName("filename").wasSetFromDefaultValue() |
|||
&& this->getOption(janiOutputOptionName).getArgumentByName("filename").getHasBeenSet() |
|||
&& this->getOption(janiOutputOptionName).getArgumentByName("filename").getValueAsString() != ""; |
|||
} |
|||
|
|||
std::string ConversionOutputSettings::getJaniOutputFilename() const { |
|||
STORM_LOG_THROW(isJaniOutputFilenameSet(), storm::exceptions::InvalidOperationException, "Tried to get the jani output name although none was specified."); |
|||
return this->getOption(janiOutputOptionName).getArgumentByName("filename").getValueAsString(); |
|||
} |
|||
|
|||
void ConversionOutputSettings::finalize() { |
|||
// Intentionally left empty.
|
|||
} |
|||
|
|||
bool ConversionOutputSettings::check() const { |
|||
STORM_LOG_THROW(!isJaniOutputFilenameSet() || ArgumentValidatorFactory::createWritableFileValidator()->isValid(getJaniOutputFilename()), storm::exceptions::InvalidSettingsException, "Unable to write at file " + getJaniOutputFilename()); |
|||
return true; |
|||
} |
|||
|
|||
} // namespace modules
|
|||
} // namespace settings
|
|||
} // namespace storm
|
@ -0,0 +1,49 @@ |
|||
#pragma once |
|||
#include "storm/settings/modules/ModuleSettings.h" |
|||
|
|||
namespace storm { |
|||
namespace settings { |
|||
namespace modules { |
|||
|
|||
class ConversionOutputSettings : public ModuleSettings { |
|||
public: |
|||
|
|||
ConversionOutputSettings(); |
|||
|
|||
/*! |
|||
* Retrieves whether the output should be printed to stdout |
|||
*/ |
|||
bool isStdOutOutputEnabled() const; |
|||
|
|||
/*! |
|||
* Retrieves whether the output should be in the Jani format |
|||
*/ |
|||
bool isJaniOutputSet() const; |
|||
|
|||
/*! |
|||
* Retrieves whether an output filename for the jani file was specified |
|||
*/ |
|||
bool isJaniOutputFilenameSet() const; |
|||
|
|||
/*! |
|||
* Retrieves the name of the jani output (if specified) |
|||
*/ |
|||
std::string getJaniOutputFilename() const; |
|||
|
|||
bool check() const override; |
|||
void finalize() override; |
|||
|
|||
// The name of the module. |
|||
static const std::string moduleName; |
|||
// name of the option that enables output to stdout. It needs to be public because we have to check this option very early |
|||
static const std::string stdoutOptionName; |
|||
|
|||
private: |
|||
// Define the string names of the options as constants. |
|||
static const std::string janiOutputOptionName; |
|||
}; |
|||
|
|||
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,78 @@ |
|||
#include "JaniExportSettings.h"
|
|||
|
|||
#include "storm/settings/SettingsManager.h"
|
|||
#include "storm/settings/SettingMemento.h"
|
|||
#include "storm/settings/Option.h"
|
|||
#include "storm/settings/OptionBuilder.h"
|
|||
#include "storm/settings/ArgumentBuilder.h"
|
|||
#include "storm/settings/Argument.h"
|
|||
|
|||
#include <boost/algorithm/string.hpp>
|
|||
|
|||
namespace storm { |
|||
namespace settings { |
|||
namespace modules { |
|||
const std::string JaniExportSettings::moduleName = "exportJani"; |
|||
|
|||
const std::string JaniExportSettings::standardCompliantOptionName = "standard-compliant"; |
|||
const std::string JaniExportSettings::standardCompliantOptionShortName = "standard"; |
|||
const std::string JaniExportSettings::exportFlattenOptionName = "flatten"; |
|||
const std::string JaniExportSettings::locationVariablesOptionName = "location-variables"; |
|||
const std::string JaniExportSettings::globalVariablesOptionName = "globalvars"; |
|||
const std::string JaniExportSettings::compactJsonOptionName = "compactjson"; |
|||
|
|||
|
|||
JaniExportSettings::JaniExportSettings() : ModuleSettings(moduleName) { |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, locationVariablesOptionName, true, "Variables to export in the location").addArgument(storm::settings::ArgumentBuilder::createStringArgument("variables", "A comma separated list of automaton and local variable names seperated by a dot, e.g. A.x,B.y.").setDefaultValueString("").build()).build()); |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, standardCompliantOptionName, false, "Export in standard compliant variant.").setShortName(standardCompliantOptionShortName).build()); |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, exportFlattenOptionName, false, "Flattens the composition of Automata to obtain an equivalent model that contains exactly one automaton").build()); |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, globalVariablesOptionName, false, "If set, variables will preferably be made global, e.g., to guarantee the same variable order as in the input file.").build()); |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, compactJsonOptionName, false, "If set, the size of the resulting jani file will be reduced at the cost of (human-)readability.").build()); |
|||
} |
|||
|
|||
bool JaniExportSettings::isExportAsStandardJaniSet() const { |
|||
return this->getOption(standardCompliantOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
bool JaniExportSettings::isExportFlattenedSet() const { |
|||
return this->getOption(exportFlattenOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
bool JaniExportSettings::isLocationVariablesSet() const { |
|||
return this->getOption(locationVariablesOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
std::vector<std::pair<std::string, std::string>> JaniExportSettings::getLocationVariables() const { |
|||
std::vector<std::pair<std::string, std::string>> result; |
|||
if (isLocationVariablesSet()) { |
|||
std::string argument = this->getOption(locationVariablesOptionName).getArgumentByName("variables").getValueAsString(); |
|||
std::vector<std::string> arguments; |
|||
boost::split( arguments, argument, boost::is_any_of(",")); |
|||
for (auto const& pair : arguments) { |
|||
std::vector<std::string> keyvaluepair; |
|||
boost::split( keyvaluepair, pair, boost::is_any_of(".")); |
|||
STORM_LOG_THROW(keyvaluepair.size() == 2, storm::exceptions::IllegalArgumentException, "Expected a name of the form AUTOMATON.VARIABLE (with no further dots) but got " << pair); |
|||
result.emplace_back(keyvaluepair.at(0), keyvaluepair.at(1)); |
|||
} |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
bool JaniExportSettings::isGlobalVarsSet() const { |
|||
return this->getOption(globalVariablesOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
bool JaniExportSettings::isCompactJsonSet() const { |
|||
return this->getOption(compactJsonOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
void JaniExportSettings::finalize() { |
|||
|
|||
} |
|||
|
|||
bool JaniExportSettings::check() const { |
|||
return true; |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,40 @@ |
|||
file(GLOB_RECURSE ALL_FILES ${PROJECT_SOURCE_DIR}/src/storm-counterexamples/*.h ${PROJECT_SOURCE_DIR}/src/storm-counterexamples/*.cpp) |
|||
|
|||
register_source_groups_from_filestructure("${ALL_FILES}" storm-counterexamples) |
|||
|
|||
|
|||
|
|||
file(GLOB_RECURSE STORM_CEX_SOURCES ${PROJECT_SOURCE_DIR}/src/storm-counterexamples/*/*.cpp) |
|||
file(GLOB_RECURSE STORM_CEX_HEADERS ${PROJECT_SOURCE_DIR}/src/storm-counterexamples/*/*.h) |
|||
|
|||
|
|||
# Create storm-dft. |
|||
add_library(storm-counterexamples SHARED ${STORM_CEX_SOURCES} ${STORM_CEX_HEADERS}) |
|||
|
|||
# Remove define symbol for shared libstorm. |
|||
set_target_properties(storm-counterexamples PROPERTIES DEFINE_SYMBOL "") |
|||
#add_dependencies(storm resources) |
|||
list(APPEND STORM_TARGETS storm-counterexamples) |
|||
set(STORM_TARGETS ${STORM_TARGETS} PARENT_SCOPE) |
|||
|
|||
target_link_libraries(storm-counterexamples PUBLIC storm) |
|||
|
|||
# Install storm headers to include directory. |
|||
foreach(HEADER ${STORM_CEX_HEADERS}) |
|||
string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/src/?" "" RELATIVE_HEADER_PATH ${HEADER}) |
|||
string(REGEX MATCH "(.*)[/\\]" RELATIVE_DIRECTORY ${RELATIVE_HEADER_PATH}) |
|||
string(REGEX REPLACE "${RELATIVE_DIRECTORY}/?" "" HEADER_FILENAME ${RELATIVE_HEADER_PATH}) |
|||
add_custom_command( |
|||
OUTPUT ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME} |
|||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY} |
|||
COMMAND ${CMAKE_COMMAND} -E copy ${HEADER} ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME} |
|||
DEPENDS ${HEADER} |
|||
) |
|||
list(APPEND STORM_CEX_OUTPUT_HEADERS "${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME}") |
|||
endforeach() |
|||
add_custom_target(copy_storm_cex_headers DEPENDS ${STORM_CEX_OUTPUT_HEADERS} ${STORM_CEX_HEADERS}) |
|||
add_dependencies(storm-counterexamples copy_storm_cex_headers) |
|||
|
|||
# installation |
|||
install(TARGETS storm-counterexamples EXPORT storm_Targets RUNTIME DESTINATION bin LIBRARY DESTINATION lib OPTIONAL) |
|||
|
@ -1,4 +1,4 @@ |
|||
#include "storm/api/counterexamples.h"
|
|||
#include "storm-counterexamples/api/counterexamples.h"
|
|||
|
|||
#include "storm/environment/Environment.h"
|
|||
|
@ -1,7 +1,7 @@ |
|||
#pragma once |
|||
|
|||
#include "storm/counterexamples/MILPMinimalLabelSetGenerator.h" |
|||
#include "storm/counterexamples/SMTMinimalLabelSetGenerator.h" |
|||
#include "storm-counterexamples/counterexamples/MILPMinimalLabelSetGenerator.h" |
|||
#include "storm-counterexamples/counterexamples/SMTMinimalLabelSetGenerator.h" |
|||
|
|||
namespace storm { |
|||
namespace api { |
@ -1,4 +1,4 @@ |
|||
#include "storm/counterexamples/Counterexample.h"
|
|||
#include "storm-counterexamples/counterexamples/Counterexample.h"
|
|||
|
|||
namespace storm { |
|||
namespace counterexamples { |
@ -1,4 +1,4 @@ |
|||
#include "storm/counterexamples/HighLevelCounterexample.h"
|
|||
#include "storm-counterexamples/counterexamples/HighLevelCounterexample.h"
|
|||
|
|||
namespace storm { |
|||
namespace counterexamples { |
@ -1,6 +1,6 @@ |
|||
#pragma once |
|||
|
|||
#include "storm/counterexamples/Counterexample.h" |
|||
#include "Counterexample.h" |
|||
|
|||
#include "storm/storage/SymbolicModelDescription.h" |
|||
|
754
src/storm-counterexamples/counterexamples/SMTMinimalLabelSetGenerator.h
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,27 @@ |
|||
#include "storm-pars/modelchecker/instantiation/SparseCtmcInstantiationModelChecker.h"
|
|||
|
|||
#include "storm/modelchecker/csl/SparseCtmcCslModelChecker.h"
|
|||
|
|||
#include "storm/exceptions/InvalidStateException.h"
|
|||
|
|||
namespace storm { |
|||
namespace modelchecker { |
|||
|
|||
template <typename SparseModelType, typename ConstantType> |
|||
SparseCtmcInstantiationModelChecker<SparseModelType, ConstantType>::SparseCtmcInstantiationModelChecker(SparseModelType const& parametricModel) : SparseInstantiationModelChecker<SparseModelType, ConstantType>(parametricModel), modelInstantiator(parametricModel) { |
|||
//Intentionally left empty
|
|||
} |
|||
|
|||
template <typename SparseModelType, typename ConstantType> |
|||
std::unique_ptr<CheckResult> SparseCtmcInstantiationModelChecker<SparseModelType, ConstantType>::check(Environment const& env, storm::utility::parametric::Valuation<typename SparseModelType::ValueType> const& valuation) { |
|||
STORM_LOG_THROW(this->currentCheckTask, storm::exceptions::InvalidStateException, "Checking has been invoked but no property has been specified before."); |
|||
auto const& instantiatedModel = modelInstantiator.instantiate(valuation); |
|||
storm::modelchecker::SparseCtmcCslModelChecker<storm::models::sparse::Ctmc<ConstantType>> modelChecker(instantiatedModel); |
|||
|
|||
return modelChecker.check(env, *this->currentCheckTask); |
|||
} |
|||
|
|||
template class SparseCtmcInstantiationModelChecker<storm::models::sparse::Ctmc<storm::RationalFunction>, double>; |
|||
template class SparseCtmcInstantiationModelChecker<storm::models::sparse::Ctmc<storm::RationalFunction>, storm::RationalNumber>; |
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
#pragma once |
|||
|
|||
#include <memory> |
|||
#include <boost/optional.hpp> |
|||
|
|||
#include "storm-pars/modelchecker/instantiation/SparseInstantiationModelChecker.h" |
|||
#include "storm-pars/utility/ModelInstantiator.h" |
|||
#include "storm/models/sparse/Dtmc.h" |
|||
#include "storm/models/sparse/StandardRewardModel.h" |
|||
#include "storm/modelchecker/prctl/SparseDtmcPrctlModelChecker.h" |
|||
|
|||
namespace storm { |
|||
namespace modelchecker { |
|||
|
|||
/*! |
|||
* Class to efficiently check a formula on a parametric model with different parameter instantiations. |
|||
*/ |
|||
template <typename SparseModelType, typename ConstantType> |
|||
class SparseCtmcInstantiationModelChecker : public SparseInstantiationModelChecker<SparseModelType, ConstantType> { |
|||
public: |
|||
SparseCtmcInstantiationModelChecker(SparseModelType const& parametricModel); |
|||
|
|||
virtual std::unique_ptr<CheckResult> check(Environment const& env, storm::utility::parametric::Valuation<typename SparseModelType::ValueType> const& valuation) override; |
|||
|
|||
storm::utility::ModelInstantiator<SparseModelType, storm::models::sparse::Ctmc<ConstantType>> modelInstantiator; |
|||
}; |
|||
} |
|||
} |
@ -0,0 +1,42 @@ |
|||
file(GLOB_RECURSE ALL_FILES ${PROJECT_SOURCE_DIR}/src/storm-parsers/*.h ${PROJECT_SOURCE_DIR}/src/storm-parsers/*.cpp) |
|||
|
|||
register_source_groups_from_filestructure("${ALL_FILES}" storm-parsers) |
|||
|
|||
|
|||
|
|||
file(GLOB_RECURSE STORM_PARSER_SOURCES ${PROJECT_SOURCE_DIR}/src/storm-parsers/*/*.cpp) |
|||
file(GLOB_RECURSE STORM_PARSER_HEADERS ${PROJECT_SOURCE_DIR}/src/storm-parsers/*/*.h) |
|||
|
|||
|
|||
# Disable Debug compiler flags for PrismParser to lessen memory consumption during compilation |
|||
SET_SOURCE_FILES_PROPERTIES(${PROJECT_SOURCE_DIR}/src/storm-parsers/parser/PrismParser.cpp PROPERTIES COMPILE_FLAGS -g0) |
|||
# Create storm-parsers. |
|||
add_library(storm-parsers SHARED ${STORM_PARSER_SOURCES} ${STORM_PARSER_HEADERS}) |
|||
|
|||
# Remove define symbol for shared libstorm. |
|||
set_target_properties(storm-parsers PROPERTIES DEFINE_SYMBOL "") |
|||
#add_dependencies(storm resources) |
|||
list(APPEND STORM_TARGETS storm-parsers) |
|||
set(STORM_TARGETS ${STORM_TARGETS} PARENT_SCOPE) |
|||
|
|||
target_link_libraries(storm-parsers PUBLIC storm) |
|||
|
|||
# Install storm headers to include directory. |
|||
foreach(HEADER ${STORM_PARSER_HEADERS}) |
|||
string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/src/?" "" RELATIVE_HEADER_PATH ${HEADER}) |
|||
string(REGEX MATCH "(.*)[/\\]" RELATIVE_DIRECTORY ${RELATIVE_HEADER_PATH}) |
|||
string(REGEX REPLACE "${RELATIVE_DIRECTORY}/?" "" HEADER_FILENAME ${RELATIVE_HEADER_PATH}) |
|||
add_custom_command( |
|||
OUTPUT ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME} |
|||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY} |
|||
COMMAND ${CMAKE_COMMAND} -E copy ${HEADER} ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME} |
|||
DEPENDS ${HEADER} |
|||
) |
|||
list(APPEND STORM_PARSER_OUTPUT_HEADERS "${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME}") |
|||
endforeach() |
|||
add_custom_target(copy_storm_parser_headers DEPENDS ${STORM_PARSER_OUTPUT_HEADERS} ${STORM_PARSER_HEADERS}) |
|||
add_dependencies(storm-parsers copy_storm_parser_headers) |
|||
|
|||
# installation |
|||
install(TARGETS storm-parsers EXPORT storm_Targets RUNTIME DESTINATION bin LIBRARY DESTINATION lib OPTIONAL) |
|||
|
@ -1,7 +1,7 @@ |
|||
#include "storm/api/model_descriptions.h"
|
|||
#include "model_descriptions.h"
|
|||
|
|||
#include "storm/parser/PrismParser.h"
|
|||
#include "storm/parser/JaniParser.h"
|
|||
#include "storm-parsers/parser/PrismParser.h"
|
|||
#include "storm-parsers/parser/JaniParser.h"
|
|||
|
|||
#include "storm/storage/jani/Model.h"
|
|||
#include "storm/storage/jani/Property.h"
|
@ -0,0 +1,71 @@ |
|||
#include "storm-parsers/api/properties.h"
|
|||
|
|||
#include "storm-parsers/parser/FormulaParser.h"
|
|||
#include "storm/api/properties.h"
|
|||
|
|||
|
|||
#include "storm/storage/SymbolicModelDescription.h"
|
|||
#include "storm/storage/prism/Program.h"
|
|||
#include "storm/storage/jani/Model.h"
|
|||
#include "storm/storage/jani/Property.h"
|
|||
|
|||
#include "storm/logic/Formula.h"
|
|||
|
|||
#include "storm/utility/cli.h"
|
|||
|
|||
|
|||
namespace storm { |
|||
namespace api { |
|||
|
|||
boost::optional <std::set<std::string>> parsePropertyFilter(std::string const &propertyFilter) { |
|||
if (propertyFilter == "all") { |
|||
return boost::none; |
|||
} |
|||
std::vector <std::string> propertyNames = storm::utility::cli::parseCommaSeparatedStrings(propertyFilter); |
|||
std::set <std::string> propertyNameSet(propertyNames.begin(), propertyNames.end()); |
|||
return propertyNameSet; |
|||
} |
|||
|
|||
std::vector <storm::jani::Property> parseProperties(storm::parser::FormulaParser &formulaParser, std::string const &inputString, boost::optional <std::set<std::string>> const &propertyFilter) { |
|||
// If the given property is a file, we parse it as a file, otherwise we assume it's a property.
|
|||
std::vector <storm::jani::Property> properties; |
|||
if (std::ifstream(inputString).good()) { |
|||
STORM_LOG_INFO("Loading properties from file: " << inputString << std::endl); |
|||
properties = formulaParser.parseFromFile(inputString); |
|||
} else { |
|||
properties = formulaParser.parseFromString(inputString); |
|||
} |
|||
|
|||
return filterProperties(properties, propertyFilter); |
|||
} |
|||
|
|||
std::vector <storm::jani::Property> parseProperties(std::string const &inputString, boost::optional <std::set<std::string>> const &propertyFilter) { |
|||
auto exprManager = std::make_shared<storm::expressions::ExpressionManager>(); |
|||
storm::parser::FormulaParser formulaParser(exprManager); |
|||
return parseProperties(formulaParser, inputString, propertyFilter); |
|||
} |
|||
|
|||
std::vector <storm::jani::Property> parsePropertiesForJaniModel(std::string const &inputString, storm::jani::Model const &model, boost::optional <std::set<std::string>> const &propertyFilter) { |
|||
storm::parser::FormulaParser formulaParser(model.getManager().getSharedPointer()); |
|||
auto formulas = parseProperties(formulaParser, inputString, propertyFilter); |
|||
return substituteConstantsInProperties(formulas, model.getConstantsSubstitution()); |
|||
} |
|||
|
|||
std::vector <storm::jani::Property> parsePropertiesForPrismProgram(std::string const &inputString, storm::prism::Program const &program, boost::optional <std::set<std::string>> const &propertyFilter) { |
|||
storm::parser::FormulaParser formulaParser(program); |
|||
auto formulas = parseProperties(formulaParser, inputString, propertyFilter); |
|||
return substituteConstantsInProperties(formulas, program.getConstantsSubstitution()); |
|||
} |
|||
|
|||
std::vector <storm::jani::Property> parsePropertiesForSymbolicModelDescription(std::string const &inputString, storm::storage::SymbolicModelDescription const &modelDescription, boost::optional <std::set<std::string>> const &propertyFilter) { |
|||
std::vector <storm::jani::Property> result; |
|||
if (modelDescription.isPrismProgram()) { |
|||
result = storm::api::parsePropertiesForPrismProgram(inputString, modelDescription.asPrismProgram(), propertyFilter); |
|||
} else { |
|||
STORM_LOG_ASSERT(modelDescription.isJaniModel(), "Unknown model description type."); |
|||
result = storm::api::parsePropertiesForJaniModel(inputString, modelDescription.asJaniModel(), propertyFilter); |
|||
} |
|||
return result; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,43 @@ |
|||
#pragma once |
|||
|
|||
#include <string> |
|||
#include <set> |
|||
#include <map> |
|||
#include <vector> |
|||
#include <memory> |
|||
#include <boost/optional.hpp> |
|||
|
|||
namespace storm { |
|||
namespace parser { |
|||
class FormulaParser; |
|||
} |
|||
namespace jani { |
|||
class Property; |
|||
class Model; |
|||
} |
|||
namespace expressions { |
|||
class Variable; |
|||
class Expression; |
|||
} |
|||
namespace prism { |
|||
class Program; |
|||
} |
|||
namespace storage { |
|||
class SymbolicModelDescription; |
|||
} |
|||
namespace logic { |
|||
class Formula; |
|||
} |
|||
|
|||
namespace api { |
|||
boost::optional<std::set<std::string>> parsePropertyFilter(std::string const& propertyFilter); |
|||
|
|||
// Parsing properties. |
|||
std::vector<storm::jani::Property> parseProperties(storm::parser::FormulaParser& formulaParser, std::string const& inputString, boost::optional<std::set<std::string>> const& propertyFilter = boost::none); |
|||
std::vector<storm::jani::Property> parseProperties(std::string const& inputString, boost::optional<std::set<std::string>> const& propertyFilter = boost::none); |
|||
std::vector<storm::jani::Property> parsePropertiesForPrismProgram(std::string const& inputString, storm::prism::Program const& program, boost::optional<std::set<std::string>> const& propertyFilter = boost::none); |
|||
std::vector<storm::jani::Property> parsePropertiesForJaniModel(std::string const& inputString, storm::jani::Model const& model, boost::optional<std::set<std::string>> const& propertyFilter = boost::none); |
|||
std::vector<storm::jani::Property> parsePropertiesForSymbolicModelDescription(std::string const& inputString, storm::storage::SymbolicModelDescription const& modelDescription, boost::optional<std::set<std::string>> const& propertyFilter = boost::none); |
|||
|
|||
} |
|||
} |
@ -0,0 +1,4 @@ |
|||
#pragma once |
|||
|
|||
#include "storm-parsers/api/model_descriptions.h" |
|||
#include "storm-parsers/api/properties.h" |
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue