Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
DeterministicModel.cpp
Go to the documentation of this file.
2
6#include "storm/io/export.h"
9
10namespace storm {
11namespace models {
12namespace sparse {
13
14template<typename ValueType, typename RewardModelType>
20
21template<typename ValueType, typename RewardModelType>
27
28template<typename ValueType, typename RewardModelType>
29void DeterministicModel<ValueType, RewardModelType>::writeDotToStream(std::ostream& outStream, size_t maxWidthLabel, bool includeLabeling,
30 storm::storage::BitVector const* subsystem, std::vector<ValueType> const* firstValue,
31 std::vector<ValueType> const* secondValue,
32 std::vector<uint_fast64_t> const* stateColoring, std::vector<std::string> const* colors,
33 std::vector<uint_fast64_t>* scheduler, bool finalizeOutput) const {
34 Model<ValueType, RewardModelType>::writeDotToStream(outStream, maxWidthLabel, includeLabeling, subsystem, firstValue, secondValue, stateColoring, colors,
35 scheduler, false);
36
37 // iterate over all transitions and draw the arrows with probability information attached.
38 auto rowIt = this->getTransitionMatrix().begin();
39 for (uint_fast64_t i = 0; i < this->getTransitionMatrix().getRowCount(); ++i, ++rowIt) {
40 // Put in an intermediate node if there is a choice labeling
41 std::string arrowOrigin = std::to_string(i);
42 if (this->hasChoiceLabeling()) {
43 arrowOrigin = "\"" + arrowOrigin + "c\"";
44 outStream << "\t" << arrowOrigin << " [shape = \"point\"]\n";
45 outStream << "\t" << i << " -> " << arrowOrigin << " [label= \"{";
46 storm::io::outputFixedWidth(outStream, this->getChoiceLabeling().getLabelsOfChoice(i), maxWidthLabel);
47 outStream << "}\"];\n";
48 }
49
50 typename storm::storage::SparseMatrix<ValueType>::const_rows row = this->getTransitionMatrix().getRow(i);
51 for (auto const& transition : row) {
52 if (transition.getValue() != storm::utility::zero<ValueType>()) {
53 if (subsystem == nullptr || subsystem->get(transition.getColumn())) {
54 outStream << "\t" << arrowOrigin << " -> " << transition.getColumn() << " [ label= \"" << transition.getValue() << "\" ];\n";
55 }
56 }
57 }
58 }
59
60 if (finalizeOutput) {
61 outStream << "}\n";
62 }
63}
64
65template class DeterministicModel<double>;
70} // namespace sparse
71} // namespace models
72} // namespace storm
The base class of all sparse deterministic models.
DeterministicModel(ModelType modelType, storm::storage::sparse::ModelComponents< ValueType, RewardModelType > const &components)
Constructs a model from the given data.
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
Base class for all sparse models.
Definition Model.h:32
CRewardModelType RewardModelType
Definition Model.h:35
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.
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:16
bool get(uint64_t index) const
Retrieves the truth value of the bit at the given index and performs a bound check.
This class represents a number of consecutive rows of the matrix.
void outputFixedWidth(std::ostream &stream, Container const &output, size_t maxWidth=30)
Output list of strings with linebreaks according to fixed width.
Definition export.h:60