MultiAgentDecisionProcess
MultiAgentDecisionProcessDiscreteFactoredStates Class Referenceabstract

MultiAgentDecisionProcessDiscreteFactoredStates is a class that represents the dynamics of a MAS with a factored state space. More...

#include <MultiAgentDecisionProcessDiscreteFactoredStates.h>

Inheritance diagram for MultiAgentDecisionProcessDiscreteFactoredStates:
[legend]

Classes

class  BoundObservationProbFunctor
 The BoundObservationProbFunctor class binds the "ComputeObservationProb" function to a templated object. More...
 
class  BoundScopeFunctor
 The BoundScopeFunctor class binds the "SetScopes" function to a templated object. More...
 
class  BoundTransitionProbFunctor
 The BoundTransitionProbFunctor class binds the "ComputeTransitionProb" function to a templated object. More...
 
class  EmptyObservationProbFunctor
 The EmptyObservationProbFunctor class can be used by fully-observable subclasses of MultiAgentDecisionProcessDiscreteFactoredStates, in order to initialize the 2DBN without requiring an actual observation function. More...
 
class  ObservationProbFunctor
 This is the base class for functors that return the observation probability for a given (s,a,s',o) tuple. More...
 
class  ScopeFunctor
 This is the base class for functors that set the scopes of the 2-DBN. More...
 
class  TransitionProbFunctor
 This is the base class for functors that return the transition probability for a given (s,a,s') tuple. More...
 

Public Member Functions

void AddAction (Index AI, const std::string &name, const std::string &description="")
 
void AddObservation (Index AI, const std::string &name, const std::string &description="")
 
Index AddStateFactor (const std::string &n="undef. name", const std::string &d="undef. descr.")
 
Index AddStateFactorValue (Index sf, const std::string &v="undef")
 
Scope AgentScopeBackup (const Scope &stateScope, const Scope &agentScope) const
 
void CacheFlatObservationModel (bool sparse=false)
 
void CacheFlatTransitionModel (bool sparse=false)
 
size_t ConstructJointActions ()
 
size_t ConstructJointObservations ()
 
void CreateNewObservationModel ()
 Creates a new observation model mapping: initializes new CPDs. More...
 
void CreateNewTransitionModel ()
 Creates a new transition model: initializes new CPDs for the 2BDN. More...
 
Index FactorValueIndicesToStateIndex (const std::vector< Index > &fv) const
 convert std::vector of (indices of) factor values to (flat) state index. More...
 
Index FactorValueIndicesToStateIndex (const std::vector< Index > &s_e_vec, const Scope &sfSC) const
 convert an local state vector s_e_vec of scope sfScope to a joint index. More...
 
const
TwoStageDynamicBayesianNetwork
Get2DBN () const
 Copy assignment operator. More...
 
const ActionGetAction (Index agentI, Index a) const
 Return a ref to the a-th action of agent agentI. More...
 
const ScopeGetAllStateFactorScope () const
 Convenience function to quickly get the full state scope. More...
 
const ScopeGetASoI_O (Index o) const
 
const ScopeGetASoI_Y (Index y) const
 
bool GetEventObservability () const
 Are we using an event observation model? More...
 
const FactoredStateDistributionGetFactoredISD () const
 
double GetInitialStateProbability (Index sI) const
 
StateDistributionGetISD () const
 Returns the complete initial state distribution. More...
 
const JointActionGetJointAction (Index i) const
 Return a ref to the i-th joint action. More...
 
const JointObservationGetJointObservation (Index i) const
 Return a ref to the i-th joint observation. More...
 
const std::vector< size_t > & GetNrActions () const
 Return the number of actions vector. More...
 
size_t GetNrActions (Index AgentI) const
 Return the number of actions of agent agentI. More...
 
size_t GetNrJointActions () const
 Return the number of joint actions. More...
 
size_t GetNrJointActions (const Scope &agScope) const
 Get the number of joint actions the agents in agScope can form. More...
 
size_t GetNrJointObservations () const
 Return the number of joint observations. More...
 
const std::vector< size_t > & GetNrObservations () const
 Return the number of observations vector. More...
 
size_t GetNrObservations (Index AgentI) const
 Return the number of observations of agent agentI. More...
 
size_t GetNrStateFactorInstantiations (const Scope &sfScope) const
 Get the number of joint instantiations for the factors in sfScope. More...
 
size_t GetNrStateFactors () const
 Get the number of state components. -no is inherited from. More...
 
size_t GetNrStates () const
 Return the number of states. More...
 
const size_t GetNrValuesForFactor (Index sf) const
 Get the number of possible values for a particular factor. More...
 
const std::vector< size_t > & GetNrValuesPerFactor () const
 Get the number of possible assignments or values to each factor. More...
 
const ObservationGetObservation (Index agentI, Index a) const
 Return a ref to the a-th observation of agent agentI. More...
 
const ObservationModelDiscreteGetObservationModelDiscretePtr () const
 Returns a pointer to the underlying observation model. More...
 
double GetObservationProbability (Index jaI, Index sucSI, Index joI) const
 Return the probability of joint observation joI: P(joI|jaI,sucSI). More...
 
double GetObservationProbability (Index sI, Index jaI, Index sucSI, Index joI) const
 O(s,ja,s',jo) version. You can access a standard O(ja,s',jo) model both ways (the PS index is simply ignored in the latter case). More...
 
OGetGetOGet () const
 
const ScopeGetOSoI_O (Index o) const
 
const StateGetState (Index i) const
 Returns a pointer to state i. More...
 
const StateFactorDiscreteGetStateFactorDiscrete (Index sfacI) const
 
TGetGetTGet () const
 
const TransitionModelDiscreteGetTransitionModelDiscretePtr () const
 Returns a pointer to the underlying transition model. More...
 
double GetTransitionProbability (Index sI, Index jaI, Index sucSI) const
 Return the probability of successor state sucSI: P(sucSI|sI,jaI). More...
 
const ScopeGetXSoI_O (Index o) const
 
const ScopeGetXSoI_Y (Index y) const
 
double GetYOProbability (const Scope &X, const std::vector< Index > &Xs, const Scope &A, const std::vector< Index > &As, const Scope &Y, const std::vector< Index > &Ys, const Scope &O, const std::vector< Index > &Os) const
 
const ScopeGetYSoI_O (Index o) const
 
const ScopeGetYSoI_Y (Index y) const
 
Index IndividualToJointActionIndices (const Index *AI_ar) const
 Returns the joint action index that corresponds to the array of specified individual action indices. More...
 
Index IndividualToJointActionIndices (const std::vector< Index > &indivActionIndices) const
 Returns the joint action index that corresponds to the vector of specified individual action indices. More...
 
Index IndividualToJointActionIndices (const std::vector< Index > &ja_e, const Scope &agSC) const
 indiv->joint for a restricted set (Scope) of agents More...
 
Index IndividualToJointObservationIndices (const std::vector< Index > &indivObservationIndices) const
 Returns the joint observation index that corresponds to the vector of specified individual observation indices. More...
 
Index IndividualToJointObservationIndices (const std::vector< Index > &jo_e, const Scope &agSC) const
 indiv->joint for a restricted set (Scope) of agents More...
 
virtual void Initialize2DBN ()
 
virtual void Initialize2DBN (ScopeFunctor &SetScopes, TransitionProbFunctor &ComputeTransitionProb, ObservationProbFunctor &ComputeObservationProb)
 This signature allows us to initialize the 2DBN using externally supplied functors to set the scopes, and compute transition and observation probabilities in a discrete factored model. More...
 
bool JointAIndicesValid () const
 
bool JointIndicesValid () const
 
bool JointOIndicesValid () const
 
const std::vector< Index > & JointToIndividualActionIndices (Index jaI) const
 Returns a vector of indices to indiv. More...
 
std::vector< IndexJointToIndividualActionIndices (Index ja_e, const Scope &agSC) const
 joint->indiv for a restricted set (Scope) of agents More...
 
const std::vector< Index > & JointToIndividualObservationIndices (Index joI) const
 Returns a vector of indices to indiv. More...
 
std::vector< IndexJointToIndividualObservationIndices (Index jo_e, const Scope &agSC) const
 joint->indiv for a restricted set (Scope) of agents More...
 
Index JointToRestrictedJointActionIndex (Index jaI, const Scope &agSc_e) const
 Converts a global joint action index jaI to a restricted joint action index ja_e, for agents scope agSc_e Returns a vector of indices to indiv. More...
 
Index JointToRestrictedJointObservationIndex (Index joI, const Scope &agSc_e) const
 Converts a global joint observation index joI to a restricted joint observation index jo_e, for agents scope agSc_e Returns a vector of indices to indiv. More...
 
void MarginalizeTransitionObservationModel (const Index sf, bool sparse)
 This function marginalizes a state factor out of the flat joint transition and observation models of the system. More...
 
 MultiAgentDecisionProcessDiscreteFactoredStates (const std::string &name="received unspec. by MultiAgentDecisionProcessDiscreteFactoredStates", const std::string &descr="received unspec. by MultiAgentDecisionProcessDiscreteFactoredStates", const std::string &pf="received unspec. by MultiAgentDecisionProcessDiscreteFactoredStates")
 (default) Constructor More...
 
 MultiAgentDecisionProcessDiscreteFactoredStates (const MultiAgentDecisionProcessDiscreteFactoredStates &a)
 Copy constructor. More...
 
MultiAgentDecisionProcessDiscreteFactoredStatesoperator= (const MultiAgentDecisionProcessDiscreteFactoredStates &o)
 Copy assignment operator. More...
 
void RemoveStateFactor (Index sf)
 This function removes a state factor from the model's MADPComponentFactoredStates, fixes the factor indices, and adjusts the 2DBN accordingly - all CPTs of nodes which depend on the removed state factor are recalculated by marginalizing their respective clique joints. More...
 
Index SampleInitialState () const
 Sample a state according to the initial state PDF. More...
 
void SampleInitialState (std::vector< Index > &sIs) const
 
Index SampleJointObservation (Index jaI, Index sucI) const
 Sample an observation - needed for simulations. More...
 
Index SampleJointObservation (Index sI, Index jaI, Index sucI) const
 
void SampleJointObservation (const std::vector< Index > &aIs, const std::vector< Index > &sucIs, std::vector< Index > &oIs) const
 
void SampleJointObservation (const std::vector< Index > &sIs, const std::vector< Index > &aIs, const std::vector< Index > &sucIs, std::vector< Index > &oIs) const
 
Index SampleSuccessorState (Index sI, Index jaI) const
 Sample a successor state - needed by simulations. More...
 
void SampleSuccessorState (const std::vector< Index > &sIs, const std::vector< Index > &aIs, std::vector< Index > &sucIs) const
 
bool SetActionsInitialized (bool b)
 
void SetConnectionsSpecified (bool b)
 
void SetEventObservability (bool eventO)
 
bool SetInitialized (bool b)
 
void SetISD (FactoredStateDistribution *p)
 
void SetNrActions (Index AI, size_t nrA)
 
void SetNrObservations (Index AI, size_t nrO)
 
bool SetObservationsInitialized (bool b)
 
void SetSoI_O (Index o, const Scope &ASoI, const Scope &YSoI, const Scope &OSoI)
 
void SetSoI_O (Index o, const Scope &XSoI, const Scope &ASoI, const Scope &YSoI, const Scope &OSoI)
 
void SetSoI_Y (Index y, const Scope &XSoI, const Scope &ASoI, const Scope &YSoI)
 
void SetSparse (bool b)
 
bool SetStatesInitialized (bool b)
 
void SetUniformISD ()
 
std::string SoftPrint () const
 SoftPrints information on the MultiAgentDecisionProcessDiscrete. More...
 
std::string SoftPrintState (Index sI) const
 
Index StateIndexToFactorValueIndex (Index factor, Index s) const
 Get the value of a particular state factor given a joint flat state. More...
 
std::vector< IndexStateIndexToFactorValueIndices (Index stateI) const
 Get the vector of FactorValue indices corresponding to stateI used to be called virtual vector<Index> GetStateFactorValues(Index stateI) const. More...
 
std::vector< IndexStateIndexToFactorValueIndices (Index s_e, const Scope &sfSC) const
 convert an local state index s_e to a vector of state factors (with scope sfScope). More...
 
Scope StateScopeBackup (const Scope &stateScope, const Scope &agentScope) const
 
 ~MultiAgentDecisionProcessDiscreteFactoredStates ()
 Destructor. More...
 
- Public Member Functions inherited from MultiAgentDecisionProcessDiscreteFactoredStatesInterface
virtual void CacheFlatModels (bool sparse)
 
virtual
MultiAgentDecisionProcessDiscreteFactoredStatesInterface
Clone () const =0
 Returns a pointer to a copy of this class. More...
 
std::string SoftPrintState (Index sI) const
 SoftPrints information on the MultiAgentDecisionProcessDiscrete. More...
 
virtual ~MultiAgentDecisionProcessDiscreteFactoredStatesInterface ()
 (default) Constructor More...
 
- Public Member Functions inherited from MultiAgentDecisionProcessDiscreteInterface
virtual ~MultiAgentDecisionProcessDiscreteInterface ()
 Destructor. More...
 
- Public Member Functions inherited from MultiAgentDecisionProcessInterface
virtual ~MultiAgentDecisionProcessInterface ()
 Destructor. More...
 
- Public Member Functions inherited from MultiAgentDecisionProcess
void AddAgent (std::string name)
 Add a new agent with name "name" to the MADP. More...
 
Index GetAgentIndexByName (const std::string &s) const
 Returns the index of an agent given its name, if it exists. More...
 
std::string GetAgentNameByIndex (Index i) const
 Returns the name of the agent at the given index. More...
 
const ScopeGetAllAgentScope () const
 
std::string GetDescription () const
 
std::string GetName () const
 
size_t GetNrAgents () const
 Returns the number of agents in this MultiAgentDecisionProcess. More...
 
std::string GetProblemFile () const
 Returns the name of the problem file. More...
 
std::string GetUnixName () const
 Returns a name which can be in unix path, by default the base part of the problem filename. More...
 
 MultiAgentDecisionProcess (size_t nrAgents, const std::string &name="received unspec. by MultiAgentDecisionProcess", const std::string &description="received unspec. by MultiAgentDecisionProcess", const std::string &pf="received unspec. by MultiAgentDecisionProcess")
 Constructor. More...
 
 MultiAgentDecisionProcess (const std::string &name="received unspec. by MultiAgentDecisionProcess", const std::string &description="received unspec. by MultiAgentDecisionProcess", const std::string &pf="received unspec. by MultiAgentDecisionProcess")
 Default Constructor without specifying the number of agents. More...
 
void Print () const
 
void SetDescription (const std::string &description)
 
void SetName (const std::string &name)
 
void SetNrAgents (size_t nrAgents)
 Sets the number of agents. More...
 
void SetUnixName (std::string unixName)
 Sets the name which can be used inin unix paths. More...
 
std::string SoftPrint () const
 Prints some information on the MultiAgentDecisionProcess. More...
 
virtual ~MultiAgentDecisionProcess ()
 Destructor. More...
 

Protected Member Functions

TwoStageDynamicBayesianNetworkGet2DBN ()
 
virtual bool SanityCheckObservations () const
 
virtual bool SanityCheckTransitions () const
 

Private Member Functions

virtual double ComputeObservationProb (Index o, Index oVal, const std::vector< Index > &As, const std::vector< Index > &Ys, const std::vector< Index > &Os) const =0
 
virtual double ComputeObservationProb (Index o, Index oVal, const std::vector< Index > &Xs, const std::vector< Index > &As, const std::vector< Index > &Ys, const std::vector< Index > &Os) const
 
virtual double ComputeTransitionProb (Index y, Index yVal, const std::vector< Index > &Xs, const std::vector< Index > &As, const std::vector< Index > &Ys) const =0
 
bool SanityCheck () const
 Check whether models appear valid probability distributions. More...
 
virtual void SetOScopes ()=0
 
virtual void SetScopes ()
 
virtual void SetYScopes ()=0
 

Private Attributes

TwoStageDynamicBayesianNetwork _m_2dbn
 
MADPComponentDiscreteActions _m_A
 
bool _m_cached_FlatOM
 
bool _m_cached_FlatTM
 
bool _m_connectionsSpecified
 Boolean to indicate whether all connections in the 2TBN are specified. More...
 
bool _m_eventObservability
 Boolean that controls whether the observation model is defined over events. More...
 
bool _m_initialized
 Boolean to indicate whether this MADPDiscrete has been initialized. More...
 
MADPComponentDiscreteObservations _m_O
 
ObservationModelDiscrete_m_p_oModel
 Pointer to the flat (chached) observation model. More...
 
TransitionModelDiscrete_m_p_tModel
 Pointer to the flat (chached) transition model. More...
 
MADPComponentFactoredStates _m_S
 
bool _m_sparse_FlatOM
 
bool _m_sparse_FlatTM
 

Additional Inherited Members

- Protected Attributes inherited from MultiAgentDecisionProcess
std::vector< Agent_m_agents
 Vector containing Agent objects, which are indexed named entities. More...
 
Scope _m_allAgentsScope
 Scope containing all agents - usefull sometimes. More...
 
size_t _m_nrAgents
 The number of agents participating in the MADP. More...
 
std::string _m_problemFile
 String holding the filename of the problem file to be parsed - if applicable. More...
 
std::string _m_unixName
 String for the unix name of the MADP. More...
 

Detailed Description

MultiAgentDecisionProcessDiscreteFactoredStates is a class that represents the dynamics of a MAS with a factored state space.

The agents are inherited from the MultiAgentDecisionProcess. Their actions and observations are discrete and defined and implemented in MADPComponentXXX

The state space is factored and defined and implemented in MADPComponentFactoredStates.

This class implements/maintains the factored transition and observation models through means of a TwoStageDynamicBayesianNetwork.

Constructor & Destructor Documentation

MultiAgentDecisionProcessDiscreteFactoredStates::MultiAgentDecisionProcessDiscreteFactoredStates ( const std::string &  name = "received unspec. by MultiAgentDecisionProcessDiscreteFactoredStates",
const std::string &  descr = "received unspec. by MultiAgentDecisionProcessDiscreteFactoredStates",
const std::string &  pf = "received unspec. by MultiAgentDecisionProcessDiscreteFactoredStates" 
)

(default) Constructor

MultiAgentDecisionProcessDiscreteFactoredStates::MultiAgentDecisionProcessDiscreteFactoredStates ( const MultiAgentDecisionProcessDiscreteFactoredStates a)

Copy constructor.

MultiAgentDecisionProcessDiscreteFactoredStates::~MultiAgentDecisionProcessDiscreteFactoredStates ( )

Destructor.

References _m_p_oModel, and _m_p_tModel.

Member Function Documentation

void MultiAgentDecisionProcessDiscreteFactoredStates::AddAction ( Index  AI,
const std::string &  name,
const std::string &  description = "" 
)
inline
void MultiAgentDecisionProcessDiscreteFactoredStates::AddObservation ( Index  AI,
const std::string &  name,
const std::string &  description = "" 
)
inline
Index MultiAgentDecisionProcessDiscreteFactoredStates::AddStateFactor ( const std::string &  n = "undef. name",
const std::string &  d = "undef. descr." 
)
inline
Index MultiAgentDecisionProcessDiscreteFactoredStates::AddStateFactorValue ( Index  sf,
const std::string &  v = "undef" 
)
inline
Scope MultiAgentDecisionProcessDiscreteFactoredStates::AgentScopeBackup ( const Scope stateScope,
const Scope agentScope 
) const
inlinevirtual
void MultiAgentDecisionProcessDiscreteFactoredStates::CacheFlatTransitionModel ( bool  sparse = false)
virtual double MultiAgentDecisionProcessDiscreteFactoredStates::ComputeObservationProb ( Index  o,
Index  oVal,
const std::vector< Index > &  As,
const std::vector< Index > &  Ys,
const std::vector< Index > &  Os 
) const
privatepure virtual
virtual double MultiAgentDecisionProcessDiscreteFactoredStates::ComputeObservationProb ( Index  o,
Index  oVal,
const std::vector< Index > &  Xs,
const std::vector< Index > &  As,
const std::vector< Index > &  Ys,
const std::vector< Index > &  Os 
) const
inlineprivatevirtual
virtual double MultiAgentDecisionProcessDiscreteFactoredStates::ComputeTransitionProb ( Index  y,
Index  yVal,
const std::vector< Index > &  Xs,
const std::vector< Index > &  As,
const std::vector< Index > &  Ys 
) const
privatepure virtual
void MultiAgentDecisionProcessDiscreteFactoredStates::CreateNewObservationModel ( )

Creates a new observation model mapping: initializes new CPDs.

This first checks whether all connections are specified (_m_connectionsSpecified) and consequently allocates CPDs for the 2DBN.

In the future it should be possible to specify what kind of CPDs are used (e.g. CPT, sparse CPT, ADD, rules etc.)

References _m_2dbn, _m_connectionsSpecified, TwoStageDynamicBayesianNetwork::AddCPDForO(), and MultiAgentDecisionProcess::GetNrAgents().

void MultiAgentDecisionProcessDiscreteFactoredStates::CreateNewTransitionModel ( )

Creates a new transition model: initializes new CPDs for the 2BDN.

This first checks whether all connections are specified (_m_connectionsSpecified) and consequently allocates CPDs for the 2DBN.

In the future it should be possible to specify what kind of CPDs are used (e.g. CPT, sparse CPT, ADD, rules etc.)

References _m_2dbn, _m_connectionsSpecified, TwoStageDynamicBayesianNetwork::AddCPDForY(), and GetNrStateFactors().

Index MultiAgentDecisionProcessDiscreteFactoredStates::FactorValueIndicesToStateIndex ( const std::vector< Index > &  fv) const
inlinevirtual

convert std::vector of (indices of) factor values to (flat) state index.

Implements MultiAgentDecisionProcessDiscreteFactoredStatesInterface.

References MADPComponentFactoredStates::FactorValueIndicesToStateIndex().

Referenced by SampleSuccessorState().

Index MultiAgentDecisionProcessDiscreteFactoredStates::FactorValueIndicesToStateIndex ( const std::vector< Index > &  s_e_vec,
const Scope sfSC 
) const
inlinevirtual

convert an local state vector s_e_vec of scope sfScope to a joint index.

Implements MultiAgentDecisionProcessDiscreteFactoredStatesInterface.

References MADPComponentFactoredStates::FactorValueIndicesToStateIndex().

TwoStageDynamicBayesianNetwork* MultiAgentDecisionProcessDiscreteFactoredStates::Get2DBN ( )
inlineprotected
const TwoStageDynamicBayesianNetwork* MultiAgentDecisionProcessDiscreteFactoredStates::Get2DBN ( ) const
inlinevirtual

Copy assignment operator.

Reimplemented from MultiAgentDecisionProcessDiscreteFactoredStatesInterface.

References _m_2dbn.

const Action* MultiAgentDecisionProcessDiscreteFactoredStates::GetAction ( Index  agentI,
Index  a 
) const
inlinevirtual

Return a ref to the a-th action of agent agentI.

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteActions::GetAction().

Referenced by FactoredDecPOMDPDiscrete::ExportSpuddFile().

const Scope& MultiAgentDecisionProcessDiscreteFactoredStates::GetAllStateFactorScope ( ) const
inlinevirtual

Convenience function to quickly get the full state scope.

Implements MultiAgentDecisionProcessDiscreteFactoredStatesInterface.

References MADPComponentFactoredStates::GetAllStateFactorScope().

Referenced by MarginalizeTransitionObservationModel().

const Scope& MultiAgentDecisionProcessDiscreteFactoredStates::GetASoI_O ( Index  o) const
inline
const Scope& MultiAgentDecisionProcessDiscreteFactoredStates::GetASoI_Y ( Index  y) const
inline
bool MultiAgentDecisionProcessDiscreteFactoredStates::GetEventObservability ( ) const
inlinevirtual

Are we using an event observation model?

Reimplemented from MultiAgentDecisionProcessDiscreteInterface.

Referenced by Initialize2DBN().

const FactoredStateDistribution* MultiAgentDecisionProcessDiscreteFactoredStates::GetFactoredISD ( ) const
inlinevirtual
double MultiAgentDecisionProcessDiscreteFactoredStates::GetInitialStateProbability ( Index  sI) const
inlinevirtual
StateDistribution* MultiAgentDecisionProcessDiscreteFactoredStates::GetISD ( ) const
inlinevirtual

Returns the complete initial state distribution.

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentFactoredStates::GetISD().

Referenced by FactoredDecPOMDPDiscrete::MarginalizeISD().

const JointAction* MultiAgentDecisionProcessDiscreteFactoredStates::GetJointAction ( Index  i) const
inlinevirtual

Return a ref to the i-th joint action.

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteActions::GetJointAction().

const JointObservation* MultiAgentDecisionProcessDiscreteFactoredStates::GetJointObservation ( Index  i) const
inlinevirtual

Return a ref to the i-th joint observation.

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteObservations::GetJointObservation().

const std::vector<size_t>& MultiAgentDecisionProcessDiscreteFactoredStates::GetNrActions ( ) const
inlinevirtual
size_t MultiAgentDecisionProcessDiscreteFactoredStates::GetNrActions ( Index  AgentI) const
inlinevirtual

Return the number of actions of agent agentI.

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteActions::GetNrActions().

size_t MultiAgentDecisionProcessDiscreteFactoredStates::GetNrJointActions ( const Scope agScope) const
inlinevirtual

Get the number of joint actions the agents in agScope can form.

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteActions::GetNrJointActions().

size_t MultiAgentDecisionProcessDiscreteFactoredStates::GetNrJointObservations ( ) const
inlinevirtual
const std::vector<size_t>& MultiAgentDecisionProcessDiscreteFactoredStates::GetNrObservations ( ) const
inlinevirtual

Return the number of observations vector.

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteObservations::GetNrObservations().

Referenced by Initialize2DBN().

size_t MultiAgentDecisionProcessDiscreteFactoredStates::GetNrObservations ( Index  AgentI) const
inlinevirtual

Return the number of observations of agent agentI.

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteObservations::GetNrObservations().

size_t MultiAgentDecisionProcessDiscreteFactoredStates::GetNrStateFactorInstantiations ( const Scope sfScope) const
virtual

Get the number of joint instantiations for the factors in sfScope.

Implements MultiAgentDecisionProcessDiscreteFactoredStatesInterface.

References GetNrValuesPerFactor(), IndexTools::RestrictIndividualIndicesToScope(), and VectorTools::VectorProduct().

size_t MultiAgentDecisionProcessDiscreteFactoredStates::GetNrStateFactors ( ) const
inlinevirtual
size_t MultiAgentDecisionProcessDiscreteFactoredStates::GetNrStates ( ) const
inlinevirtual
const size_t MultiAgentDecisionProcessDiscreteFactoredStates::GetNrValuesForFactor ( Index  sf) const
inlinevirtual
const Observation* MultiAgentDecisionProcessDiscreteFactoredStates::GetObservation ( Index  agentI,
Index  a 
) const
inlinevirtual

Return a ref to the a-th observation of agent agentI.

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteObservations::GetObservation().

const ObservationModelDiscrete* MultiAgentDecisionProcessDiscreteFactoredStates::GetObservationModelDiscretePtr ( ) const
inlinevirtual

Returns a pointer to the underlying observation model.

If speed is required (for instance when looping through all states) the pointer can be requested by an algorithm. It can than obtain a pointer to the actual implementation type by runtime type identification. (i.e., using typeid and dynamic_cast).

Implements MultiAgentDecisionProcessDiscreteInterface.

References _m_p_oModel.

double MultiAgentDecisionProcessDiscreteFactoredStates::GetObservationProbability ( Index  jaI,
Index  sucSI,
Index  joI 
) const
virtual
double MultiAgentDecisionProcessDiscreteFactoredStates::GetObservationProbability ( Index  sI,
Index  jaI,
Index  sucSI,
Index  joI 
) const
virtual

O(s,ja,s',jo) version. You can access a standard O(ja,s',jo) model both ways (the PS index is simply ignored in the latter case).

Reimplemented from MultiAgentDecisionProcessDiscreteInterface.

References _m_2dbn, _m_cached_FlatOM, _m_p_oModel, ObservationModelDiscreteInterface::Get(), TwoStageDynamicBayesianNetwork::GetOProbability(), JointToIndividualActionIndices(), JointToIndividualObservationIndices(), and StateIndexToFactorValueIndices().

OGet * MultiAgentDecisionProcessDiscreteFactoredStates::GetOGet ( ) const
virtual
const Scope& MultiAgentDecisionProcessDiscreteFactoredStates::GetOSoI_O ( Index  o) const
inline
const State* MultiAgentDecisionProcessDiscreteFactoredStates::GetState ( Index  i) const
inlinevirtual

Returns a pointer to state i.

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentFactoredStates::GetState().

const StateFactorDiscrete* MultiAgentDecisionProcessDiscreteFactoredStates::GetStateFactorDiscrete ( Index  sfacI) const
inlinevirtual
TGet * MultiAgentDecisionProcessDiscreteFactoredStates::GetTGet ( ) const
virtual
const TransitionModelDiscrete* MultiAgentDecisionProcessDiscreteFactoredStates::GetTransitionModelDiscretePtr ( ) const
inlinevirtual

Returns a pointer to the underlying transition model.

If speed is required (for instance when looping through all states) the pointer can be requested by an algorithm. It can than obtain a pointer to the actual implementation type by runtime type identification. (i.e., using typeid and dynamic_cast).

Implements MultiAgentDecisionProcessDiscreteInterface.

References _m_p_tModel.

double MultiAgentDecisionProcessDiscreteFactoredStates::GetTransitionProbability ( Index  sI,
Index  jaI,
Index  sucSI 
) const
virtual
const Scope& MultiAgentDecisionProcessDiscreteFactoredStates::GetXSoI_O ( Index  o) const
inline
double MultiAgentDecisionProcessDiscreteFactoredStates::GetYOProbability ( const Scope X,
const std::vector< Index > &  Xs,
const Scope A,
const std::vector< Index > &  As,
const Scope Y,
const std::vector< Index > &  Ys,
const Scope O,
const std::vector< Index > &  Os 
) const
inline
const Scope& MultiAgentDecisionProcessDiscreteFactoredStates::GetYSoI_O ( Index  o) const
inline
const Scope& MultiAgentDecisionProcessDiscreteFactoredStates::GetYSoI_Y ( Index  y) const
inline
Index MultiAgentDecisionProcessDiscreteFactoredStates::IndividualToJointActionIndices ( const Index AI_ar) const
inlinevirtual

Returns the joint action index that corresponds to the array of specified individual action indices.

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteActions::IndividualToJointActionIndices().

Referenced by MarginalizeTransitionObservationModel().

Index MultiAgentDecisionProcessDiscreteFactoredStates::IndividualToJointActionIndices ( const std::vector< Index > &  indivActionIndices) const
inlinevirtual

Returns the joint action index that corresponds to the vector of specified individual action indices.

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteActions::IndividualToJointActionIndices().

Index MultiAgentDecisionProcessDiscreteFactoredStates::IndividualToJointActionIndices ( const std::vector< Index > &  ja_e,
const Scope agSC 
) const
inlinevirtual

indiv->joint for a restricted set (Scope) of agents

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteActions::IndividualToJointActionIndices().

Index MultiAgentDecisionProcessDiscreteFactoredStates::IndividualToJointObservationIndices ( const std::vector< Index > &  indivObservationIndices) const
inlinevirtual

Returns the joint observation index that corresponds to the vector of specified individual observation indices.

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteObservations::IndividualToJointObservationIndices().

Referenced by SampleJointObservation().

Index MultiAgentDecisionProcessDiscreteFactoredStates::IndividualToJointObservationIndices ( const std::vector< Index > &  jo_e,
const Scope agSC 
) const
inlinevirtual

indiv->joint for a restricted set (Scope) of agents

Reimplemented from MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteObservations::IndividualToJointObservationIndices().

void MultiAgentDecisionProcessDiscreteFactoredStates::Initialize2DBN ( )
virtual
void MultiAgentDecisionProcessDiscreteFactoredStates::Initialize2DBN ( ScopeFunctor SetScopes,
TransitionProbFunctor ComputeTransitionProb,
ObservationProbFunctor ComputeObservationProb 
)
virtual

This signature allows us to initialize the 2DBN using externally supplied functors to set the scopes, and compute transition and observation probabilities in a discrete factored model.

This is useful, for example, if we want to read these from a file (e.g. as done by ParserProbModelXML) instead of creating ad-hoc implementations of each of these functions for each specific planning problem.

References _m_2dbn, _m_eventObservability, ComputeObservationProb(), ComputeTransitionProb(), DEBUG_2DBN, TwoStageDynamicBayesianNetwork::GetASoI_O(), TwoStageDynamicBayesianNetwork::GetASoI_Y(), GetEventObservability(), TwoStageDynamicBayesianNetwork::GetiiSize_O(), TwoStageDynamicBayesianNetwork::GetiiSize_Y(), NamedDescribedEntity::GetName(), MultiAgentDecisionProcess::GetNrAgents(), GetNrObservations(), GetNrStateFactors(), TwoStageDynamicBayesianNetwork::GetNrVals_ASoI_O(), TwoStageDynamicBayesianNetwork::GetNrVals_ASoI_Y(), TwoStageDynamicBayesianNetwork::GetNrVals_OSoI_O(), TwoStageDynamicBayesianNetwork::GetNrVals_XSoI_O(), TwoStageDynamicBayesianNetwork::GetNrVals_XSoI_Y(), TwoStageDynamicBayesianNetwork::GetNrVals_YSoI_O(), TwoStageDynamicBayesianNetwork::GetNrVals_YSoI_Y(), GetNrValuesPerFactor(), TwoStageDynamicBayesianNetwork::GetOSoI_O(), GetStateFactorDiscrete(), StateFactorDiscrete::GetStateFactorValue(), TwoStageDynamicBayesianNetwork::GetXSoI_O(), TwoStageDynamicBayesianNetwork::GetXSoI_Y(), TwoStageDynamicBayesianNetwork::GetYProbabilityGeneral(), TwoStageDynamicBayesianNetwork::GetYSoI_O(), TwoStageDynamicBayesianNetwork::GetYSoI_Y(), IndexTools::Increment(), TwoStageDynamicBayesianNetwork::IndividualToJointOiiIndices(), TwoStageDynamicBayesianNetwork::IndividualToJointYiiIndices(), TwoStageDynamicBayesianNetwork::InitializeIIs(), TwoStageDynamicBayesianNetwork::InitializeStorage(), Scope::Insert(), MultiAgentDecisionProcessDiscreteFactoredStates::ObservationProbFunctor::isEmpty(), Scope::IsSubSetOf(), Globals::PROB_PRECISION, CPT::Set(), SetConnectionsSpecified(), TwoStageDynamicBayesianNetwork::SetCPD_O(), TwoStageDynamicBayesianNetwork::SetCPD_Y(), SetEventObservability(), SetInitialized(), SetScopes(), TwoStageDynamicBayesianNetwork::SoftPrint(), and PrintTools::SoftPrintVector().

bool MultiAgentDecisionProcessDiscreteFactoredStates::JointAIndicesValid ( ) const
inline
bool MultiAgentDecisionProcessDiscreteFactoredStates::JointIndicesValid ( ) const
inline
bool MultiAgentDecisionProcessDiscreteFactoredStates::JointOIndicesValid ( ) const
inline
const std::vector<Index>& MultiAgentDecisionProcessDiscreteFactoredStates::JointToIndividualActionIndices ( Index  jaI) const
inlinevirtual
std::vector<Index> MultiAgentDecisionProcessDiscreteFactoredStates::JointToIndividualActionIndices ( Index  ja_e,
const Scope agSC 
) const
inlinevirtual

joint->indiv for a restricted set (Scope) of agents

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteActions::JointToIndividualActionIndices().

const std::vector<Index>& MultiAgentDecisionProcessDiscreteFactoredStates::JointToIndividualObservationIndices ( Index  joI) const
inlinevirtual

Returns a vector of indices to indiv.

observation indicies corr. to joint observation index joI.

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteObservations::JointToIndividualObservationIndices().

Referenced by GetObservationProbability(), and MarginalizeTransitionObservationModel().

std::vector<Index> MultiAgentDecisionProcessDiscreteFactoredStates::JointToIndividualObservationIndices ( Index  jo_e,
const Scope agSC 
) const
inlinevirtual

joint->indiv for a restricted set (Scope) of agents

Reimplemented from MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteObservations::JointToIndividualObservationIndices().

Index MultiAgentDecisionProcessDiscreteFactoredStates::JointToRestrictedJointActionIndex ( Index  jaI,
const Scope agSc_e 
) const
inlinevirtual

Converts a global joint action index jaI to a restricted joint action index ja_e, for agents scope agSc_e Returns a vector of indices to indiv.

action indicies corr. to joint action index jaI.

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteActions::JointToRestrictedJointActionIndex().

Index MultiAgentDecisionProcessDiscreteFactoredStates::JointToRestrictedJointObservationIndex ( Index  joI,
const Scope agSc_e 
) const
inlinevirtual

Converts a global joint observation index joI to a restricted joint observation index jo_e, for agents scope agSc_e Returns a vector of indices to indiv.

observation indicies corr. to joint observation index joI.

Reimplemented from MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentDiscreteObservations::JointToRestrictedJointObservationIndex().

void MultiAgentDecisionProcessDiscreteFactoredStates::MarginalizeTransitionObservationModel ( const Index  sf,
bool  sparse 
)
MultiAgentDecisionProcessDiscreteFactoredStates & MultiAgentDecisionProcessDiscreteFactoredStates::operator= ( const MultiAgentDecisionProcessDiscreteFactoredStates o)

Copy assignment operator.

References _m_2dbn.

Index MultiAgentDecisionProcessDiscreteFactoredStates::SampleInitialState ( ) const
inlinevirtual

Sample a state according to the initial state PDF.

Implements MultiAgentDecisionProcessDiscreteInterface.

References MADPComponentFactoredStates::SampleInitialState().

void MultiAgentDecisionProcessDiscreteFactoredStates::SampleInitialState ( std::vector< Index > &  sIs) const
inlinevirtual
Index MultiAgentDecisionProcessDiscreteFactoredStates::SampleJointObservation ( Index  jaI,
Index  sucI 
) const
virtual
void MultiAgentDecisionProcessDiscreteFactoredStates::SampleJointObservation ( const std::vector< Index > &  aIs,
const std::vector< Index > &  sucIs,
std::vector< Index > &  oIs 
) const
inlinevirtual
void MultiAgentDecisionProcessDiscreteFactoredStates::SampleJointObservation ( const std::vector< Index > &  sIs,
const std::vector< Index > &  aIs,
const std::vector< Index > &  sucIs,
std::vector< Index > &  oIs 
) const
Index MultiAgentDecisionProcessDiscreteFactoredStates::SampleSuccessorState ( Index  sI,
Index  jaI 
) const
virtual
void MultiAgentDecisionProcessDiscreteFactoredStates::SampleSuccessorState ( const std::vector< Index > &  sIs,
const std::vector< Index > &  aIs,
std::vector< Index > &  sucIs 
) const
virtual
bool MultiAgentDecisionProcessDiscreteFactoredStates::SanityCheck ( void  ) const
inlineprivate

Check whether models appear valid probability distributions.

References SanityCheckObservations(), and SanityCheckTransitions().

Referenced by MarginalizeTransitionObservationModel(), and SetInitialized().

bool MultiAgentDecisionProcessDiscreteFactoredStates::SanityCheckObservations ( void  ) const
protectedvirtual
bool MultiAgentDecisionProcessDiscreteFactoredStates::SanityCheckTransitions ( void  ) const
protectedvirtual
bool MultiAgentDecisionProcessDiscreteFactoredStates::SetActionsInitialized ( bool  b)
inline
void MultiAgentDecisionProcessDiscreteFactoredStates::SetConnectionsSpecified ( bool  b)
inline

Referenced by Initialize2DBN().

void MultiAgentDecisionProcessDiscreteFactoredStates::SetEventObservability ( bool  eventO)
inline
void MultiAgentDecisionProcessDiscreteFactoredStates::SetISD ( FactoredStateDistribution p)
inline
void MultiAgentDecisionProcessDiscreteFactoredStates::SetNrActions ( Index  AI,
size_t  nrA 
)
inline
void MultiAgentDecisionProcessDiscreteFactoredStates::SetNrObservations ( Index  AI,
size_t  nrO 
)
inline
bool MultiAgentDecisionProcessDiscreteFactoredStates::SetObservationsInitialized ( bool  b)
inline
virtual void MultiAgentDecisionProcessDiscreteFactoredStates::SetOScopes ( )
privatepure virtual
virtual void MultiAgentDecisionProcessDiscreteFactoredStates::SetScopes ( )
inlineprivatevirtual

Reimplemented in FactoredMMDPDiscrete.

References SetOScopes(), and SetYScopes().

Referenced by Initialize2DBN().

void MultiAgentDecisionProcessDiscreteFactoredStates::SetSoI_O ( Index  o,
const Scope ASoI,
const Scope YSoI,
const Scope OSoI 
)
inline
void MultiAgentDecisionProcessDiscreteFactoredStates::SetSoI_O ( Index  o,
const Scope XSoI,
const Scope ASoI,
const Scope YSoI,
const Scope OSoI 
)
inline
void MultiAgentDecisionProcessDiscreteFactoredStates::SetSoI_Y ( Index  y,
const Scope XSoI,
const Scope ASoI,
const Scope YSoI 
)
inline
void MultiAgentDecisionProcessDiscreteFactoredStates::SetSparse ( bool  b)
inline
bool MultiAgentDecisionProcessDiscreteFactoredStates::SetStatesInitialized ( bool  b)
inline
void MultiAgentDecisionProcessDiscreteFactoredStates::SetUniformISD ( )
inline
virtual void MultiAgentDecisionProcessDiscreteFactoredStates::SetYScopes ( )
privatepure virtual
std::string MultiAgentDecisionProcessDiscreteFactoredStates::SoftPrintState ( Index  sI) const
inlinevirtual
Index MultiAgentDecisionProcessDiscreteFactoredStates::StateIndexToFactorValueIndex ( Index  factor,
Index  s 
) const
inlinevirtual

Get the value of a particular state factor given a joint flat state.

Implements MultiAgentDecisionProcessDiscreteFactoredStatesInterface.

References MADPComponentFactoredStates::StateIndexToFactorValueIndex().

std::vector<Index> MultiAgentDecisionProcessDiscreteFactoredStates::StateIndexToFactorValueIndices ( Index  stateI) const
inlinevirtual
std::vector<Index> MultiAgentDecisionProcessDiscreteFactoredStates::StateIndexToFactorValueIndices ( Index  s_e,
const Scope sfSC 
) const
inlinevirtual

convert an local state index s_e to a vector of state factors (with scope sfScope).

Implements MultiAgentDecisionProcessDiscreteFactoredStatesInterface.

References MADPComponentFactoredStates::StateIndexToFactorValueIndices().

Scope MultiAgentDecisionProcessDiscreteFactoredStates::StateScopeBackup ( const Scope stateScope,
const Scope agentScope 
) const
inlinevirtual

Member Data Documentation

MADPComponentDiscreteActions MultiAgentDecisionProcessDiscreteFactoredStates::_m_A
private

Referenced by SetInitialized(), and SoftPrint().

bool MultiAgentDecisionProcessDiscreteFactoredStates::_m_cached_FlatOM
private
bool MultiAgentDecisionProcessDiscreteFactoredStates::_m_cached_FlatTM
private
bool MultiAgentDecisionProcessDiscreteFactoredStates::_m_connectionsSpecified
private

Boolean to indicate whether all connections in the 2TBN are specified.

If this is the case, than we can allocate space for CPDs. So this var is referenced by CreateNewTransitionModel and CreateNewObservationModel.

Referenced by CreateNewObservationModel(), and CreateNewTransitionModel().

bool MultiAgentDecisionProcessDiscreteFactoredStates::_m_eventObservability
private

Boolean that controls whether the observation model is defined over events.

Referenced by CacheFlatObservationModel(), GetOGet(), Initialize2DBN(), MarginalizeTransitionObservationModel(), SampleJointObservation(), and SampleSuccessorState().

bool MultiAgentDecisionProcessDiscreteFactoredStates::_m_initialized
private

Boolean to indicate whether this MADPDiscrete has been initialized.

Referenced by SetInitialized(), and SoftPrint().

MADPComponentDiscreteObservations MultiAgentDecisionProcessDiscreteFactoredStates::_m_O
private

Referenced by SetInitialized(), and SoftPrint().

TransitionModelDiscrete* MultiAgentDecisionProcessDiscreteFactoredStates::_m_p_tModel
private
MADPComponentFactoredStates MultiAgentDecisionProcessDiscreteFactoredStates::_m_S
private
bool MultiAgentDecisionProcessDiscreteFactoredStates::_m_sparse_FlatOM
private
bool MultiAgentDecisionProcessDiscreteFactoredStates::_m_sparse_FlatTM
private