Browse Source

Merge branch 'parametricSystems' of https://sselab.de/lab9/private/git/storm into parametricSystems

Former-commit-id: b022b59c61
tempestpy_adaptions
sjunges 10 years ago
parent
commit
4ba45efd1c
  1. 15
      src/models/AtomicPropositionsLabeling.h
  2. 30
      src/models/Dtmc.h

15
src/models/AtomicPropositionsLabeling.h

@ -142,6 +142,21 @@ public:
return addAtomicProposition(ap, storage::BitVector(stateCount)); return addAtomicProposition(ap, storage::BitVector(stateCount));
} }
/*!
* Retrieves the set of atomic propositions contained in this labeling.
*
* @return The set of known atomic propositions.
*/
std::set<std::string> getAtomicPropositions() const {
std::set<std::string> result;
for (auto const& apIndexPair : this->nameToLabelingMap) {
result.insert(apIndexPair.first);
}
return result;
}
/** /**
* Creates a new atomic proposition and attaches the given states with the label. * Creates a new atomic proposition and attaches the given states with the label.
* @param ap * @param ap

30
src/models/Dtmc.h

@ -291,6 +291,36 @@ public:
return std::shared_ptr<AbstractModel<T>>(new Dtmc(newTransitionMatrix, this->getStateLabeling(), this->hasStateRewards() ? this->getStateRewardVector() : boost::optional<std::vector<T>>(), this->hasTransitionRewards() ? this->getTransitionRewardMatrix() : boost::optional<storm::storage::SparseMatrix<T>>(), this->hasChoiceLabeling() ? this->getChoiceLabeling() : boost::optional<std::vector<boost::container::flat_set<uint_fast64_t>>>())); return std::shared_ptr<AbstractModel<T>>(new Dtmc(newTransitionMatrix, this->getStateLabeling(), this->hasStateRewards() ? this->getStateRewardVector() : boost::optional<std::vector<T>>(), this->hasTransitionRewards() ? this->getTransitionRewardMatrix() : boost::optional<storm::storage::SparseMatrix<T>>(), this->hasChoiceLabeling() ? this->getChoiceLabeling() : boost::optional<std::vector<boost::container::flat_set<uint_fast64_t>>>()));
} }
void dumpToExplicitFormat(std::string const& traFilename, std::string const& labFilename) const {
std::ofstream transStream(traFilename);
transStream << "dtmc" << std::endl;
for (uint_fast64_t stateIndex = 0; stateIndex < this->getNumberOfStates(); ++stateIndex) {
for (auto const& element : this->getTransitionMatrix().getRow(stateIndex)) {
transStream << stateIndex << " " << element.first << " " << element.second << std::endl;
}
}
transStream.close();
std::ofstream labStream(labFilename);
labStream << "#DECLARATION" << std::endl;
for (auto const& label : this->getStateLabeling().getAtomicPropositions()) {
labStream << label << " ";
}
labStream << std::endl;
labStream << "#END" << std::endl;
for (uint_fast64_t stateIndex = 0; stateIndex < this->getNumberOfStates(); ++stateIndex) {
std::set<std::string> labels = this->getLabelsForState(stateIndex);
if (!labels.empty()) {
labStream << stateIndex << " ";
for (auto const& label : labels) {
labStream << label << " ";
}
labStream << std::endl;
}
}
labStream.close();
}
private: private:
/*! /*!
* @brief Perform some sanity checks. * @brief Perform some sanity checks.

Loading…
Cancel
Save