MultiAgentDecisionProcess
Release 0.2.1
|
BayesianGameIdenticalPayoff is a class that represents a Bayesian game with identical payoffs. More...
#include <BayesianGameIdenticalPayoff.h>
Public Member Functions | |
BayesianGameIdenticalPayoff () | |
BayesianGameIdenticalPayoff (size_t nrAgents, const std::vector< size_t > &nrActions, const std::vector< size_t > &nrTypes) | |
double | GetUtility (const Index jtype, const Index ja) const |
Gets the utility for (for all agents) jtype, ja. | |
double | GetUtility (const std::vector< Index > &indTypeIndices, const std::vector< Index > &indActionIndices) const |
Gets the utility for (for all agents) joint type corresponding to the individual type indices (indTypeIndices) and joint action corresponding to individual action indices (indActionIndices). | |
void | Print () const |
Print this BayesianGameIdenticalPayoff to cout. | |
void | PrintUtilForJointType (Index jtype) const |
bool | SetInitialized (bool b) |
Destructor. | |
void | SetUtility (const Index jtype, const Index ja, const double u) |
Sets the utility for (for all agents) jtype, ja to u. | |
void | SetUtility (const std::vector< Index > &indTypeIndices, const std::vector< Index > &indActionIndices, const double u) |
Sets the utility for (for all agents) joint type corresponding to the individual type indices (indTypeIndices) and joint action corresponding to individual action indices (indActionIndices). | |
std::string | SoftPrint () const |
Prints a description of this entire BayesianGameIdenticalPayoff to a string. | |
std::string | SoftPrintUtilForJointType (Index jtype) const |
Prints the utilities for jtype. | |
![]() | |
BayesianGameIdenticalPayoffInterface () | |
(default) Constructor | |
BayesianGameIdenticalPayoffInterface (size_t nrAgents, const std::vector< size_t > &nrActions, const std::vector< size_t > &nrTypes) | |
![]() | |
void | AddProbability (const Index i, const double p) |
Adds p to the probability of joint type i. | |
void | AddProbability (const std::vector< Index > &indIndices, const double p) |
Adds p to the probability of joint type corresponding to the individual type indices (indIndices). | |
virtual bool | AreCachedJointToIndivIndices (const PolicyGlobals::IndexDomainCategory pdc) const |
Check whether certain index conversions are cached. | |
BayesianGameBase () | |
BayesianGameBase (const size_t nrAgents, const std::vector< size_t > &nrActions, const std::vector< size_t > &nrTypes, int verboseness=0) | |
BayesianGameBase (const BayesianGameBase &a) | |
Copy constructor. | |
bool | CacheJointToIndivAOH_Indices () const |
bool | CacheJointToIndivOH_Indices () const |
bool | CacheJointToIndivType_Indices () const |
virtual PolicyGlobals::IndexDomainCategory | GetDefaultIndexDomCat () const |
Return the default IndexDomainCategory for the problem. | |
size_t | GetNrActions (Index agentI) const |
Get the number of invididual actions of a particular agent. | |
const std::vector< size_t > & | GetNrActions () const |
size_t | GetNrAgents () const |
implement the Interface_ProblemToPolicyDiscrete interface: | |
size_t | GetNrJointActions () const |
Get the number of joint actions. | |
LIndex | GetNrJointPolicies () const |
size_t | GetNrJointTypes () const |
LIndex | GetNrPolicies (Index ag) const |
size_t | GetNrPolicyDomainElements (Index agentI, PolicyGlobals::IndexDomainCategory cat, size_t depth=MAXHORIZON) const |
Get the number of elements in the domain of an agent's policy. | |
const std::vector< size_t > & | GetNrTypes () const |
size_t | GetNrTypes (Index agI) const |
virtual double | GetProbability (const Index i) const |
Gets the probability of joint type i. | |
double | GetProbability (const std::vector< Index > &indIndices) |
Gets the probability of joint type corresponding to the individual type indices (indIndices) | |
Index | IndividualToJointActionIndices (const Index *IndArr) const |
Converts individual action indices to a joint action index. | |
Index | IndividualToJointActionIndices (const std::vector< Index > &indices) const |
Converts individual action indices to a joint action index. | |
Index | IndividualToJointTypeIndices (const std::vector< Index > &indices) const |
std::vector< Index > | JointToIndividualActionIndices (Index jaI) const |
std::vector< Index > | JointToIndividualPolicyDomainIndices (Index jdI, PolicyGlobals::IndexDomainCategory cat) const |
implementation of JointToIndividualPolicyDomainIndices | |
const std::vector< Index > & | JointToIndividualPolicyDomainIndicesRef (Index jdI, PolicyGlobals::IndexDomainCategory cat) const |
implementation of JointToIndividualPolicyDomainIndicesRef | |
const std::vector< Index > & | JointToIndividualTypeIndices (Index jTypeI) const |
void | PrintAction (Index agentI, Index actionI) const |
y | |
void | PrintPolicyDomain (Index agentI, Index typeIndex) const |
bool | SanityCheck () const |
virtual void | SanityCheck () |
void | SanityCheckBGBase () |
void | SetProbability (const Index i, const double p) |
Sets the probability of joint type i to p. | |
void | SetProbability (const std::vector< Index > &indIndices, const double p) |
Sets the probability of joint type corresponding to the individual type indices (indIndices) to p. | |
std::string | SoftPrintAction (Index agentI, Index actionI) const |
std::string | SoftPrintPolicyDomainElement (Index agentI, Index typeIndex, PolicyGlobals::IndexDomainCategory cat) const |
~BayesianGameBase () | |
Destructor. | |
![]() | |
LIndex | GetNrJointPolicies (PolicyGlobals::IndexDomainCategory cat, size_t depth=MAXHORIZON) const |
Get the number of joint policies, given the policy's domain. | |
LIndex | GetNrPolicies (Index ag, PolicyGlobals::IndexDomainCategory cat, size_t depth=MAXHORIZON) const |
Get the number of policies for an agent, given the policy's domain. | |
virtual | ~Interface_ProblemToPolicyDiscretePure () |
Destructor. | |
![]() | |
Interface_ProblemToPolicyDiscrete () | |
(default) Constructor | |
virtual | ~Interface_ProblemToPolicyDiscrete () |
Destructor. |
Static Public Member Functions | |
static BayesianGameIdenticalPayoff | GenerateRandomBG (size_t nrAgents, std::vector< size_t > acs, std::vector< size_t > obs) |
Generates a random BG with identical payoffs. | |
static BayesianGameIdenticalPayoff | Load (std::string filename) |
Loads a BG from file. | |
static void | Save (const BayesianGameIdenticalPayoff &bg, std::string filename) |
Private Attributes | |
bool | _m_initialized |
private bool to indicate whether this BG is initialized. | |
RewardModelMapping | _m_utilFunction |
Util function - in identical payoff case we need only 1 util function We use RewardModelMapping substituting joint type indices for state indices. |
Additional Inherited Members | |
![]() | |
bool | _m_initialized |
private bool to indicate whether this BG is initialized. | |
std::vector< size_t > | _m_nrActions |
the number of actions for each agent | |
size_t | _m_nrAgents |
the number of players (or agents) | |
size_t | _m_nrJA |
the number of joint types: | |
size_t | _m_nrJTypes |
the number of joint actions: | |
std::vector< size_t > | _m_nrTypes |
the number of types for each agent | |
size_t * | _m_stepSizeActions |
an size_t array that caches the stepsize array for actions: | |
size_t * | _m_stepSizeTypes |
an size_t array that caches the stepsize array for types: | |
int | _m_verboseness |
_m_verboseness >0 verbose, <0 is quiet |
BayesianGameIdenticalPayoff is a class that represents a Bayesian game with identical payoffs.
(there is just 1 util function)
This is a self contained class: meaning that it does not depend on any Multi-agent decision problem or Planning unit. This implies that, in order to convert a time-step of a MADP Planning Unit to a Bayesian game, indices of observation(-action) histories have to be converted. This class uses its own indices.
Definition at line 50 of file BayesianGameIdenticalPayoff.h.
BayesianGameIdenticalPayoff::BayesianGameIdenticalPayoff | ( | ) |
Definition at line 34 of file BayesianGameIdenticalPayoff.cpp.
BayesianGameIdenticalPayoff::BayesianGameIdenticalPayoff | ( | size_t | nrAgents, |
const std::vector< size_t > & | nrActions, | ||
const std::vector< size_t > & | nrTypes | ||
) |
Definition at line 40 of file BayesianGameIdenticalPayoff.cpp.
References _m_initialized.
|
static |
Generates a random BG with identical payoffs.
Note that it returns the BG by value, so the copy assignment operator should be working. Also, this may be less suitable for large BGs.
Definition at line 96 of file BayesianGameIdenticalPayoff.cpp.
References BayesianGameBase::GetNrJointActions(), BayesianGameBase::GetNrJointTypes(), BayesianGameBase::SetProbability(), and SetUtility().
|
inlinevirtual |
Gets the utility for (for all agents) jtype, ja.
Implements BayesianGameIdenticalPayoffInterface.
Definition at line 102 of file BayesianGameIdenticalPayoff.h.
References _m_utilFunction, and RewardModelMapping::Get().
Referenced by GMAA_MAAstar::ConstructAndValuateNextPolicies(), SoftPrint(), and SoftPrintUtilForJointType().
|
inlinevirtual |
Gets the utility for (for all agents) joint type corresponding to the individual type indices (indTypeIndices) and joint action corresponding to individual action indices (indActionIndices).
Implements BayesianGameIdenticalPayoffInterface.
Definition at line 107 of file BayesianGameIdenticalPayoff.h.
References _m_utilFunction, RewardModelMapping::Get(), BayesianGameBase::IndividualToJointActionIndices(), and BayesianGameBase::IndividualToJointTypeIndices().
|
static |
Loads a BG from file.
Note that it returns the BG by value, so the copy assignment operator should be working. Also, this may be less suitable for large BGs.
Definition at line 88 of file BayesianGameIdenticalPayoff.cpp.
|
inlinevirtual |
Print this BayesianGameIdenticalPayoff to cout.
Reimplemented from BayesianGameIdenticalPayoffInterface.
Reimplemented in BayesianGameForDecPOMDPStage.
Definition at line 116 of file BayesianGameIdenticalPayoff.h.
References SoftPrint().
Referenced by QBG::ComputeRecursively(), and QBG::ComputeRecursivelyNoCache().
|
inline |
Definition at line 122 of file BayesianGameIdenticalPayoff.h.
References SoftPrintUtilForJointType().
Referenced by QPOMDP::ComputeRecursively().
|
static |
Definition at line 82 of file BayesianGameIdenticalPayoff.cpp.
Referenced by GMAA_kGMAA::ConstructAndValuateNextPolicies().
bool BayesianGameIdenticalPayoff::SetInitialized | ( | bool | b | ) |
Destructor.
Sets the initialized status to b. When setting to true - checks are performed to see if this is a consistent Bayesian Game.
Reimplemented from BayesianGameBase.
Definition at line 49 of file BayesianGameIdenticalPayoff.cpp.
References _m_initialized.
|
inline |
Sets the utility for (for all agents) jtype, ja to u.
Definition at line 88 of file BayesianGameIdenticalPayoff.h.
References _m_utilFunction, and RewardModelMapping::Set().
Referenced by AlphaVectorBG::BeliefBackupBGIP_Solver(), QPOMDP::ComputeRecursively(), QBG::ComputeRecursively(), QBG::ComputeRecursivelyNoCache(), GenerateRandomBG(), and BayesianGameForDecPOMDPStage::Initialize().
|
inline |
Sets the utility for (for all agents) joint type corresponding to the individual type indices (indTypeIndices) and joint action corresponding to individual action indices (indActionIndices).
Definition at line 93 of file BayesianGameIdenticalPayoff.h.
References _m_utilFunction, BayesianGameBase::IndividualToJointActionIndices(), BayesianGameBase::IndividualToJointTypeIndices(), and RewardModelMapping::Set().
|
virtual |
Prints a description of this entire BayesianGameIdenticalPayoff to a string.
Implements BayesianGameIdenticalPayoffInterface.
Reimplemented in BayesianGameForDecPOMDPStage.
Definition at line 67 of file BayesianGameIdenticalPayoff.cpp.
References BayesianGameBase::_m_nrJA, BayesianGameBase::_m_nrJTypes, and GetUtility().
Referenced by AgentBG::AgentBG(), and Print().
string BayesianGameIdenticalPayoff::SoftPrintUtilForJointType | ( | Index | jtype | ) | const |
Prints the utilities for jtype.
Definition at line 56 of file BayesianGameIdenticalPayoff.cpp.
References BayesianGameBase::_m_nrJA, BayesianGameBase::GetProbability(), and GetUtility().
Referenced by PrintUtilForJointType().
|
private |
private bool to indicate whether this BG is initialized.
To access the BayesianGameBase initialized bool use: BayesianGameBase::_m_initialized
Definition at line 62 of file BayesianGameIdenticalPayoff.h.
Referenced by BayesianGameIdenticalPayoff(), and SetInitialized().
|
private |
Util function - in identical payoff case we need only 1 util function We use RewardModelMapping substituting joint type indices for state indices.
Definition at line 67 of file BayesianGameIdenticalPayoff.h.
Referenced by GetUtility(), and SetUtility().