From eca4dab6c069642731639aea3a0b1dcb0cb8736f Mon Sep 17 00:00:00 2001 From: Tim Quatmann Date: Tue, 7 Apr 2020 13:43:49 +0200 Subject: [PATCH] Beliefmanager: expanding a belief now returns a vector instead of a map --- src/storm-pomdp/storage/BeliefManager.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/storm-pomdp/storage/BeliefManager.h b/src/storm-pomdp/storage/BeliefManager.h index 0731aef35..b74390a79 100644 --- a/src/storm-pomdp/storage/BeliefManager.h +++ b/src/storm-pomdp/storage/BeliefManager.h @@ -120,11 +120,11 @@ namespace storm { return beliefs.size(); } - std::map expandAndTriangulate(BeliefId const& beliefId, uint64_t actionIndex, std::vector const& observationResolutions) { + std::vector> expandAndTriangulate(BeliefId const& beliefId, uint64_t actionIndex, std::vector const& observationResolutions) { return expandInternal(beliefId, actionIndex, observationResolutions); } - std::map expand(BeliefId const& beliefId, uint64_t actionIndex) { + std::vector> expand(BeliefId const& beliefId, uint64_t actionIndex) { return expandInternal(beliefId, actionIndex); } @@ -341,8 +341,8 @@ namespace storm { return result; } - std::map expandInternal(BeliefId const& beliefId, uint64_t actionIndex, boost::optional> const& observationTriangulationResolutions = boost::none) { - std::map destinations; + std::vector> expandInternal(BeliefId const& beliefId, uint64_t actionIndex, boost::optional> const& observationTriangulationResolutions = boost::none) { + std::vector> destinations; // TODO: Output as vector? BeliefType belief = getBelief(beliefId); @@ -373,13 +373,15 @@ namespace storm { } STORM_LOG_ASSERT(assertBelief(successorBelief), "Invalid successor belief."); + // Insert the destination. We know that destinations have to be disjoined since they have different observations if (observationTriangulationResolutions) { Triangulation triangulation = triangulateBelief(successorBelief, observationTriangulationResolutions.get()[successor.first]); for (size_t j = 0; j < triangulation.size(); ++j) { - addToDistribution(destinations, triangulation.gridPoints[j], triangulation.weights[j] * successor.second); + // Here we additionally assume that triangulation.gridPoints does not contain the same point multiple times + destinations.emplace_back(triangulation.gridPoints[j], triangulation.weights[j] * successor.second); } } else { - addToDistribution(destinations, getOrAddBeliefId(successorBelief), successor.second); + destinations.emplace_back(getOrAddBeliefId(successorBelief), successor.second); } }