From 558078b6e9d26b15606dc5fb213554c1de506e7e Mon Sep 17 00:00:00 2001 From: Tim Quatmann Date: Tue, 24 Mar 2020 14:49:12 +0100 Subject: [PATCH] MakePOMDPCanonic: Improved output of error message --- .../transformer/MakePOMDPCanonic.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/storm-pomdp/transformer/MakePOMDPCanonic.cpp b/src/storm-pomdp/transformer/MakePOMDPCanonic.cpp index da03d47ca..62314426c 100644 --- a/src/storm-pomdp/transformer/MakePOMDPCanonic.cpp +++ b/src/storm-pomdp/transformer/MakePOMDPCanonic.cpp @@ -95,7 +95,13 @@ namespace storm { void actionIdentifiersToStream(std::ostream& stream, std::vector 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 void actionIdentifiersToStream(std::ostream& stream, std::map 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 std::string MakePOMDPCanonic::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."); } }