Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType > Class Template Reference

This class represents a Markov automaton. More...

#include <MarkovAutomaton.h>

Inheritance diagram for storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >:
Collaboration diagram for storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >:

Public Member Functions

 MarkovAutomaton (storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::models::sparse::StateLabeling const &stateLabeling, storm::storage::BitVector const &markovianStates, std::unordered_map< std::string, RewardModelType > const &rewardModels=std::unordered_map< std::string, RewardModelType >())
 Constructs a model from the given data.
 
 MarkovAutomaton (storm::storage::SparseMatrix< ValueType > &&transitionMatrix, storm::models::sparse::StateLabeling &&stateLabeling, storm::storage::BitVector &&markovianStates, std::unordered_map< std::string, RewardModelType > &&rewardModels=std::unordered_map< std::string, RewardModelType >())
 Constructs a model from the given data.
 
 MarkovAutomaton (storm::storage::sparse::ModelComponents< ValueType, RewardModelType > const &components)
 Constructs a model from the given data.
 
 MarkovAutomaton (storm::storage::sparse::ModelComponents< ValueType, RewardModelType > &&components)
 
 MarkovAutomaton (MarkovAutomaton< ValueType, RewardModelType > const &other)=default
 
MarkovAutomatonoperator= (MarkovAutomaton< ValueType, RewardModelType > const &other)=default
 
 MarkovAutomaton (MarkovAutomaton< ValueType, RewardModelType > &&other)=default
 
MarkovAutomatonoperator= (MarkovAutomaton< ValueType, RewardModelType > &&other)=default
 
bool isClosed () const
 Retrieves whether the Markov automaton is closed.
 
bool containsZenoCycle () const
 Retrieves whether the Markov automaton contains Zeno cycles.
 
bool isHybridState (storm::storage::sparse::state_type state) const
 Retrieves whether the given state is a hybrid state, i.e.
 
bool isMarkovianState (storm::storage::sparse::state_type state) const
 Retrieves whether the given state is a Markovian state.
 
bool isProbabilisticState (storm::storage::sparse::state_type state) const
 Retrieves whether the given state is a probabilistic state.
 
std::vector< ValueType > const & getExitRates () const
 Retrieves the vector representing the exit rates of the states.
 
std::vector< ValueType > & getExitRates ()
 Retrieves the vector representing the exit rates of the states.
 
ValueType const & getExitRate (storm::storage::sparse::state_type state) const
 Retrieves the exit rate of the given state.
 
ValueType getMaximalExitRate () const
 Retrieves the maximal exit rate over all states of the model.
 
storm::storage::BitVector const & getMarkovianStates () const
 Retrieves the set of Markovian states of the model.
 
void close ()
 Closes the Markov automaton.
 
bool isConvertibleToCtmc () const
 Determines whether the Markov automaton can be converted to a CTMC without changing any measures.
 
bool hasOnlyTrivialNondeterminism () const
 
std::shared_ptr< storm::models::sparse::Ctmc< ValueType, RewardModelType > > convertToCtmc () const
 Convert the MA to a CTMC.
 
virtual void printModelInformationToStream (std::ostream &out) const override
 Prints information about the model to the specified stream.
 
- Public Member Functions inherited from storm::models::sparse::NondeterministicModel< ValueType, RewardModelType >
 NondeterministicModel (ModelType modelType, storm::storage::sparse::ModelComponents< ValueType, RewardModelType > const &components)
 Constructs a model from the given data.
 
 NondeterministicModel (ModelType modelType, storm::storage::sparse::ModelComponents< ValueType, RewardModelType > &&components)
 
virtual ~NondeterministicModel ()=default
 
std::vector< uint_fast64_t > const & getNondeterministicChoiceIndices () const
 Retrieves the vector indicating which matrix rows represent non-deterministic choices of a certain state.
 
uint_fast64_t getNumberOfChoices (uint_fast64_t state) const
 
virtual void reduceToStateBasedRewards () override
 Converts the transition rewards of all reward models to state-based rewards.
 
uint_fast64_t getChoiceIndex (storm::storage::StateActionPair const &stateactPair) const
 For a state/action pair, get the choice index referring to the state-action pair.
 
std::shared_ptr< storm::models::sparse::Model< ValueType, RewardModelType > > applyScheduler (storm::storage::Scheduler< ValueType > const &scheduler, bool dropUnreachableStates=true, bool preserveModelType=false) const
 Applies the given scheduler to this 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< uint_fast64_t > const *stateColoring=nullptr, std::vector< std::string > const *colors=nullptr, std::vector< uint_fast64_t > *scheduler=nullptr, bool finalizeOutput=true) const override
 
- Public Member Functions inherited from storm::models::sparse::Model< CValueType, CRewardModelType >
 Model (Model< ValueType, RewardModelType > const &other)=default
 
Modeloperator= (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< ValueTypegetBackwardTransitions () 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.
 
RewardModelTypegetRewardModel (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.
 
RewardModelTypegetUniqueRewardModel ()
 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::StateLabelinggetStateLabeling ()
 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.
 
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
 
- Public Member Functions inherited from storm::models::Model< CValueType >
 Model (ModelType const &modelType)
 Constructs a model of the given type.
 
- Public Member Functions inherited from storm::models::ModelBase
 ModelBase (ModelType const &modelType)
 Constructs a model of the given type.
 
virtual ~ModelBase ()
 
template<typename ModelType >
std::shared_ptr< ModelTypeas ()
 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
 

Additional Inherited Members

- Public Types inherited from storm::models::sparse::Model< CValueType, CRewardModelType >
typedef CValueType ValueType
 
typedef CRewardModelType RewardModelType
 
- Static Public Attributes inherited from storm::models::sparse::Model< CValueType, CRewardModelType >
static const storm::models::ModelRepresentation Representation = ModelRepresentation::Sparse
 
- Protected Member Functions inherited from storm::models::sparse::Model< CValueType, CRewardModelType >
RewardModelTyperewardModel (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.
 

Detailed Description

template<class ValueType, typename RewardModelType = StandardRewardModel<ValueType>>
class storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >

This class represents a Markov automaton.

Definition at line 16 of file MarkovAutomaton.h.

Constructor & Destructor Documentation

◆ MarkovAutomaton() [1/6]

template<typename ValueType , typename RewardModelType >
storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::MarkovAutomaton ( storm::storage::SparseMatrix< ValueType > const &  transitionMatrix,
storm::models::sparse::StateLabeling const &  stateLabeling,
storm::storage::BitVector const &  markovianStates,
std::unordered_map< std::string, RewardModelType > const &  rewardModels = std::unordered_map<std::string, RewardModelType>() 
)

Constructs a model from the given data.

For hybrid states (i.e., states with Markovian and probabilistic transitions), it is assumed that the first choice corresponds to the markovian transitions.

Parameters
transitionMatrixThe matrix representing the transitions in the model in terms of rates (Markovian choices) and probabilities (probabilistic choices).
stateLabelingThe labeling of the states.
markovianStatesA bit vector indicating the Markovian states of the automaton (i.e., states with at least one markovian transition).
rewardModelsA mapping of reward model names to reward models.

Definition at line 24 of file MarkovAutomaton.cpp.

◆ MarkovAutomaton() [2/6]

template<typename ValueType , typename RewardModelType >
storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::MarkovAutomaton ( storm::storage::SparseMatrix< ValueType > &&  transitionMatrix,
storm::models::sparse::StateLabeling &&  stateLabeling,
storm::storage::BitVector &&  markovianStates,
std::unordered_map< std::string, RewardModelType > &&  rewardModels = std::unordered_map<std::string, RewardModelType>() 
)

Constructs a model from the given data.

For hybrid states (i.e., states with Markovian and probabilistic transitions), it is assumed that the first choice corresponds to the markovian transitions.

Parameters
transitionMatrixThe matrix representing the transitions in the model in terms of rates (Markovian choices) and probabilities (probabilistic choices).
stateLabelingThe labeling of the states.
markovianStatesA bit vector indicating the Markovian states of the automaton (i.e., states with at least one markovian transition).
rewardModelsA mapping of reward model names to reward models.

Definition at line 34 of file MarkovAutomaton.cpp.

◆ MarkovAutomaton() [3/6]

Constructs a model from the given data.

Parameters
componentsThe components for this model.

Definition at line 43 of file MarkovAutomaton.cpp.

◆ MarkovAutomaton() [4/6]

Definition at line 56 of file MarkovAutomaton.cpp.

◆ MarkovAutomaton() [5/6]

template<class ValueType , typename RewardModelType = StandardRewardModel<ValueType>>
storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::MarkovAutomaton ( MarkovAutomaton< ValueType, RewardModelType > const &  other)
default

◆ MarkovAutomaton() [6/6]

template<class ValueType , typename RewardModelType = StandardRewardModel<ValueType>>
storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::MarkovAutomaton ( MarkovAutomaton< ValueType, RewardModelType > &&  other)
default

Member Function Documentation

◆ close()

Closes the Markov automaton.

That is, this applies the maximal progress assumption to all hybrid states.

Definition at line 123 of file MarkovAutomaton.cpp.

◆ containsZenoCycle()

template<typename ValueType , typename RewardModelType >
bool storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::containsZenoCycle ( ) const

Retrieves whether the Markov automaton contains Zeno cycles.

A Zeno cyle contains only non-Markovian states and allows to visit infinitely many states in finite time.

Returns
True iff the Markov automaton contains Zeno cycles.

Definition at line 75 of file MarkovAutomaton.cpp.

◆ convertToCtmc()

template<typename ValueType , typename RewardModelType >
std::shared_ptr< storm::models::sparse::Ctmc< ValueType, RewardModelType > > storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::convertToCtmc ( ) const

Convert the MA to a CTMC.

May only be called if the MA is convertible to a CTMC.

Returns
The resulting CTMC.

Definition at line 216 of file MarkovAutomaton.cpp.

◆ getExitRate()

Retrieves the exit rate of the given state.

Parameters
stateThe state for which retrieve the exit rate.
Returns
The exit rate of the state.

Definition at line 108 of file MarkovAutomaton.cpp.

◆ getExitRates() [1/2]

template<typename ValueType , typename RewardModelType >
std::vector< ValueType > & storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::getExitRates ( )

Retrieves the vector representing the exit rates of the states.

Returns
The exit rate vector of the model.

Definition at line 103 of file MarkovAutomaton.cpp.

◆ getExitRates() [2/2]

template<typename ValueType , typename RewardModelType >
std::vector< ValueType > const & storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::getExitRates ( ) const

Retrieves the vector representing the exit rates of the states.

Returns
The exit rate vector of the model.

Definition at line 98 of file MarkovAutomaton.cpp.

◆ getMarkovianStates()

template<typename ValueType , typename RewardModelType >
storm::storage::BitVector const & storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::getMarkovianStates ( ) const

Retrieves the set of Markovian states of the model.

Returns
A bit vector representing the Markovian states of the model.

Definition at line 118 of file MarkovAutomaton.cpp.

◆ getMaximalExitRate()

template<typename ValueType , typename RewardModelType >
ValueType storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::getMaximalExitRate ( ) const

Retrieves the maximal exit rate over all states of the model.

Returns
The maximal exit rate of any state of the model.

Definition at line 113 of file MarkovAutomaton.cpp.

◆ hasOnlyTrivialNondeterminism()

template<typename ValueType , typename RewardModelType >
bool storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::hasOnlyTrivialNondeterminism ( ) const

Definition at line 192 of file MarkovAutomaton.cpp.

◆ isClosed()

template<typename ValueType , typename RewardModelType >
bool storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::isClosed ( ) const

Retrieves whether the Markov automaton is closed.

Returns
True iff the Markov automaton is closed.

Definition at line 70 of file MarkovAutomaton.cpp.

◆ isConvertibleToCtmc()

template<typename ValueType , typename RewardModelType >
bool storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::isConvertibleToCtmc ( ) const

Determines whether the Markov automaton can be converted to a CTMC without changing any measures.

Definition at line 187 of file MarkovAutomaton.cpp.

◆ isHybridState()

Retrieves whether the given state is a hybrid state, i.e.

Markovian and probabilistic.

Parameters
stateThe state for which determine whether it's hybrid.
Returns
True iff the state is hybrid.

Definition at line 83 of file MarkovAutomaton.cpp.

◆ isMarkovianState()

template<typename ValueType , typename RewardModelType >
bool storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::isMarkovianState ( storm::storage::sparse::state_type  state) const

Retrieves whether the given state is a Markovian state.

Parameters
stateThe state for which determine whether it's Markovian.
Returns
True iff the state is Markovian.

Definition at line 88 of file MarkovAutomaton.cpp.

◆ isProbabilisticState()

template<typename ValueType , typename RewardModelType >
bool storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::isProbabilisticState ( storm::storage::sparse::state_type  state) const

Retrieves whether the given state is a probabilistic state.

Parameters
stateThe state for which determine whether it's probabilistic.
Returns
True iff the state is probabilistic.

Definition at line 93 of file MarkovAutomaton.cpp.

◆ operator=() [1/2]

template<class ValueType , typename RewardModelType = StandardRewardModel<ValueType>>
MarkovAutomaton & storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::operator= ( MarkovAutomaton< ValueType, RewardModelType > &&  other)
default

◆ operator=() [2/2]

template<class ValueType , typename RewardModelType = StandardRewardModel<ValueType>>
MarkovAutomaton & storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::operator= ( MarkovAutomaton< ValueType, RewardModelType > const &  other)
default

◆ printModelInformationToStream()

template<typename ValueType , typename RewardModelType >
void storm::models::sparse::MarkovAutomaton< ValueType, RewardModelType >::printModelInformationToStream ( std::ostream &  out) const
overridevirtual

Prints information about the model to the specified stream.

Parameters
outThe stream the information is to be printed to.

Reimplemented from storm::models::sparse::NondeterministicModel< ValueType, RewardModelType >.

Definition at line 246 of file MarkovAutomaton.cpp.


The documentation for this class was generated from the following files: