10template<
typename ValueType>
16 ValueType
getRisk(uint64_t)
const;
21 uint64_t
getState(uint32_t obs, uint64_t offset)
const;
27 std::vector<ValueType> riskPerState;
28 std::vector<uint64_t> numberActionsPerObservation;
29 uint64_t beliefIdCounter = 0;
30 std::vector<uint64_t> observationOffsetId;
31 std::vector<std::vector<uint64_t>> statePerObservationAndOffset;
34template<
typename ValueType>
36template<
typename ValueType>
42template<
typename ValueType>
51 void update(uint32_t newObservation, std::unordered_set<SparseBeliefState>& previousBeliefs)
const;
52 std::size_t
hash()
const noexcept;
58 ValueType
get(uint64_t state)
const;
70 std::map<uint64_t, ValueType>
const&
getBeliefMap()
const;
75 void updateHelper(std::vector<std::map<uint64_t, ValueType>>
const& partialBeliefs, std::vector<ValueType>
const& sums,
76 typename std::map<uint64_t, ValueType>::const_iterator nextStateIt, uint32_t newObservation,
79 ValueType
const& risk, uint64_t prevId);
80 std::shared_ptr<BeliefStateManager<ValueType>> manager;
82 std::map<uint64_t, ValueType> belief;
83 std::size_t prestoredhash = 0;
96template<
typename ValueType,
typename BeliefState>
111 bool reset(uint32_t observation);
117 bool track(uint64_t newObservation);
143 void setRisk(std::vector<ValueType>
const& risk);
163 std::shared_ptr<BeliefStateManager<ValueType>> manager;
164 std::unordered_set<BeliefState> beliefs;
165 bool reductionTimedOut =
false;
167 uint32_t lastObservation;
175struct hash<
storm::generator::SparseBeliefState<T>> {
This class keeps track of common information of a set of beliefs.
uint64_t getObservationOffset(uint64_t state) const
BeliefStateManager(storm::models::sparse::Pomdp< ValueType > const &pomdp)
uint64_t getNumberOfStates() const
ValueType getRisk(uint64_t) const
storm::models::sparse::Pomdp< ValueType > const & getPomdp() const
uint64_t getState(uint32_t obs, uint64_t offset) const
uint64_t numberOfStatesPerObservation(uint32_t observation) const
uint32_t getObservation(uint64_t state) const
void setRiskPerState(std::vector< ValueType > const &risk)
uint64_t getActionsForObservation(uint32_t observation) const
std::unordered_set< BeliefState > const & getCurrentBeliefs() const
Provides access to the current beliefs.
NondeterministicBeliefTracker(storm::models::sparse::Pomdp< ValueType > const &pomdp, typename NondeterministicBeliefTracker< ValueType, BeliefState >::Options options=Options())
uint64_t reduce()
Apply reductions to the belief state.
ValueType getCurrentRisk(bool max=true)
What is the (worst-case/best-case) risk over all beliefs.
void setRisk(std::vector< ValueType > const &risk)
Sets the state-risk to use for all beliefs.
uint64_t getCurrentDimension() const
What is the dimension of the current set of beliefs, i.e., what is the number of states we could poss...
uint32_t getCurrentObservation() const
What was the last obervation that we made?
bool hasTimedOut() const
Did we time out during the computation?
bool reset(uint32_t observation)
Start with a new trace.
uint64_t getNumberOfBeliefs() const
How many beliefs are we currently tracking?
bool track(uint64_t newObservation)
Extend the observed trace with the new observation.
SparseBeliefState stores beliefs in a sparse format.
void setSupport(storm::storage::BitVector &) const
void update(uint32_t newObservation, std::unordered_set< SparseBeliefState > &previousBeliefs) const
Update the belief using the new observation.
std::string toString() const
std::map< uint64_t, ValueType > const & getBeliefMap() const
ValueType get(uint64_t state) const
Get the estimate to be in the given state.
std::size_t hash() const noexcept
friend bool operator==(SparseBeliefState< ValueType > const &lhs, SparseBeliefState< ValueType > const &rhs)
uint64_t getSupportSize() const
ValueType getRisk() const
Get the weighted risk.
SparseBeliefState(std::shared_ptr< BeliefStateManager< ValueType > > const &manager, uint64_t state)
This class represents a partially observable Markov decision process.
A bit vector that is internally represented as a vector of 64-bit values.
bool operator==(SparseBeliefState< ValueType > const &lhs, SparseBeliefState< ValueType > const &rhs)
std::size_t operator()(storm::generator::SparseBeliefState< T > const &s) const noexcept