Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ExplicitGameStrategy.cpp
Go to the documentation of this file.
1
#include "
storm/storage/ExplicitGameStrategy.h
"
2
3
#include <algorithm>
4
#include <limits>
5
6
namespace
storm
{
7
namespace
storage {
8
9
const
uint64_t
ExplicitGameStrategy::UNDEFINED
= std::numeric_limits<uint64_t>::max();
10
11
ExplicitGameStrategy::ExplicitGameStrategy
(uint64_t numberOfStates) : choices(numberOfStates, UNDEFINED) {
12
// Intentionally left empty.
13
}
14
15
ExplicitGameStrategy::ExplicitGameStrategy
(std::vector<uint64_t>&& choices) : choices(
std
::move(choices)) {
16
// Intentionally left empty.
17
}
18
19
uint64_t
ExplicitGameStrategy::getNumberOfStates
()
const
{
20
return
choices.size();
21
}
22
23
uint64_t
ExplicitGameStrategy::getChoice
(uint64_t state)
const
{
24
return
choices[state];
25
}
26
27
void
ExplicitGameStrategy::setChoice
(uint64_t state, uint64_t choice) {
28
choices[state] = choice;
29
}
30
31
bool
ExplicitGameStrategy::hasDefinedChoice
(uint64_t state)
const
{
32
return
choices[state] !=
UNDEFINED
;
33
}
34
35
void
ExplicitGameStrategy::undefineAll
() {
36
for
(
auto
& e : choices) {
37
e =
UNDEFINED
;
38
}
39
}
40
41
uint64_t
ExplicitGameStrategy::getNumberOfUndefinedStates
()
const
{
42
return
std::count_if(choices.begin(), choices.end(), [](uint64_t choice) { return choice == UNDEFINED; });
43
}
44
45
std::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
ExplicitGameStrategy.h
storm::storage::ExplicitGameStrategy
Definition
ExplicitGameStrategy.h:10
storm::storage::ExplicitGameStrategy::getNumberOfUndefinedStates
uint64_t getNumberOfUndefinedStates() const
Definition
ExplicitGameStrategy.cpp:41
storm::storage::ExplicitGameStrategy::ExplicitGameStrategy
ExplicitGameStrategy(uint64_t numberOfStates)
Definition
ExplicitGameStrategy.cpp:11
storm::storage::ExplicitGameStrategy::hasDefinedChoice
bool hasDefinedChoice(uint64_t state) const
Definition
ExplicitGameStrategy.cpp:31
storm::storage::ExplicitGameStrategy::getNumberOfStates
uint64_t getNumberOfStates() const
Definition
ExplicitGameStrategy.cpp:19
storm::storage::ExplicitGameStrategy::setChoice
void setChoice(uint64_t state, uint64_t choice)
Definition
ExplicitGameStrategy.cpp:27
storm::storage::ExplicitGameStrategy::undefineAll
void undefineAll()
Definition
ExplicitGameStrategy.cpp:35
storm::storage::ExplicitGameStrategy::getChoice
uint64_t getChoice(uint64_t state) const
Definition
ExplicitGameStrategy.cpp:23
storm::storage::ExplicitGameStrategy::UNDEFINED
static const uint64_t UNDEFINED
Definition
ExplicitGameStrategy.h:12
std
Definition
DFTIsomorphism.h:691
storm::storage::operator<<
std::ostream & operator<<(std::ostream &out, ParameterRegion< ParametricType > const ®ion)
Definition
ParameterRegion.cpp:288
storm
LabParser.cpp.
Definition
cli.cpp:18
src
storm
storage
ExplicitGameStrategy.cpp
Generated by
1.9.8