MultiAgentDecisionProcess
Release 0.2.1
|
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. | |
double | GetIndividualReward (Index indSI, Index indAI, Index agentID) const |
double | GetReward (Index sI, Index jaI) const |
return the reward for state, joint action indices | |
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. | |
std::string | SoftPrint () const |
SoftPrints some information on the DecPOMDPDiscrete. | |
TOICompactRewardDecPOMDPDiscrete (std::string name="received unspec. by TOICompactRewardDecPOMDPDiscrete", std::string descr="received unspec. by TOICompactRewardDecPOMDPDiscrete", std::string pf="received unspec. by TOICompactRewardDecPOMDPDiscrete") | |
(default) Constructor | |
TOICompactRewardDecPOMDPDiscrete (const TOICompactRewardDecPOMDPDiscrete &o) | |
virtual | ~TOICompactRewardDecPOMDPDiscrete () |
![]() | |
void | CreateNewRewardModel () |
Creates a new reward model. | |
void | CreateNewRewardModelForAgent (Index agentI) |
implementation of POSGDiscreteInterface | |
DecPOMDPDiscrete * | GetIndividualDecPOMDPD (Index agentI) 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) |
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. | |
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< RewardModel * > | _m_p_rModels |
![]() | |
std::vector< DecPOMDPDiscrete * > | _m_individualDecPOMDPDs |
A vector storing pointers to the individual DecPOMDPs. | |
RewardModelTOISparse * | _m_p_rModel |
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 DecPOMDP is initialized. | |
std::vector< size_t > | _m_nrTwoAgentActions |
std::vector< size_t > | _m_nrTwoAgentStates |
Additional Inherited Members | |
![]() | |
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.
Definition at line 42 of file TOICompactRewardDecPOMDPDiscrete.h.
TOICompactRewardDecPOMDPDiscrete::TOICompactRewardDecPOMDPDiscrete | ( | std::string | name = "received unspec. by TOICompactRewardDecPOMDPDiscrete" , |
std::string | descr = "received unspec. by TOICompactRewardDecPOMDPDiscrete" , |
||
std::string | pf = "received unspec. by TOICompactRewardDecPOMDPDiscrete" |
||
) |
(default) Constructor
Definition at line 35 of file TOICompactRewardDecPOMDPDiscrete.cpp.
References _m_initialized.
Referenced by Clone().
TOICompactRewardDecPOMDPDiscrete::TOICompactRewardDecPOMDPDiscrete | ( | const TOICompactRewardDecPOMDPDiscrete & | o | ) |
Definition at line 45 of file TOICompactRewardDecPOMDPDiscrete.cpp.
|
virtual |
Definition at line 50 of file TOICompactRewardDecPOMDPDiscrete.cpp.
References _m_p_rModels.
|
inlinevirtual |
Returns a pointer to a copy of this class.
Reimplemented from TOIDecPOMDPDiscrete.
Definition at line 90 of file TOICompactRewardDecPOMDPDiscrete.h.
References TOICompactRewardDecPOMDPDiscrete().
double TOICompactRewardDecPOMDPDiscrete::GetIndividualReward | ( | Index | indSI, |
Index | indAI, | ||
Index | agentID | ||
) | const |
Definition at line 214 of file TOICompactRewardDecPOMDPDiscrete.cpp.
References _m_p_rModels.
Referenced by GetReward().
|
virtual |
return the reward for state, joint action indices
Reimplemented from TOIDecPOMDPDiscrete.
Definition at line 107 of file TOICompactRewardDecPOMDPDiscrete.cpp.
References TransitionObservationIndependentMADPDiscrete::JointToIndividualActionIndices(), and TransitionObservationIndependentMADPDiscrete::JointToIndividualStateIndices().
|
virtual |
Reimplemented from TOIDecPOMDPDiscrete.
Definition at line 113 of file TOICompactRewardDecPOMDPDiscrete.cpp.
References TOIDecPOMDPDiscrete::_m_p_rModel, RewardModelTOISparse::Get(), TransitionObservationIndependentMADPDiscrete::GetIndividualMADPD(), GetIndividualReward(), MultiAgentDecisionProcess::GetNrAgents(), MultiAgentDecisionProcessDiscreteInterface::GetState(), GetTwoAgentReward(), IndexTools::Increment(), and NamedDescribedEntity::SoftPrint().
|
private |
Definition at line 175 of file TOICompactRewardDecPOMDPDiscrete.cpp.
References _m_nrTwoAgentActions, _m_nrTwoAgentStates, TOIDecPOMDPDiscrete::_m_p_rModel, RewardModelTOISparse::Get(), IndexTools::IndividualToJointIndices(), and PrintTools::SoftPrintVector().
Referenced by GetReward().
TOICompactRewardDecPOMDPDiscrete & TOICompactRewardDecPOMDPDiscrete::operator= | ( | const TOICompactRewardDecPOMDPDiscrete & | o | ) |
Definition at line 59 of file TOICompactRewardDecPOMDPDiscrete.cpp.
void TOICompactRewardDecPOMDPDiscrete::SetIndividualRewardModel | ( | RewardModel * | rewardModel, |
Index | agentID | ||
) |
Definition at line 204 of file TOICompactRewardDecPOMDPDiscrete.cpp.
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.
Definition at line 69 of file TOICompactRewardDecPOMDPDiscrete.cpp.
References _m_initialized, _m_nrTwoAgentActions, _m_nrTwoAgentStates, _m_p_rModels, TOIDecPOMDPDiscrete::GetIndividualDecPOMDPD(), TransitionObservationIndependentMADPDiscrete::GetIndividualMADPD(), MultiAgentDecisionProcess::GetNrAgents(), MultiAgentDecisionProcessDiscreteInterface::GetNrJointActions(), MultiAgentDecisionProcessDiscreteInterface::GetNrStates(), and TOIDecPOMDPDiscrete::SetInitialized().
|
virtual |
SoftPrints some information on the DecPOMDPDiscrete.
Reimplemented from TOIDecPOMDPDiscrete.
Definition at line 224 of file TOICompactRewardDecPOMDPDiscrete.cpp.
References _m_initialized, _m_p_rModels, and MultiAgentDecisionProcess::GetNrAgents().
|
private |
Boolean that tracks whether this DecPOMDP is initialized.
Definition at line 47 of file TOICompactRewardDecPOMDPDiscrete.h.
Referenced by SetInitialized(), SoftPrint(), and TOICompactRewardDecPOMDPDiscrete().
|
private |
Definition at line 49 of file TOICompactRewardDecPOMDPDiscrete.h.
Referenced by GetTwoAgentReward(), and SetInitialized().
|
private |
Definition at line 49 of file TOICompactRewardDecPOMDPDiscrete.h.
Referenced by GetTwoAgentReward(), and SetInitialized().
|
protected |
Definition at line 56 of file TOICompactRewardDecPOMDPDiscrete.h.
Referenced by GetIndividualReward(), SetIndividualRewardModel(), SetInitialized(), SoftPrint(), and ~TOICompactRewardDecPOMDPDiscrete().