MultiAgentDecisionProcess
|
TOICompactRewardDecPOMDPDiscrete is a class that represents a transition observation independent Dec-POMDP, in which the reward is the sum of each agent's individual reward plus some shared reward. More...
#include <TOICompactRewardDecPOMDPDiscrete.h>
Public Member Functions | |
virtual TOICompactRewardDecPOMDPDiscrete * | Clone () const |
Returns a pointer to a copy of this class. More... | |
double | GetIndividualReward (Index indSI, Index indAI, Index agentID) const |
double | GetReward (Index sI, Index jaI) const |
return the reward for state, joint action indices More... | |
double | GetReward (const std::vector< Index > &sIs, const std::vector< Index > &aIs) const |
TOICompactRewardDecPOMDPDiscrete & | operator= (const TOICompactRewardDecPOMDPDiscrete &o) |
void | SetIndividualRewardModel (RewardModel *rewardModel, Index agentID) |
virtual bool | SetInitialized (bool b) |
Sets _m_initialized to b. More... | |
std::string | SoftPrint () const |
SoftPrints some information on the DecPOMDPDiscrete. More... | |
TOICompactRewardDecPOMDPDiscrete (const std::string &name="received unspec. by TOICompactRewardDecPOMDPDiscrete", const std::string &descr="received unspec. by TOICompactRewardDecPOMDPDiscrete", const std::string &pf="received unspec. by TOICompactRewardDecPOMDPDiscrete", bool cacheFlatModels=false) | |
(default) Constructor More... | |
TOICompactRewardDecPOMDPDiscrete (const TOICompactRewardDecPOMDPDiscrete &o) | |
virtual | ~TOICompactRewardDecPOMDPDiscrete () |
Public Member Functions inherited from TOIDecPOMDPDiscrete | |
void | CreateNewRewardModel () |
Creates a new reward model. More... | |
void | CreateNewRewardModelForAgent (Index agentI) |
implementation of POSGDiscreteInterface More... | |
DecPOMDPDiscrete * | GetIndividualDecPOMDPD (Index agentI) 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 |
RGet * | GetRGet () const |
TOIDecPOMDPDiscrete & | operator= (const TOIDecPOMDPDiscrete &o) |
Copy assignment operator. More... | |
void | Print () const |
Prints some information on the DecPOMDPDiscrete. More... | |
void | SetIndividualDecPOMDPD (DecPOMDPDiscrete *model, Index agentI) |
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... | |
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< Index > | JointToIndividualObservationIndices (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 Action * | GetAction (Index agentI, Index a) const |
Get a pointer to action a of agentI. More... | |
MultiAgentDecisionProcessDiscrete * | GetIndividualMADPD (Index agentI) const |
Returns a pointer to agentsI's individual model. More... | |
double | GetInitialStateProbability (Index sI) const |
returns the prob. More... | |
virtual StateDistributionVector * | GetISD () const |
returns the initial state distribution. More... | |
const JointAction * | GetJointAction (Index i) const |
Returns a pointer to joint action i. More... | |
const JointActionDiscrete * | GetJointActionDiscrete (Index i) const |
return a ref to the i-th joint action (a JointActionDiscrete). More... | |
const JointObservation * | GetJointObservation (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 Observation * | GetObservation (Index agentI, Index o) const |
Get a pointer to observation o of agentI. More... | |
ObservationModelDiscrete * | GetObservationModelDiscretePtr () 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 |
OGet * | GetOGet () const |
const State * | GetState (Index i) const |
Returns a pointer to state i. More... | |
const State * | GetState (const std::vector< Index > &sIs) const |
TGet * | GetTGet () const |
TransitionModelDiscrete * | GetTransitionModelDiscretePtr () 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< Index > | JointToIndividualActionIndices (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< Index > | SampleInitialStates () const |
Index | SampleJointObservation (Index jaI, Index sucI) const |
Returns a joint observation, sampled according to the observation probabilities. More... | |
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. More... | |
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. 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 Scope & | GetAllAgentScope () 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< RewardModel * > | _m_p_rModels |
Protected Attributes inherited from TOIDecPOMDPDiscrete | |
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 Member Functions | |
double | GetTwoAgentReward (Index i, Index j, const std::vector< Index > &indSIs, const std::vector< Index > &indAIs) const |
Private Attributes | |
bool | _m_initialized |
Boolean that tracks whether this TOICompactRewardDecPOMDPDiscrete is initialized. More... | |
std::vector< size_t > | _m_nrTwoAgentActions |
std::vector< size_t > | _m_nrTwoAgentStates |
Additional Inherited Members | |
Protected Member Functions inherited from TransitionObservationIndependentMADPDiscrete | |
void | CreateCentralizedFullModels () |
void | CreateCentralizedObservationTransitionModel () |
void | CreateCentralizedSparseModels () |
bool | GetSparse () const |
TOICompactRewardDecPOMDPDiscrete is a class that represents a transition observation independent Dec-POMDP, in which the reward is the sum of each agent's individual reward plus some shared reward.
The shared reward is defined for two agents only, and replicated for all combinations.
TOICompactRewardDecPOMDPDiscrete::TOICompactRewardDecPOMDPDiscrete | ( | const std::string & | name = "received unspec. by TOICompactRewardDecPOMDPDiscrete" , |
const std::string & | descr = "received unspec. by TOICompactRewardDecPOMDPDiscrete" , |
||
const std::string & | pf = "received unspec. by TOICompactRewardDecPOMDPDiscrete" , |
||
bool | cacheFlatModels = false |
||
) |
TOICompactRewardDecPOMDPDiscrete::TOICompactRewardDecPOMDPDiscrete | ( | const TOICompactRewardDecPOMDPDiscrete & | o | ) |
|
virtual |
References _m_p_rModels.
|
inlinevirtual |
Returns a pointer to a copy of this class.
Reimplemented from TOIDecPOMDPDiscrete.
References TOICompactRewardDecPOMDPDiscrete().
double TOICompactRewardDecPOMDPDiscrete::GetIndividualReward | ( | Index | indSI, |
Index | indAI, | ||
Index | agentID | ||
) | const |
References _m_p_rModels.
Referenced by GetReward().
return the reward for state, joint action indices
Reimplemented from TOIDecPOMDPDiscrete.
References TransitionObservationIndependentMADPDiscrete::JointToIndividualActionIndices(), and TransitionObservationIndependentMADPDiscrete::JointToIndividualStateIndices().
|
virtual |
Reimplemented from TOIDecPOMDPDiscrete.
References TOIDecPOMDPDiscrete::_m_p_rModel, RewardModelTOISparse::Get(), TransitionObservationIndependentMADPDiscrete::GetIndividualMADPD(), GetIndividualReward(), MultiAgentDecisionProcess::GetNrAgents(), MultiAgentDecisionProcessDiscrete::GetState(), GetTwoAgentReward(), IndexTools::Increment(), and NamedDescribedEntity::SoftPrint().
TOICompactRewardDecPOMDPDiscrete & TOICompactRewardDecPOMDPDiscrete::operator= | ( | const TOICompactRewardDecPOMDPDiscrete & | o | ) |
void TOICompactRewardDecPOMDPDiscrete::SetIndividualRewardModel | ( | RewardModel * | rewardModel, |
Index | agentID | ||
) |
References _m_p_rModels.
Referenced by ParserTOICompactRewardDecPOMDPDiscrete::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 TOIDecPOMDPDiscrete.
References _m_initialized, _m_nrTwoAgentActions, _m_nrTwoAgentStates, _m_p_rModels, TOIDecPOMDPDiscrete::GetIndividualDecPOMDPD(), TransitionObservationIndependentMADPDiscrete::GetIndividualMADPD(), MultiAgentDecisionProcess::GetNrAgents(), MultiAgentDecisionProcessDiscrete::GetNrJointActions(), MultiAgentDecisionProcessDiscrete::GetNrStates(), and TOIDecPOMDPDiscrete::SetInitialized().
|
virtual |
SoftPrints some information on the DecPOMDPDiscrete.
Reimplemented from TOIDecPOMDPDiscrete.
References _m_initialized, _m_p_rModels, MultiAgentDecisionProcess::GetNrAgents(), and TOIDecPOMDPDiscrete::SoftPrint().
|
private |
Boolean that tracks whether this TOICompactRewardDecPOMDPDiscrete is initialized.
Referenced by SetInitialized(), SoftPrint(), and TOICompactRewardDecPOMDPDiscrete().
|
private |
Referenced by GetTwoAgentReward(), and SetInitialized().
|
private |
Referenced by GetTwoAgentReward(), and SetInitialized().
|
protected |