Browse Source

Beliefmanager: expanding a belief now returns a vector instead of a map

tempestpy_adaptions
Tim Quatmann 5 years ago
parent
commit
eca4dab6c0
  1. 14
      src/storm-pomdp/storage/BeliefManager.h

14
src/storm-pomdp/storage/BeliefManager.h

@ -120,11 +120,11 @@ namespace storm {
return beliefs.size(); return beliefs.size();
} }
std::map<BeliefId, ValueType> expandAndTriangulate(BeliefId const& beliefId, uint64_t actionIndex, std::vector<uint64_t> const& observationResolutions) {
std::vector<std::pair<BeliefId, ValueType>> expandAndTriangulate(BeliefId const& beliefId, uint64_t actionIndex, std::vector<uint64_t> const& observationResolutions) {
return expandInternal(beliefId, actionIndex, observationResolutions); return expandInternal(beliefId, actionIndex, observationResolutions);
} }
std::map<BeliefId, ValueType> expand(BeliefId const& beliefId, uint64_t actionIndex) {
std::vector<std::pair<BeliefId, ValueType>> expand(BeliefId const& beliefId, uint64_t actionIndex) {
return expandInternal(beliefId, actionIndex); return expandInternal(beliefId, actionIndex);
} }
@ -341,8 +341,8 @@ namespace storm {
return result; return result;
} }
std::map<BeliefId, ValueType> expandInternal(BeliefId const& beliefId, uint64_t actionIndex, boost::optional<std::vector<uint64_t>> const& observationTriangulationResolutions = boost::none) {
std::map<BeliefId, ValueType> destinations;
std::vector<std::pair<BeliefId, ValueType>> expandInternal(BeliefId const& beliefId, uint64_t actionIndex, boost::optional<std::vector<uint64_t>> const& observationTriangulationResolutions = boost::none) {
std::vector<std::pair<BeliefId, ValueType>> destinations;
// TODO: Output as vector? // TODO: Output as vector?
BeliefType belief = getBelief(beliefId); BeliefType belief = getBelief(beliefId);
@ -373,13 +373,15 @@ namespace storm {
} }
STORM_LOG_ASSERT(assertBelief(successorBelief), "Invalid successor belief."); 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) { if (observationTriangulationResolutions) {
Triangulation triangulation = triangulateBelief(successorBelief, observationTriangulationResolutions.get()[successor.first]); Triangulation triangulation = triangulateBelief(successorBelief, observationTriangulationResolutions.get()[successor.first]);
for (size_t j = 0; j < triangulation.size(); ++j) { 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 { } else {
addToDistribution(destinations, getOrAddBeliefId(successorBelief), successor.second);
destinations.emplace_back(getOrAddBeliefId(successorBelief), successor.second);
} }
} }

Loading…
Cancel
Save