Skip to content

import/export of explicit models in (binary) UMB format#875

Merged
tquatmann merged 103 commits intostormchecker:masterfrom
tquatmann:io/binaryformat
Mar 18, 2026
Merged

import/export of explicit models in (binary) UMB format#875
tquatmann merged 103 commits intostormchecker:masterfrom
tquatmann:io/binaryformat

Conversation

@tquatmann
Copy link
Copy Markdown
Contributor

@tquatmann tquatmann commented Mar 4, 2026

Import and export of UMB models.

  • Provides UmbModel class that serves as an immediate layer between the raw files and a storm::models::sparse::Model.
  • Supports almost all of UMB (Valuations are not fully integrated yet)
  • Uses for_each_field from Boost.PFR for cleaner JSON (de-)serialization and to import/export the different .bin files from and to the right location.


// State valuations
if (model.hasStateValuations()) {
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "State valuations are not yet supported for UMB export.");
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

State valuations are not (fully) supported by this PR yet.

I'd like to replace our existing state valuation representation as it is somewhat incompatible with the UMB state valuations. I fear this will require touching another ~20 files, so maybe we should merge the current PR first.

@tquatmann
Copy link
Copy Markdown
Contributor Author

This is now ready for review @sjunges @volkm 🙂

return static_cast<ToType>(v);
}
else if constexpr (std::is_same_v<ToType, int>)
{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Is this something we should try to get into main modernjson?

Copy link
Copy Markdown
Contributor Author

@tquatmann tquatmann Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The convert function is mainly needed to handle conversions from and to storm::RationalNumber.

Iirc, we made some more intrusive changes, because a json "float" has to represented as a pointer to a rational number for us.

In any case, we should update our shipped modernjson soon. (currently shipped version is apparently from Nov 2023)

*/
std::string toString(Type const type);

struct SizedType {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be part of umb headers? Is a umb representation something that is intimately bound to this json serialization (maybe it is, after all, it is currently foremost a file format...)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What specifically do you mean by "umb headers"?
Generally, most of the things in storm/storage/umb/model/ are closely tied to the UMB standard (by intention).

On the one side, SizedType and Type could into ModelIndex.h , i.e., the main file describing almost all of the JSON of a UMB model.
However, we also need Type and SizedType in other places where it would be odd to include ModelIndex.h (like in ValueEncoding.h where we do low-level bit stuff).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point was mostly whether it makes sense to separate umb from the json representation, but I guess it doesnt make sense, currently).

@sjunges
Copy link
Copy Markdown
Contributor

sjunges commented Mar 11, 2026

whoop whoop. LGTM. I didnt go over the complete umb code....

return (useDefault && haveRational) || (useRational && !haveInterval);
} else {
static_assert(std::is_same_v<ValueType, storm::Interval>, "Unhandled value type");
// Rational intervals currently not supported.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I currently have #885 working which adds rational intervals. Would it be an idea to implement rational intervals at some point?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the UMB code is kind of ready for that. Once both PRs are merged, we can probably add rational intervals easily.

@sjunges
Copy link
Copy Markdown
Contributor

sjunges commented Mar 17, 2026

Merge?! :-)

@tquatmann tquatmann merged commit 5084245 into stormchecker:master Mar 18, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants