Skip to content

Feature/valuations - #424

Merged
sjunges merged 15 commits into
stormchecker:masterfrom
sjunges:feature/valuations
Jul 30, 2026
Merged

Feature/valuations#424
sjunges merged 15 commits into
stormchecker:masterfrom
sjunges:feature/valuations

Conversation

@sjunges

@sjunges sjunges commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Match stormchecker/storm#937, requires stormchecker/storm#949 also to compile.

@sjunges

sjunges commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

@volkm this wont compile unless I start merging the other PRs in Storm, but if you could have a look whether there is something major that you want changed, then we could avoid having the main thing nto compiling for too long?

@volkm volkm left a comment

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.

Overall looks good to me. Mostly some smaller comments.

On a higher level, I was wondering whether it is needed to define some bindings in the C++ part and then add some extension in __init__.py? Would it be possible to define the binding only in the C++ part and add the type check there as well? This would make it easier if the code is not spread over two locations.

Comment thread src/pomdp/transformations.cpp
Comment thread tests/storage/test_valuations.py
Comment thread tests/storage/test_valuations.py
Comment thread lib/stormpy/storage/__init__.py Outdated
Comment thread lib/stormpy/storage/__init__.py Outdated
Comment thread lib/stormpy/storage/__init__.py Outdated
Comment thread src/storage/valuation.cpp
Comment thread src/storage/valuation.cpp Outdated
Comment thread src/storage/valuation.cpp Outdated
Comment on lines +77 to +82
storm::storage::BitVector bv = v.getBooleanValues(var);
std::vector<bool> result(bv.size(), false);
for (uint64_t index : bv) {
result[index] = true;
}
return result;

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 maybe be part of Storm to convert from/to std::vector<bool>?

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.

For the C++ api, I dont see an advantage in doing that, but for the python api (where types are hidden) I think this is important to avoid bugs.

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.

Sorry, I meant whether we should add a dedicated method BitVector::toVector in Storm which returns a std::vector<bool>. This method could then be used in this binding.
The idea would be that such a dedicated toVector method could also be useful in other places.

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.

I havent done that yet. Can do that :-)

Comment thread src/storage/valuation.cpp
sjunges and others added 7 commits July 28, 2026 16:15
Co-authored-by: Matthias Volk <volkm@users.noreply.github.com>
Co-authored-by: Matthias Volk <volkm@users.noreply.github.com>
Co-authored-by: Matthias Volk <volkm@users.noreply.github.com>
Co-authored-by: Matthias Volk <volkm@users.noreply.github.com>
Co-authored-by: Matthias Volk <volkm@users.noreply.github.com>
Comment on lines +73 to +76
# Extend class Valuations
# get_value, get_values_states, write_value, get_boolean_values_states_as_bitvector,
# get_integer_bigint_value/write_integer_bigint_value, and get_double_value/get_double_values_states/
# write_double_value (including their type checks) are implemented directly in src/storage/valuation.cpp.

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.

Remove?

@volkm volkm left a comment

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.

Thanks for the changes, in particular moving the Python code to the C++ side.
Looks good to me now.

@volkm

volkm commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

CI seems to improve, only one example is failing. Seems good to have additional checks now.

@sjunges
sjunges merged commit c97c486 into stormchecker:master Jul 30, 2026
22 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.

2 participants