MultiAgentDecisionProcess
BG_FactorGraphCreator Class Reference

BG_FactorGraphCreator will create a FG from a BG. More...

#include <BG_FactorGraphCreator.h>

Public Types

enum  BGFactorGraph_t { AgentTypeIndependence, AgentIndependence, TypeIndependence }
 

Public Member Functions

 BG_FactorGraphCreator (const boost::shared_ptr< const BayesianGameCollaborativeGraphical > &bg, BGFactorGraph_t type=AgentTypeIndependence, int verbosity=2, bool exploitSparseness=false)
 (default) Constructor More...
 
 BG_FactorGraphCreator (const BG_FactorGraphCreator &a)
 Copy constructor. More...
 
const libDAI::FactorGraph * CreateFG ()
 actually creates the FG More...
 
BGFactorGraph_t GetBGFactorGraph_t () const
 
const libDAI::FactorGraph * GetFG ()
 returns a pointer to the FG More...
 
Index GetVariableIndexForAgentType (Index agI, Index typeI) const
 
BG_FactorGraphCreatoroperator= (const BG_FactorGraphCreator &o)
 Copy assignment operator. More...
 
 ~BG_FactorGraphCreator ()
 Destructor. More...
 

Static Public Member Functions

static std::string SoftPrint (BGFactorGraph_t bgfg)
 

Protected Member Functions

void Construct_AgentBGPolicy_Variables ()
 constuct variables for each agent (i.e., no type independence) More...
 
void Construct_AgentTypePair_Variables ()
 construct variables for each (agent-type) pair - values are actions More...
 
void Construct_JointType_Factors ()
 constructs factors for each joint type: type indep. More...
 
void Construct_LocalJointType_Factors ()
 constructs factors for each local joint type: agent+type indep. More...
 
void Construct_LocalPayoff_Factors ()
 constructs factors for each local payoff function: agent indep. More...
 
void Construct_Payoff_Factor ()
 this constructs the strategic game: 1 single factor with agents: no indep. More...
 
const libDAI::FactorGraph * CreateFG_AgentIndepence ()
 
const libDAI::FactorGraph * CreateFG_AgentTypeIndepence ()
 
const libDAI::FactorGraph * CreateFG_TypeIndepence ()
 
double PerturbationTerm ()
 the amount of random perturbation to add to the factors: More...
 

Private Attributes

boost::shared_ptr< const
BayesianGameCollaborativeGraphical
_m_bg
 
bool _m_exploitSparse
 Do we want to exploit sparseness of joint type space? More...
 
std::vector< libDAI::Factor > _m_facs
 
libDAI::FactorGraph * _m_FG
 
BGFactorGraph_t _m_FGt
 
std::vector< std::vector< Index > > _m_var_indices
 
std::vector< libDAI::Var > _m_vars
 
int _m_verbosity
 verbosity level: More...
 

Detailed Description

BG_FactorGraphCreator will create a FG from a BG.

Currently only works for CGBG (BayesianGameCollaborativeGraphical)

known bugs: -will fail for CGBGs in which not all agents participate in at least 1 payoff components. (in that case libDAI will not include the variables corresponding to the excluded agent(s) in the graphical model. However, the labels will not be changes, so an out of index exception is thrown)

Member Enumeration Documentation

Enumerator
AgentTypeIndependence 
AgentIndependence 
TypeIndependence 

Constructor & Destructor Documentation

BG_FactorGraphCreator::BG_FactorGraphCreator ( const boost::shared_ptr< const BayesianGameCollaborativeGraphical > &  bg,
BGFactorGraph_t  type = AgentTypeIndependence,
int  verbosity = 2,
bool  exploitSparseness = false 
)

(default) Constructor

BG_FactorGraphCreator::BG_FactorGraphCreator ( const BG_FactorGraphCreator a)
inline

Copy constructor.

BG_FactorGraphCreator::~BG_FactorGraphCreator ( )

Destructor.

References _m_FG.

Member Function Documentation

void BG_FactorGraphCreator::Construct_AgentBGPolicy_Variables ( )
protected

constuct variables for each agent (i.e., no type independence)

There is 1 variable for each agent, the values are BG policies

References _m_bg, _m_vars, and Globals::CastLIndexToIndex().

Referenced by CreateFG_AgentIndepence().

void BG_FactorGraphCreator::Construct_AgentTypePair_Variables ( )
protected

construct variables for each (agent-type) pair - values are actions

an assignment of variables (v3, v8, v14) corresponds to an assignment of joint actions (a1, a2, a3) for a particular joint type. I.e., each (the action taken for each) (agent,type)-pair is a variable of the FG

References _m_bg, _m_var_indices, _m_vars, and _m_verbosity.

Referenced by CreateFG_AgentTypeIndepence(), and CreateFG_TypeIndepence().

void BG_FactorGraphCreator::Construct_JointType_Factors ( )
protected
void BG_FactorGraphCreator::Construct_Payoff_Factor ( )
protected

this constructs the strategic game: 1 single factor with agents: no indep.

References _m_bg, _m_facs, _m_var_indices, _m_vars, _m_verbosity, and PrintTools::SoftPrintVector().

const libDAI::FactorGraph * BG_FactorGraphCreator::CreateFG ( )
const libDAI::FactorGraph * BG_FactorGraphCreator::CreateFG_AgentIndepence ( )
protected
const libDAI::FactorGraph * BG_FactorGraphCreator::CreateFG_AgentTypeIndepence ( )
protected
const libDAI::FactorGraph * BG_FactorGraphCreator::CreateFG_TypeIndepence ( )
protected
BGFactorGraph_t BG_FactorGraphCreator::GetBGFactorGraph_t ( ) const
inline

References _m_FGt.

Referenced by BGCG_SolverFG::Solve().

const libDAI::FactorGraph* BG_FactorGraphCreator::GetFG ( )
inline

returns a pointer to the FG

References _m_FG.

Referenced by BGCG_SolverFG::Solve().

Index BG_FactorGraphCreator::GetVariableIndexForAgentType ( Index  agI,
Index  typeI 
) const
BG_FactorGraphCreator& BG_FactorGraphCreator::operator= ( const BG_FactorGraphCreator o)
inline

Copy assignment operator.

double BG_FactorGraphCreator::PerturbationTerm ( )
inlineprotected

the amount of random perturbation to add to the factors:

References Globals::PROB_PRECISION.

Referenced by Construct_JointType_Factors(), and Construct_LocalPayoff_Factors().

static std::string BG_FactorGraphCreator::SoftPrint ( BGFactorGraph_t  bgfg)
inlinestatic

Member Data Documentation

bool BG_FactorGraphCreator::_m_exploitSparse
private

Do we want to exploit sparseness of joint type space?

Referenced by Construct_JointType_Factors(), and Construct_LocalJointType_Factors().

libDAI::FactorGraph* BG_FactorGraphCreator::_m_FG
private
BGFactorGraph_t BG_FactorGraphCreator::_m_FGt
private