12template<
typename BeliefType>
17template<
typename BeliefType>
20 if (
auto [insertionIt, success] = data.emplace(state, value); !success) {
21 insertionIt->second += value;
25template<
typename BeliefType>
30template<
typename BeliefType>
33 for (
auto const& [state, value] : data) {
39 for (
auto& [state, value] : data) {
46template<
typename BeliefType>
56 return BeliefType{std::move(data), std::move(obs)};
59template<
typename BeliefType>
65template<
typename BeliefType>
66bool BeliefBuilder<BeliefType>::assertBelief() {
67 using ValueType =
typename BeliefType::ValueType;
73 for (
auto const& [state, value] : data) {
75 STORM_LOG_ERROR(
"Non-positive belief value " << value <<
" at state " << state <<
".");
79 STORM_LOG_ERROR(
"Invalid belief value " << value <<
" at state " << state <<
".");
void reserve(uint64_t size)
Reserves space to build the belief more efficiently.
BeliefType build()
Builds the belief and returns it.
ValueType normalize()
Normalizes the belief, i.e., if the sum of the values is not 1, it divides all values by the sum.
void setObservation(BeliefObservationType const &observation)
Sets the observation of the belief.
typename BeliefType::ValueType ValueType
void addValue(BeliefStateType const &state, ValueType const &value)
Adds a probability value to the given state.
void reset()
Resets the builder to its initial state.
#define STORM_LOG_ERROR(message)
#define STORM_LOG_ASSERT(cond, message)
constexpr BeliefObservationType InvalidObservation
Required e.g. for comparing two beliefs.
uint64_t BeliefStateType
Shared identifiers and sparse-container types used by the belief subsystem.
uint32_t BeliefObservationType
bool isOne(ValueType const &a)
static const bool IsExact
static bool isOne(ValueType const &val)
static bool lessOrEqual(ValueType const &lhs, ValueType const &rhs)