18template<
typename ValueType,
typename RewardModelType>
25template<
typename ValueType,
typename RewardModelType>
32template<
typename ValueType,
typename RewardModelType>
37template<
typename ValueType,
typename RewardModelType>
40 return indices[state + 1] - indices[state];
43template<
typename ValueType,
typename RewardModelType>
50template<
typename ValueType,
typename RewardModelType>
63 if (!dropUnreachableStates) {
64 memoryProduct.setBuildFullProduct();
66 return memoryProduct.build(preserveModelType);
70template<
typename ValueType,
typename RewardModelType>
77template<
typename ValueType,
typename RewardModelType>
80 std::vector<ValueType>
const* secondValue,
81 std::vector<uint_fast64_t>
const* stateColoring,
82 std::vector<std::string>
const* colors, std::vector<uint_fast64_t>* scheduler,
83 bool finalizeOutput)
const {
90 bool highlightChoice =
true;
93 for (uint_fast64_t choice = 0; choice < rowCount; ++choice) {
97 if (scheduler !=
nullptr) {
99 if ((*scheduler)[state] == choice) {
100 highlightChoice =
true;
102 highlightChoice =
false;
110 outStream <<
"\t\"" << state <<
"c" << choice <<
"\" [shape = \"point\"";
112 if (scheduler !=
nullptr) {
113 if (highlightChoice) {
114 outStream <<
", fillcolor=\"red\"";
120 outStream <<
"\t" << state <<
" -> \"" << state <<
"c" << choice <<
"\"";
121 bool arrowHasLabel =
false;
126 arrowHasLabel =
true;
127 outStream <<
" [ label = \"" << ma->
getExitRate(state);
134 outStream <<
" [ label = \"{";
136 arrowHasLabel =
true;
144 if (scheduler !=
nullptr) {
150 if (highlightChoice) {
151 outStream <<
"color=\"red\", penwidth = 2";
153 outStream <<
"style = \"dotted\"";
157 if (arrowHasLabel || scheduler !=
nullptr) {
163 for (
auto const& transition : row) {
164 if (subsystem ==
nullptr || subsystem->
get(transition.getColumn())) {
165 outStream <<
"\t\"" << state <<
"c" << choice <<
"\" -> " << transition.getColumn() <<
" [ label= \"" << transition.getValue() <<
"\" ]";
168 if (scheduler !=
nullptr) {
169 if (highlightChoice) {
170 outStream <<
" [color=\"red\", penwidth = 2]";
172 outStream <<
" [style = \"dotted\"]";
181 if (finalizeOutput) {
186template<
typename ValueType,
typename RewardModelType>
virtual uint_fast64_t getNumberOfChoices() const =0
Returns the number of choices ine the model.
bool isOfType(storm::models::ModelType const &modelType) const
Checks whether the model is of the given type.
This class represents a Markov automaton.
bool isMarkovianState(storm::storage::sparse::state_type state) const
Retrieves whether the given state is a Markovian state.
ValueType const & getExitRate(storm::storage::sparse::state_type state) const
Retrieves the exit rate of the given state.
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.
Model(Model< ValueType, RewardModelType > const &other)=default
void printModelInformationFooterToStream(std::ostream &out) const
Prints the information footer (reward models, labels and size in memory) of the model to the specifie...
std::unordered_map< std::string, RewardModelType > const & getRewardModels() const
Retrieves the reward models.
RewardModelType & rewardModel(std::string const &rewardModelName)
bool hasChoiceLabeling() const
Retrieves whether this model has a labeling of the choices.
void printModelInformationHeaderToStream(std::ostream &out) const
Prints the information header (number of states and transitions) of the model to the specified stream...
CRewardModelType RewardModelType
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 uint_fast64_t getNumberOfStates() const override
The base class of sparse nondeterministic models.
std::vector< uint_fast64_t > const & getNondeterministicChoiceIndices() const
Retrieves the vector indicating which matrix rows represent non-deterministic choices of a certain st...
virtual void printModelInformationToStream(std::ostream &out) const override
Prints information about the model to the specified stream.
NondeterministicModel(ModelType modelType, storm::storage::sparse::ModelComponents< ValueType, RewardModelType > const &components)
Constructs a model from the given data.
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 reduceToStateBasedRewards() override
Converts the transition rewards of all reward models to state-based rewards.
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
uint_fast64_t getNumberOfChoices(uint_fast64_t state) const
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.
A bit vector that is internally represented as a vector of 64-bit values.
bool get(uint64_t index) const
Retrieves the truth value of the bit at the given index and performs a bound check.
This class defines which action is chosen in a particular state of a non-deterministic model.
bool isDeterministicScheduler() const
Retrieves whether all defined choices are deterministic.
storm::storage::BitVector computeActionSupport(std::vector< uint64_t > const &nondeterministicChoiceIndicies) const
Compute the Action Support: A bit vector that indicates all actions that are selected with positive p...
bool isPartialScheduler() const
Retrieves whether there is a reachable pair of model and memory state for which the choice is undefin...
bool isMemorylessScheduler() const
Retrieves whether the scheduler considers a trivial memory structure (i.e., a memory structure with j...
This class represents a number of consecutive rows of the matrix.
This class builds the product of the given sparse model and the given memory structure.
uint_fast64_t getState() const
uint_fast64_t getAction() const
void outputFixedWidth(std::ostream &stream, Container const &output, size_t maxWidth=30)
Output list of strings with linebreaks according to fixed width.