Browse Source

MakePOMDPCanonic: Improved output of error message

tempestpy_adaptions
Tim Quatmann 5 years ago
parent
commit
558078b6e9
  1. 18
      src/storm-pomdp/transformer/MakePOMDPCanonic.cpp

18
src/storm-pomdp/transformer/MakePOMDPCanonic.cpp

@ -95,7 +95,13 @@ namespace storm {
void actionIdentifiersToStream(std::ostream& stream, std::vector<ActionIdentifier> const& actionIdentifiers, ChoiceLabelIdStorage const& labelStorage) {
stream << "actions: {";
bool first = true;
for (auto ai : actionIdentifiers) {
if (first) {
first = false;
} else {
stream << " ";
}
stream << "[" << ai.choiceLabelId << " (" << labelStorage.getLabel(ai.choiceLabelId) << ")";
stream << ", " << ai.choiceOriginId << "]";
}
@ -105,8 +111,14 @@ namespace storm {
template <typename IrrelevantType>
void actionIdentifiersToStream(std::ostream& stream, std::map<ActionIdentifier, IrrelevantType> const& actionIdentifiers, ChoiceLabelIdStorage const& labelStorage) {
stream << "actions: {";
bool first = true;
for (auto ai : actionIdentifiers) {
stream << "[" << ai.first.choiceLabelId << "('" << labelStorage.getLabel(ai.first.choiceLabelId) << "')";
if (first) {
first = false;
} else {
stream << " ";
}
stream << "[" << ai.first.choiceLabelId << " (" << labelStorage.getLabel(ai.first.choiceLabelId) << ")";
stream << ", " << ai.first.choiceOriginId << "]";
}
stream << "}";
@ -144,7 +156,7 @@ namespace storm {
template<typename ValueType>
std::string MakePOMDPCanonic<ValueType>::getStateInformation(uint64_t state) const {
if(pomdp.hasStateValuations()) {
return std::to_string(state) + "[" + pomdp.getStateValuations().getStateInfo(state) + "]";
return std::to_string(state) + " " + pomdp.getStateValuations().getStateInfo(state);
} else {
return std::to_string(state);
}
@ -242,7 +254,7 @@ namespace storm {
detail::actionIdentifiersToStream(std::cout, actionIdentifiers, labelStorage);
std::cout << " according to state " << state << "." << std::endl;
STORM_LOG_THROW(false, storm::exceptions::AmbiguousModelException, "Actions identifiers do not align between states '" << getStateInformation(state) << "' and '" << getStateInformation(actionIdentifierDefinition[observation]) << "', both having observation " << observation << ". See output above for more information.");
STORM_LOG_THROW(false, storm::exceptions::AmbiguousModelException, "Actions identifiers do not align between states \n\t" << getStateInformation(state) << "\nand\n\t" << getStateInformation(actionIdentifierDefinition[observation]) << "\nboth having observation " << observation << ". See output above for more information.");
}
}

Loading…
Cancel
Save