Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
DeterministicModel.cpp
Go to the documentation of this file.
2
4#include "storm/io/export.h"
7
8namespace storm {
9namespace models {
10namespace sparse {
11
12template<typename ValueType, typename RewardModelType>
18
19template<typename ValueType, typename RewardModelType>
22 : Model<ValueType, RewardModelType>(modelType, std::move(components)) {
23 // Intentionally left empty
25
26template<typename ValueType, typename RewardModelType>
27void DeterministicModel<ValueType, RewardModelType>::writeDotToStream(std::ostream& outStream, size_t maxWidthLabel, bool includeLabeling,
28 storm::storage::BitVector const* subsystem, std::vector<ValueType> const* firstValue,
29 std::vector<ValueType> const* secondValue,
30 std::vector<uint_fast64_t> const* stateColoring, std::vector<std::string> const* colors,
31 std::vector<uint_fast64_t>* scheduler, bool finalizeOutput) const {
32 Model<ValueType, RewardModelType>::writeDotToStream(outStream, maxWidthLabel, includeLabeling, subsystem, firstValue, secondValue, stateColoring, colors,
33 scheduler, false);
35 // iterate over all transitions and draw the arrows with probability information attached.
36 auto rowIt = this->getTransitionMatrix().begin();
37 for (uint_fast64_t i = 0; i < this->getTransitionMatrix().getRowCount(); ++i, ++rowIt) {
38 // Put in an intermediate node if there is a choice labeling
39 std::string arrowOrigin = std::to_string(i);
40 if (this->hasChoiceLabeling()) {
41 arrowOrigin = "\"" + arrowOrigin + "c\"";
42 outStream << "\t" << arrowOrigin << " [shape = \"point\"]\n";
43 outStream << "\t" << i << " -> " << arrowOrigin << " [label= \"{";
44 storm::io::outputFixedWidth(outStream, this->getChoiceLabeling().getLabelsOfChoice(i), maxWidthLabel);
45 outStream << "}\"];\n";
46 }
47
48 typename storm::storage::SparseMatrix<ValueType>::const_rows row = this->getTransitionMatrix().getRow(i);
49 for (auto const& transition : row) {
50 if (transition.getValue() != storm::utility::zero<ValueType>()) {
51 if (subsystem == nullptr || subsystem->get(transition.getColumn())) {
52 outStream << "\t" << arrowOrigin << " -> " << transition.getColumn() << " [ label= \"" << transition.getValue() << "\" ];\n";
53 }
54 }
55 }
56 }
57
58 if (finalizeOutput) {
59 outStream << "}\n";
60 }
61}
62
63template class DeterministicModel<double>;
64#ifdef STORM_HAVE_CARL
65template class DeterministicModel<storm::RationalNumber>;
66
67template class DeterministicModel<double, storm::models::sparse::StandardRewardModel<storm::Interval>>;
68template class DeterministicModel<storm::RationalFunction>;
69template class DeterministicModel<storm::Interval>;
70#endif
71} // namespace sparse
72} // namespace models
73} // namespace storm
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:33
CRewardModelType RewardModelType
Definition Model.h:36
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:18
bool get(uint_fast64_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
LabParser.cpp.
Definition cli.cpp:18