Storm
A Modern Probabilistic Model Checker
|
Base class for all sparse models. More...
#include <Model.h>
Public Types | |
typedef CValueType | ValueType |
typedef CRewardModelType | RewardModelType |
Public Member Functions | |
Model (Model< ValueType, RewardModelType > const &other)=default | |
Model & | operator= (Model< ValueType, RewardModelType > const &other)=default |
Model (ModelType modelType, storm::storage::sparse::ModelComponents< ValueType, RewardModelType > const &components) | |
Constructs a model from the given data. | |
Model (ModelType modelType, storm::storage::sparse::ModelComponents< ValueType, RewardModelType > &&components) | |
virtual | ~Model ()=default |
storm::storage::SparseMatrix< ValueType > | getBackwardTransitions () const |
Retrieves the backward transition relation of the model, i.e. | |
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. | |
virtual uint_fast64_t | getNumberOfStates () const override |
Returns the number of states of the model. | |
virtual uint_fast64_t | getNumberOfTransitions () const override |
Returns the number of (non-zero) transitions of the model. | |
virtual uint_fast64_t | getNumberOfChoices () const override |
Returns the number of choices ine the model. | |
storm::storage::BitVector const & | getInitialStates () const |
Retrieves the initial states of the model. | |
void | setInitialStates (storm::storage::BitVector const &states) |
Overwrites the initial states of the model. | |
storm::storage::BitVector const & | getStates (std::string const &label) const |
Returns the sets of states labeled with the given label. | |
bool | hasLabel (std::string const &label) const |
Retrieves whether the given label is a valid label in this model. | |
storm::storage::SparseMatrix< ValueType > const & | getTransitionMatrix () const |
Retrieves the matrix representing the transitions of the model. | |
storm::storage::SparseMatrix< ValueType > & | getTransitionMatrix () |
Retrieves the matrix representing the transitions of the model. | |
std::unordered_map< std::string, RewardModelType > const & | getRewardModels () const |
Retrieves the reward models. | |
std::unordered_map< std::string, RewardModelType > & | getRewardModels () |
Retrieves the reward models. | |
virtual bool | hasRewardModel (std::string const &rewardModelName) const override |
Retrieves whether the model has a reward model with the given name. | |
RewardModelType const & | getRewardModel (std::string const &rewardModelName) const |
Retrieves the reward model with the given name, if one exists. | |
RewardModelType & | getRewardModel (std::string const &rewardModelName) |
Retrieves the reward model with the given name, if one exists. | |
RewardModelType const & | getUniqueRewardModel () const |
Retrieves the unique reward model, if there exists exactly one. | |
RewardModelType & | getUniqueRewardModel () |
Retrieves the unique reward model, if there exists exactly one. | |
virtual bool | hasUniqueRewardModel () const override |
Retrieves whether the model has a unique reward model. | |
virtual std::string const & | getUniqueRewardModelName () const override |
Retrieves the name of the unique reward model, if there exists exactly one. | |
bool | hasRewardModel () const |
Retrieves whether the model has at least one reward model. | |
uint_fast64_t | getNumberOfRewardModels () const |
Retrieves the number of reward models associated with this model. | |
void | addRewardModel (std::string const &rewardModelName, RewardModelType const &rewModel) |
Adds a reward model to the model. | |
bool | removeRewardModel (std::string const &rewardModelName) |
Removes the reward model with the given name from the model. | |
void | restrictRewardModels (std::set< std::string > const &keptRewardModels) |
Removes all reward models whose name is not in the given set. | |
storm::models::sparse::StateLabeling const & | getStateLabeling () const |
Returns the state labeling associated with this model. | |
storm::models::sparse::StateLabeling & | getStateLabeling () |
Returns the state labeling associated with this model. | |
bool | hasChoiceLabeling () const |
Retrieves whether this model has a labeling of the choices. | |
storm::models::sparse::ChoiceLabeling const & | getChoiceLabeling () const |
Retrieves the labels for the choices of the model. | |
std::optional< storm::models::sparse::ChoiceLabeling > const & | getOptionalChoiceLabeling () const |
Retrieves an optional value that contains the choice labeling if there is one. | |
std::optional< storm::models::sparse::ChoiceLabeling > & | getOptionalChoiceLabeling () |
Retrieves an optional value that contains the choice labeling if there is one. | |
bool | hasStateValuations () const |
Retrieves whether this model was build with state valuations. | |
storm::storage::sparse::StateValuations const & | getStateValuations () const |
Retrieves the valuations of the states of the model. | |
std::optional< storm::storage::sparse::StateValuations > const & | getOptionalStateValuations () const |
Retrieves an optional value that contains the state valuations if there are some. | |
std::optional< storm::storage::sparse::StateValuations > & | getOptionalStateValuations () |
Retrieves an optional value that contains the state valuations if there are some. | |
bool | hasChoiceOrigins () const |
Retrieves whether this model was build with choice origins. | |
std::shared_ptr< storm::storage::sparse::ChoiceOrigins > const & | getChoiceOrigins () const |
Retrieves the origins of the choices of the model. | |
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. | |
std::optional< std::shared_ptr< storm::storage::sparse::ChoiceOrigins > > & | getOptionalChoiceOrigins () |
Retrieves an optional value that contains the choice origins if there are some. | |
virtual void | printModelInformationToStream (std::ostream &out) const override |
Prints information about the model to the specified stream. | |
bool | isSinkState (uint64_t sink) const |
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 void | writeJsonToStream (std::ostream &outStream) const |
Writes a JSON representation of the model to the given stream. | |
std::set< std::string > | getLabelsOfState (storm::storage::sparse::state_type state) const |
Retrieves the set of labels attached to the given state. | |
virtual bool | isSparseModel () const override |
Checks whether the model is a sparse model. | |
virtual bool | supportsParameters () const override |
Checks whether the model supports parameters. | |
virtual bool | hasParameters () const override |
Checks whether the model has parameters. | |
virtual bool | isExact () const override |
Checks whether the model is exact. | |
virtual bool | supportsUncertainty () const |
Does it support uncertainty (e.g., via interval-valued entries). | |
virtual bool | hasUncertainty () const |
Checks whether the model actually is uncertain, i.e., whether there is a non-singleton transition relation. | |
virtual std::size_t | hash () const |
void | writeJsonToStream (std::ostream &) const |
![]() | |
Model (ModelType const &modelType) | |
Constructs a model of the given type. | |
![]() | |
ModelBase (ModelType const &modelType) | |
Constructs a model of the given type. | |
virtual | ~ModelBase () |
template<typename ModelType > | |
std::shared_ptr< ModelType > | as () |
Casts the model into the model type given by the template parameter. | |
template<typename ModelType > | |
std::shared_ptr< ModelType const > | as () const |
Casts the model into the model type given by the template parameter. | |
virtual ModelType | getType () const |
Return the actual type of the model. | |
virtual bool | isSymbolicModel () const |
Checks whether the model is a symbolic model. | |
bool | isOfType (storm::models::ModelType const &modelType) const |
Checks whether the model is of the given type. | |
bool | isNondeterministicModel () const |
Returns true if the model is a nondeterministic model. | |
bool | isDiscreteTimeModel () const |
Returns true if the model is a descrete-time model. | |
virtual bool | isPartiallyObservable () const |
virtual void | reduceToStateBasedRewards ()=0 |
Converts the transition rewards of all reward models to state-based rewards. | |
Static Public Attributes | |
static const storm::models::ModelRepresentation | Representation = ModelRepresentation::Sparse |
Protected Member Functions | |
RewardModelType & | rewardModel (std::string const &rewardModelName) |
void | setTransitionMatrix (storm::storage::SparseMatrix< ValueType > const &transitionMatrix) |
Sets the transition matrix of the model. | |
void | setTransitionMatrix (storm::storage::SparseMatrix< ValueType > &&transitionMatrix) |
Sets the transition matrix of the model. | |
void | printModelInformationHeaderToStream (std::ostream &out) const |
Prints the information header (number of states and transitions) of the model to the specified stream. | |
void | printModelInformationFooterToStream (std::ostream &out) const |
Prints the information footer (reward models, labels and size in memory) of the model to the specified stream. | |
void | printRewardModelsInformationToStream (std::ostream &out) const |
Prints information about the reward models to the specified stream. | |
virtual std::string | additionalDotStateInfo (uint64_t state) const |
Return a string that is additonally added to the state information in the dot stream. | |
Base class for all sparse models.
typedef CRewardModelType storm::models::sparse::Model< CValueType, CRewardModelType >::RewardModelType |
typedef CValueType storm::models::sparse::Model< CValueType, CRewardModelType >::ValueType |
|
default |
storm::models::sparse::Model< ValueType, RewardModelType >::Model | ( | ModelType | modelType, |
storm::storage::sparse::ModelComponents< ValueType, RewardModelType > const & | components | ||
) |
storm::models::sparse::Model< ValueType, RewardModelType >::Model | ( | ModelType | modelType, |
storm::storage::sparse::ModelComponents< ValueType, RewardModelType > && | components | ||
) |
|
virtualdefault |
Reimplemented from storm::models::Model< CValueType >.
|
protectedvirtual |
Return a string that is additonally added to the state information in the dot stream.
state |
Reimplemented in storm::models::sparse::Pomdp< ValueType, RewardModelType >.
void storm::models::sparse::Model< ValueType, RewardModelType >::addRewardModel | ( | std::string const & | rewardModelName, |
RewardModelType const & | rewModel | ||
) |
storm::storage::SparseMatrix< ValueType > storm::models::sparse::Model< ValueType, RewardModelType >::getBackwardTransitions | ( | ) | const |
storm::models::sparse::ChoiceLabeling const & storm::models::sparse::Model< ValueType, RewardModelType >::getChoiceLabeling | ( | ) | const |
std::shared_ptr< storm::storage::sparse::ChoiceOrigins > const & storm::models::sparse::Model< ValueType, RewardModelType >::getChoiceOrigins | ( | ) | const |
storm::storage::BitVector const & storm::models::sparse::Model< ValueType, RewardModelType >::getInitialStates | ( | ) | const |
std::set< std::string > storm::models::sparse::Model< ValueType, RewardModelType >::getLabelsOfState | ( | storm::storage::sparse::state_type | state | ) | const |
|
overridevirtual |
Returns the number of choices ine the model.
Implements storm::models::ModelBase.
uint_fast64_t storm::models::sparse::Model< ValueType, RewardModelType >::getNumberOfRewardModels | ( | ) | const |
|
overridevirtual |
Returns the number of states of the model.
Implements storm::models::ModelBase.
|
overridevirtual |
Returns the number of (non-zero) transitions of the model.
Implements storm::models::ModelBase.
std::optional< storm::models::sparse::ChoiceLabeling > & storm::models::sparse::Model< ValueType, RewardModelType >::getOptionalChoiceLabeling | ( | ) |
std::optional< storm::models::sparse::ChoiceLabeling > const & storm::models::sparse::Model< ValueType, RewardModelType >::getOptionalChoiceLabeling | ( | ) | const |
std::optional< std::shared_ptr< storm::storage::sparse::ChoiceOrigins > > & storm::models::sparse::Model< ValueType, RewardModelType >::getOptionalChoiceOrigins | ( | ) |
std::optional< std::shared_ptr< storm::storage::sparse::ChoiceOrigins > > const & storm::models::sparse::Model< ValueType, RewardModelType >::getOptionalChoiceOrigins | ( | ) | const |
std::optional< storm::storage::sparse::StateValuations > & storm::models::sparse::Model< ValueType, RewardModelType >::getOptionalStateValuations | ( | ) |
std::optional< storm::storage::sparse::StateValuations > const & storm::models::sparse::Model< ValueType, RewardModelType >::getOptionalStateValuations | ( | ) | const |
RewardModelType & storm::models::sparse::Model< ValueType, RewardModelType >::getRewardModel | ( | std::string const & | rewardModelName | ) |
RewardModelType const & storm::models::sparse::Model< ValueType, RewardModelType >::getRewardModel | ( | std::string const & | rewardModelName | ) | const |
std::unordered_map< std::string, RewardModelType > & storm::models::sparse::Model< ValueType, RewardModelType >::getRewardModels | ( | ) |
std::unordered_map< std::string, RewardModelType > const & storm::models::sparse::Model< ValueType, RewardModelType >::getRewardModels | ( | ) | const |
|
virtual |
storm::models::sparse::StateLabeling & storm::models::sparse::Model< ValueType, RewardModelType >::getStateLabeling | ( | ) |
storm::models::sparse::StateLabeling const & storm::models::sparse::Model< ValueType, RewardModelType >::getStateLabeling | ( | ) | const |
storm::storage::BitVector const & storm::models::sparse::Model< ValueType, RewardModelType >::getStates | ( | std::string const & | label | ) | const |
storm::storage::sparse::StateValuations const & storm::models::sparse::Model< ValueType, RewardModelType >::getStateValuations | ( | ) | const |
storm::storage::SparseMatrix< ValueType > & storm::models::sparse::Model< ValueType, RewardModelType >::getTransitionMatrix | ( | ) |
storm::storage::SparseMatrix< ValueType > const & storm::models::sparse::Model< ValueType, RewardModelType >::getTransitionMatrix | ( | ) | const |
RewardModelType & storm::models::sparse::Model< ValueType, RewardModelType >::getUniqueRewardModel | ( | ) |
RewardModelType const & storm::models::sparse::Model< ValueType, RewardModelType >::getUniqueRewardModel | ( | ) | const |
|
overridevirtual |
Retrieves the name of the unique reward model, if there exists exactly one.
Otherwise, an exception is thrown.
Implements storm::models::ModelBase.
bool storm::models::sparse::Model< ValueType, RewardModelType >::hasChoiceLabeling | ( | ) | const |
bool storm::models::sparse::Model< ValueType, RewardModelType >::hasChoiceOrigins | ( | ) | const |
|
virtual |
Reimplemented in storm::models::sparse::Pomdp< ValueType, RewardModelType >.
bool storm::models::sparse::Model< ValueType, RewardModelType >::hasLabel | ( | std::string const & | label | ) | const |
|
overridevirtual |
Checks whether the model has parameters.
Performance warning: the worst-case complexity is linear in the number of transitions.
Reimplemented from storm::models::ModelBase.
bool storm::models::sparse::Model< ValueType, RewardModelType >::hasRewardModel | ( | ) | const |
|
overridevirtual |
Retrieves whether the model has a reward model with the given name.
Implements storm::models::ModelBase.
bool storm::models::sparse::Model< ValueType, RewardModelType >::hasStateValuations | ( | ) | const |
|
virtual |
Checks whether the model actually is uncertain, i.e., whether there is a non-singleton transition relation.
Performance warning: the worst-case complexity is linear in the number of transitions. Notice that while parametric Markov models may be seen as uncertain, within storm,these models are not called uncertain.
|
overridevirtual |
Retrieves whether the model has a unique reward model.
Implements storm::models::ModelBase.
|
overridevirtual |
Checks whether the model is exact.
Reimplemented from storm::models::ModelBase.
bool storm::models::sparse::Model< ValueType, RewardModelType >::isSinkState | ( | uint64_t | sink | ) | const |
|
overridevirtual |
Checks whether the model is a sparse model.
Reimplemented from storm::models::ModelBase.
|
default |
|
protected |
|
protected |
|
overridevirtual |
Prints information about the model to the specified stream.
out | The stream the information is to be printed to. |
Implements storm::models::ModelBase.
Reimplemented in storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >, storm::models::sparse::NondeterministicModel< ValueType, RewardModelType >, storm::models::sparse::NondeterministicModel< double, RM >, storm::models::sparse::NondeterministicModel< double, storm::models::sparse::StandardRewardModel< double > >, storm::models::sparse::NondeterministicModel< ValueType, StandardRewardModel< ValueType > >, storm::models::sparse::NondeterministicModel< ValueType, storm::models::sparse::StandardRewardModel< ValueType > >, and storm::models::sparse::Pomdp< ValueType, RewardModelType >.
|
protected |
bool storm::models::sparse::Model< ValueType, RewardModelType >::removeRewardModel | ( | std::string const & | rewardModelName | ) |
void storm::models::sparse::Model< ValueType, RewardModelType >::restrictRewardModels | ( | std::set< std::string > const & | keptRewardModels | ) |
|
protected |
void storm::models::sparse::Model< ValueType, RewardModelType >::setInitialStates | ( | storm::storage::BitVector const & | states | ) |
|
protected |
|
protected |
|
overridevirtual |
Checks whether the model supports parameters.
Reimplemented from storm::models::ModelBase.
|
virtual |
|
virtual |
Exports the model to the dot-format and prints the result to the given stream.
outStream | The stream to which the model is to be written. |
maxWidthLabel | Maximal width of the labeling before a linebreak is inserted. Value 0 represents no linebreaks. |
includeLabling | If set to true, the states will be exported with their labels. |
subsystem | If not null, this represents the subsystem that is to be exported. |
firstValue | If not null, the values in this vector are attached to the states. |
secondValue | If not null, the values in this vector are attached to the states. |
stateColoring | If not null, this is a mapping from states to color codes. |
colors | A mapping of color codes to color names. |
finalizeOutput | A flag that sets whether or not the dot stream is closed with a curly brace. |
void storm::models::sparse::Model< double, storm::models::sparse::StandardRewardModel< storm::Interval > >::writeJsonToStream | ( | std::ostream & | ) | const |
|
virtual |
|
static |