MultiAgentDecisionProcess
TOIDecPOMDPDiscrete Class Reference

TOIDecPOMDPDiscrete is a class that represents a transition observation independent discrete DecPOMDP. More...

#include <TOIDecPOMDPDiscrete.h>

Inheritance diagram for TOIDecPOMDPDiscrete:
[legend]

Public Member Functions

virtual TOIDecPOMDPDiscreteClone () const
 Returns a pointer to a copy of this class. More...
 
void CreateNewRewardModel ()
 Creates a new reward model. More...
 
void CreateNewRewardModelForAgent (Index agentI)
 implementation of POSGDiscreteInterface More...
 
DecPOMDPDiscreteGetIndividualDecPOMDPD (Index agentI) const
 
virtual double GetReward (Index sI, Index jaI) const
 return the reward for state, joint action indices More...
 
virtual double GetReward (const std::vector< Index > &sIs, const std::vector< Index > &aIs) const
 
double GetReward (State *s, JointAction *ja) const
 implements the DecPOMDPInterface More...
 
double GetRewardForAgent (Index agentI, State *s, JointAction *ja) const
 Function that returns the reward for a state and joint action. More...
 
double GetRewardForAgent (Index agentI, Index sI, Index jaI) const
 Return the reward for state, joint action indices. More...
 
std::vector< double > GetRewards (Index sI, Index jaI) const
 
RGetGetRGet () const
 
TOIDecPOMDPDiscreteoperator= (const TOIDecPOMDPDiscrete &o)
 Copy assignment operator. More...
 
void Print () const
 Prints some information on the DecPOMDPDiscrete. More...
 
void SetIndividualDecPOMDPD (DecPOMDPDiscrete *model, Index agentI)
 
virtual bool SetInitialized (bool b)
 Sets _m_initialized to b. More...
 
void SetReward (Index sI, Index jaI, double r)
 Set the reward for state, joint action indices. More...
 
void SetReward (const std::vector< Index > &sIs, const std::vector< Index > &aIs, double r)
 
void SetReward (Index sI, Index jaI, Index sucSI, double r)
 set the reward for state, joint action , suc. More...
 
void SetReward (Index sI, Index jaI, Index sucSI, Index joI, double r)
 set the reward for state, joint action, suc.state, joint observation indices More...
 
void SetReward (State *s, JointAction *ja, double r)
 implements the DecPOMDPInterface More...
 
void SetRewardForAgent (Index agentI, State *s, JointAction *ja, double r)
 Function that sets the reward for an agent, state and joint action. More...
 
void SetRewardForAgent (Index agentI, Index sI, Index jaI, double r)
 
void SetRewardForAgent (Index agentI, Index sI, Index jaI, Index sucSI, double r)
 Set the reward for state, joint action , suc. state indices. More...
 
void SetRewardForAgent (Index agentI, Index sI, Index jaI, Index sucSI, Index joI, double r)
 Set the reward for state, joint action, suc.state, joint obs indices. More...
 
virtual std::string SoftPrint () const
 SoftPrints some information on the DecPOMDPDiscrete. More...
 
 TOIDecPOMDPDiscrete (const std::string &name="received unspec. by TOIDecPOMDPDiscrete", const std::string &descr="received unspec. by TOIDecPOMDPDiscrete", const std::string &pf="received unspec. by TOIDecPOMDPDiscrete", bool cacheFlatModels=false)
 (default) Constructor More...
 
 TOIDecPOMDPDiscrete (const TOIDecPOMDPDiscrete &a)
 Copy constructor. More...
 
virtual ~TOIDecPOMDPDiscrete ()
 Destructor. More...
 
- Public Member Functions inherited from DecPOMDPDiscreteInterface
virtual ~DecPOMDPDiscreteInterface ()
 import the GetReward function from the base class in current scope. More...
 
- Public Member Functions inherited from DecPOMDPInterface
virtual ~DecPOMDPInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from POSGInterface
virtual ~POSGInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from MultiAgentDecisionProcessInterface
virtual ~MultiAgentDecisionProcessInterface ()
 Destructor. More...
 
- Public Member Functions inherited from MultiAgentDecisionProcessDiscreteInterface
virtual bool GetEventObservability () const
 Whether observation models are P(o|s,a) or P(o|s,a,s'). More...
 
virtual double GetObservationProbability (Index sI, Index jaI, Index sucSI, Index joI) const
 
virtual Index IndividualToJointObservationIndices (const std::vector< Index > &jo_e, const Scope &agSC) const
 indiv->joint for a restricted set (Scope) of agents More...
 
virtual std::vector< IndexJointToIndividualObservationIndices (Index jo_e, const Scope &agSC) const
 joint->indiv for a restricted set (Scope) of agents More...
 
virtual 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...
 
virtual Index SampleJointObservation (Index sI, Index jaI, Index sucI) const
 
virtual ~MultiAgentDecisionProcessDiscreteInterface ()
 Destructor. More...
 
- Public Member Functions inherited from TransitionObservationIndependentMADPDiscrete
void AddAction (Index agentI, const std::string &name)
 Adds an action with a particular name for the specified agent. More...
 
void AddAgent (const std::string &name="unspec.")
 Adds one agent with an optional name. More...
 
void AddObservation (Index agentI, const std::string &name)
 Adds an Observation with a particular name for the specified agent. More...
 
void AddState (Index agentI, const std::string &name)
 Adds a state with a particular name for the specified agent. More...
 
void CreateCentralizedSparseTransitionModel ()
 
const ActionGetAction (Index agentI, Index a) const
 Get a pointer to action a of agentI. More...
 
MultiAgentDecisionProcessDiscreteGetIndividualMADPD (Index agentI) const
 Returns a pointer to agentsI's individual model. More...
 
double GetInitialStateProbability (Index sI) const
 returns the prob. More...
 
virtual StateDistributionVectorGetISD () const
 returns the initial state distribution. More...
 
const JointActionGetJointAction (Index i) const
 Returns a pointer to joint action i. More...
 
const JointActionDiscreteGetJointActionDiscrete (Index i) const
 return a ref to the i-th joint action (a JointActionDiscrete). More...
 
const JointObservationGetJointObservation (Index i) const
 Get a pointer to the i-th joint observation. More...
 
size_t GetNrActions (Index agentI) const
 return the number of actions of agent agentI More...
 
const std::vector< size_t > & GetNrActions () const
 returns a vector with the number of actions for each agent. 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
 Get the number of joint observations. More...
 
size_t GetNrJointStates () const
 
size_t GetNrObservations (Index agentI) const
 return the number of observations of agent agentI More...
 
const std::vector< size_t > & GetNrObservations () const
 Returns a vector with the number of observations for each agent. More...
 
size_t GetNrStates (Index agI) const
 Returns the number of local states for agent i. More...
 
size_t GetNrStates () const
 returns the number of (joint) states. More...
 
const ObservationGetObservation (Index agentI, Index o) const
 Get a pointer to observation o of agentI. More...
 
ObservationModelDiscreteGetObservationModelDiscretePtr () const
 Returns a pointer to the underlying observation model. More...
 
double GetObservationProbability (Index jaI, Index sucSI, Index joI) const
 Returns the probability of the joint observation joI (the product of the individual observation probabilities, which depend only on local states). More...
 
double GetObservationProbability (const std::vector< Index > &aIs, const std::vector< Index > &sucSIs, const std::vector< Index > &oIs) const
 
OGetGetOGet () const
 
const StateGetState (Index i) const
 Returns a pointer to state i. More...
 
const StateGetState (const std::vector< Index > &sIs) const
 
TGetGetTGet () const
 
TransitionModelDiscreteGetTransitionModelDiscretePtr () const
 Returns a pointer to the underlying transition model. More...
 
double GetTransitionProbability (Index sI, Index jaI, Index sucSI) const
 returns probability of joint transition (the product of the probabilities of the individual transitions) More...
 
double GetTransitionProbability (const std::vector< Index > &sIs, const std::vector< Index > &aIs, const std::vector< Index > &sucSIs) const
 
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 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 > &ja_e, const Scope &agSC) const
 indiv->joint for a restricted set (Scope) of agents More...
 
Index IndividualToJointActionIndices (Index *IndexArray) const
 converts individual to joint actions. More...
 
Index IndividualToJointObservationIndices (const std::vector< Index > &indivObsIndices) const
 returns the joint index for indivObsIndices More...
 
Index IndividualToJointStateIndices (const std::vector< Index > &indivStateIndices) const
 returns the joint index for indivStateIndices More...
 
bool Initialize ()
 
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 the individual indices for joint observation joI. More...
 
const std::vector< Index > & JointToIndividualStateIndices (Index jointSI) const
 returns a vector of individual (local) state indices corresponding to joint state index jointSI. 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...
 
void Print () const
 Prints information regarding this TransitionObservationIndependentMADPDiscrete. More...
 
void PrintActionSets () const
 Prints the action set for each agent. More...
 
void PrintJointActionSet () const
 Prints the set of joint actions. More...
 
Index SampleInitialState () const
 Samples an initial state. More...
 
std::vector< IndexSampleInitialStates () const
 
Index SampleJointObservation (Index jaI, Index sucI) const
 Returns a joint observation, sampled according to the observation probabilities. More...
 
std::vector< IndexSampleJointObservation (const std::vector< Index > &aIs, const std::vector< Index > &sucIs) const
 
Index SampleSuccessorState (Index sI, Index jaI) const
 returns a successor state index sampled according to the transition probabilities. More...
 
std::vector< IndexSampleSuccessorState (const std::vector< Index > &sIs, const std::vector< Index > &aIs) const
 
void SetISD (const std::vector< double > &v)
 Sets the initial state distribution to v. More...
 
void SetNrActions (Index agentI, size_t nr)
 Sets the number of actions for the specified agent. More...
 
void SetNrAgents (size_t n)
 Sets the number of agents to n. More...
 
void SetNrObservations (Index agentI, size_t nr)
 Sets the number of Observations for the specified agent. More...
 
void SetNrStates (Index agentI, size_t nr)
 Sets the number of states for the specified agent. More...
 
void SetSparse (bool sparse)
 
std::string SoftPrint () const
 SoftPrints information regarding this TransitionObservationIndependentMADPDiscrete. More...
 
std::string SoftPrintActionSets () const
 SoftPrints the action set for each agent. More...
 
std::string SoftPrintJointActionSet () const
 SoftPrints the set of joint actions. More...
 
std::string SoftPrintState (Index sI) const
 
 TransitionObservationIndependentMADPDiscrete (const std::string &name="received unspec. by TransitionObservationIndependentMADPDiscrete", const std::string &descr="received unspec.by TransitionObservationIndependentMADPDiscrete", const std::string &pf="received unspec. by TransitionObservationIndependentMADPDiscrete", bool cacheFlatModels=false)
 
 TransitionObservationIndependentMADPDiscrete (const TransitionObservationIndependentMADPDiscrete &)
 
virtual ~TransitionObservationIndependentMADPDiscrete ()
 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...
 
- Public Member Functions inherited from DecPOMDP
 DecPOMDP ()
 Default constructor. sets RewardType to REWARD and discount to 1.0. More...
 
double GetDiscount () const
 Returns the discount parameter. More...
 
double GetDiscountForAgent (Index agentI) const
 Returns the discount parameter. More...
 
reward_t GetRewardType () const
 Returns the reward type. More...
 
reward_t GetRewardTypeForAgent (Index agentI) const
 Returns the reward type. More...
 
void SetDiscount (double d)
 Sets the discount parameter to d. More...
 
void SetDiscountForAgent (Index agentI, double d)
 Functions needed for POSGInterface: More...
 
void SetRewardType (reward_t r)
 Sets the reward type to reward_t r. More...
 
void SetRewardTypeForAgent (Index agentI, reward_t r)
 Sets the reward type to reward_t r. More...
 
std::string SoftPrint () const
 SoftPrints some information on the DecPOMDP. More...
 

Protected Attributes

std::vector< DecPOMDPDiscrete * > _m_individualDecPOMDPDs
 A vector storing pointers to the individual DecPOMDPs. More...
 
RewardModelTOISparse_m_p_rModel
 
- 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...
 

Private Attributes

bool _m_initialized
 Boolean that tracks whether this TOIDecPOMDPDiscrete is initialized. More...
 

Additional Inherited Members

- Protected Member Functions inherited from TransitionObservationIndependentMADPDiscrete
void CreateCentralizedFullModels ()
 
void CreateCentralizedObservationTransitionModel ()
 
void CreateCentralizedSparseModels ()
 
bool GetSparse () const
 

Detailed Description

TOIDecPOMDPDiscrete is a class that represents a transition observation independent discrete DecPOMDP.

Constructor & Destructor Documentation

TOIDecPOMDPDiscrete::TOIDecPOMDPDiscrete ( const std::string &  name = "received unspec. by TOIDecPOMDPDiscrete",
const std::string &  descr = "received unspec. by TOIDecPOMDPDiscrete",
const std::string &  pf = "received unspec. by TOIDecPOMDPDiscrete",
bool  cacheFlatModels = false 
)

(default) Constructor

Default constructor. Constructor that sets the name, description, and problem file. The problem file for a TransitionObservationIndependentMADPDiscrete is only the base name, e.g. test.toi-dpomdp. The files parsed in such a case are: test.toi-dpomdp.base test.toi-dpomdp.agent0 ... test.toi-dpomdp.agentN [where N-1 is the number of agents] test.toi-dpomdp.rewards

The .base file specifies the number of agents, discount and reward_t The .agenti files specifies the local model for agent i. The .rewards files specifies the rewards.

References _m_initialized, and _m_p_rModel.

Referenced by Clone().

TOIDecPOMDPDiscrete::TOIDecPOMDPDiscrete ( const TOIDecPOMDPDiscrete a)

Copy constructor.

TOIDecPOMDPDiscrete::~TOIDecPOMDPDiscrete ( )
virtual

Destructor.

References _m_p_rModel.

Member Function Documentation

virtual TOIDecPOMDPDiscrete* TOIDecPOMDPDiscrete::Clone ( ) const
inlinevirtual

Returns a pointer to a copy of this class.

Implements DecPOMDPDiscreteInterface.

Reimplemented in TOICompactRewardDecPOMDPDiscrete, and TOIFactoredRewardDecPOMDPDiscrete.

References TOIDecPOMDPDiscrete().

void TOIDecPOMDPDiscrete::CreateNewRewardModelForAgent ( Index  agentI)
inline

implementation of POSGDiscreteInterface

References CreateNewRewardModel().

DecPOMDPDiscrete* TOIDecPOMDPDiscrete::GetIndividualDecPOMDPD ( Index  agentI) const
inline
virtual double TOIDecPOMDPDiscrete::GetReward ( Index  sI,
Index  jaI 
) const
inlinevirtual
virtual double TOIDecPOMDPDiscrete::GetReward ( const std::vector< Index > &  sIs,
const std::vector< Index > &  aIs 
) const
inlinevirtual
double TOIDecPOMDPDiscrete::GetReward ( State s,
JointAction ja 
) const
inlinevirtual

implements the DecPOMDPInterface

Implements DecPOMDPInterface.

References GetReward().

double TOIDecPOMDPDiscrete::GetRewardForAgent ( Index  agentI,
State s,
JointAction ja 
) const
inlinevirtual

Function that returns the reward for a state and joint action.

This should be very generic.

Implements POSGInterface.

References GetReward().

double TOIDecPOMDPDiscrete::GetRewardForAgent ( Index  agentI,
Index  sI,
Index  jaI 
) const
inline

Return the reward for state, joint action indices.

References GetReward().

std::vector<double> TOIDecPOMDPDiscrete::GetRewards ( Index  sI,
Index  jaI 
) const
RGet* TOIDecPOMDPDiscrete::GetRGet ( ) const
inlinevirtual
TOIDecPOMDPDiscrete & TOIDecPOMDPDiscrete::operator= ( const TOIDecPOMDPDiscrete o)

Copy assignment operator.

void TOIDecPOMDPDiscrete::Print ( ) const
inline

Prints some information on the DecPOMDPDiscrete.

References SoftPrint().

bool TOIDecPOMDPDiscrete::SetInitialized ( bool  b)
virtual

Sets _m_initialized to b.

When setting to true, a verification of member elements is performed. (i.e. a check whether all vectors have the correct size and non-zero entries)

Reimplemented from TransitionObservationIndependentMADPDiscrete.

Reimplemented in TOICompactRewardDecPOMDPDiscrete, TOIFactoredRewardDecPOMDPDiscrete, and TOIDecMDPDiscrete.

References _m_initialized, _m_p_rModel, and TransitionObservationIndependentMADPDiscrete::SetInitialized().

Referenced by ParserTOIDecPOMDPDiscrete::Parse(), TOIDecMDPDiscrete::SetInitialized(), TOIFactoredRewardDecPOMDPDiscrete::SetInitialized(), and TOICompactRewardDecPOMDPDiscrete::SetInitialized().

void TOIDecPOMDPDiscrete::SetReward ( Index  sI,
Index  jaI,
double  r 
)
inlinevirtual
void TOIDecPOMDPDiscrete::SetReward ( const std::vector< Index > &  sIs,
const std::vector< Index > &  aIs,
double  r 
)
inline
void TOIDecPOMDPDiscrete::SetReward ( Index  sI,
Index  jaI,
Index  sucSI,
double  r 
)
inlinevirtual

set the reward for state, joint action , suc.

state indices

Implements DecPOMDPDiscreteInterface.

void TOIDecPOMDPDiscrete::SetReward ( Index  sI,
Index  jaI,
Index  sucSI,
Index  joI,
double  r 
)
inlinevirtual

set the reward for state, joint action, suc.state, joint observation indices

Implements DecPOMDPDiscreteInterface.

void TOIDecPOMDPDiscrete::SetReward ( State s,
JointAction ja,
double  r 
)
inlinevirtual

implements the DecPOMDPInterface

Implements DecPOMDPInterface.

References SetReward().

void TOIDecPOMDPDiscrete::SetRewardForAgent ( Index  agentI,
State s,
JointAction ja,
double  r 
)
inlinevirtual

Function that sets the reward for an agent, state and joint action.

This should be very generic.

Implements POSGInterface.

References SetReward().

void TOIDecPOMDPDiscrete::SetRewardForAgent ( Index  agentI,
Index  sI,
Index  jaI,
double  r 
)
inline

References SetReward().

void TOIDecPOMDPDiscrete::SetRewardForAgent ( Index  agentI,
Index  sI,
Index  jaI,
Index  sucSI,
double  r 
)
inline

Set the reward for state, joint action , suc. state indices.

References SetReward().

void TOIDecPOMDPDiscrete::SetRewardForAgent ( Index  agentI,
Index  sI,
Index  jaI,
Index  sucSI,
Index  joI,
double  r 
)
inline

Set the reward for state, joint action, suc.state, joint obs indices.

References SetReward().

Member Data Documentation

std::vector<DecPOMDPDiscrete*> TOIDecPOMDPDiscrete::_m_individualDecPOMDPDs
protected

A vector storing pointers to the individual DecPOMDPs.

Referenced by SetIndividualDecPOMDPD().

bool TOIDecPOMDPDiscrete::_m_initialized
private

Boolean that tracks whether this TOIDecPOMDPDiscrete is initialized.

Referenced by CreateNewRewardModel(), SetInitialized(), SoftPrint(), and TOIDecPOMDPDiscrete().