Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
PermissiveSchedulerPenalty.h
Go to the documentation of this file.
1#pragma once
2
3#include <unordered_map>
4
6
7namespace storm {
8namespace ps {
9
11 std::unordered_map<storage::StateActionPair, double> mPenalties;
12
13 public:
14 double get(uint_fast64_t state, uint_fast64_t action) const {
15 return get(storage::StateActionPair(state, action));
16 }
17
18 double get(storage::StateActionPair const& sap) const {
19 auto it = mPenalties.find(sap);
20 if (it == mPenalties.end()) {
21 return 1.0;
22 } else {
23 return it->second;
24 }
25 }
26
27 void set(uint64_t state, uint64_t action, double penalty) {
28 STORM_LOG_ASSERT(penalty >= 1.0, "Penalty too low.");
29 if (penalty == 1.0) {
30 auto it = mPenalties.find(std::make_pair(state, action));
31 if (it != mPenalties.end()) {
32 mPenalties.erase(it);
33 }
34 } else {
35 mPenalties.emplace(std::make_pair(state, action), penalty);
36 }
37 }
38
39 void clear() {
40 mPenalties.clear();
41 }
42};
43} // namespace ps
44} // namespace storm
double get(storage::StateActionPair const &sap) const
void set(uint64_t state, uint64_t action, double penalty)
double get(uint_fast64_t state, uint_fast64_t action) const
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
LabParser.cpp.
Definition cli.cpp:18