14template<
typename ValueType,
typename RewardModelType>
18 playerNameToIndexMap = components.playerNameToIndexMap.get();
23template<
typename ValueType,
typename RewardModelType>
26 statePlayerIndications(
std::move(components.statePlayerIndications.get())) {
27 if (components.playerNameToIndexMap) {
28 playerNameToIndexMap = std::move(components.playerNameToIndexMap.get());
33template<
typename ValueType,
typename RewardModelType>
35 return statePlayerIndications;
38template<
typename ValueType,
typename RewardModelType>
41 return statePlayerIndications[stateIndex];
44template<
typename ValueType,
typename RewardModelType>
46 auto findIt = playerNameToIndexMap.find(playerName);
47 STORM_LOG_THROW(findIt != playerNameToIndexMap.end(), storm::exceptions::InvalidArgumentException,
"Unknown player name '" << playerName <<
"'.");
48 return findIt->second;
51template<
typename ValueType,
typename RewardModelType>
53 return playerNameToIndexMap;
56template<
typename ValueType,
typename RewardModelType>
58 return playerNameToIndexMap.size();
61template<
typename ValueType,
typename RewardModelType>
64 std::set<storm::storage::PlayerIndex> coalitionAsIndexSet;
65 for (
auto const& player : coalition.
getPlayers()) {
66 if (std::holds_alternative<std::string>(player)) {
67 coalitionAsIndexSet.insert(
getPlayerIndex(std::get<std::string>(player)));
69 STORM_LOG_ASSERT(std::holds_alternative<storm::storage::PlayerIndex>(player),
"Player identifier has unexpected type.");
70 coalitionAsIndexSet.insert(std::get<storm::storage::PlayerIndex>(player));
74 for (
auto const& pi : coalitionAsIndexSet) {
75 coalitionAsBitVector.
set(pi);
81 auto const& pi = statePlayerIndications[state];
82 if (pi < coalitionAsBitVector.
size() && coalitionAsBitVector.
get(pi)) {
83 result.
set(state,
true);
std::vector< std::variant< std::string, storm::storage::PlayerIndex > > const & getPlayers() const
CRewardModelType RewardModelType
virtual uint_fast64_t getNumberOfStates() const override
Returns the number of states of the model.
NondeterministicModel(ModelType modelType, storm::storage::sparse::ModelComponents< ValueType, RewardModelType > const &components)
Constructs a model from the given data.
This class represents a stochastic multiplayer game.
std::vector< storm::storage::PlayerIndex > const & getStatePlayerIndications() const
storm::storage::PlayerIndex getPlayerOfState(uint64_t stateIndex) const
storm::storage::BitVector computeStatesOfCoalition(storm::logic::PlayerCoalition const &coalition) const
std::map< std::string, storm::storage::PlayerIndex > const & getPlayerNamesToIndex() const
Smg(storm::storage::sparse::ModelComponents< ValueType, RewardModelType > const &components)
Constructs a model from the given data.
storm::storage::PlayerIndex getPlayerIndex(std::string const &playerName) const
uint64_t getNumberOfPlayers() const
A bit vector that is internally represented as a vector of 64-bit values.
void set(uint64_t index, bool value=true)
Sets the given truth value at the given index.
size_t size() const
Retrieves the number of bits this bit vector can store.
bool get(uint64_t index) const
Retrieves the truth value of the bit at the given index and performs a bound check.
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
boost::optional< std::map< std::string, storm::storage::PlayerIndex > > playerNameToIndexMap