28template<
typename ValueType>
30 std::vector<std::string>
const& parameterNames = {},
bool allowPlaceholders =
true) {
39template<storm::dd::DdType Type,
typename ValueType>
44template<
typename ValueType>
48 model->writeDotToStream(stream, maxWidth);
52template<
typename ValueType>
56 model->writeJsonToStream(stream);
60template<storm::dd::DdType Type,
typename ValueType>
62 model->writeDotToFile(filename);
65template<
typename ValueType>
67 std::string
const& filename) {
70 std::string jsonFileExtension =
".json";
71 if (filename.size() > 4 && std::equal(jsonFileExtension.rbegin(), jsonFileExtension.rend(), filename.rbegin())) {
79template<
typename ValueType,
typename Po
intType>
86 std::filesystem::path baseFilename(baseFilenameStr);
87 std::ofstream infoStream;
88 auto infoFilePath = baseFilename;
89 infoFilePath.replace_filename(infoFilePath.stem().string() +
"_info.csv");
91 infoStream <<
"file;point\n";
92 STORM_LOG_THROW(points.size() == schedulers.size(), storm::exceptions::UnexpectedException,
"Number of points and schedulers must match.");
93 for (uint64_t i = 0; i < points.size(); ++i) {
94 std::string schedulerFileName = baseFilename.stem().string() +
"_point" + std::to_string(i) + baseFilename.extension().string();
95 infoStream << schedulerFileName <<
";[";
97 for (
auto const& pointEntry : points[i]) {
102 infoStream << pointEntry;
105 std::filesystem::path schedulerPath = baseFilename;
106 schedulerPath.replace_filename(schedulerFileName);
112template<
typename ValueType>
114 std::unique_ptr<storm::modelchecker::CheckResult>
const& checkResult, std::string
const& filename) {
115 std::ofstream stream;
117 if (checkResult->isExplicitQualitativeCheckResult()) {
118 auto j = checkResult->asExplicitQualitativeCheckResult().toJson<storm::RationalNumber>(model->getOptionalStateValuations(), model->getStateLabeling());
121 STORM_LOG_THROW(checkResult->isExplicitQuantitativeCheckResult(), storm::exceptions::NotSupportedException,
122 "Export of check results is only supported for explicit check results (e.g. in the sparse engine)");
123 auto j = checkResult->template asExplicitQuantitativeCheckResult<ValueType>().toJson(model->getOptionalStateValuations(), model->getStateLabeling());
131 std::unique_ptr<storm::modelchecker::CheckResult>
const&, std::string
const&) {
132 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"Export of check results is not supported for rational functions. ");
Base class for all sparse models.
Base class for all symbolic models.
This class defines which action is chosen in a particular state of a non-deterministic model.
void printJsonToStream(std::ostream &out, std::shared_ptr< storm::models::sparse::Model< ValueType > > model=nullptr, bool skipUniqueChoices=false, bool skipDontCareStates=false) const
Prints the scheduler in json format to the given output stream.
void printToStream(std::ostream &out, std::shared_ptr< storm::models::sparse::Model< ValueType > > model=nullptr, bool skipUniqueChoices=false, bool skipDontCareStates=false) const
Prints the scheduler to the given output stream.
#define STORM_LOG_THROW(cond, exception, message)
void exportScheduler(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, storm::storage::Scheduler< ValueType > const &scheduler, std::string const &filename)
void exportSymbolicModelAsDot(std::shared_ptr< storm::models::symbolic::Model< Type, ValueType > > const &model, std::string const &filename)
void exportCheckResultToJson< storm::RationalFunction >(std::shared_ptr< storm::models::sparse::Model< storm::RationalFunction > > const &, std::unique_ptr< storm::modelchecker::CheckResult > const &, std::string const &)
void exportJaniModelAsDot(storm::jani::Model const &model, std::string const &filename)
void exportSymbolicModelAsDrdd(std::shared_ptr< storm::models::symbolic::Model< Type, ValueType > > const &model, std::string const &filename)
void exportSparseModelAsDrn(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, std::string const &filename, std::vector< std::string > const ¶meterNames={}, bool allowPlaceholders=true)
void exportCheckResultToJson(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, std::unique_ptr< storm::modelchecker::CheckResult > const &checkResult, std::string const &filename)
void exportSparseModelAsJson(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, std::string const &filename)
void exportSparseModelAsDot(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, std::string const &filename, size_t maxWidth=30)
void exportParetoScheduler(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, std::vector< PointType > const &points, std::vector< storm::storage::Scheduler< ValueType > > const &schedulers, std::string const &baseFilenameStr)
void explicitExportSparseModel(std::ostream &os, std::shared_ptr< storm::models::sparse::Model< ValueType > > sparseModel, std::vector< std::string > const ¶meters, DirectEncodingOptions const &options)
Exports a sparse model into the explicit DRN format.
void explicitExportSymbolicModel(std::string const &filename, std::shared_ptr< storm::models::symbolic::Model< Type, ValueType > > symbolicModel)
Exports a sparse model into the explicit drdd format.
void closeFile(std::ofstream &stream)
Close the given file after writing.
void openFile(std::string const &filepath, std::ofstream &filestream, bool append=false, bool silent=false)
Open the given file for writing.
std::string dumpJson(storm::json< ValueType > const &j, bool compact)
Dumps the given json object, producing a String.