Browse Source

better dot output for pomdp models

tempestpy_adaptions
Sebastian Junges 5 years ago
parent
commit
fe2dcfc975
  1. 7
      src/storm/models/sparse/Model.cpp
  2. 9
      src/storm/models/sparse/Model.h
  3. 8
      src/storm/models/sparse/Pomdp.cpp
  4. 7
      src/storm/models/sparse/Pomdp.h

7
src/storm/models/sparse/Model.cpp

@ -364,6 +364,8 @@ namespace storm {
outStream << "}";
}
outStream << this->additionalDotStateInfo(state);
// If we are to include some values for the state as well, we do so now.
if (firstValue != nullptr || secondValue != nullptr) {
outStream << " [";
@ -398,6 +400,11 @@ namespace storm {
}
}
template<typename ValueType, typename RewardModelType>
std::string Model<ValueType, RewardModelType>::additionalDotStateInfo(uint64_t state) const {
return "";
}
template<typename ValueType, typename RewardModelType>
std::set<std::string> Model<ValueType, RewardModelType>::getLabelsOfState(storm::storage::sparse::state_type state) const {
return this->stateLabeling.getLabelsOfState(state);

9
src/storm/models/sparse/Model.h

@ -333,7 +333,7 @@ namespace storm {
* @param finalizeOutput A flag that sets whether or not the dot stream is closed with a curly brace.
* @return A string containing the exported model in dot-format.
*/
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;
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;
/*!
* Retrieves the set of labels attached to the given state.
@ -395,6 +395,13 @@ namespace storm {
*/
void printRewardModelsInformationToStream(std::ostream& out) const;
/*!
* Return a string that is additonally added to the state information in the dot stream.
* @param state
* @return
*/
virtual std::string additionalDotStateInfo(uint64_t state) const;
private:
// Upon construction of a model, this function asserts that the specified components are valid

8
src/storm/models/sparse/Pomdp.cpp

@ -59,6 +59,12 @@ namespace storm {
return observations;
}
template<typename ValueType, typename RewardModelType>
std::string Pomdp<ValueType, RewardModelType>::additionalDotStateInfo(uint64_t state) const {
return "<" + std::to_string(getObservation(state)) + ">";
}
template<typename ValueType, typename RewardModelType>
std::vector<uint64_t>
Pomdp<ValueType, RewardModelType>::getStatesWithObservation(uint32_t observation) const {
@ -71,6 +77,8 @@ namespace storm {
return result;
}
template class Pomdp<double>;
template class Pomdp<storm::RationalNumber>;
template class Pomdp<double, storm::models::sparse::StandardRewardModel<storm::Interval>>;

7
src/storm/models/sparse/Pomdp.h

@ -64,6 +64,13 @@ namespace storm {
std::vector<uint64_t> getStatesWithObservation(uint32_t observation) const;
protected:
/*!
* Return a string that is additonally added to the state information in the dot stream.
* @param state
* @return
*/
virtual std::string additionalDotStateInfo(uint64_t state) const override;
// TODO: consider a bitvector based presentation (depending on our needs).
std::vector<uint32_t> observations;

Loading…
Cancel
Save