Browse Source

Separated header and logic for struct in BeliefMdpExplorer

tempestpy_adaptions
Alexander Bork 5 years ago
committed by Tim Quatmann
parent
commit
74c2f83110
  1. 15
      src/storm-pomdp/builder/BeliefMdpExplorer.cpp
  2. 28
      src/storm-pomdp/builder/BeliefMdpExplorer.h

15
src/storm-pomdp/builder/BeliefMdpExplorer.cpp

@ -2,11 +2,20 @@
namespace storm {
namespace builder {
template<typename PomdpType, typename BeliefValueType>
BeliefMdpExplorer<PomdpType, BeliefValueType>::SuccessorObservationInformation::SuccessorObservationInformation(ValueType const &obsProb, ValueType const &maxProb, uint64_t const &count) : observationProbability(obsProb), maxProbabilityToSuccessorWithObs(maxProb), successorWithObsCount(count) {
// Intentionally left empty.
}
template<typename PomdpType, typename BeliefValueType>
void BeliefMdpExplorer<PomdpType, BeliefValueType>::SuccessorObservationInformation::join(SuccessorObservationInformation other) { /// Does not join support (for performance reasons)
observationProbability += other.observationProbability;
maxProbabilityToSuccessorWithObs = std::max(maxProbabilityToSuccessorWithObs, other.maxProbabilityToSuccessorWithObs);
successorWithObsCount += other.successorWithObsCount;
}
template<typename PomdpType, typename BeliefValueType>
BeliefMdpExplorer<PomdpType, BeliefValueType>::BeliefMdpExplorer(std::shared_ptr<BeliefManagerType> beliefManager,
storm::pomdp::modelchecker::TrivialPomdpValueBounds<ValueType> const &pomdpValueBounds) : beliefManager(
beliefManager), pomdpValueBounds(pomdpValueBounds), status(Status::Uninitialized) {
BeliefMdpExplorer<PomdpType, BeliefValueType>::BeliefMdpExplorer(std::shared_ptr<BeliefManagerType> beliefManager,storm::pomdp::modelchecker::TrivialPomdpValueBounds<ValueType> const &pomdpValueBounds) : beliefManager(beliefManager), pomdpValueBounds(pomdpValueBounds), status(Status::Uninitialized) {
// Intentionally left empty
}

28
src/storm-pomdp/builder/BeliefMdpExplorer.h

@ -32,6 +32,15 @@ namespace storm {
typedef typename BeliefManagerType::BeliefId BeliefId;
typedef uint64_t MdpStateType;
struct SuccessorObservationInformation {
SuccessorObservationInformation(ValueType const &obsProb, ValueType const &maxProb, uint64_t const &count);
void join(SuccessorObservationInformation other);
ValueType observationProbability; /// The probability we move to the corresponding observation.
ValueType maxProbabilityToSuccessorWithObs; /// The maximal probability to move to a successor with the corresponding observation.
uint64_t successorWithObsCount; /// The number of successor beliefstates with this observation
typename BeliefManagerType::BeliefSupportType support;
};
enum class Status {
Uninitialized,
Exploring,
@ -150,25 +159,6 @@ namespace storm {
MdpStateType getBeliefId(MdpStateType exploredMdpState) const;
struct SuccessorObservationInformation {
SuccessorObservationInformation(ValueType const &obsProb, ValueType const &maxProb, uint64_t const &count) : observationProbability(obsProb),
maxProbabilityToSuccessorWithObs(maxProb),
successorWithObsCount(count) {
// Intentionally left empty.
}
void join(SuccessorObservationInformation other) { /// Does not join support (for performance reasons)
observationProbability += other.observationProbability;
maxProbabilityToSuccessorWithObs = std::max(maxProbabilityToSuccessorWithObs, other.maxProbabilityToSuccessorWithObs);
successorWithObsCount += other.successorWithObsCount;
}
ValueType observationProbability; /// The probability we move to the corresponding observation.
ValueType maxProbabilityToSuccessorWithObs; /// The maximal probability to move to a successor with the corresponding observation.
uint64_t successorWithObsCount; /// The number of successor beliefstates with this observation
typename BeliefManagerType::BeliefSupportType support;
};
void gatherSuccessorObservationInformationAtCurrentState(uint64_t localActionIndex, std::map<uint32_t, SuccessorObservationInformation> &gatheredSuccessorObservations);
void gatherSuccessorObservationInformationAtMdpChoice(uint64_t mdpChoice, std::map<uint32_t, SuccessorObservationInformation> &gatheredSuccessorObservations);

Loading…
Cancel
Save