Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
BeliefCollector.h
Go to the documentation of this file.
1#pragma once
2
3#include <unordered_map>
4#include <vector>
5
7
8namespace storm::pomdp::beliefs {
9
16template<typename BeliefType>
18 public:
22 static constexpr bool HasConsecutiveIds = true;
23
27 bool isEqual(BeliefId const& first, BeliefId const& second) const;
28
33
38 BeliefType const& getBeliefFromId(BeliefId const& id) const;
39
43 BeliefId getIdFromBelief(BeliefType const& belief) const;
44
48 bool containsBelief(BeliefType const& belief) const;
49
53 bool containsId(BeliefId const& id) const;
54
58 BeliefId getIdOptional(BeliefType const& belief) const;
59
65 BeliefId getIdOrAddBelief(BeliefType&& belief);
66
71 BeliefId addBelief(BeliefType&& inputBelief);
72
73 private:
74 std::vector<BeliefType> gatheredBeliefs;
75 // Resolve hash collisions by comparing the beliefs in gatheredBeliefs.
76 std::vector<std::unordered_multimap<std::size_t, BeliefId>> beliefToIdMap;
77};
78
79} // namespace storm::pomdp::beliefs
Interns beliefs and assigns them consecutive identifiers.
bool containsBelief(BeliefType const &belief) const
BeliefId getIdOptional(BeliefType const &belief) const
BeliefType const & getBeliefFromId(BeliefId const &id) const
BeliefId addBelief(BeliefType &&inputBelief)
Adds a fresh belief and returns its ID.
BeliefId getIdOrAddBelief(BeliefType &&belief)
Checks if the given belief has already been collected before.
bool containsId(BeliefId const &id) const
BeliefId getIdFromBelief(BeliefType const &belief) const
bool isEqual(BeliefId const &first, BeliefId const &second) const
uint64_t BeliefId
Definition types.h:12