8namespace modelchecker {
10namespace rewardbounded {
13 : dimensionCount(dimensionCount),
14 dimensionBitMask(1ull),
15 relevantBitsMask((1ull << dimensionCount) - 1),
16 stateCount(dimensionBitMask << dimensionCount),
17 dimensionsWithoutMemoryMask(0),
18 upperMemoryStateBound(stateCount) {
19 STORM_LOG_THROW(dimensionCount > 0, storm::exceptions::IllegalArgumentException,
"Invoked MemoryStateManager with zero dimension count.");
20 STORM_LOG_THROW(dimensionCount <= 64, storm::exceptions::IllegalArgumentException,
"Invoked MemoryStateManager with too many dimensions.");
24 return dimensionCount;
32 return upperMemoryStateBound;
36 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked MemoryStateManager with zero dimension count.");
37 STORM_LOG_ASSERT(dimension < dimensionCount,
"Tried to set a dimension that is larger then the number of considered dimensions");
38 if (((dimensionBitMask << dimension) & dimensionsWithoutMemoryMask) == 0) {
39 stateCount = (stateCount >> 1);
41 dimensionsWithoutMemoryMask |= (dimensionBitMask << dimension);
45 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked MemoryStateManager with zero dimension count.");
46 return relevantBitsMask;
50 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked MemoryStateManager with zero dimension count.");
51 STORM_LOG_ASSERT((state & dimensionsWithoutMemoryMask) == dimensionsWithoutMemoryMask,
"Invalid memory state found.");
52 return (state & (dimensionBitMask << dimension)) != 0;
56 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked MemoryStateManager with zero dimension count.");
57 STORM_LOG_ASSERT(dimension < dimensionCount,
"Tried to set a dimension that is larger then the number of considered dimensions");
58 STORM_LOG_ASSERT(((dimensionBitMask << dimension) & dimensionsWithoutMemoryMask) == 0,
59 "Tried to change a memory state for a dimension but the dimension is assumed to have no memory.");
61 state |= (dimensionBitMask << dimension);
63 state &= ~(dimensionBitMask << dimension);
68 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked MemoryStateManager with zero dimension count.");
71 for (
auto d : dimensions) {
72 STORM_LOG_ASSERT(((dimensionBitMask << d) & dimensionsWithoutMemoryMask) == 0,
73 "Tried to set a dimension to 'relevant'-memory state but the dimension is assumed to have no memory.");
74 state |= (dimensionBitMask << d);
77 for (
auto d : dimensions) {
78 STORM_LOG_ASSERT(((dimensionBitMask << d) & dimensionsWithoutMemoryMask) == 0,
79 "Tried to set a dimension to 'unrelevant'-memory state but the dimension is assumed to have no memory.");
80 state &= ~(dimensionBitMask << d);
86 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
87 std::string res =
"[";
89 for (uint64_t d = 1; d < dimensionCount; ++d) {
uint64_t const & getMemoryStateCount() const
MemoryStateManager(uint64_t dimensionCount)
std::string toString(MemoryState const &state) const
bool isRelevantDimension(MemoryState const &state, uint64_t dimension) const
MemoryState getInitialMemoryState() const
void setDimensionWithoutMemory(uint64_t dimension)
void setRelevantDimension(MemoryState &state, uint64_t dimension, bool value=true) const
MemoryState const & getUpperMemoryStateBound() const
uint64_t const & getDimensionCount() const
void setRelevantDimensions(MemoryState &state, storm::storage::BitVector const &dimensions, bool value=true) const
A bit vector that is internally represented as a vector of 64-bit values.
size_t size() const
Retrieves the number of bits this bit vector can store.
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_THROW(cond, exception, message)