29template<
typename ValueType>
31 std::vector<std::string>
const& parameterNames = {},
bool allowPlaceholders =
true) {
37template<
typename ValueType>
43template<storm::dd::DdType Type,
typename ValueType>
48template<
typename ValueType>
52 model->writeDotToStream(stream, maxWidth);
56template<
typename ValueType>
60 model->writeJsonToStream(stream);
64template<
typename ValueType>
67 if constexpr (std::is_same_v<ValueType, storm::RationalFunction>) {
68 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"Export of rational functions to UMB is not supported.");
74template<storm::dd::DdType Type,
typename ValueType>
76 model->writeDotToFile(filename);
79template<
typename ValueType>
81 std::string
const& filename) {
84 std::string jsonFileExtension =
".json";
85 if (filename.size() > 4 && std::equal(jsonFileExtension.rbegin(), jsonFileExtension.rend(), filename.rbegin())) {
93template<
typename ValueType,
typename Po
intType>
100 std::filesystem::path baseFilename(baseFilenameStr);
101 std::ofstream infoStream;
102 auto infoFilePath = baseFilename;
103 infoFilePath.replace_filename(infoFilePath.stem().string() +
"_info.csv");
105 infoStream <<
"file;point\n";
106 STORM_LOG_THROW(points.size() == schedulers.size(), storm::exceptions::UnexpectedException,
"Number of points and schedulers must match.");
107 for (uint64_t i = 0; i < points.size(); ++i) {
108 std::string schedulerFileName = baseFilename.stem().string() +
"_point" + std::to_string(i) + baseFilename.extension().string();
109 infoStream << schedulerFileName <<
";[";
111 for (
auto const& pointEntry : points[i]) {
116 infoStream << pointEntry;
119 std::filesystem::path schedulerPath = baseFilename;
120 schedulerPath.replace_filename(schedulerFileName);
126template<
typename ValueType>
128 std::unique_ptr<storm::modelchecker::CheckResult>
const& checkResult, std::string
const& filename) {
129 std::ofstream stream;
131 if (checkResult->isExplicitQualitativeCheckResult()) {
132 auto j = checkResult->template asExplicitQualitativeCheckResult<ValueType>().template toJson<storm::RationalNumber>(model->getOptionalStateValuations(),
133 model->getStateLabeling());
136 STORM_LOG_THROW(checkResult->isExplicitQuantitativeCheckResult(), storm::exceptions::NotSupportedException,
137 "Export of check results is only supported for explicit check results (e.g. in the sparse engine)");
138 auto j = checkResult->template asExplicitQuantitativeCheckResult<ValueType>().toJson(model->getOptionalStateValuations(), model->getStateLabeling());
146 std::unique_ptr<storm::modelchecker::CheckResult>
const&, std::string
const&) {
147 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 exportSparseModelAsUmb(std::shared_ptr< storm::models::sparse::Model< ValueType > > const &model, std::string const &filename, storm::umb::ExportOptions const &options={})
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::filesystem::path const &filename, std::shared_ptr< storm::models::sparse::Model< ValueType > > sparseModel, std::vector< std::string > const ¶meters, DirectEncodingExporterOptions 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.
void exportModelToUmb(storm::models::sparse::Model< ValueType > const &model, std::filesystem::path const &targetLocation, ExportOptions const &options)
std::string dumpJson(storm::json< ValueType > const &j, bool compact)
Dumps the given json object, producing a String.
bool allowPlaceholders
Allow placeholders for rational functions in the exported DRN file.