MultiAgentDecisionProcess
|
Problem_CGBG_FF reprents a generalized single-shot fire fighting problem. More...
#include <Problem_CGBG_FF.h>
Classes | |
struct | diPairComp |
Public Types | |
typedef Index | observation_t |
Public Member Functions | |
virtual void | ExportAsMAID (const std::string &suffix="", const std::string &prefix="/tmp/") const |
void | ExportToTextFiles (const std::string &suffix="", const std::string &prefix="/tmp/") const |
double | GetProbability (Index jtype) const |
Gets the probability of joint type i. More... | |
std::string | GetUnixName () const |
Problem_CGBG_FF (size_t nrHouses, size_t nrFLs, size_t nrAgents, size_t nrActionsPerAgent, size_t nrObservedHousesPerAgent, size_t k) | |
(default) Constructor More... | |
std::string | SoftPrintReadableType (Index agI, Index typeI) const |
Copy assignment operator. More... | |
~Problem_CGBG_FF () | |
Copy constructor. More... | |
Public Member Functions inherited from BayesianGameCollaborativeGraphical | |
void | AddLRF (const Scope &s) |
Add an LRF with scope s. More... | |
BayesianGameCollaborativeGraphical () | |
Constructor without arguments. More... | |
BayesianGameCollaborativeGraphical (size_t nrAgents, const std::vector< size_t > &nrActions, const std::vector< size_t > &nrTypes) | |
Constructor - the constructor is called in the same way as a (regular) BayesianGameIdenticalPayoff, with the number of agents and the number of actions, types per agent. More... | |
BayesianGameCollaborativeGraphical (const BayesianGameCollaborativeGraphical &a) | |
Copy constructor. More... | |
virtual double | ComputeValueJPol (const JointPolicyDiscretePure &jpolBG) const |
evaluates the value of a joint policy. More... | |
void | DistributeProbability (Index jtI, double p) |
Set and distributes probability: More... | |
virtual void | ExportAsMAID () const |
virtual const BayesianGameIdenticalPayoff * | GetBGIPforLRF (Index e) const |
virtual size_t | GetNrJointActionsForLRF (Index e) |
Return the number of joint actions for LRF e. More... | |
virtual size_t | GetNrJointTypesForLRF (Index e) |
Return the number of joint types for LRF e. More... | |
virtual size_t | GetNrLRFs () const |
Return the number of agents. More... | |
virtual double | GetProbability (Index e, const std::vector< Index > &indTypes) const |
virtual double | GetProbability (Index e, Index jtI_e) const |
std::vector< double > | GetRestrictedJointTypeProbabilities (Index jtI) const |
For each LRF e this function returns the probability of the jtI_agSC{e} consistent with jtI. More... | |
virtual Scope | GetScope (Index e) const |
Return the scope of LRF e. More... | |
virtual double | GetUtility (Index e, Index jtI_e, Index jaI_e) const |
virtual double | GetUtility (Index e, const std::vector< Index > &indTypes_e, const std::vector< Index > &actions_e) const |
virtual double | GetUtility (Index jtype, Index ja) const |
Gets the utility for (for all agents) jtype, ja. More... | |
double | GetUtility (const std::vector< Index > &indTypeIndices, const std::vector< Index > &indActionIndices) const |
Gets the utility for (for all agents) joint type corresponding to the individual type indices (indTypeIndices) and joint action corresponding to individual action indices (indActionIndices). More... | |
bool | IsFullyConnected () const |
virtual Index | JointToGroupActionIndex (Index e, Index jtI) const |
Returns the group type index jaGI corresponding to joint action index jaI for LRF e. More... | |
virtual Index | JointToGroupTypeIndex (Index e, Index jtI) const |
Returns the group type index jtGI corresponding to joint type index jtI for LRF e. More... | |
BayesianGameCollaborativeGraphical & | operator= (const BayesianGameCollaborativeGraphical &o) |
Copy assignment operator. More... | |
template<typename T > | |
std::vector< T > | RestrictIndividualIndicesToScope (const std::vector< T > &indivIndices, Index LRF) const |
Restrict the vector indivIndices to the agents in the scope of LRF e (and returns that result) More... | |
void | SanityCheckBGCG () const |
virtual void | SetProbability (Index jtI, double p) |
virtual void | SetProbability (Index e, const std::vector< Index > &indTypes, double p) |
virtual void | SetProbability (Index e, Index jtI_e, double p) |
void | SetProbabilityDistribution (const PDDiscreteInterface *pd) |
virtual void | SetUtility (Index e, Index jtI_e, Index jaI_e, double ut) |
virtual void | SetUtility (Index e, const std::vector< Index > &indTypes_e, const std::vector< Index > &actions_e, double ut) |
std::string | SoftPrint () const |
Prints a description of this entire BayesianGameIdenticalPayoff to a string. More... | |
std::string | SoftPrintSummary () const |
virtual | ~BayesianGameCollaborativeGraphical () |
Destructor. More... | |
Public Member Functions inherited from BayesianGameIdenticalPayoffInterface | |
BayesianGameIdenticalPayoffInterface () | |
(default) Constructor More... | |
BayesianGameIdenticalPayoffInterface (size_t nrAgents, const std::vector< size_t > &nrActions, const std::vector< size_t > &nrTypes) | |
double | ComputeValueJPol (const JointPolicyDiscretePure &jpolBG) const |
BayesianGameIdenticalPayoffInterface & | operator= (const BayesianGameIdenticalPayoffInterface &o) |
virtual void | Print () const |
Print this BayesianGameIdenticalPayoff to cout. More... | |
Public Member Functions inherited from BayesianGameBase | |
void | AddProbability (Index i, double p) |
Adds p to the probability of joint type i. More... | |
void | AddProbability (const std::vector< Index > &indIndices, double p) |
Adds p to the probability of joint type corresponding to the individual type indices (indIndices). More... | |
virtual bool | AreCachedJointToIndivIndices (const PolicyGlobals::PolicyDomainCategory pdc) const |
Check whether certain index conversions are cached. More... | |
BayesianGameBase () | |
BayesianGameBase (size_t nrAgents, const std::vector< size_t > &nrActions, const std::vector< size_t > &nrTypes, int verboseness=0) | |
BayesianGameBase (const BayesianGameBase &a) | |
Copy constructor. More... | |
bool | CacheJointToIndivAOH_Indices () const |
bool | CacheJointToIndivOH_Indices () const |
bool | CacheJointToIndivType_Indices () const |
virtual PolicyGlobals::PolicyDomainCategory | GetDefaultIndexDomCat () const |
Return the default PolicyDomainCategory for the problem. More... | |
size_t | GetNrActions (Index agentI) const |
Get the number of invididual actions of a particular agent. More... | |
const std::vector< size_t > & | GetNrActions () const |
size_t | GetNrAgents () const |
implement the Interface_ProblemToPolicyDiscrete interface: More... | |
size_t | GetNrJointActions () const |
LIndex | GetNrJointPolicies () const |
size_t | GetNrJointTypes () const |
LIndex | GetNrPolicies (Index ag) const |
size_t | GetNrPolicyDomainElements (Index agentI, PolicyGlobals::PolicyDomainCategory cat, size_t depth=MAXHORIZON) const |
Get the number of elements in the domain of an agent's policy. More... | |
const std::vector< size_t > & | GetNrTypes () const |
size_t | GetNrTypes (Index agI) const |
virtual double | GetProbability (const std::vector< Index > &indIndices) const |
Gets the probability of joint type corresponding to the individual type indices (indIndices) More... | |
Index | IndividualToJointActionIndices (const Index *IndArr) const |
Converts individual action indices to a joint action index. More... | |
Index | IndividualToJointActionIndices (const std::vector< Index > &indices) const |
Converts individual action indices to a joint action index. More... | |
Index | IndividualToJointTypeIndices (const std::vector< Index > &indices) const |
std::vector< Index > | JointToIndividualActionIndices (Index jaI) const |
std::vector< Index > | JointToIndividualPolicyDomainIndices (Index jdI, PolicyGlobals::PolicyDomainCategory cat) const |
implementation of JointToIndividualPolicyDomainIndices More... | |
const std::vector< Index > & | JointToIndividualPolicyDomainIndicesRef (Index jdI, PolicyGlobals::PolicyDomainCategory cat) const |
implementation of JointToIndividualPolicyDomainIndicesRef More... | |
const std::vector< Index > & | JointToIndividualTypeIndices (Index jTypeI) const |
BayesianGameBase & | operator= (const BayesianGameBase &o) |
void | Print () const |
Print this BayesianGameBase to cout. More... | |
virtual void | SanityCheck () |
Sanity check should be overriden by classes that do not use the implementation provided by this class (e.g. More... | |
void | SanityCheckBGBase () |
bool | SetInitialized (bool b) |
Sets the initialized status to b. More... | |
void | SetProbability (Index i, double p) |
Sets the probability of joint type i to p. More... | |
void | SetProbability (const std::vector< Index > &indIndices, double p) |
Sets the probability of joint type corresponding to the individual type indices (indIndices) to p. More... | |
std::string | SoftPrint () const |
Prints a description of this BayesianGameBase to a string. More... | |
std::string | SoftPrintAction (Index agentI, Index actionI) const |
Virtual function that has to be implemented by derived class. More... | |
std::string | SoftPrintPolicyDomainElement (Index agentI, Index typeIndex, PolicyGlobals::PolicyDomainCategory cat) const |
Virtual function that has to be implemented by derived class. More... | |
std::string | SoftPrintSummary () const |
std::string | SoftPrintType (Index agentI, Index typeIndex) const |
~BayesianGameBase () | |
Destructor. More... | |
Public Member Functions inherited from Interface_ProblemToPolicyDiscretePure | |
LIndex | GetNrJointPolicies (PolicyGlobals::PolicyDomainCategory cat, size_t depth=MAXHORIZON) const |
Get the number of joint policies, given the policy's domain. More... | |
LIndex | GetNrPolicies (Index ag, PolicyGlobals::PolicyDomainCategory cat, size_t depth=MAXHORIZON) const |
Get the number of policies for an agent, given the policy's domain. More... | |
virtual | ~Interface_ProblemToPolicyDiscretePure () |
Destructor. More... | |
Public Member Functions inherited from Interface_ProblemToPolicyDiscrete | |
size_t | GetNrJointActions () const |
Get the number of joint actions. More... | |
Interface_ProblemToPolicyDiscrete () | |
(default) Constructor More... | |
virtual | ~Interface_ProblemToPolicyDiscrete () |
Destructor. More... | |
Protected Types | |
typedef std::pair< double, Index > | diPair |
Private Types | |
typedef std::map< std::vector < observation_t >, double > | VecDMap |
typedef std::pair< std::vector < observation_t >, double > | VecDPair |
Private Member Functions | |
void | AddEdge (Index hI) |
void | AssignAgentActionsToHouses () |
void | AssignAgentTypesToHouses () |
double | ComputeDistanceAgentToHouse (Index agI, Index hI) |
double | ComputeHouseProbability (Index hI, const Scope &tupleOfAgents, const std::vector< Index > &types) const |
double | ComputeIndividualTypeProb (Index agI, Index typeI, std::vector< Index > &FL_vec) const |
Compute the probability of an individual type given the vector of fire levels (used in MAID export) More... | |
double | ComputeLocalProbability (const Scope &tupleOfAgents, const std::vector< Index > &types) const |
double | ComputeLocalUtility (Index hI, const Scope &tupleOfAgents, const std::vector< Index > &actions, const std::vector< Index > &types) |
size_t | ComputeNumberOfAgentsPresentAtHouse (Index houseI, const std::vector< Index > &a_vec) const |
std::vector< observation_t > | FilterObservationsForHouse (Index hI, const Scope &tupleOfAgents, const std::vector< Index > &types) const |
Extracts all the observations that concern house hI from the types of tupleOfAgents. More... | |
double | FLObservationProb (Index fireLevel, Problem_CGBG_FF::observation_t obs) const |
const Scope & | GetAgentsForHouse (Index houseI) |
double | GetHouseReward (Index fl, size_t nrAgentsPresent) const |
double | Likelihood (Index houseI, const std::vector< observation_t > &oVec_hI, Index fireLevel) const |
double | Prior (Index houseI, Index fireLevel) const |
void | ScatterAgents () |
void | ScatterHouses () |
std::vector< Index > | TypeIndexToObservationIndices (Index agI, Index typeI) const |
void | TypeIndexToObservationIndices (Index typeI, std::vector< Index > &obsIndices) const |
Private Attributes | |
std::vector< double > | _m_agentPositionX |
std::vector< double > | _m_agentPositionY |
std::vector< Scope > | _m_agentsForHouse_action |
std::vector< Scope > | _m_agentsForHouse_obs |
Scope | _m_allAgents |
std::vector< std::vector< Index > > | _m_houseIndices_action |
similarly, the houses that the agent has as its actions (can go to): More... | |
std::vector< std::vector< Index > > | _m_houseIndices_obs |
_m_houseIndices_obs[agI] contains a vector of house indices, indicating the houses that agent agI can observe. More... | |
std::vector< double > | _m_housePositionX |
std::vector< double > | _m_housePositionY |
size_t | _m_k |
size_t | _m_maxNrAgentsObservingAHouse |
VecDMap | _m_Norm_cache |
size_t | _m_nrActionsPerAgent |
size_t | _m_nrFireLevels |
size_t | _m_nrHouses |
size_t | _m_nrObservedHousesPerAgents |
size_t | _m_nrObsPerHouse |
Additional Inherited Members | |
Protected Member Functions inherited from BayesianGameBase | |
void | ChangeNrActions (Index agI, size_t new_nr) |
void | ChangeNrTypes (Index agI, size_t new_nr) |
void | Initialize () |
Protected Attributes inherited from BayesianGameCollaborativeGraphical | |
std::vector< Scope > | _m_agentScopes |
PDDiscreteInterface * | _m_jt_pd |
a pointer to a (discrete) probablity distribution over types. More... | |
std::vector < BayesianGameIdenticalPayoff * > | _m_LRFs |
The components or LRFs of the CGBG. More... | |
size_t | _m_nrLRFs |
Protected Attributes inherited from BayesianGameBase | |
bool | _m_initialized |
private bool to indicate whether this BG is initialized. More... | |
bool | _m_JAoverflow |
Boolean that indicates whether the number of joint actions can be represented by size_t (or that overflowing occurs) More... | |
bool | _m_JToverflow |
Boolean that indicates whether the number of joint types can be represented by size_t (or that overflowing occurs) More... | |
std::vector< size_t > | _m_nrActions |
the number of actions for each agent More... | |
size_t | _m_nrAgents |
the number of players (or agents) More... | |
size_t | _m_nrJA |
the number of joint types: More... | |
size_t | _m_nrJTypes |
the number of joint actions: More... | |
std::vector< size_t > | _m_nrTypes |
the number of types for each agent More... | |
size_t * | _m_stepSizeActions |
an size_t array that caches the stepsize array for actions: More... | |
size_t * | _m_stepSizeTypes |
an size_t array that caches the stepsize array for types: More... | |
int | _m_verboseness |
_m_verboseness >0 verbose, <0 is quiet More... | |
Problem_CGBG_FF reprents a generalized single-shot fire fighting problem.
-there are x houses scattered uniformly in the 2D plane (in the box bounded by [0,0], [1,1]) -the fire level of each house is uniformly drawn from {0, ..., nrFireLevels-1} -each agent is assigned a random position in the same box (also uniform). -each agent can fight fire at the z nearest houses. -each agent gets an observation of the y nearest houses. -each house induces a cost, -more agents at a house means a lower cost, however, the effect of adding agents is sub-additive. -a higher fire-level means a higher penalty formula ?
-In order to prevent an arbitrary number of agents from participating in a single house, we remove house from being selected when #agents that participate in it reaches a threshold k. "this will in general not lead to an optimal assignment, other assignments methods may be used in the construction of the CGBG"
Note, that this implementation only supports y<z. I.e., it will not correctly deal with the case where the agents can observe houses where they do not fight fire at. The problem is that in that case, even though an agent cannot influence such a house via its action, it does influence the local utility u(jt,ja) via its type. (However, I guess that that will not influence the optimal joint policy?)
|
protected |
typedef Index Problem_CGBG_FF::observation_t |
|
private |
|
private |
Problem_CGBG_FF::Problem_CGBG_FF | ( | size_t | nrHouses, |
size_t | nrFLs, | ||
size_t | nrAgents, | ||
size_t | nrActionsPerAgent, | ||
size_t | nrObservedHousesPerAgent, | ||
size_t | k | ||
) |
(default) Constructor
References _m_agentsForHouse_action, _m_agentsForHouse_obs, _m_allAgents, _m_houseIndices_action, _m_houseIndices_obs, _m_nrHouses, AddEdge(), AssignAgentActionsToHouses(), AssignAgentTypesToHouses(), BayesianGameBase::GetNrAgents(), Scope::Insert(), ScatterAgents(), ScatterHouses(), and PrintTools::SoftPrintVector().
Problem_CGBG_FF::~Problem_CGBG_FF | ( | ) |
Copy constructor.
Destructor.
|
private |
References _m_agentsForHouse_action, BayesianGameCollaborativeGraphical::AddLRF(), ComputeLocalProbability(), ComputeLocalUtility(), BayesianGameCollaborativeGraphical::GetBGIPforLRF(), BayesianGameBase::GetNrActions(), BayesianGameBase::GetNrTypes(), IndexTools::Increment(), BayesianGameCollaborativeGraphical::SetProbability(), BayesianGameCollaborativeGraphical::SetUtility(), and PrintTools::SoftPrintVector().
Referenced by Problem_CGBG_FF().
|
private |
References _m_agentsForHouse_action, _m_houseIndices_action, _m_k, _m_nrActionsPerAgent, _m_nrHouses, BayesianGameBase::ChangeNrActions(), ComputeDistanceAgentToHouse(), FixedCapacityPriorityQueue< T, _Compare >::empty(), BayesianGameBase::GetNrAgents(), FixedCapacityPriorityQueue< T, _Compare >::insert(), FixedCapacityPriorityQueue< T, _Compare >::pop(), and FixedCapacityPriorityQueue< T, _Compare >::top().
Referenced by Problem_CGBG_FF().
|
private |
References _m_agentsForHouse_obs, _m_houseIndices_action, _m_houseIndices_obs, _m_maxNrAgentsObservingAHouse, _m_nrHouses, _m_nrObservedHousesPerAgents, _m_nrObsPerHouse, BayesianGameBase::ChangeNrTypes(), ComputeDistanceAgentToHouse(), FixedCapacityPriorityQueue< T, _Compare >::empty(), BayesianGameBase::GetNrAgents(), FixedCapacityPriorityQueue< T, _Compare >::insert(), FixedCapacityPriorityQueue< T, _Compare >::pop(), and FixedCapacityPriorityQueue< T, _Compare >::top().
Referenced by Problem_CGBG_FF().
References _m_agentPositionX, _m_agentPositionY, _m_housePositionX, and _m_housePositionY.
Referenced by AssignAgentActionsToHouses(), and AssignAgentTypesToHouses().
|
private |
References _m_nrFireLevels, FilterObservationsForHouse(), Likelihood(), Prior(), and PrintTools::SoftPrintVector().
Referenced by ComputeLocalProbability().
|
private |
Compute the probability of an individual type given the vector of fire levels (used in MAID export)
References FLObservationProb(), and TypeIndexToObservationIndices().
Referenced by ExportAsMAID().
|
private |
References _m_houseIndices_obs, ComputeHouseProbability(), PrintTools::SoftPrintSet(), and PrintTools::SoftPrintVector().
Referenced by AddEdge(), and GetProbability().
|
private |
References _m_nrFireLevels, ComputeNumberOfAgentsPresentAtHouse(), Globals::EqualProbability(), FilterObservationsForHouse(), GetHouseReward(), Likelihood(), Prior(), and PrintTools::SoftPrintVector().
Referenced by AddEdge().
|
private |
References _m_agentsForHouse_action, and _m_houseIndices_action.
Referenced by ComputeLocalUtility(), and ExportAsMAID().
|
virtual |
References _m_agentsForHouse_action, _m_houseIndices_obs, _m_nrFireLevels, _m_nrHouses, ComputeIndividualTypeProb(), ComputeNumberOfAgentsPresentAtHouse(), GetHouseReward(), BayesianGameBase::GetNrActions(), BayesianGameBase::GetNrAgents(), BayesianGameBase::GetNrTypes(), GetUnixName(), IndexTools::Increment(), Prior(), and SoftPrintReadableType().
void Problem_CGBG_FF::ExportToTextFiles | ( | const std::string & | suffix = "" , |
const std::string & | prefix = "/tmp/" |
||
) | const |
|
private |
Extracts all the observations that concern house hI from the types of tupleOfAgents.
References _m_houseIndices_obs, PrintTools::SoftPrintVector(), and TypeIndexToObservationIndices().
Referenced by ComputeHouseProbability(), and ComputeLocalUtility().
|
private |
References _m_nrFireLevels, and _m_nrObsPerHouse.
Referenced by ComputeIndividualTypeProb(), and Likelihood().
|
private |
Referenced by ComputeLocalUtility(), and ExportAsMAID().
|
virtual |
Gets the probability of joint type i.
Reimplemented from BayesianGameCollaborativeGraphical.
References _m_allAgents, ComputeLocalProbability(), and BayesianGameBase::JointToIndividualTypeIndices().
string Problem_CGBG_FF::GetUnixName | ( | ) | const |
References _m_k, _m_nrActionsPerAgent, _m_nrFireLevels, _m_nrHouses, _m_nrObservedHousesPerAgents, and BayesianGameBase::GetNrAgents().
Referenced by ExportAsMAID(), and ExportToTextFiles().
|
private |
References FLObservationProb().
Referenced by ComputeHouseProbability(), and ComputeLocalUtility().
References _m_nrFireLevels.
Referenced by ComputeHouseProbability(), ComputeLocalUtility(), and ExportAsMAID().
|
private |
References _m_agentPositionX, _m_agentPositionY, and BayesianGameBase::GetNrAgents().
Referenced by Problem_CGBG_FF().
|
private |
References _m_housePositionX, _m_housePositionY, and _m_nrHouses.
Referenced by Problem_CGBG_FF().
Copy assignment operator.
References _m_houseIndices_obs, and TypeIndexToObservationIndices().
Referenced by ExportAsMAID().
|
private |
References _m_houseIndices_obs.
Referenced by ComputeIndividualTypeProb(), FilterObservationsForHouse(), and SoftPrintReadableType().
|
private |
References _m_nrObsPerHouse, and IndexTools::JointToIndividualIndices().
|
private |
Referenced by ComputeDistanceAgentToHouse(), ExportToTextFiles(), and ScatterAgents().
|
private |
Referenced by ComputeDistanceAgentToHouse(), ExportToTextFiles(), and ScatterAgents().
|
private |
|
private |
Referenced by AssignAgentTypesToHouses(), ExportToTextFiles(), and Problem_CGBG_FF().
|
private |
Referenced by GetProbability(), and Problem_CGBG_FF().
|
private |
similarly, the houses that the agent has as its actions (can go to):
Referenced by AssignAgentActionsToHouses(), AssignAgentTypesToHouses(), ComputeNumberOfAgentsPresentAtHouse(), and Problem_CGBG_FF().
|
private |
_m_houseIndices_obs[agI] contains a vector of house indices, indicating the houses that agent agI can observe.
Referenced by AssignAgentTypesToHouses(), ComputeLocalProbability(), ExportAsMAID(), FilterObservationsForHouse(), Problem_CGBG_FF(), SoftPrintReadableType(), and TypeIndexToObservationIndices().
|
private |
Referenced by ComputeDistanceAgentToHouse(), ExportToTextFiles(), and ScatterHouses().
|
private |
Referenced by ComputeDistanceAgentToHouse(), ExportToTextFiles(), and ScatterHouses().
|
private |
Referenced by AssignAgentActionsToHouses(), and GetUnixName().
|
private |
Referenced by AssignAgentTypesToHouses().
|
private |
|
private |
Referenced by AssignAgentActionsToHouses(), and GetUnixName().
|
private |
Referenced by ComputeHouseProbability(), ComputeLocalUtility(), ExportAsMAID(), FLObservationProb(), GetUnixName(), and Prior().
|
private |
|
private |
Referenced by AssignAgentTypesToHouses(), and GetUnixName().
|
private |
Referenced by AssignAgentTypesToHouses(), FLObservationProb(), and TypeIndexToObservationIndices().