Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ExplicitGameStrategy.cpp
Go to the documentation of this file.
2
3#include <algorithm>
4#include <limits>
5
6namespace storm {
7namespace storage {
8
9const uint64_t ExplicitGameStrategy::UNDEFINED = std::numeric_limits<uint64_t>::max();
10
11ExplicitGameStrategy::ExplicitGameStrategy(uint64_t numberOfStates) : choices(numberOfStates, UNDEFINED) {
12 // Intentionally left empty.
13}
14
15ExplicitGameStrategy::ExplicitGameStrategy(std::vector<uint64_t>&& choices) : choices(std::move(choices)) {
16 // Intentionally left empty.
17}
18
20 return choices.size();
21}
22
23uint64_t ExplicitGameStrategy::getChoice(uint64_t state) const {
24 return choices[state];
25}
26
27void ExplicitGameStrategy::setChoice(uint64_t state, uint64_t choice) {
28 choices[state] = choice;
29}
30
31bool ExplicitGameStrategy::hasDefinedChoice(uint64_t state) const {
32 return choices[state] != UNDEFINED;
33}
34
36 for (auto& e : choices) {
37 e = UNDEFINED;
38 }
39}
40
42 return std::count_if(choices.begin(), choices.end(), [](uint64_t choice) { return choice == UNDEFINED; });
43}
44
45std::ostream& operator<<(std::ostream& out, ExplicitGameStrategy const& strategy) {
46 std::vector<uint64_t> undefinedStates;
47 for (uint64_t state = 0; state < strategy.getNumberOfStates(); ++state) {
48 uint64_t choice = strategy.getChoice(state);
49 if (choice == ExplicitGameStrategy::UNDEFINED) {
50 undefinedStates.emplace_back(state);
51 } else {
52 out << state << " -> " << choice << '\n';
53 }
54 }
55 out << "undefined states: ";
56 for (auto state : undefinedStates) {
57 out << state << ", ";
58 }
59 out << '\n';
60
61 return out;
62}
63
64} // namespace storage
65} // namespace storm
bool hasDefinedChoice(uint64_t state) const
void setChoice(uint64_t state, uint64_t choice)
uint64_t getChoice(uint64_t state) const
std::ostream & operator<<(std::ostream &out, ParameterRegion< ParametricType > const &region)
LabParser.cpp.
Definition cli.cpp:18