4#include <unordered_map>
26template<
typename ValueType>
27class StandardRewardModel;
32template<
class CValueType,
class CRewardModelType = StandardRewardModel<CValueType>>
118 bool hasLabel(std::string
const& label)
const;
139 std::unordered_map<std::string, RewardModelType>
const&
getRewardModels()
const;
153 virtual bool hasRewardModel(std::string
const& rewardModelName)
const override;
314 std::shared_ptr<storm::storage::sparse::ChoiceOrigins>
const&
getChoiceOrigins()
const;
353 virtual void writeDotToStream(std::ostream& outStream,
size_t maxWidthLabel = 30,
bool includeLabeling =
true,
355 std::vector<ValueType>
const* secondValue =
nullptr, std::vector<uint64_t>
const* stateColoring =
nullptr,
356 std::vector<std::string>
const* colors =
nullptr, std::vector<uint_fast64_t>* scheduler =
nullptr,
357 bool finalizeOutput =
true)
const;
384 virtual bool isExact()
const override;
403 virtual std::size_t
hash()
const;
461 std::unordered_map<std::string, RewardModelType> rewardModels;
464 std::optional<storm::models::sparse::ChoiceLabeling> choiceLabeling;
467 std::optional<storm::storage::sparse::StateValuations> stateValuations;
470 std::optional<std::shared_ptr<storm::storage::sparse::ChoiceOrigins>> choiceOrigins;
This class manages the labeling of the choice space with a number of (atomic) labels.
Base class for all sparse models.
storm::models::sparse::ChoiceLabeling const & getChoiceLabeling() const
Retrieves the labels for the choices of the model.
RewardModelType const & getUniqueRewardModel() const
Retrieves the unique reward model, if there exists exactly one.
bool hasRewardModel() const
Retrieves whether the model has at least one reward model.
storm::storage::SparseMatrix< ValueType > const & getTransitionMatrix() const
Retrieves the matrix representing the transitions of the model.
virtual std::size_t hash() const
virtual bool hasUncertainty() const
Checks whether the model actually is uncertain, i.e., whether there is a non-singleton transition rel...
Model(Model< ValueType, RewardModelType > const &other)=default
void setInitialStates(storm::storage::BitVector const &states)
Overwrites the initial states of the model.
void setTransitionMatrix(storm::storage::SparseMatrix< ValueType > const &transitionMatrix)
Sets the transition matrix of the model.
void printModelInformationFooterToStream(std::ostream &out) const
Prints the information footer (reward models, labels and size in memory) of the model to the specifie...
virtual void printModelInformationToStream(std::ostream &out) const override
Prints information about the model to the specified stream.
Model & operator=(Model< ValueType, RewardModelType > const &other)=default
std::unordered_map< std::string, RewardModelType > const & getRewardModels() const
Retrieves the reward models.
void restrictRewardModels(std::set< std::string > const &keptRewardModels)
Removes all reward models whose name is not in the given set.
bool hasStateValuations() const
Retrieves whether this model was build with state valuations.
storm::storage::BitVector const & getStates(std::string const &label) const
Returns the sets of states labeled with the given label.
bool removeRewardModel(std::string const &rewardModelName)
Removes the reward model with the given name from the model.
void printRewardModelsInformationToStream(std::ostream &out) const
Prints information about the reward models to the specified stream.
std::set< std::string > getLabelsOfState(storm::storage::sparse::state_type state) const
Retrieves the set of labels attached to the given state.
std::optional< std::shared_ptr< storm::storage::sparse::ChoiceOrigins > > const & getOptionalChoiceOrigins() const
Retrieves an optional value that contains the choice origins if there are some.
RewardModelType & rewardModel(std::string const &rewardModelName)
virtual uint_fast64_t getNumberOfChoices() const override
Returns the number of choices ine the model.
storm::storage::sparse::StateValuations const & getStateValuations() const
Retrieves the valuations of the states of the model.
virtual bool isSparseModel() const override
Checks whether the model is a sparse model.
void addRewardModel(std::string const &rewardModelName, RewardModelType const &rewModel)
Adds a reward model to the model.
virtual storm::storage::SparseMatrix< ValueType >::const_rows getRows(storm::storage::sparse::state_type state) const
Returns an object representing the matrix rows associated with the given state.
std::shared_ptr< storm::storage::sparse::ChoiceOrigins > const & getChoiceOrigins() const
Retrieves the origins of the choices of the model.
virtual bool supportsUncertainty() const
Does it support uncertainty (e.g., via interval-valued entries).
storm::storage::SparseMatrix< ValueType > getBackwardTransitions() const
Retrieves the backward transition relation of the model, i.e.
bool isSinkState(uint64_t sink) const
bool hasChoiceLabeling() const
Retrieves whether this model has a labeling of the choices.
uint_fast64_t getNumberOfRewardModels() const
Retrieves the number of reward models associated with this model.
storm::models::sparse::StateLabeling const & getStateLabeling() const
Returns the state labeling associated with this model.
static const storm::models::ModelRepresentation Representation
virtual void writeJsonToStream(std::ostream &outStream) const
Writes a JSON representation of the model to the given stream.
void printModelInformationHeaderToStream(std::ostream &out) const
Prints the information header (number of states and transitions) of the model to the specified stream...
std::optional< storm::models::sparse::ChoiceLabeling > const & getOptionalChoiceLabeling() const
Retrieves an optional value that contains the choice labeling if there is one.
CRewardModelType RewardModelType
virtual bool supportsParameters() const override
Checks whether the model supports parameters.
virtual bool hasUniqueRewardModel() const override
Retrieves whether the model has a unique reward model.
virtual void writeDotToStream(std::ostream &outStream, size_t maxWidthLabel=30, bool includeLabeling=true, storm::storage::BitVector const *subsystem=nullptr, std::vector< ValueType > const *firstValue=nullptr, std::vector< ValueType > const *secondValue=nullptr, std::vector< uint64_t > const *stateColoring=nullptr, std::vector< std::string > const *colors=nullptr, std::vector< uint_fast64_t > *scheduler=nullptr, bool finalizeOutput=true) const
Exports the model to the dot-format and prints the result to the given stream.
virtual std::string additionalDotStateInfo(uint64_t state) const
Return a string that is additonally added to the state information in the dot stream.
std::optional< storm::storage::sparse::StateValuations > const & getOptionalStateValuations() const
Retrieves an optional value that contains the state valuations if there are some.
virtual uint_fast64_t getNumberOfTransitions() const override
Returns the number of (non-zero) transitions of the model.
virtual bool isExact() const override
Checks whether the model is exact.
bool hasChoiceOrigins() const
Retrieves whether this model was build with choice origins.
virtual bool hasParameters() const override
Checks whether the model has parameters.
virtual uint_fast64_t getNumberOfStates() const override
Returns the number of states of the model.
bool hasLabel(std::string const &label) const
Retrieves whether the given label is a valid label in this model.
RewardModelType const & getRewardModel(std::string const &rewardModelName) const
Retrieves the reward model with the given name, if one exists.
virtual std::string const & getUniqueRewardModelName() const override
Retrieves the name of the unique reward model, if there exists exactly one.
storm::storage::BitVector const & getInitialStates() const
Retrieves the initial states of the model.
This class manages the labeling of the state space with a number of (atomic) labels.
A bit vector that is internally represented as a vector of 64-bit values.
This class represents a number of consecutive rows of the matrix.
A class that holds a possibly non-square matrix in the compressed row storage format.
std::set< storm::RationalFunctionVariable > getRateParameters(Model< storm::RationalFunction > const &model)
Get all parameters occurring in rates.
std::set< storm::RationalFunctionVariable > getRewardParameters(Model< storm::RationalFunction > const &model)
Get all parameters occurring in rewards.
std::set< storm::RationalFunctionVariable > getProbabilityParameters(Model< storm::RationalFunction > const &model)
Get all probability parameters occurring on transitions.
std::set< storm::RationalFunctionVariable > getAllParameters(Model< storm::RationalFunction > const &model)
Get all parameters (probability, rewards, and rates) occurring in the model.
storage::BitVector BitVector