From e4a4214fc4e1f4b007e5aa7d5073572e4fe83681 Mon Sep 17 00:00:00 2001 From: Sebastian Junges Date: Thu, 23 Apr 2020 15:52:36 -0700 Subject: [PATCH] towards more helpful output when POMDP is not canonical --- .../transformer/MakePOMDPCanonic.cpp | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/storm-pomdp/transformer/MakePOMDPCanonic.cpp b/src/storm-pomdp/transformer/MakePOMDPCanonic.cpp index 9b83f898d..f0a9a3c26 100644 --- a/src/storm-pomdp/transformer/MakePOMDPCanonic.cpp +++ b/src/storm-pomdp/transformer/MakePOMDPCanonic.cpp @@ -175,7 +175,15 @@ namespace storm { if (moreActionObservations.get(observation)) { // We have seen this observation previously with multiple actions. Error! // TODO provide more diagnostic information - STORM_LOG_THROW(false, storm::exceptions::AmbiguousModelException, "Observation " << observation << " sometimes provides multiple actions, but in state " << state << " provides one action."); + std::string stateval =""; + if (pomdp.hasStateValuations()) { + stateval = " (" + pomdp.getStateValuations().getStateInfo(state) + ") "; + } + std::string actionval= ""; + if (pomdp.hasChoiceLabeling()) { + actionval = *pomdp.getChoiceLabeling().getLabelsOfChoice(rowIndexFrom).begin(); + } + STORM_LOG_THROW(false, storm::exceptions::AmbiguousModelException, "Observation " << observation << " sometimes provides multiple actions, but in state " << state << stateval << " provides only one action " << actionval << "."); } oneActionObservations.set(observation); @@ -184,7 +192,15 @@ namespace storm { } else { if (oneActionObservations.get(observation)) { // We have seen this observation previously with one action. Error! - STORM_LOG_THROW(false, storm::exceptions::AmbiguousModelException, "Observation " << observation << " sometimes provides one action, but in state " << state << " provides multiple actions."); + std::string stateval =""; + if (pomdp.hasStateValuations()) { + stateval = " (" + pomdp.getStateValuations().getStateInfo(state) + ") "; + } +// std::string actionval= ""; +// if (pomdp.hasChoiceLabeling()) { +// actionval = *pomdp.getChoiceLabeling().getLabelsOfChoice(rowIndexFrom).begin(); +// } + STORM_LOG_THROW(false, storm::exceptions::AmbiguousModelException, "Observation " << observation << " sometimes provides one action, but in state " << state << stateval << " provides " << rowIndexTo - rowIndexFrom << " actions."); } moreActionObservations.set(observation); }