8namespace modelchecker {
10namespace rewardbounded {
17 STORM_LOG_THROW(dimensionCount > 0, storm::exceptions::IllegalArgumentException,
"Invoked EpochManager with zero dimension count.");
18 STORM_LOG_THROW(dimensionCount <= 64, storm::exceptions::IllegalArgumentException,
"Invoked EpochManager with too many dimensions.");
19 bitsPerDimension = 64 / dimensionCount;
20 if (dimensionCount == 1) {
21 dimensionBitMask = -1ull;
23 dimensionBitMask = (1ull << bitsPerDimension) - 1;
26 if (dimensionCount * bitsPerDimension == 64ull) {
27 relevantBitsMask = -1ull;
29 relevantBitsMask = (1ull << (dimensionCount * bitsPerDimension)) - 1;
34 return relevantBitsMask;
42 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
43 return dimensionCount;
47 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
48 uint64_t mask = dimensionBitMask;
49 for (uint64_t d = 0; d < dimensionCount; ++d) {
50 if (((epoch1 & mask) == mask) != ((epoch2 & mask) == mask)) {
54 mask = mask << bitsPerDimension;
61 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
63 uint64_t dimensionMask = dimensionBitMask;
64 uint64_t classMask = 1;
65 for (uint64_t d = 0; d < dimensionCount; ++d) {
66 if ((epoch & dimensionMask) == dimensionMask) {
69 classMask = classMask << 1;
70 dimensionMask = dimensionMask << bitsPerDimension;
76 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
80 uint64_t mask = dimensionBitMask;
81 uint64_t e_d = epoch & mask;
82 uint64_t s_d = step & mask;
83 uint64_t result = (e_d < s_d || e_d == mask) ? mask : e_d - s_d;
86 for (uint64_t d = 1; d < dimensionCount; ++d) {
87 mask = mask << bitsPerDimension;
90 result |= ((e_d < s_d || e_d == mask) ? mask : e_d - s_d);
96 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
98 std::set<Epoch> resultAsSet;
100 return std::vector<Epoch>(resultAsSet.begin(), resultAsSet.end());
104 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
106 Epoch currStep = step;
108 while (d < dimensionCount) {
109 Epoch predecessor = epoch;
110 for (uint64_t dPrime = 0; dPrime < dimensionCount; ++dPrime) {
113 if (step_dPrime != 0) {
121 gatheredPredecessorEpochs.insert(predecessor);
135 }
while (d < dimensionCount);
140 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
141 return ((value & dimensionBitMask) == value) && value != dimensionBitMask;
145 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
146 return (epoch & relevantBitsMask) == 0;
150 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
151 return (epoch & relevantBitsMask) == relevantBitsMask;
155 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
156 uint64_t mask = dimensionBitMask;
157 for (uint64_t d = 0; d < dimensionCount; ++d) {
158 if ((epoch | mask) == epoch) {
161 mask = mask << bitsPerDimension;
167 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
168 uint64_t mask = (1 << dimensionCount) - 1;
169 return (epochClass & mask) != 0;
173 return (epochClass1 & epochClass2) == epochClass1;
177 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
178 epoch |= (dimensionBitMask << (dimension * bitsPerDimension));
182 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
184 epoch &= ~(dimensionBitMask << (dimension * bitsPerDimension));
185 epoch |= (value << (dimension * bitsPerDimension));
189 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
191 epochClass |= (1 << dimension);
193 epochClass &= ~(1 << dimension);
198 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
199 return (epoch | (dimensionBitMask << (dimension * bitsPerDimension))) == epoch;
203 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
204 return (epochClass | (1 << dimension)) == epochClass;
208 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
209 return (epoch >> (dimension * bitsPerDimension)) & dimensionBitMask;
213 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
214 uint64_t sumOfDimensions = 0;
220 return sumOfDimensions;
224 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
226 for (uint64_t d = 1; d < dimensionCount; ++d) {
235 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
246 for (uint64_t dim = 0; dim < dimensionCount; ++dim) {
255 }
else if (e1Sum > e2Sum) {
261 bool sumEven = (e1Sum % 2) == 0;
263 for (uint64_t dim = 0; dim < dimensionCount; ++dim) {
266 if (e1Value < e2Value) {
268 }
else if (e1Value > e2Value) {
273 uint64_t dim = dimensionCount;
278 if (e1Value < e2Value) {
280 }
else if (e1Value > e2Value) {
287 assert(epoch1 == epoch2);
292 STORM_LOG_ASSERT(dimensionCount > 0,
"Invoked EpochManager with zero dimension count.");
294 if (epochClass1 == epochClass2) {
303 for (count = 0; ec; ++count) {
307 for (; ec; --count) {
312 }
else if (count < 0) {
316 return epochClass1 < epochClass2;
bool isZeroEpoch(Epoch const &epoch) const
void gatherPredecessorEpochs(std::set< Epoch > &gatheredPredecessorEpochs, Epoch const &epoch, Epoch const &step) const
uint64_t getSumOfDimensions(Epoch const &epoch) const
bool isPredecessorEpochClass(EpochClass const &epochClass1, EpochClass const &epochClass2) const
bool isBottomDimension(Epoch const &epoch, uint64_t const &dimension) const
void setDimensionOfEpochClass(EpochClass &epochClass, uint64_t const &dimension, bool const &setToBottom) const
Epoch getSuccessorEpoch(Epoch const &epoch, Epoch const &step) const
bool isValidDimensionValue(uint64_t const &value) const
bool hasBottomDimension(Epoch const &epoch) const
uint64_t const & getDimensionCount() const
std::string toString(Epoch const &epoch) const
bool hasBottomDimensionEpochClass(EpochClass const &epochClass) const
bool epochClassOrder(EpochClass const &epochClass1, EpochClass const &epochClass2) const
bool compareEpochClass(Epoch const &epoch1, Epoch const &epoch2) const
uint64_t getDimensionOfEpoch(Epoch const &epoch, uint64_t const &dimension) const
Epoch getBottomEpoch() const
EpochClass getEpochClass(Epoch const &epoch) const
void setDimensionOfEpoch(Epoch &epoch, uint64_t const &dimension, uint64_t const &value) const
std::vector< Epoch > getPredecessorEpochs(Epoch const &epoch, Epoch const &step) const
bool isBottomEpoch(Epoch const &epoch) const
void setBottomDimension(Epoch &epoch, uint64_t const &dimension) const
bool isBottomDimensionEpochClass(EpochClass const &epochClass, uint64_t const &dimension) const
bool epochClassZigZagOrder(Epoch const &epoch1, Epoch const &epoch2) const
Epoch getZeroEpoch() const
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_THROW(cond, exception, message)