MultiAgentDecisionProcess
BayesianGameIdenticalPayoff Class Reference

BayesianGameIdenticalPayoff is a class that represents a Bayesian game with identical payoffs. More...

#include <BayesianGameIdenticalPayoff.h>

Inheritance diagram for BayesianGameIdenticalPayoff:
[legend]

Public Member Functions

 BayesianGameIdenticalPayoff ()
 
 BayesianGameIdenticalPayoff (const BayesianGameIdenticalPayoff &o)
 
 BayesianGameIdenticalPayoff (size_t nrAgents, const std::vector< size_t > &nrActions, const std::vector< size_t > &nrTypes, bool useSparseRewardModel=false)
 
virtual double ComputeValueJPol (const JointPolicyDiscretePure &jpolBG) const
 evaluates the value of a joint policy. More...
 
double GetUtility (const Index jtype, const Index ja) const
 Gets the utility for (for all agents) jtype, ja. More...
 
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). More...
 
BayesianGameIdenticalPayoffoperator= (const BayesianGameIdenticalPayoff &o)
 Copy assignment operator. More...
 
void Print () const
 Print this BayesianGameIdenticalPayoff to cout. More...
 
void PrintUtilForJointType (Index jtype) const
 Prints the utilities for jtype. More...
 
bool SetInitialized (bool b)
 Sets the initialized status to b. More...
 
void SetUtility (const Index jtype, const Index ja, const double u)
 Sets the utility for (for all agents) jtype, ja to u. More...
 
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). More...
 
std::string SoftPrint () const
 Prints a description of this entire BayesianGameIdenticalPayoff to a string. More...
 
std::string SoftPrintUtilForJointType (Index jtype) const
 Prints the utilities for jtype. More...
 
virtual ~BayesianGameIdenticalPayoff ()
 Destructor. More...
 
- Public Member Functions inherited from BayesianGameIdenticalPayoffInterface
 BayesianGameIdenticalPayoffInterface ()
 (default) Constructor More...
 
 BayesianGameIdenticalPayoffInterface (size_t nrAgents, const std::vector< size_t > &nrActions, const std::vector< size_t > &nrTypes)
 
double ComputeValueJPol (const JointPolicyDiscretePure &jpolBG) const
 
BayesianGameIdenticalPayoffInterfaceoperator= (const BayesianGameIdenticalPayoffInterface &o)
 
- Public Member Functions inherited from BayesianGameBase
void AddProbability (Index i, double p)
 Adds p to the probability of joint type i. More...
 
void AddProbability (const std::vector< Index > &indIndices, double p)
 Adds p to the probability of joint type corresponding to the individual type indices (indIndices). More...
 
virtual bool AreCachedJointToIndivIndices (const PolicyGlobals::PolicyDomainCategory pdc) const
 Check whether certain index conversions are cached. More...
 
 BayesianGameBase ()
 
 BayesianGameBase (size_t nrAgents, const std::vector< size_t > &nrActions, const std::vector< size_t > &nrTypes, int verboseness=0)
 
 BayesianGameBase (const BayesianGameBase &a)
 Copy constructor. More...
 
bool CacheJointToIndivAOH_Indices () const
 
bool CacheJointToIndivOH_Indices () const
 
bool CacheJointToIndivType_Indices () const
 
virtual
PolicyGlobals::PolicyDomainCategory 
GetDefaultIndexDomCat () const
 Return the default PolicyDomainCategory for the problem. More...
 
size_t GetNrActions (Index agentI) const
 Get the number of invididual actions of a particular agent. More...
 
const std::vector< size_t > & GetNrActions () const
 
size_t GetNrAgents () const
 implement the Interface_ProblemToPolicyDiscrete interface: More...
 
size_t GetNrJointActions () const
 
LIndex GetNrJointPolicies () const
 
size_t GetNrJointTypes () const
 
LIndex GetNrPolicies (Index ag) const
 
size_t GetNrPolicyDomainElements (Index agentI, PolicyGlobals::PolicyDomainCategory cat, size_t depth=MAXHORIZON) const
 Get the number of elements in the domain of an agent's policy. More...
 
const std::vector< size_t > & GetNrTypes () const
 
size_t GetNrTypes (Index agI) const
 
virtual double GetProbability (Index i) const
 Gets the probability of joint type i. More...
 
virtual double GetProbability (const std::vector< Index > &indIndices) const
 Gets the probability of joint type corresponding to the individual type indices (indIndices) More...
 
Index IndividualToJointActionIndices (const Index *IndArr) const
 Converts individual action indices to a joint action index. More...
 
Index IndividualToJointActionIndices (const std::vector< Index > &indices) const
 Converts individual action indices to a joint action index. More...
 
Index IndividualToJointTypeIndices (const std::vector< Index > &indices) const
 
std::vector< IndexJointToIndividualActionIndices (Index jaI) const
 
std::vector< IndexJointToIndividualPolicyDomainIndices (Index jdI, PolicyGlobals::PolicyDomainCategory cat) const
 implementation of JointToIndividualPolicyDomainIndices More...
 
const std::vector< Index > & JointToIndividualPolicyDomainIndicesRef (Index jdI, PolicyGlobals::PolicyDomainCategory cat) const
 implementation of JointToIndividualPolicyDomainIndicesRef More...
 
const std::vector< Index > & JointToIndividualTypeIndices (Index jTypeI) const
 
BayesianGameBaseoperator= (const BayesianGameBase &o)
 
void Print () const
 Print this BayesianGameBase to cout. More...
 
virtual void SanityCheck ()
 Sanity check should be overriden by classes that do not use the implementation provided by this class (e.g. More...
 
void SanityCheckBGBase ()
 
bool SetInitialized (bool b)
 Sets the initialized status to b. More...
 
void SetProbability (Index i, double p)
 Sets the probability of joint type i to p. More...
 
void SetProbability (const std::vector< Index > &indIndices, double p)
 Sets the probability of joint type corresponding to the individual type indices (indIndices) to p. More...
 
std::string SoftPrint () const
 Prints a description of this BayesianGameBase to a string. More...
 
std::string SoftPrintAction (Index agentI, Index actionI) const
 Virtual function that has to be implemented by derived class. More...
 
std::string SoftPrintPolicyDomainElement (Index agentI, Index typeIndex, PolicyGlobals::PolicyDomainCategory cat) const
 Virtual function that has to be implemented by derived class. More...
 
std::string SoftPrintSummary () const
 
std::string SoftPrintType (Index agentI, Index typeIndex) const
 
 ~BayesianGameBase ()
 Destructor. More...
 
- Public Member Functions inherited from Interface_ProblemToPolicyDiscretePure
LIndex GetNrJointPolicies (PolicyGlobals::PolicyDomainCategory cat, size_t depth=MAXHORIZON) const
 Get the number of joint policies, given the policy's domain. More...
 
LIndex GetNrPolicies (Index ag, PolicyGlobals::PolicyDomainCategory cat, size_t depth=MAXHORIZON) const
 Get the number of policies for an agent, given the policy's domain. More...
 
virtual ~Interface_ProblemToPolicyDiscretePure ()
 Destructor. More...
 
- Public Member Functions inherited from Interface_ProblemToPolicyDiscrete
size_t GetNrJointActions () const
 Get the number of joint actions. More...
 
 Interface_ProblemToPolicyDiscrete ()
 (default) Constructor More...
 
virtual ~Interface_ProblemToPolicyDiscrete ()
 Destructor. More...
 

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. More...
 
static BayesianGameIdenticalPayoff Load (const std::string &filename)
 Loads a BG from file. More...
 
static BayesianGameIdenticalPayoff LoadTextFormat (const std::string &filename)
 
static void Save (const BayesianGameIdenticalPayoff &bg, const std::string &filename)
 
static void SaveTextFormat (const BayesianGameIdenticalPayoff &bg, const std::string &filename)
 

Private Attributes

bool _m_initialized
 private bool to indicate whether this BG is initialized. More...
 
RewardModelDiscreteInterface_m_utilFunction
 Util function - in identical payoff case we need only 1 util function We use RewardModelMapping substituting joint type indices for state indices. More...
 

Additional Inherited Members

- Protected Member Functions inherited from BayesianGameBase
void ChangeNrActions (Index agI, size_t new_nr)
 
void ChangeNrTypes (Index agI, size_t new_nr)
 
void Initialize ()
 
- Protected Attributes inherited from BayesianGameBase
bool _m_initialized
 private bool to indicate whether this BG is initialized. More...
 
bool _m_JAoverflow
 Boolean that indicates whether the number of joint actions can be represented by size_t (or that overflowing occurs) More...
 
bool _m_JToverflow
 Boolean that indicates whether the number of joint types can be represented by size_t (or that overflowing occurs) More...
 
std::vector< size_t > _m_nrActions
 the number of actions for each agent More...
 
size_t _m_nrAgents
 the number of players (or agents) More...
 
size_t _m_nrJA
 the number of joint types: More...
 
size_t _m_nrJTypes
 the number of joint actions: More...
 
std::vector< size_t > _m_nrTypes
 the number of types for each agent More...
 
size_t * _m_stepSizeActions
 an size_t array that caches the stepsize array for actions: More...
 
size_t * _m_stepSizeTypes
 an size_t array that caches the stepsize array for types: More...
 
int _m_verboseness
 _m_verboseness >0 verbose, <0 is quiet More...
 

Detailed Description

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.

Constructor & Destructor Documentation

BayesianGameIdenticalPayoff::BayesianGameIdenticalPayoff ( )

References _m_initialized.

Referenced by LoadTextFormat().

BayesianGameIdenticalPayoff::BayesianGameIdenticalPayoff ( const BayesianGameIdenticalPayoff o)
BayesianGameIdenticalPayoff::BayesianGameIdenticalPayoff ( size_t  nrAgents,
const std::vector< size_t > &  nrActions,
const std::vector< size_t > &  nrTypes,
bool  useSparseRewardModel = false 
)
BayesianGameIdenticalPayoff::~BayesianGameIdenticalPayoff ( )
virtual

Destructor.

References _m_utilFunction.

Member Function Documentation

double BayesianGameIdenticalPayoff::ComputeValueJPol ( const JointPolicyDiscretePure jpolBG) const
virtual
BayesianGameIdenticalPayoff BayesianGameIdenticalPayoff::GenerateRandomBG ( size_t  nrAgents,
std::vector< size_t >  acs,
std::vector< size_t >  obs 
)
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.

References BayesianGameBase::GetNrJointActions(), BayesianGameBase::GetNrJointTypes(), BayesianGameBase::SetProbability(), and SetUtility().

double BayesianGameIdenticalPayoff::GetUtility ( const std::vector< Index > &  indTypeIndices,
const std::vector< Index > &  indActionIndices 
) const
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.

References RewardModelDiscreteInterface::Get(), BayesianGameBase::IndividualToJointActionIndices(), and BayesianGameBase::IndividualToJointTypeIndices().

BayesianGameIdenticalPayoff BayesianGameIdenticalPayoff::Load ( const std::string &  filename)
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.

References LoadTextFormat().

void BayesianGameIdenticalPayoff::Print ( ) const
inlinevirtual

Print this BayesianGameIdenticalPayoff to cout.

Reimplemented from BayesianGameIdenticalPayoffInterface.

Reimplemented in BayesianGameWithClusterInfo.

References SoftPrint().

void BayesianGameIdenticalPayoff::PrintUtilForJointType ( Index  jtype) const
inline

Prints the utilities for jtype.

References SoftPrintUtilForJointType().

Referenced by QPOMDP::ComputeRecursively().

bool BayesianGameIdenticalPayoff::SetInitialized ( bool  b)

Sets the initialized status to b.

When setting to true - checks are performed to see if this is a consistent Bayesian Game.

References _m_initialized.

Referenced by LoadTextFormat().

void BayesianGameIdenticalPayoff::SetUtility ( const Index  jtype,
const Index  ja,
const double  u 
)
inline
void BayesianGameIdenticalPayoff::SetUtility ( const std::vector< Index > &  indTypeIndices,
const std::vector< Index > &  indActionIndices,
const double  u 
)
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).

References BayesianGameBase::IndividualToJointActionIndices(), BayesianGameBase::IndividualToJointTypeIndices(), and RewardModelDiscreteInterface::Set().

string BayesianGameIdenticalPayoff::SoftPrint ( void  ) const
virtual
string BayesianGameIdenticalPayoff::SoftPrintUtilForJointType ( Index  jtype) const

Prints the utilities for jtype.

References BayesianGameBase::_m_nrJA, BayesianGameBase::GetProbability(), and GetUtility().

Referenced by PrintUtilForJointType().

Member Data Documentation

bool BayesianGameIdenticalPayoff::_m_initialized
private

private bool to indicate whether this BG is initialized.

To access the BayesianGameBase initialized bool use: BayesianGameBase::_m_initialized

Referenced by BayesianGameIdenticalPayoff(), operator=(), and SetInitialized().

RewardModelDiscreteInterface* BayesianGameIdenticalPayoff::_m_utilFunction
private

Util function - in identical payoff case we need only 1 util function We use RewardModelMapping substituting joint type indices for state indices.

Referenced by BayesianGameIdenticalPayoff(), operator=(), and ~BayesianGameIdenticalPayoff().