22template<
typename ValueType>
24 std::vector<uint64_t>
const& permutation) {
34 auto permutedMatrix = originalModel.
getTransitionMatrix().permuteRowGroupsAndColumns(inversePermutation, permutation);
38 for (
auto const& [name, origRewardModel] : originalModel.
getRewardModels()) {
39 auto permutedRewardModel = origRewardModel.permuteStates(inversePermutation, optionalGroupIndices, permutation);
40 components.
rewardModels.emplace(name, std::move(permutedRewardModel));
54 auto const& pomdp = *originalModel.template as<storm::models::sparse::Pomdp<ValueType>>();
56 STORM_LOG_WARN_COND(!pomdp.hasObservationValuations(),
"Observation valuations will be dropped as permuting them is currently not implemented.");
59 auto const& ma = *originalModel.template as<storm::models::sparse::MarkovAutomaton<ValueType>>();
60 components.
markovianStates = ma.getMarkovianStates().permute(inversePermutation);
64 auto const& ctmc = *originalModel.template as<storm::models::sparse::Ctmc<ValueType>>();
69 storm::exceptions::UnexpectedException,
"Unhandled model type.");
75 std::vector<uint64_t>
const& permutation);
76template std::shared_ptr<storm::models::sparse::Model<storm::RationalNumber>>
permuteStates(
78template std::shared_ptr<storm::models::sparse::Model<storm::RationalFunction>>
permuteStates(
Helper class that optionally holds a reference to an object of type T.
void reset()
Unsets the reference.
virtual ModelType getType() const
Return the actual type of the model.
bool isOfType(storm::models::ModelType const &modelType) const
Checks whether the model is of the given type.
void permuteItems(std::vector< uint64_t > const &inversePermutation)
Base class for all sparse models.
storm::models::sparse::ChoiceLabeling const & getChoiceLabeling() const
Retrieves the labels for the choices of the model.
storm::storage::SparseMatrix< ValueType > const & getTransitionMatrix() const
Retrieves the matrix representing the transitions of the model.
std::unordered_map< std::string, RewardModelType > const & getRewardModels() const
Retrieves the reward models.
bool hasStateValuations() const
Retrieves whether this model was build with state valuations.
bool hasChoiceLabeling() const
Retrieves whether this model has a labeling of the choices.
storm::models::sparse::StateLabeling const & getStateLabeling() const
Returns the state labeling associated with this model.
bool hasChoiceOrigins() const
Retrieves whether this model was build with choice origins.
virtual uint_fast64_t getNumberOfStates() const override
Returns the number of states of the model.
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_WARN_COND(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
std::shared_ptr< storm::models::sparse::Model< ValueType, RewardModelType > > buildModelFromComponents(storm::models::ModelType modelType, storm::storage::sparse::ModelComponents< ValueType, RewardModelType > &&components)
std::vector< index_type > invertPermutation(std::vector< index_type > const &permutation)
Inverts the given permutation.
bool isValidPermutation(std::vector< index_type > const &permutation)
Returns true if the given vector is a permutation of the numbers 0, 1, ..., n-1 for n = permutation....
std::vector< T > applyInversePermutation(std::vector< uint64_t > const &inversePermutation, std::vector< T > const &source)
std::unordered_map< std::string, RewardModelType > rewardModels
boost::optional< storm::storage::BitVector > markovianStates
std::optional< storm::models::sparse::ChoiceLabeling > choiceLabeling
std::optional< std::vector< uint32_t > > observabilityClasses
boost::optional< std::vector< ValueType > > exitRates