MultiAgentDecisionProcess
Release 0.2.1
|
TOIDecPOMDPDiscrete is a class that represents a transition observation independent discrete DecPOMDP. More...
#include <TOIDecPOMDPDiscrete.h>
Public Member Functions | |
virtual TOIDecPOMDPDiscrete * | Clone () const |
Returns a pointer to a copy of this class. | |
void | CreateNewRewardModel () |
Creates a new reward model. | |
void | CreateNewRewardModelForAgent (Index agentI) |
implementation of POSGDiscreteInterface | |
DecPOMDPDiscrete * | GetIndividualDecPOMDPD (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 |
RGet * | GetRGet () const |
TOIDecPOMDPDiscrete & | operator= (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. | |
![]() | |
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 Action * | GetAction (Index agentI, Index a) const |
Get a pointer to action a of agentI. | |
MultiAgentDecisionProcessDiscrete * | GetIndividualMADPD (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 JointAction * | GetJointAction (Index i) const |
Returns a pointer to joint action i. | |
const JointActionDiscrete * | GetJointActionDiscrete (Index i) const |
return a ref to the i-th joint action (a JointActionDiscrete). | |
const JointObservation * | GetJointObservation (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 Observation * | GetObservation (Index agentI, Index o) const |
Get a pointer to observation o of agentI. | |
ObservationModelDiscrete * | GetObservationModelDiscretePtr () 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 |
OGet * | GetOGet () const |
const State * | GetState (Index i) const |
Returns a pointer to state i. | |
const State * | GetState (const std::vector< Index > &sIs) const |
TGet * | GetTGet () const |
TransitionModelDiscrete * | GetTransitionModelDiscretePtr () 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. | |
![]() | |
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. | |
![]() | |
virtual | ~MultiAgentDecisionProcessInterface () |
Destructor. | |
![]() | |
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. | |
![]() | |
virtual | ~MultiAgentDecisionProcessDiscreteInterface () |
Destructor. Can't make a virt.destr. pure abstract! | |
![]() | |
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. | |
![]() | |
virtual | ~DecPOMDPInterface () |
Virtual destructor. | |
![]() | |
virtual | ~POSGInterface () |
Virtual destructor. | |
![]() | |
virtual | ~DecPOMDPDiscreteInterface () |
import the GetReward function from the base class in current scope. | |
![]() | |
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 | |
![]() | |
bool | GetSparse () const |
TOIDecPOMDPDiscrete is a class that represents a transition observation independent discrete DecPOMDP.
Definition at line 43 of file TOIDecPOMDPDiscrete.h.
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.
|
virtual |
|
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().
|
virtual |
Creates a new reward model.
Implements DecPOMDPDiscreteInterface.
Definition at line 96 of file TOIDecPOMDPDiscrete.cpp.
References _m_initialized, _m_p_rModel, TransitionObservationIndependentMADPDiscrete::GetIndividualMADPD(), MultiAgentDecisionProcess::GetNrAgents(), MultiAgentDecisionProcessDiscreteInterface::GetNrJointActions(), MultiAgentDecisionProcessDiscreteInterface::GetNrStates(), and TransitionObservationIndependentMADPDiscrete::GetSparse().
Referenced by CreateNewRewardModelForAgent(), and ParserTOIDecPOMDPDiscrete::ParseRewards().
|
inlinevirtual |
implementation of POSGDiscreteInterface
Implements POSGDiscreteInterface.
Definition at line 187 of file TOIDecPOMDPDiscrete.h.
References CreateNewRewardModel().
|
inline |
Definition at line 134 of file TOIDecPOMDPDiscrete.h.
References _m_individualDecPOMDPDs.
Referenced by TOICompactRewardDecPOMDPDiscrete::SetInitialized().
|
inlinevirtual |
return the reward for state, joint action indices
Implements DecPOMDPDiscreteInterface.
Reimplemented in TOICompactRewardDecPOMDPDiscrete, and TOIFactoredRewardDecPOMDPDiscrete.
Definition at line 139 of file TOIDecPOMDPDiscrete.h.
References GetReward(), TransitionObservationIndependentMADPDiscrete::JointToIndividualActionIndices(), and TransitionObservationIndependentMADPDiscrete::JointToIndividualStateIndices().
Referenced by GetReward(), and GetRewardForAgent().
|
inlinevirtual |
Reimplemented in TOICompactRewardDecPOMDPDiscrete, and TOIFactoredRewardDecPOMDPDiscrete.
Definition at line 143 of file TOIDecPOMDPDiscrete.h.
References _m_p_rModel, and RewardModelTOISparse::Get().
|
inlinevirtual |
implements the DecPOMDPInterface
Implements DecPOMDPInterface.
Definition at line 159 of file TOIDecPOMDPDiscrete.h.
References GetReward().
|
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().
|
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 |
|
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.
|
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 | ||
) |
Definition at line 63 of file TOIDecPOMDPDiscrete.cpp.
References _m_individualDecPOMDPDs.
Referenced by ParserTOICompactRewardDecPOMDPDiscrete::StoreDecPOMDP(), ParserTOIFactoredRewardDecPOMDPDiscrete::StoreDecPOMDP(), and ParserTOIDecPOMDPDiscrete::StoreDecPOMDP().
|
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().
|
inlinevirtual |
Set the reward for state, joint action indices.
Implements DecPOMDPDiscreteInterface.
Definition at line 110 of file TOIDecPOMDPDiscrete.h.
References _m_p_rModel, TransitionObservationIndependentMADPDiscrete::JointToIndividualActionIndices(), TransitionObservationIndependentMADPDiscrete::JointToIndividualStateIndices(), and RewardModelTOISparse::Set().
Referenced by SetReward(), and SetRewardForAgent().
|
inline |
Definition at line 116 of file TOIDecPOMDPDiscrete.h.
References _m_p_rModel, and RewardModelTOISparse::Set().
|
inlinevirtual |
set the reward for state, joint action , suc.
state indices
Implements DecPOMDPDiscreteInterface.
Definition at line 122 of file TOIDecPOMDPDiscrete.h.
|
inlinevirtual |
set the reward for state, joint action, suc.state, joint observation indices
Implements DecPOMDPDiscreteInterface.
Definition at line 126 of file TOIDecPOMDPDiscrete.h.
|
inlinevirtual |
implements the DecPOMDPInterface
Implements DecPOMDPInterface.
Definition at line 166 of file TOIDecPOMDPDiscrete.h.
References SetReward().
|
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().
|
inlinevirtual |
Set the reward for state, joint action indices.
Implements POSGDiscreteInterface.
Definition at line 190 of file TOIDecPOMDPDiscrete.h.
References SetReward().
|
inlinevirtual |
Set the reward for state, joint action , suc. state indices.
Implements POSGDiscreteInterface.
Definition at line 194 of file TOIDecPOMDPDiscrete.h.
References SetReward().
|
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().
|
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().
|
protected |
A vector storing pointers to the individual DecPOMDPs.
Definition at line 63 of file TOIDecPOMDPDiscrete.h.
Referenced by GetIndividualDecPOMDPD(), and SetIndividualDecPOMDPD().
|
private |
Boolean that tracks whether this TOIDecPOMDPDiscrete is initialized.
Definition at line 52 of file TOIDecPOMDPDiscrete.h.
Referenced by CreateNewRewardModel(), SetInitialized(), SoftPrint(), and TOIDecPOMDPDiscrete().
|
protected |
Definition at line 60 of file TOIDecPOMDPDiscrete.h.
Referenced by CreateNewRewardModel(), TOIFactoredRewardDecPOMDPDiscrete::GetReward(), TOICompactRewardDecPOMDPDiscrete::GetReward(), GetReward(), TOICompactRewardDecPOMDPDiscrete::GetTwoAgentReward(), SetInitialized(), SetReward(), SoftPrint(), TOIDecPOMDPDiscrete(), and ~TOIDecPOMDPDiscrete().