MultiAgentDecisionProcess  Release 0.2.1
TOIDecPOMDPDiscrete Class Reference

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

#include <TOIDecPOMDPDiscrete.h>

+ Inheritance diagram for TOIDecPOMDPDiscrete:
+ Collaboration diagram for TOIDecPOMDPDiscrete:

Public Member Functions

virtual TOIDecPOMDPDiscreteClone () const
 Returns a pointer to a copy of this class.
void CreateNewRewardModel ()
 Creates a new reward model.
void CreateNewRewardModelForAgent (Index agentI)
 implementation of POSGDiscreteInterface
DecPOMDPDiscreteGetIndividualDecPOMDPD (Index agentI) const
virtual double GetReward (Index sI, Index jaI) const
 return the reward for state, joint action indices
virtual double GetReward (const std::vector< Index > &sIs, const std::vector< Index > &aIs) const
double GetReward (State *s, JointAction *ja) const
 implements the DecPOMDPInterface
double GetRewardForAgent (Index agentI, State *s, JointAction *ja) const
 Function that returns the reward for a state and joint action.
double GetRewardForAgent (Index agentI, Index sI, Index jaI) const
 Return the reward for state, joint action indices.
std::vector< double > GetRewards (Index sI, Index jaI) const
RGetGetRGet () const
TOIDecPOMDPDiscreteoperator= (const TOIDecPOMDPDiscrete &o)
 Copy assignment operator.
void Print () const
 Prints some information on the DecPOMDPDiscrete.
void SetIndividualDecPOMDPD (DecPOMDPDiscrete *model, Index agentI)
virtual bool SetInitialized (bool b)
 Sets _m_initialized to b.
void SetReward (Index sI, Index jaI, double r)
 Set the reward for state, joint action indices.
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.
void SetReward (Index sI, Index jaI, Index sucSI, Index joI, double r)
 set the reward for state, joint action, suc.state, joint observation indices
void SetReward (State *s, JointAction *ja, double r)
 implements the DecPOMDPInterface
void SetRewardForAgent (Index agentI, State *s, JointAction *ja, double r)
 Function that sets the reward for an agent, state and joint action.
void SetRewardForAgent (Index agentI, Index sI, Index jaI, double r)
 Set the reward for state, joint action indices.
void SetRewardForAgent (Index agentI, Index sI, Index jaI, Index sucSI, double r)
 Set the reward for state, joint action , suc. state indices.
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.
virtual std::string SoftPrint () const
 SoftPrints some information on the DecPOMDPDiscrete.
 TOIDecPOMDPDiscrete (std::string name="received unspec. by TOIDecPOMDPDiscrete", std::string descr="received unspec. by TOIDecPOMDPDiscrete", std::string pf="received unspec. by TOIDecPOMDPDiscrete")
 (default) Constructor
 TOIDecPOMDPDiscrete (const TOIDecPOMDPDiscrete &a)
 Copy constructor.
virtual ~TOIDecPOMDPDiscrete ()
 Destructor.
- Public Member Functions inherited from TransitionObservationIndependentMADPDiscrete
void AddAction (Index agentI, std::string name)
 Adds an action with a particular name for the specified agent.
void AddAgent (std::string name="unspec.")
 Adds one agent with an optional name.
void AddObservation (Index agentI, std::string name)
 Adds an Observation with a particular name for the specified agent.
void AddState (Index agentI, std::string name)
 Adds a state with a particular name for the specified agent.
void CreateCentralizedFullModels ()
void CreateCentralizedSparseModels ()
const ActionGetAction (Index agentI, Index a) const
 Get a pointer to action a of agentI.
MultiAgentDecisionProcessDiscreteGetIndividualMADPD (Index agentI) const
 Returns a pointer to agentsI's individual model.
double GetInitialStateProbability (Index sI) const
 returns the prob.
virtual const
StateDistributionVector
GetISD () const
 returns the initial state distribution.
const JointActionGetJointAction (Index i) const
 Returns a pointer to joint action i.
const JointActionDiscreteGetJointActionDiscrete (Index i) const
 return a ref to the i-th joint action (a JointActionDiscrete).
const JointObservationGetJointObservation (Index i) const
 Get a pointer to the i-th joint observation.
size_t GetNrActions (Index agentI) const
 return the number of actions of agent agentI
const std::vector< size_t > & GetNrActions () const
 returns a vector with the number of actions for each agent.
size_t GetNrJointActions () const
 return the number of joint actions.
size_t GetNrJointObservations () const
 Get the number of joint observations.
size_t GetNrJointStates () const
size_t GetNrObservations (Index agentI) const
 return the number of observations of agent agentI
const std::vector< size_t > & GetNrObservations () const
 Returns a vector with the number of observations for each agent.
size_t GetNrStates (Index agI) const
 Returns the number of local states for agent i.
size_t GetNrStates () const
 returns the number of (joint) states.
const ObservationGetObservation (Index agentI, Index o) const
 Get a pointer to observation o of agentI.
ObservationModelDiscreteGetObservationModelDiscretePtr () const
 Returns a pointer to the underlying observation model.
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).
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.
const StateGetState (const std::vector< Index > &sIs) const
TGetGetTGet () const
TransitionModelDiscreteGetTransitionModelDiscretePtr () const
 Returns a pointer to the underlying transition model.
double GetTransitionProbability (Index sI, Index jaI, Index sucSI) const
 returns probability of joint transition (the product of the probabilities of the individual transitions)
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.
Index IndividualToJointActionIndices (const Index *AI_ar) const
 Returns the joint action index that corresponds to the array of specified individual action indices.
Index IndividualToJointActionIndices (Index *IndexArray) const
 converts individual to joint actions.
Index IndividualToJointObservationIndices (const std::vector< Index > &indivObsIndices) const
 returns the joint index for indivObsIndices
Index IndividualToJointStateIndices (const std::vector< Index > &indivStateIndices) const
 returns the joint index for indivStateIndices
bool Initialize ()
const std::vector< Index > & JointToIndividualActionIndices (Index jaI) const
 Returns the joint action index that corresponds to the array of specified individual action indices.
const std::vector< Index > & JointToIndividualObservationIndices (Index joI) const
 returns the individual indices for joint observation joI.
const std::vector< Index > & JointToIndividualStateIndices (Index jointSI) const
 returns a vector of individual (local) state indices corresponding to joint state index jointSI.
void PrintActionSets () const
 Prints the action set for each agent.
void PrintJointActionSet () const
 Prints the set of joint actions.
Index SampleInitialState (void) const
 Samples an initial state.
std::vector< Index > SampleInitialStates (void) const
Index SampleJointObservation (Index jaI, Index sucI) const
 Returns a joint observation, sampled according to the observation probabilities.
std::vector< Index > SampleJointObservation (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.
std::vector< Index > SampleSuccessorState (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.
void SetNrActions (Index agentI, size_t nr)
 Sets the number of actions for the specified agent.
void SetNrAgents (size_t n)
 Sets the number of agents to n.
void SetNrObservations (Index agentI, size_t nr)
 Sets the number of Observations for the specified agent.
void SetNrStates (Index agentI, size_t nr)
 Sets the number of states for the specified agent.
void SetSparse (bool sparse)
std::string SoftPrintActionSets () const
 SoftPrints the action set for each agent.
std::string SoftPrintJointActionSet () const
 SoftPrints the set of joint actions.
std::string SoftPrintState (Index sI) const
 TransitionObservationIndependentMADPDiscrete (std::string name="received unspec. by TransitionObservationIndependentMADPDiscrete", std::string descr="received unspec.by TransitionObservationIndependentMADPDiscrete", std::string pf="received unspec. by TransitionObservationIndependentMADPDiscrete")
 TransitionObservationIndependentMADPDiscrete (const TransitionObservationIndependentMADPDiscrete &)
virtual ~TransitionObservationIndependentMADPDiscrete ()
 Destructor.
- Public Member Functions inherited from MultiAgentDecisionProcess
size_t GetNrAgents () const
 Returns the number of agents in this MultiAgentDecisionProcess.
std::string GetProblemFile () const
 Returns the name of the problem file.
std::string GetUnixName () const
 Returns a name which can be in unix path, by default the base part of the problem filename.
 MultiAgentDecisionProcess (size_t nrAgents, std::string name="received unspec. by MultiAgentDecisionProcess", std::string description="received unspec. by MultiAgentDecisionProcess", std::string pf="received unspec. by MultiAgentDecisionProcess")
 Constructor.
 MultiAgentDecisionProcess (std::string name="received unspec. by MultiAgentDecisionProcess", std::string description="received unspec. by MultiAgentDecisionProcess", std::string pf="received unspec. by MultiAgentDecisionProcess")
 Default Constructor without specifying the number of agents.
void SetUnixName (std::string unixName)
 Sets the name which can be used inin unix paths.
virtual ~MultiAgentDecisionProcess ()
 Destructor.
- Public Member Functions inherited from MultiAgentDecisionProcessInterface
virtual ~MultiAgentDecisionProcessInterface ()
 Destructor.
- Public Member Functions inherited from NamedDescribedEntity
std::string GetDescription () const
 Get the description of the NamedDescribedEntity.
std::string GetName () const
 Get the name of the NamedDescribedEntity.
 NamedDescribedEntity (std::string name=std::string("undefined"), std::string description=std::string("undefined"))
 (default) Constructor
 NamedDescribedEntity (const NamedDescribedEntity &)
 copy constructor.
void PrintBrief () const
 Prints the name (by default).
void SetDescription (std::string description)
 Set the description.
void SetName (std::string name)
 Set the name.
virtual std::string SoftPrintBrief () const
 Returns the name (if not reimplemented).
virtual ~NamedDescribedEntity ()
 Destructor.
- Public Member Functions inherited from MultiAgentDecisionProcessDiscreteInterface
virtual ~MultiAgentDecisionProcessDiscreteInterface ()
 Destructor. Can't make a virt.destr. pure abstract!
- Public Member Functions inherited from DecPOMDP
 DecPOMDP ()
 Default constructor. sets RewardType to REWARD and discount to 1.0.
double GetDiscount () const
 Returns the discount parameter.
double GetDiscountForAgent (Index agentI) const
 Returns the discount parameter.
reward_t GetRewardType () const
 Returns the reward type.
reward_t GetRewardTypeForAgent (Index agentI) const
 Returns the reward type.
void SetDiscount (double d)
 Sets the discount parameter to d.
void SetDiscountForAgent (Index agentI, double d)
 Functions needed for POSGInterface:
void SetRewardType (reward_t r)
 Sets the reward type to reward_t r.
void SetRewardTypeForAgent (Index agentI, reward_t r)
 Sets the reward type to reward_t r.
- Public Member Functions inherited from DecPOMDPInterface
virtual ~DecPOMDPInterface ()
 Virtual destructor.
- Public Member Functions inherited from POSGInterface
virtual ~POSGInterface ()
 Virtual destructor.
- Public Member Functions inherited from DecPOMDPDiscreteInterface
virtual ~DecPOMDPDiscreteInterface ()
 import the GetReward function from the base class in current scope.
- Public Member Functions inherited from POSGDiscreteInterface
virtual ~POSGDiscreteInterface ()
 Destructor.Can't make a virt.destr. pure abstract!

Protected Attributes

std::vector< DecPOMDPDiscrete * > _m_individualDecPOMDPDs
 A vector storing pointers to the individual DecPOMDPs.
RewardModelTOISparse_m_p_rModel

Private Attributes

bool _m_initialized
 Boolean that tracks whether this TOIDecPOMDPDiscrete is initialized.

Additional Inherited Members

- Protected Member Functions inherited from TransitionObservationIndependentMADPDiscrete
bool GetSparse () const

Detailed Description

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

Definition at line 43 of file TOIDecPOMDPDiscrete.h.

Constructor & Destructor Documentation

TOIDecPOMDPDiscrete::TOIDecPOMDPDiscrete ( std::string  name = "received unspec. by TOIDecPOMDPDiscrete",
std::string  descr = "received unspec. by TOIDecPOMDPDiscrete",
std::string  pf = "received unspec. by TOIDecPOMDPDiscrete" 
)

(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.

Definition at line 35 of file TOIDecPOMDPDiscrete.cpp.

References _m_initialized, and _m_p_rModel.

Referenced by Clone().

TOIDecPOMDPDiscrete::TOIDecPOMDPDiscrete ( const TOIDecPOMDPDiscrete a)

Copy constructor.

Definition at line 43 of file TOIDecPOMDPDiscrete.cpp.

TOIDecPOMDPDiscrete::~TOIDecPOMDPDiscrete ( )
virtual

Destructor.

Definition at line 48 of file TOIDecPOMDPDiscrete.cpp.

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.

Definition at line 210 of file TOIDecPOMDPDiscrete.h.

References TOIDecPOMDPDiscrete().

void TOIDecPOMDPDiscrete::CreateNewRewardModelForAgent ( Index  agentI)
inlinevirtual

implementation of POSGDiscreteInterface

Implements POSGDiscreteInterface.

Definition at line 187 of file TOIDecPOMDPDiscrete.h.

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.

Definition at line 159 of file TOIDecPOMDPDiscrete.h.

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.

Definition at line 181 of file TOIDecPOMDPDiscrete.h.

References GetReward().

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

Return the reward for state, joint action indices.

Implements POSGDiscreteInterface.

Definition at line 204 of file TOIDecPOMDPDiscrete.h.

References GetReward().

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

Implements DecPOMDPDiscreteInterface.

Definition at line 207 of file TOIDecPOMDPDiscrete.h.

TOIDecPOMDPDiscrete & TOIDecPOMDPDiscrete::operator= ( const TOIDecPOMDPDiscrete o)

Copy assignment operator.

Definition at line 53 of file TOIDecPOMDPDiscrete.cpp.

void TOIDecPOMDPDiscrete::Print ( ) const
inline

Prints some information on the DecPOMDPDiscrete.

Reimplemented from TransitionObservationIndependentMADPDiscrete.

Definition at line 153 of file TOIDecPOMDPDiscrete.h.

References SoftPrint().

void TOIDecPOMDPDiscrete::SetIndividualDecPOMDPD ( DecPOMDPDiscrete model,
Index  agentI 
)
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.

Definition at line 72 of file TOIDecPOMDPDiscrete.cpp.

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

Definition at line 116 of file TOIDecPOMDPDiscrete.h.

References _m_p_rModel, and RewardModelTOISparse::Set().

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

set the reward for state, joint action , suc.

state indices

Implements DecPOMDPDiscreteInterface.

Definition at line 122 of file TOIDecPOMDPDiscrete.h.

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.

Definition at line 126 of file TOIDecPOMDPDiscrete.h.

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

implements the DecPOMDPInterface

Implements DecPOMDPInterface.

Definition at line 166 of file TOIDecPOMDPDiscrete.h.

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.

Definition at line 177 of file TOIDecPOMDPDiscrete.h.

References SetReward().

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

Set the reward for state, joint action indices.

Implements POSGDiscreteInterface.

Definition at line 190 of file TOIDecPOMDPDiscrete.h.

References SetReward().

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

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

Implements POSGDiscreteInterface.

Definition at line 194 of file TOIDecPOMDPDiscrete.h.

References SetReward().

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

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

Implements POSGDiscreteInterface.

Definition at line 199 of file TOIDecPOMDPDiscrete.h.

References SetReward().

string TOIDecPOMDPDiscrete::SoftPrint ( ) const
virtual

SoftPrints some information on the DecPOMDPDiscrete.

Reimplemented from DecPOMDP.

Reimplemented in TOICompactRewardDecPOMDPDiscrete, and TOIFactoredRewardDecPOMDPDiscrete.

Definition at line 121 of file TOIDecPOMDPDiscrete.cpp.

References _m_initialized, _m_p_rModel, and RewardModelTOISparse::SoftPrint().

Referenced by Print().

Member Data Documentation

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

A vector storing pointers to the individual DecPOMDPs.

Definition at line 63 of file TOIDecPOMDPDiscrete.h.

Referenced by GetIndividualDecPOMDPD(), and SetIndividualDecPOMDPD().

bool TOIDecPOMDPDiscrete::_m_initialized
private

Boolean that tracks whether this TOIDecPOMDPDiscrete is initialized.

Definition at line 52 of file TOIDecPOMDPDiscrete.h.

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


The documentation for this class was generated from the following files: