Open Ad Hoc Teamwork with Cooperative Game Theory
Abstract
Ad hoc teamwork poses a challenging problem, requiring the design of an agent to collaborate with teammates without prior coordination or joint training. Open ad hoc teamwork further complicates this challenge by considering environments with a changing number of teammates, referred to as open teams. One promising solution to this problem is leveraging the generalizability of graph neural networks to handle an unrestricted number of agents and effectively address open teams, named graph-based policy learning (GPL). However, its joint Q-value representation over a coordination graph lacks convincing explanations. In this paper, we establish a new theory to understand the joint Q-value representation from the perspective of cooperative game theory, and validate its learning paradigm in open team settings. Building on our theory, we propose a novel algorithm named CIAO compatible with GPL framework, with additional provable implementation tricks that can facilitate learning. The demo of experiments is available on https://sites.google.com/view/ciao2024, and the code of experiments is published on https://github.com/hsvgbkhgbv/CIAO.
1 Introduction
Multi-agent reinforcement learning (MARL) has achieved partial success on multiple tasks including playing strategy games (Rashid et al., 2020), power system operation (Wang et al., 2021), and dynamic algorithm configuration (Xue et al., 2022). These tasks fit to the training paradigm of MARL, which requires all agents to be controllable and to be coordinated during training. However, with this paradigm it is difficult to tackle many real-world tasks where not all agents are controllable and even prior coordination may not be possible. For example, in search and rescue, a robot must collaborate with other robots it has not seen before (e.g., manufactured by various companies without a common coordination protocol) or humans to rescue survivors (Barrett & Stone, 2015). Similar situations occur in AI that helps trading markets (Albrecht & Ramamoorthy, 2013), as well as in the human-machine and machine-machine collaboration emerging from the prevailing embodied AI settings (Smith & Gasser, 2005; Duan et al., 2022) and large language models (Brown et al., 2020; Zhao et al., 2023).
To tackle the ad hoc teamwork problem, we explore a scenario where one agent, referred to as the learner, operates under our control and seeks to collaborate without prior coordination with teammates which have unknown types and policies (Stone et al., 2010). When dealing with teams of dynamic sizes, commonly termed open teams, the research problem addressed in this paper is often referred to as open ad hoc teamwork (OAHT) (Mirsky et al., 2022). One promising solution for OAHT is graph-based policy learning (GPL) (Rahman et al., 2021). GPL presents an empirical three-fold framework, encompassing a type inference model, a joint action value model, and an agent model, to tackle this problem. Although GPL reaps the success of performance, its weakness is that the representation of the joint Q-value over a coordination graph in OAHT lacks convincing explanations. This restricts its applicability to real-world problems requiring trustworthy algorithms (Bhat & Alqahtani, 2021; Wang et al., 2021).
We propose to describe OAHT using a game model from cooperative game theory, namely the coalitional affinity game (CAG) (Brânzei & Larson, 2009). Specifically, we extend the CAG by incorporating Bayesian games (Harsanyi, 1967) to depict uncertain agent types and stochastic games (Shapley, 1953) to represent the long-horizon goal. The resulting game is termed the open stochastic Bayesian coalitional affinity game (OSB-CAG). In this game, the learner aims to influence other teammates (via its actions) to collaborate in achieving a shared goal. To formalize this, we extend the standard cooperative game theory notion of strict core to a novel solution concept which we call dynamic variational strict core (DVSC). The DVSC transforms collaboration in a temporary team into the task of forming a stable temporary team, where no agent has incentives to leave. We model the OAHT process under the learner’s influence as a dynamic affinity graph (equivalent to a coordination graph), generalizing the classical static CAG. Based on the dynamic affinity graph, we further conceptualize an agent’s preference for a temporary team to measure whether they prefer to stay in the team under the learner’s influence. GPL’s joint action value model is proven to be the sum of any temporary agents’ preferences over a long horizon.
The main contributions of this paper can be summarized as follows: (1) We conceptualize OAHT as a dynamic coalitional affinity game, OSB-CAG. In this model, the learner seeks to influence teammates through its actions, without prior coordination, to establish a stable temporary team. (2) The theoretical model of OSB-CAG gives an understanding of GPL’s joint action value model. It ensures collaboration within any temporary team under open team settings. (3) Building on the OSB-CAG theory, we derive a constraint for representing the joint action value to facilitate learning, and an additional regularization term depending on the graph structure to rationalize solving DVSC as an RL problem. The novel algorithm, named CIAO (Cooperative game theory Inspired Ad hoc teamwork in Open teams), is implemented based on GPL and incorporates the above novel and provable tricks. (4) We validate the learning paradigm of GPL in open team settings. (5) We conduct experiments, primarily comparing two instances of CIAO (CIAO-S and CIAO-C, implemented in star and complete graph structures, respectively) based on GPL framework in two environments: Level-based Foraging (LBF) and Wolfpack under open team settings (Rahman et al., 2021). Finally, we conduct a comprehensive review and discussion of related works on both theoretical and algorithmic aspects of AHT and explore its relationship to MARL in Appendix A.
2 Background
Let indicate the set of probability distributions over a random variable on a sample space and let denote the power set of an arbitrary set . To simplify the notation, let exclusively denote the learner and denote the set of all temporary teammates at any timestep. indicates the generic probability distribution over a random variable and indicates the cardinality of an arbitrary set .
2.1 Coalitional Affinity Game
As a subclass of non-transferable utility games, hedonic game (Chalkiadakis et al., 2022) is defined as a tuple , where is a set of all agents; and is a sequence of agents’ preferences over the subsets of called coalitions. implies that coalition is no less preferred by agent than coalition . For each agent , describes a complete and transitive preference relation over a collection of all feasible coalitions . The outcome of a hedonic game is a coalition structure , i.e., a partition of into disjoint coalitions. We denote by the coalition including agent . The ordinal preferences can be represented as the cardinal form with preference values (Sliwinski & Zick, 2017). More specifically, an agent has a preference value function such that . if , which implies that agent weakly prefers to ; if , which implies that agent strictly prefers to .
To concisely represent the preference value, a hedonic game is equipped with an affinity graph , where each edge describes an affinity relation between agents and . For each edge , it defines an affinity weight to indicate the value that agent can receive from agent , while if , . For any coalition , the preference value of agent is specified as if , otherwise, .111In the original CAG setting (Sliwinski & Zick, 2017), is conventionally set to zero. Herein, we extend it to non-negative values for generality (see Appendix E). An affinity graph is symmetric if , for all . The hedonic game with an affinity graph is named as coalitional affinity game (CAG) (Brânzei & Larson, 2009). Strict core stability is a principal solution concept of CAG (see Definition 1).
Definition 1.
We say that a blocking coalition weakly blocks a coalition structure if every agent weakly prefers to and there exists at least one agent who strictly prefers to . A coalition structure admitting no weakly blocking coalition is called strict core stable.
2.2 Graph-Based Policy Learning
We now briefly review GPL’s empirical framework (Rahman et al., 2021) to solve OAHT (see Appendix C.1 for more details). GPL consists of the following modules: the type inference model, the joint action value model and the agent model. To align with our motivation, we transform the framework to be adaptable to any coordination graph structure, as opposed to being restricted to only the complete graph as in GPL.
Type Inference Model. This is modelled as a LSTM (Hochreiter & Schmidhuber, 1997) to infer agent types of a team at timestep given the teammates’ agent-types and the state at timestep . The agent-type is modelled as a fixed-length hidden-state vector of LSTM, referred to as agent-type embedding. To address the issue of variable team size, the embedding of the agents who leave a team would be removed at each timestep, while the type embedding of the newly added agents would be set to a zero vector.
Joint Action Value Model. The joint Q-value is approximated as the sum of the individual utility and pairwise utility :
(1) |
where the superscript implies that the above terms can only be optimized by the learner’s policy .
Agent Model. To address the open team setting, GNN is applied to process the joint agent type embedding produced from the type inference model, where each agent is represented as a node and the coordination graph is consistent with that for the joint action value model. The resulting node representation is applied as input to infer the estimated teammates’ joint policy, denoted as .
Learner’s Decision Making. The learner’s approximate action value function is defined as follows:
(2) |
where is a state at timestep , is a joint action of teammates at timestep and is the learner ’s action at timestep . The learner’s decision making is conducted by selecting the action that maximizes .
3 A New Game Model to Formalize OAHT
In this section, we generalize the coalitional affinity game framework to formalize OAHT, by integrating a graph to represent relationships among agents. It is essential to emphasize that, for the sake of brevity, our focus of this work is exclusively on fully observable scenarios.
3.1 Problem Formulation
In an environment, the learner interacts with other uncontrollable temporary teammates to achieve a shared goal. To model this process, we introduce Open Stochastic Bayesian Coalitional Affinity Game (OSB-CAG), defined as a tuple . Here, represents the set of all possible agents, is the set of states, is the action set for agent , and denotes the set of all possible agent-types. Let the joint action set under a variable agent set be defined as . Therefore, the joint action space under a variable number of agents is defined as , while the joint agent-type space under a variable number of agents is defined as . A dynamic affinity graph, denoted as , is introduced to describe the relationships among agents. Here, , and is a set of possible edges represented by pairs . This graph is referred to as the coordination graph in GPL.
Transition Function. We now introduce three primitive probability distributions denoted as , , and . These probability functions characterize the dynamics of the environment in the following procedure: (1) At the initial timestep , generates an initial set of agents and an initial state . (2) represents a type assignment function that randomly assigns agent-types to the generated agent set. (3) generates the agent set and state for the next time step . (4) Stage 2 and 3 above are repeated. To succinctly represent the aforementioned process, we derive a composite transition function (see Proposition 1) in place of stage 2 and 3 from timesteps . This function can be factorized, clarifying the GPL’s framework, as follows:
(3) |
Herein, is a probability distribution composed of , and (see the sketch of proof of Proposition 1) that generates a variable agent set and a state , observable by the learner. In contrast, a joint agent-type generated from is unobservable by the learner. However, it plays a crucial role in the agent model for the learner’s decision making in the empirical framework of GPL, motivating the estimation of this term in practice, as conducted by the type inference model (see Section 2.2). To distinguish between and clarify the observation generated from and the agent-types generated from during the decision process, both functions will be concurrently utilized to describe the composite transition function in the subsequent sections. To simplify the notation, we would use in place of for in the following sections.
Assumption 1.
The following conditional independencies are assumed to hold in any distribution over the set of variables in an OSB-CAG: (1) ; (2) ; (3) ; (4) .
Proposition 1.
for can be expressed in terms of the following well-defined probability distributions: , for , and for .
Proof.
We show the sketch of proof here. The following derivation is obtained by Assumption 1. For validity of conditions in Assumption 1, please refer to Appendix D. About the complete version of proof, please refer to Appendix G.1.
where and
We have
Also, we have and when ,
where
The sketch of proof is completed. ∎
Preference Reward. The function extends an agent ’s preference value, of the original stateless CAG, to the agent ’s preference reward which depends on the state and action. For example, indicates agent ’s preference reward for a temporary team with the corresponding joint action , whereas indicates agent ’s preference reward for a coalition only including itself. To capture the relationship between agents and in terms of both the current state and the actions taken, the affinity weight is generalized accordingly as . Following the specification of preference values through affinity weights, the preference reward of any agent for a coalition can be represented as . This summation aggregates the affinity weights for all pairs of agents in the coalition, where is a member of . The learner’s reward function for any is specified by , which will be introduced in Section 3.4.
3.2 Dynamic Variational Strict Core
We now extend the game theoretical concept of strict core from CAG to OSB-CAG as a criterion to evaluate the extent of collaboration among the agents in a temporary team (a coalition at each timestep ), named as dynamic variational strict core (DVSC). Unlike the strict core defined in CAG that evaluates coalition formation based on the given preference values, DVSC evaluates whether the learner ’s policy can influence temporary teammates’ decisions (measured by preference rewards), so that they intend to collaborate (so called variational). This is analogous to forming a temporary team as a desired coalition. Next we derive a result on strict core stability to motivate a result on DVSC. The following two statements are equivalent when the affinity graph is symmetric: Team maximizes social welfare, and team reaches strict core stability (see Lemma 1 in Appendix F). This inspires using the objective of maximizing social welfare as a surrogate criterion to evaluate strict core stability, and this criterion can be further generalized to dynamic scenarios to derive the DVSC (see Definition 2).
Definition 2.
If a dynamic affinity graph is symmetric, then maximizing the long-horizon social welfare is equivalent to reaching strict core stability under the variable teammates of uncertain agent-types generated by and the uncertain states generated by .
3.3 Is Stability of any Temporary Team a Reasonable Metric for Describing Ad Hoc Collaboration?
Recall that all agents in AHT have a shared goal, which implies that they intrinsically aim to collaborate on solving a shared task (Mirsky et al., 2022), but their preferences for collaborating with each other are not necessarily compatible. This compatibility can be interpreted as stability of a temporary team, determined by the preferences of ad hoc agents for collaborating with each other. If those ad hoc agents are incompatible with each other, the temporary team becomes unstable but still with hope of collaborating as a team to solve the shared task. Therefore, the learner’s aim is to tweak the compatibility of a temporary team through its actions, to influence the temporary teammates’ preferences, equivalent to maintaining the stability of the temporary team, across timesteps.
3.4 Solving DVSC by Reinforcement Learning
We proceed to define the learner’s reward function, initially left blank in Section 3.1 and convert DVSC from Eq. (4) into an RL problem. Since the learner’s objective is to execute actions that influence any temporary teammates to collaboratively solve a shared task, we naturally interpret the learner’s reward function as . The reward function represents the social welfare of preference rewards for a temporary team , serving as a measure of agents’ preferences to collaborate on a shared task.222In practical scenarios, only needs to implicitly encode the shared goal that multiple agents are required to achieve. Substituting into Eq. (4), we derive an RL problem equivalent to solving DVSC:
(5) |
In the following section, we will explore how the optimization problem in Eq. (5) can be solved by a novel algorithm.
4 A Novel Algorithm Building on OSB-CAG
In this section, we derive a novel graph-based RL algorithm to solve OAHT based on the OSB-CAG, with DVSC as a solution concept. We first derive the joint Q-value’s representation to narrow down its hypothesis space including the solution of DVSC. The representation aligns with and gives an interpretation to the GPL’s heuristic joint action value model. Note that we also acquire a condition to further confine the joint Q-value’s hypothesis space thanks to our theory (see Section 4.1). With the estimated type inference model and agent model, the optimal learner’s policy obtained by GPL’s optimization problem approximately reaches DSVC (see Section 4.2). Finally, we derive a novel practical algorithm, named CIAO (see Section 4.3).
4.1 Representation of Joint Q-Value
Given the joint actions generated under the influence by the optimal learner’s policy , we have a sufficient condition, as an inductive bias, for any preference reward function to narrow down its hypothesis space meeting DVSC in Theorem 1. Solving the RL problem outlined in Eq. (5) based on this condition to specify , the preference reward function is aligned to a task-specific reward . The relationship between the above conditions to generate our preference reward function is shown in Fig. 1.
Theorem 1.
In an OSB-CAG, for any dynamic affinity graph at any timestep , if there exists a joint action , for any agent , satisfying for any , then DVSC always exists.
To meet the condition that as shown in Theorem 1, we derive a representation of in Proposition 2. Recall that an agent ’s preference reward function for a temporary team at timestep is defined as (see Section 3.1).
Proposition 2.
In a dynamic affinity graph , for any state and any joint action , if for all , with the conditions that and , then for any agent .
Proof.
This result can be directly obtained by the definition that . ∎
Plugging in the expression of , we can obtain the representation of an arbitrary agent ’s preference Q-value under the learner’s optimal policy , , and the joint Q-value under the learner’s optimal policy , , outlined in Theorem 2.
Assumption 2.
Suppose that for , where is the timestep when agent or leaves the environment, and for , where is the timestep when agent leaves the environment.
Theorem 2.
Under Assumption 2, if , then the joint Q-value of the learner’s policy can be expressed as follows:
where and .
Remark 1.
Recall that the condition for solving DSVC as a RL problem is the symmetry of a dynamic affinity graph (see Definition 2). To meet this condition, we outline in Proposition 3 the constraints that must be fulfilled for the case of a dynamic affinity graph being a star graph (see Remark 2 for its validity in OAHT). Similarly, we provide the relevant constraints articulated in Proposition 4 for situations where the dynamic affinity graph takes the form of a complete graph (as applied to GPL). The implementation of the constraints for these two cases are shown in Remark 3.
Definition 3.
In this paper, we introduce a novel dynamic affinity graph structured as a star graph, with the learner serving as the internal node and temporary teammates as the leaf nodes.
Remark 2.
We introduce a novel architecture for the dynamic affinity graph in the context of OAHT, assuming teammates lack prior coordination (Mirsky et al., 2022). Given an additional assumption that teammates cannot adapt their policies or types in response to other agents,333For simplicity in presenting our theory in this paper, we tentatively disregard scenarios where temporary teammates can adapt to other agents (e.g. establishing an affinity model). it is reasonable to presume the absence of relationships among any temporary teammates. Besides, this is also in line with the assumption in AHT that the learner’s temporary teammates might not be familiar with one another before the interaction (Stone et al., 2010; Mirsky et al., 2022). In particular, this implies that no edges between any two teammates are necessary to form a dynamic affinity graph. However, the learner’s goal is to establish collaboration with a variable number of temporary teammates at each timestep, necessitating the existence of edges between the learner and each teammate. To meet all these requirements, we design the learner’s dynamic affinity graph as a star graph, as detailed in Definition 3. Consequently, the preference reward of any teammate for a temporary team is determined as , while the learner ’s preference reward for the temporary team is expressed as .
Proposition 3.
For the learner and any teammate or , the constraints and , for any and , are necessary for a star dynamic affinity graph to be symmetric.
Proposition 4.
For any two agents or , the constraints and , for any and , are necessary for the complete dynamic affinity graph to be symmetric.
Remark 3.
The following implementation is necessary to satisfy the symmetry of a dynamic affinity graph: (1) meeting in constructing preference Q-values; (2) If the dynamic affinity graph is a star graph with the learner as the internal node, is implemented as a regularizer. If the dynamic affinity graph is a complete graph, is implemented as a regularizer.
4.2 Bellman Optimality Equation for OSB-CAG
We now define the Bellman optimality equation for OSB-CAG to evaluate the learner ’s optimal policy as a solution of the DVSC following Theorem 3, such that
(6) |
The regularity condition of Eq. (6) is that , since it is pathological to consider an agent but, at timestep when expanding across timesteps, which is clarified in an illustrative example in Fig. 2.
Theorem 3.
Under Assumption 2 and an arbitrary learner’s deterministic stationary policy , the Bellman equation for the OSB-CAG with DVSC as a solution concept is expressed as follows: .
To solve Eq. (6), we further propose an operator with the same regularity condition, such that , specified as follows:
(7) |
Eq. (7) is a standard form of Bellman operator. Therefore, recursively running Eq. (7) converges to the Bellman optimality equation in Eq. (6), following the well-known value iteration algorithm (Sutton & Barto, 2018, Ch. 4).
Remark 4.
In implementation, the effect of can be omitted, due to its low proportions during the process. Therefore, solving the GPL optimization problem of fitted Q-learning (Ernst et al., 2005) that omits the effect of is a reasonable approximation of Bellman operator in Eq. (7), which reduces the computational cost of filtering out the transition samples of in practice. The GPL optimization problem is shown as follows:
(8) |
where is the approximate target optimal joint Q-value parameterised by and is the approximate optimal joint Q-value parameterised by .
4.3 Practical Implementation
Based on our theory, we introduce a novel algorithm, CIAO, representing the algorithm for Cooperative game theory Inspired Ad hoc teamwork in Open teams. We implement CIAO in dynamic affinity graphs as a star graph (refer to Remark 2 for more insights into this topology) and a complete graph, denoted as CIAO-S and CIAO-C, respectively, where “S” signifies Star graph and “C” signifies Complete graph. In addition to the joint Q-value representation model (derived from Theorem 2) and the training losses for estimating the unknown type inference model and the unknown agent model (as detailed in Section 2.2), we introduce novel Q losses tailored for variant dynamic affinity graphs based on our theory. These losses incorporate regularization terms with multipliers .
CIAO-S. If the dynamic affinity graph is a star graph, the training loss with the regularizer is as follows:
CIAO-C. If the dynamic affinity graph is a complete graph, the training loss with the regularizer is as follows:
Note that it is also requisite to enforce that by Remark 3. Following our theoretical model, the learner’s reward ought to be non-negative, while the designated reward of an environment could be negative. However, this can be adjusted by adding the maximum difference between these two rewards among states and joint actions denoted by without changing the original goal. In practice, Eq. (8) is solved by DQN (Mnih et al., 2013). The learner’s actions are decided by Eq. (2), employing the estimated teammates’ agent models (see Section 2.2) to marginalize of , as implemented in GPL. The further implementation details are left to Appendix C.
5 Experiments
We assess the effectiveness of the proposed algorithms CIAO-S and CIAO-C in two established environments, LBF and Wolfpack, featuring open team settings (Rahman et al., 2021). In these settings, teammates are randomly selected to enter the environment and remain for a certain number of time steps. During experiments, the learner is trained in an environment with a maximum of 3 agents at each timestep. Subsequently, testing is conducted in environments with a maximum of 5 and 9 agents at each timestep, showcasing the model’s ability to handle both unseen compositions and varied team sizes. All experiments are conducted with five random seeds, and the results are presented as the mean performance with a 95% confidence interval. Our experimental design aims to answer the following questions: (1) Does the joint Q-value representation outlined in our theory effectively facilitate collaboration between the learner and temporary teammates? (2) Is it necessary to generalize the preference reward function from zero, as in CAG, to a non-negative range in our theory (see Appendix E)? (3) Is the claim in Remark 4 valid in practice? (4) Is CIAO able to deal with generalization in agent-type sets?
Baselines and Ablation Variants. The state-of-the-art baseline we use in this experiment is GPL-Q (shortened as GPL) (Rahman et al., 2021). The ablation variants of the proposed CIAO are as follows: CIAO-X-FI, CIAO-X-ZI and CIAO-X-NI are variants that remove enforcement of individual utility, enforce individual utility as zero and enforce individual utility as negative values, respectively. CIAO-X-NP is a variant that enforces negative pairwise utility. “X” above indicates either “S” or “C”. Further details on experimental settings can be found in Appendix H.
5.1 Main Results
We initially address Questions 1 through experiments conducted on the original versions of Wolfpack and LBF, as depicted in Fig. 3. It is evident that CIAO-C outperforms GPL in the majority of scenarios with varying maximum numbers of agents. This not only verifies the correctness and effectiveness of our theory, irrespective of dynamic affinity graph structures but also demonstrates its capability in facilitating collaboration between the learner and temporary teammates in the open ad hoc teamwork problem. Upon comparing CIAO-C and CIAO-S, it becomes apparent that the star graph may be more effective in scenarios with fewer agents, whereas the complete graph exhibits greater effectiveness in scenarios with more agents. This observation aligns with the intuition that the direct influence from the learner to each teammate may not suffice as the number of agents increases. Instead, indirect influence, where a teammate is influenced by the learner to subsequently influence another teammate, becomes crucial.
5.2 Ablation Study
We present experimental results comparing CIAO-S and its ablations, as well as CIAO-C and its ablations. As illustrated in Figs. 4 and 5, both CIAO-C-NP and CIAO-S-NP exhibit notably inferior performance compared to CIAO-C or CIAO-S. This observation demonstrates the validity of DVSC and confirms the accuracy of the joint Q-value representation based on our theory. This outcome provides an additional perspective in addressing Question 1.
Adhering to the tradition of CAG, convention mandates setting individual utility to zero. However, in our theory, we extend its range to include non-zero values, enhancing its adaptability across diverse scenarios. This adaptability is demonstrated in the comparison between CIAO-C or CIAO-S and CIAO-C-ZI or CIAO-S-ZI in Figs. 4 and 5. Although our theory does not inherently provide specific insights into the range of individual utility, we propose a hypothesis aligned with other definitions in CAG, asserting that individual utility is non-negative. This hypothesis ensures self-consistency in our generalization, as detailed in Definition 4 in Appendix E. The superior performances of CIAO-C or CIAO-S over their ablations affirm the acceptability of our hypothesis.
5.3 Validity of Remark 4
We now validate our claim in Remark 4 that minimizing the GPL training loss (omitting the effect of ) is an approximation of Eq. (7). Based on the GPL training loss, we implement its variant that filters out the transition samples of , following the suggestion from Remark 4, referred to as CIAO-C-Va and CIAO-S-Va. As shown in Fig. 6, in both LBF and Wolfpack with the maximum of 5 agents, CIAO-C and CIAO-S trained with the GPL training loss achieve the approximate performances to those with the variant training loss considering the effect of .
5.4 Generalization in Agent-Type Sets
We now evaluate the generalizability of CIAO in agent-type sets through two scenarios: (1) the agent-type set for training has intersection of one agent-type with that for testing; (2) the agent-type set for training is mutually exclusive to that for testing. As seen from Figs. 7 and 8, the dynamic affinity graph as the star graph is more generalizable than the complete graph. One hypothesis for this phenomenon is that although the complete graph may be able to capture broader relationships among agents, it could be unnecessary for open ad hoc teamwork (as explained in Remark 2). The underlying principles behind this result deserve to be investigated in the future research.
6 Conclusion
Discussion. In this work we address the challenging problem of open ad hoc teamwork, aiming to design an agent capable of collaborating with teammates without prior coordination under dynamically changing team compositions. We propose a novel approach by incorporating cooperative game theory to develop a new theory. This theory effectively gives an interpretation to the joint Q-value representation leveraged in the state-of-the-art algorithm, GPL. Building upon the empirical foundation of GPL, we introduce a novel algorithm, CIAO, which includes an additional regularizer and a constraint for representation thanks to our theory. Consequently, CIAO can be seen as a subclass of GPL, providing extra information through our theory to narrow down the joint Q-value’s hypothesis space, facilitating learning. Besides, the incorporation of dynamic affinity graphs into OSB-CAG opens up a new avenue of designing graphs describing agent relationships aligned to game objectives. Experimental results validate the effectiveness of our theory and demonstrate the superior performance of CIAO.
Limitation and Future Work. This work is the first in establishing both a theory and a practical algorithm rooted in cooperative game theory to address ad hoc teamwork. It opens up avenues of several promising future directions. Firstly, to enhance the scope and applicability of our theory, a logical next step involves exploring the adaptivity of teammates with time-varying agent-types, a factor currently omitted in our theory for simplicity. Another compelling direction is investigating the design of understandable joint Q-value representation for open ad hoc teamwork, other than linear decomposition with pairwise relationships and individual values justified in this work. This thread can push forward the potential deployment of ad hoc teamwork to safety-critical environments requiring trustworthy and cost-saving solutions, with less trial-and-error interactions.
Impact Statement
The outcomes of this paper could significantly enhance the progress of autonomous vehicles, smart grids, and various decision-making scenarios involving multiple independently controlled agents under uncertainties. However, it is crucial to acknowledge potential drawbacks. Like many machine learning algorithms, our work may encounter challenges related to human value alignment, when the targets in interaction are humans in the potential applications. Addressing this concern is part of our ongoing research, building upon findings from related fields that emphasize alignment issues.
Acknowledgement
This work is partially supported by UKRI Turing AI World-Leading Researcher Fellowship, EP/W002973/1. The computational resources are supported by CSC – IT Center for Science LTD., Finland. Yuan Zhang receives funding from the European Union’s Horizon 2020 research and innovation program under the Marie Skłodowska-Curie grant agreement No. 953348 (ELO-X).
References
- Agmon & Stone (2012) Agmon, N. and Stone, P. Leading ad hoc agents in joint action settings with multiple teammates. In AAMAS, pp. 341–348, 2012.
- Agmon et al. (2014) Agmon, N., Barrett, S., and Stone, P. Modeling uncertainty in leading ad hoc teams. In Proceedings of the 2014 international conference on Autonomous agents and multi-agent systems, pp. 397–404, 2014.
- Albrecht & Ramamoorthy (2013) Albrecht, S. V. and Ramamoorthy, S. A game-theoretic model and best-response learning method for ad hoc coordination in multiagent systems. In Proceedings of the 2013 international conference on Autonomous agents and multi-agent systems, pp. 1155–1156, 2013.
- Bahdanau et al. (2014) Bahdanau, D., Cho, K., and Bengio, Y. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
- Barrett & Stone (2015) Barrett, S. and Stone, P. Cooperating with unknown teammates in complex domains: A robot soccer case study of ad hoc teamwork. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 29, 2015.
- Barrett et al. (2017) Barrett, S., Rosenfeld, A., Kraus, S., and Stone, P. Making friends on the fly: Cooperating with new teammates. Artificial Intelligence, 242:132–171, 2017.
- Bhat & Alqahtani (2021) Bhat, J. R. and Alqahtani, S. A. 6g ecosystem: Current status and future perspective. IEEE Access, 9:43134–43167, 2021.
- Brafman & Tennenholtz (1996) Brafman, R. I. and Tennenholtz, M. On partially controlled multi-agent systems. Journal of Artificial Intelligence Research, 4:477–507, 1996.
- Brânzei & Larson (2009) Brânzei, S. and Larson, K. Coalitional affinity games. In Proceedings of The 8th International Conference on Autonomous Agents and Multiagent Systems-Volume 2, pp. 1319–1320, 2009.
- Brown et al. (2020) Brown, T., Mann, B., Ryder, N., Subbiah, M., Kaplan, J. D., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
- Chalkiadakis et al. (2022) Chalkiadakis, G., Elkind, E., and Wooldridge, M. Computational aspects of cooperative game theory. Springer Nature, 2022.
- Chen et al. (2020) Chen, S., Andrejczuk, E., Cao, Z., and Zhang, J. AATEAM: achieving the ad hoc teamwork by employing the attention mechanism. In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, The Thirty-Second Innovative Applications of Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pp. 7095–7102. AAAI Press, 2020.
- De Peuter & Kaski (2023) De Peuter, S. and Kaski, S. Zero-shot assistance in sequential decision problems. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37, pp. 11551–11559, 2023.
- Du et al. (2019) Du, Y., Han, L., Fang, M., Liu, J., Dai, T., and Tao, D. Liir: Learning individual intrinsic reward in multi-agent reinforcement learning. Advances in Neural Information Processing Systems, 32, 2019.
- Duan et al. (2022) Duan, J., Yu, S., Tan, H. L., Zhu, H., and Tan, C. A survey of embodied ai: From simulators to research tasks. IEEE Transactions on Emerging Topics in Computational Intelligence, 6(2):230–244, 2022.
- Ernst et al. (2005) Ernst, D., Geurts, P., and Wehenkel, L. Tree-based batch mode reinforcement learning. Journal of Machine Learning Research, 6, 2005.
- Foerster et al. (2016) Foerster, J., Assael, I. A., De Freitas, N., and Whiteson, S. Learning to communicate with deep multi-agent reinforcement learning. Advances in neural information processing systems, 29, 2016.
- Foerster et al. (2018) Foerster, J. N., Farquhar, G., Afouras, T., Nardelli, N., and Whiteson, S. Counterfactual multi-agent policy gradients. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
- Gu et al. (2022) Gu, P., Zhao, M., Hao, J., and An, B. Online ad hoc teamwork under partial observability. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net, 2022.
- Harsanyi (1967) Harsanyi, J. C. Games with incomplete information played by “bayesian” players, i–iii part i. the basic model. Management science, 14(3):159–182, 1967.
- Hochreiter & Schmidhuber (1997) Hochreiter, S. and Schmidhuber, J. Long short-term memory. Neural computation, 9(8):1735–1780, 1997.
- Jiang & Lu (2018) Jiang, J. and Lu, Z. Learning attentional communication for multi-agent cooperation. Advances in neural information processing systems, 31, 2018.
- Kalyanakrishnan et al. (2007) Kalyanakrishnan, S., Liu, Y., and Stone, P. Half field offense in robocup soccer: A multiagent reinforcement learning case study. In RoboCup 2006: Robot Soccer World Cup X 10, pp. 72–85. Springer, 2007.
- Kim et al. (2019) Kim, D., Moon, S., Hostallero, D., Kang, W. J., Lee, T., Son, K., and Yi, Y. Learning to schedule communication in multi-agent reinforcement learning. arXiv preprint arXiv:1902.01554, 2019.
- Kingma & Ba (2014) Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
- Koller & Friedman (2009) Koller, D. and Friedman, N. Probabilistic graphical models: principles and techniques. MIT press, 2009.
- Mguni et al. (2022) Mguni, D. H., Jafferjee, T., Wang, J., Nieves, N. P., Slumbers, O., Tong, F., Li, Y., Zhu, J., Yang, Y., and Wang, J. LIGS: learnable intrinsic-reward generation selection for multi-agent learning. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net, 2022.
- Mirsky et al. (2022) Mirsky, R., Carlucho, I., Rahman, A., Fosong, E., Macke, W., Sridharan, M., Stone, P., and Albrecht, S. V. A survey of ad hoc teamwork research. In Multi-Agent Systems: 19th European Conference, EUMAS 2022, Düsseldorf, Germany, September 14–16, 2022, Proceedings, pp. 275–293. Springer, 2022.
- Mnih et al. (2013) Mnih, V., Kavukcuoglu, K., Silver, D., Graves, A., Antonoglou, I., Wierstra, D., and Riedmiller, M. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013.
- Paszke et al. (2019) Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32, 2019.
- Rahman et al. (2021) Rahman, M. A., Hopner, N., Christianos, F., and Albrecht, S. V. Towards open ad hoc teamwork using graph-based policy learning. In International Conference on Machine Learning, pp. 8776–8786. PMLR, 2021.
- Rashid et al. (2018) Rashid, T., Samvelyan, M., de Witt, C. S., Farquhar, G., Foerster, J. N., and Whiteson, S. QMIX: monotonic value function factorisation for deep multi-agent reinforcement learning. In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholmsmässan, Stockholm, Sweden, July 10-15, 2018, volume 80 of Proceedings of Machine Learning Research, pp. 4292–4301. PMLR, 2018.
- Rashid et al. (2020) Rashid, T., Farquhar, G., Peng, B., and Whiteson, S. Weighted qmix: Expanding monotonic value function factorisation for deep multi-agent reinforcement learning. Advances in Neural Information Processing Systems, 33, 2020.
- Shapley (1953) Shapley, L. S. Stochastic games. Proceedings of the national academy of sciences, 39(10):1095–1100, 1953.
- Shneiderman (2020) Shneiderman, B. Human-centered artificial intelligence: Three fresh ideas. AIS Transactions on Human-Computer Interaction, 12(3):109–124, 2020.
- Sliwinski & Zick (2017) Sliwinski, J. and Zick, Y. Learning hedonic games. In IJCAI, pp. 2730–2736, 2017.
- Smith & Gasser (2005) Smith, L. and Gasser, M. The development of embodied cognition: Six lessons from babies. Artificial life, 11(1-2):13–29, 2005.
- Stone & Kraus (2010) Stone, P. and Kraus, S. To teach or not to teach? decision making under uncertainty in ad hoc teams. In Proceedings of the 9th International Conference on Autonomous Agents and Multiagent Systems: volume 1-Volume 1, pp. 117–124, 2010.
- Stone et al. (2009) Stone, P., Kaminka, G. A., and Rosenschein, J. S. Leading a best-response teammate in an ad hoc team. In International Workshop on Agent-Mediated Electronic Commerce, pp. 132–146. Springer, 2009.
- Stone et al. (2010) Stone, P., Kaminka, G. A., Kraus, S., and Rosenschein, J. S. Ad hoc autonomous agent teams: Collaboration without pre-coordination. In Fox, M. and Poole, D. (eds.), Proceedings of the Twenty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2010, Atlanta, Georgia, USA, July 11-15, 2010. AAAI Press, 2010.
- Sukhbaatar et al. (2016) Sukhbaatar, S., Fergus, R., et al. Learning multiagent communication with backpropagation. Advances in neural information processing systems, 29, 2016.
- Sunehag et al. (2018) Sunehag, P., Lever, G., Gruslys, A., Czarnecki, W. M., Zambaldi, V. F., Jaderberg, M., Lanctot, M., Sonnerat, N., Leibo, J. Z., Tuyls, K., and Graepel, T. Value-decomposition networks for cooperative multi-agent learning based on team reward. In Proceedings of the 17th International Conference on Autonomous Agents and MultiAgent Systems, AAMAS 2018, Stockholm, Sweden, July 10-15, 2018, pp. 2085–2087. International Foundation for Autonomous Agents and Multiagent Systems Richland, SC, USA / ACM, 2018.
- Sutton & Barto (2018) Sutton, R. S. and Barto, A. G. Reinforcement learning: An introduction. MIT press, 2018.
- Tacchetti et al. (2019) Tacchetti, A., Song, H. F., Mediano, P. A. M., Zambaldi, V. F., Kramár, J., Rabinowitz, N. C., Graepel, T., Botvinick, M. M., and Battaglia, P. W. Relational forward models for multi-agent learning. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net, 2019.
- Wang et al. (2020) Wang, J., Zhang, Y., Kim, T.-K., and Gu, Y. Shapley q-value: A local reward approach to solve global reward games. Proceedings of the AAAI Conference on Artificial Intelligence, 34(05):7285–7292, Apr 2020.
- Wang et al. (2021) Wang, J., Xu, W., Gu, Y., Song, W., and Green, T. C. Multi-agent reinforcement learning for active voltage control on power distribution networks. Advances in Neural Information Processing Systems, 34:3271–3284, 2021.
- Wang et al. (2022) Wang, J., Zhang, Y., Gu, Y., and Kim, T.-K. Shaq: Incorporating shapley value theory into multi-agent q-learning. Advances in Neural Information Processing Systems, 35:5941–5954, 2022.
- Wu et al. (2011) Wu, F., Zilberstein, S., and Chen, X. Online planning for ad hoc autonomous agent teams. In Proceedings of the 22nd International Joint Conference on Artificial Intelligence (IJCAI), pp. 439–445, 2011.
- Xie et al. (2021) Xie, A., Losey, D., Tolsma, R., Finn, C., and Sadigh, D. Learning latent representations to influence multi-agent interaction. In Conference on robot learning, pp. 575–588. PMLR, 2021.
- Xue et al. (2022) Xue, K., Xu, J., Yuan, L., Li, M., Qian, C., Zhang, Z., and Yu, Y. Multi-agent dynamic algorithm configuration. Advances in Neural Information Processing Systems, 35:20147–20161, 2022.
- Zhao et al. (2023) Zhao, W. X., Zhou, K., Li, J., Tang, T., Wang, X., Hou, Y., Min, Y., Zhang, B., Zhang, J., Dong, Z., et al. A survey of large language models. arXiv preprint arXiv:2303.18223, 2023.
- Zintgraf et al. (2021) Zintgraf, L. M., Devlin, S., Ciosek, K., Whiteson, S., and Hofmann, K. Deep interactive bayesian reinforcement learning via meta-learning. In Dignum, F., Lomuscio, A., Endriss, U., and Nowé, A. (eds.), AAMAS ’21: 20th International Conference on Autonomous Agents and Multiagent Systems, Virtual Event, United Kingdom, May 3-7, 2021, pp. 1712–1714. ACM, 2021. doi: 10.5555/3463952.3464210.
Appendix A Related Works
Theoretical Models for Ad Hoc Teamwork. In our review of theoretical models for describing ad hoc teamwork (AHT), we begin by discussing foundational works. Brafman & Tennenholtz (1996) pioneered the study of ad hoc teamwork by investigating the repeated matrix game with a single teammate. Subsequent contributions extended this line of inquiry to scenarios involving multiple teammates, as exemplified by Agmon & Stone (2012), who expanded the analysis to incorporate multiple teammates. Agmon et al. (2014) further relaxed assumptions by allowing teammates’ policies to be drawn from a known set. Stone et al. Stone & Kraus (2010) proposed collaborative multi-armed bandits, initially formalizing AHT but with notable assumptions, such as knowing teammates’ policies and environments. Albrecht & Ramamoorthy (2013) introduced the stochastic Bayesian game (SBG) as the first complete theoretical model for addressing dynamic environments and unknown teammates in AHT. Building upon the SBG, Rahman et al. (2021) proposed the open stochastic Bayesian game (OSBG) to address open ad hoc teamwork (OAHT). Zintgraf et al. (2021) modelled AHT as interactive Bayesian reinforcement learning (IBRL) in Markov games, focusing on solving non-stationary teammates’ policies within episodes. In contrast, Xie et al. (2021) introduced a hidden parameter Markov decision process (HiP-MDP) to address scenarios where teammates’ policies vary across episodes but remain stationary within each episode. In this paper, we contribute to the theoretical landscape of AHT by extending the coalitional affinity game (CAG) from the perspective of cooperative game theory, under the assumptions similar to SBG and OSBG. In more details, we introduce a novel theoretical model, referred to as Open Stochastic Bayesian Coalitional Affinity Game (OSB-CAG), shedding light on the interactive process between the learner and temporary teammates. This theoretical model can be seen as an extension of OSBG (see Appendix B), where the relationship between agents is conceptualized as a dynamic affinity graph in theory, moving beyond treating the graph solely as an implementation tool.444If the dynamic affinity graph is with no edges, the OSB-CAG will degrade to a plain OSBG. Our proposed solution concept, DVSC, provides a fresh perspective on how the learner can find optimal policies to attract temporary teammates for effective collaboration. Furthermore, we introduce a more specified transition function under our theoretical model in place of the one proposed by Rahman et al. (2021). The main benefit of our proposed transition function is that it enjoys a strong relationship to the underlying assumptions, and explicitly subsumes the concrete interactive process described by Rahman et al. (2021).
Algorithms for Ad Hoc Teamwork. We now review AHT from an algorithmic standpoint. The best response algorithm (Stone et al., 2009), initially proposed under the assumptions of a matrix game and well-known teammates’ policies, laid the foundation for algorithmic solutions in this domain. Extending this work, REACT (Agmon et al., 2014) emerged as a solution effective for matrices where teammates’ policies are drawn from a known set. Wu et al. (2011) introduced a novel approach using biased adaptive play to estimate teammates’ actions based on their historical actions. They combined this with Monte Carlo tree search to plan the ad hoc agent’s actions. HBA (Albrecht & Ramamoorthy, 2013) expanded the scope beyond matrix games, maintaining a probability distribution of predetermined agent types and maximizing long-term payoffs through an extended Bellman operator. PLASTIC-Policy (Barrett et al., 2017) addressed more realistic scenarios, such as RoboCup (Kalyanakrishnan et al., 2007), by training teammates’ policies through behavior cloning and the ad hoc agent’s policy through FQI (Ernst et al., 2005). AATEAM (Chen et al., 2020) extended PLASTIC-Policy, incorporating an attention network (Bahdanau et al., 2014) to enhance the estimation of unseen agent types. Rahman et al. (2021) integrated modern deep learning techniques, including GNNs and RL algorithms, into HBA to address open ad hoc teamwork (OAHT) and introduced GPL. ODITS (Gu et al., 2022) was proposed to handle teammates with rapidly changing behaviors under partial observability. In this paper, we introduce CIAO, a novel algorithm based on our proposed theory (OSB-CAG with DVSC as a solution concept). Specifically, CIAO extends the joint Q-value representation and training loss of GPL. Additionally, CIAO generalizes the implementation of training losses to various structures of the dynamic affinity graph, known as the coordination graph in GPL, with theoretical guarantees. This provides a design paradigm of training loss to facilitate the investigation of diverse dynamic affinity graph structures. This paradigm not only can cater for various scenarios of applications, but also can facilitate realizing the ideas inspired by other fields. Furthermore, we prove in theory and demonstrate in experiments that the existing GPL training loss is a viable approximation of the exact learning paradigm under our theory.
Relationship to Cooperative Multi-Agent Reinforcement Learning. Cooperative multi-agent reinforcement learning (MARL) primarily aims at training and controlling agents altogether to optimally achieve a shared goal. The key research topics are credit assignment (also known as value decomposition in some literature) (Foerster et al., 2018; Sunehag et al., 2018; Rashid et al., 2018), reward shaping (Du et al., 2019; Mguni et al., 2022), and communication (Foerster et al., 2016; Sukhbaatar et al., 2016; Jiang & Lu, 2018; Kim et al., 2019). In this paper, we shift the focus to AHT, where only one agent (referred to as learner) is controllable and trained to collaborate with an unknown set of uncontrollable agents to achieve a shared goal. Although the teammates’ behaviours in AHT can be influenced by the learner’s action (under assumption that they are capable of reacting to the learner’s action) (Mirsky et al., 2022), the joint policy may still be sub-optimal owing to either the reactivity of teammates or the effectiveness to attract teammates in implementation. On the other hand, a transferable utility game known as the convex game, belonging to cooperative game theory was introduced for employing Shapley value as a credit assignment scheme with theoretical guarantees and interpretation, to address credit assignment (Wang et al., 2020, 2022). In this paper, we introduce CAG, belonging to non-transferable utility games (a broader class including transferable utility games), for establishing a graph-based joint Q-value representation with theoretical guarantees and understandings to address OAHT.
Appendix B Open Stochastic Bayesian Game
We now review the open stochastic Bayesian game (OSBG) that describes the open ad hoc teamwork for establishing GPL (Rahman et al., 2021). It is defined as a tuple such that . is a set of all possible agents; is a set of states; is agent ’s action set; is a set of all possible agent types. Let the joint action set under a variable agent set be defined as that . Therefore, the joint action space under the variable number of agents is defined as that , while the joint agent-type space under the variable number of agents is defined as that . is the learner’s reward. is a transition function to describe the evolution of states and agents of variable types. The learner’s action value function is defined as follows:
where is a discount factor; is a state at timestep , is a joint action of teammates at timestep and is the learner ’s action at timestep ; is the learner’s stationary policy and is a joint policy of teammates ; is a joint Q-value. The learner’s policy is optimal, if and only if for all . The teammates’ joint policy is represented as that . The learner is unable to observe the teammates’ types and their policies, which can only be inferred through the history states and actions. The learner’s decision making is conducted by selecting the actions that maximize .
Appendix C Further Details of Implementation
Given the learner’s lack of knowledge about and , it is essential to discuss strategies for estimating these terms to achieve the convergence of Eq. (7). In the GPL framework, these two terms are implemented as the type inference model and the agent model, respectively. The implementation details are presented below.
C.1 GPL Framework
We now review the GPL’s empirical framework (Rahman et al., 2021). This framework consists of the following modules: the type inference model, the joint action value model and the agent model. We only summarize the model specifications. Note that while the original GPL framework is oriented towards a fixed coordination graph, specifically a complete graph, we relax this constraint to accommodate any graph structures as needed.
Type Inference Model. This is modelled as a LSTM (Hochreiter & Schmidhuber, 1997) to infer agent-types of a team at timestep given that of a team at timestep . The agent-type is modelled as a fixed-length hidden-state vector of LSTM, named as agent-type embedding. At each timestep , the state information of an emergent team is reproduced to a batch of agents’ information , where each agent is preserved a vector composing and which are observations and agent specific information extracted from state . Along with additional information such as the agent-type embedding of and the cell state, LSTM estimates the agent-type embedding of . To address the situation of changing team size, at each timestep the agent-type embedding of the agents who leave a team would be removed, while the new added agents’ agent-type embedding would be set to a zero vector.
Joint Action Value Model. The joint Q-value, denoted as , is approximated as the sum of the corresponding individual utilities, , and pairwise utilities, , based on the coordination graph structure. The approximation is expressed as follows:
Both and are implemented as multilayer perceptrons (MLPs) parameterised by and , denoted as and . The input of is the concatenation of the learner’s agent-type embedding and the teammate ’s agent-type embedding . Its output is a vector with a length of estimating . The detailed expression is shown as follows:
The pairwise utility is approximated by low-rank factorization, as follows:
where the input of is the same as ; the output of is a matrix with the shape and .
Agent Model. It is assumed that all other connected agents, as described by a coordination graph, would influence an agent’s actions. To model this situation, GNN is applied to process the agent-type embedding of a temporary team, denoted as , where each team member is represented as a node. More specifically, a GNN model called relational forward model (RFM) (Tacchetti et al., 2019) parameterised by is applied to transform (as the initial node representation) to (as the new node representation) considering other agents’ effects. Then, is employed to infer , as the approximation of teammates’ joint policy, . The detailed expression is as follows:
Learner’s Action Value Model. Substituting the agent model and the joint action value model defined above into Eq. (2), the learner’s Q-value for its own decision making is approximated as follows:
C.2 Overall Training Procedure of CIAO
We now summarize the overall training procedure of CIAO in Algorithm 1. Note that in the GPL framework, the type inference model is absorbed into the joint Q-value and the agent model as a LSTM, respectively. This construction aims to prevent these two models’ gradients from interfering against each other during training (Rahman et al., 2021).
Appendix D Assumptions
Assumption 1.
The following conditional independencies are assumed to hold in any distribution over the set of variables in an OSB-CAG: (1) ; (2) ; (3) ; (4) .
Assumption 1 indicates the assumptions encoding the relationships among random variables that are entailed by any probability distribution describing the open ad hoc teamwork process, referred to as conditional independencies (Koller & Friedman, 2009, Ch. 2).
As for conditional independence (1), it implies that the agent-types for the current timestep are conditionally independent of the related variables for the preceding timestep, given the agent set and the state for the current timestep. This is reflected by .
As for conditional independence (2), it implies that the agent set and the state for the current timestep is independent of the agent-types for the preceding timestep, given the variables for the preceding timestep. This is reflected by .
As for conditional independence (3), it implies that the agent set is independent of the joint action , given the state and the agent-type set for the same timestep. This is reflected by . Note that this condition coincides with scenarios encoded by Assumption 2, where the agent ’s policy is able to be varied across timesteps, and the policy is only correlated with its agent-type. In turn, this implies that an agent’s mind could be changed across timesteps, which is an evidence that open ad hoc teamwork is also suitable for modelling human-AI cooperation (Shneiderman, 2020; De Peuter & Kaski, 2023). However, for clarity and simplicity to introduce our theory, we assume in this paper that the policy is fixed (time invariant or stationary) across timesteps, as shown in Assumption 5.
As for conditional independence (4), it implies that an agent ’s agent-type for some timestep is conditionally independent of other agents and their agent-types , given itself denoted as and the state for that timestep. This is reflected by .
Assumption 2.
Suppose that for , where is the timestep when agent or leaves the environment, and for , where is the timestep when agent leaves the environment.
Assumption 2 introduces a metric to quantify the impact of agents leaving the environment. Essentially, it posits that an agent that has departed from the environment no longer exerts any influence on the remaining agents within the environment.
Assumption 2.
There exists an underlying agent-type set to generate ad hoc teammates in an environment which is unknown to the learner.
Assumption 2 provides a natural framework for describing the agent types of teammates. In scenarios where the agent type set is sufficiently large, traversing all possible agent types or compositions becomes impractical. Therefore, this assumption ensures that the generalizability of open ad hoc teamwork is not compromised.
Assumption 3.
Teammates can be influenced by the learner through its decision making.
Assumption 3 constitutes a fundamental and commonly assumed property essential for rationalizing the ad hoc teamwork problem. Often referred to as the reactivity of teammates (Barrett et al., 2017), this assumption posits that teammates must be capable of reacting to or being influenced by the learner. Without this interaction, the problem would regress to a scenario akin to a single-agent problem, where teammates merely function as moving ‘obstacles.’ To avert such a pathological situation, maintaining this assumption serves as a crucial boundary for ad hoc teamwork.
Assumption 4.
The agents stay in the environment at least for a period of timesteps.
Assumption 4 is a prerequisite ensuring the feasibility of completing arbitrary tasks. Without this condition, wherein an agent joining at a given timestep remains in the environment for a non-instantaneous duration, there would be minimal opportunity for teams of agents to react to and influence each other effectively.
Assumption 5.
Each teammate of an arbitrary agent type is equipped with a fixed policy.
Assumption 5 serves as a simplified condition for analyzing the learner’s convergence to the optimal policy. By assuming fixed policies for teammates, the Markov process becomes stationary from the learner’s perspective, facilitating a more tractable analysis of convergence dynamics. However, this can be further relaxed to cater for more realistic situations.
Appendix E Generalization of Preference Values for Coalitional Affinity Game
At the beginning, it is worth noting that in the original work of CAG (Brânzei & Larson, 2009), the definition of the preference value of an arbitrary agent is as follows:
(9) |
While the condition that each agent’s preference value of a coalition including only itself, equals zero, is convenient and straightforward for analysis, it imposes limitations on the representational capacity for various problems. To address this issue, we generalize the definition of the preference value function in Eq. (9) to the form as follows:
(10) |
The main difference between the definitions in Eq. (9) and Eq. (10) is that the preference value of the coalition only including a single agent is not forced to be zero in Eq. (10). Albeit that the results shown in the original work of CAG (Brânzei & Larson, 2009) are based on each agent’s original preference value function shown in Eq. (9), we can still generalize and leverage the results by conducting translation to each agent’s preference value function by its preference value of the coalition including itself, to align with condition of in Eq. (9). In more details, we can transform the newly defined preference value function in Eq. (10) as follows:
(11) |
Therefore, we can directly leverage the results from the previous work (Brânzei & Larson, 2009) by replacing with , and generalize the results to the newly defined preference value function in Eq. (10) by conducting the change of variables to the results according to Eq. (11).
The generalised preference value plays an important role of proving the results of OSB-CAG in the following sections.
Definition 4.
In a CAG with the generalised preference value function, for any agent , its preference value of the coalition including only itself is defined as that .
In the conventional definition of a coalition value function555The preference value function of an agent can be seen as a coalition value function specifically defined for the agent. in the cooperative game theory, the value of an empty set (empty coalition) is defined as zero (Chalkiadakis et al., 2022). In the context of a CAG, we can formally extend the domain of an agent ’s preference value function by considering the empty set such that . This extension can be interpreted as that an agent imagines a scenario where it is not included (with no incentives to join). If , it may lead to a paradox that an agent would choose to disappear from the environment (e.g. suicide) to escape independence, which is apparently opposite to morality and ethics. To avoid the paradox, it is reasonable to generalise an agent ’s preference value of the coalition including itself to only the non-negative range such that .
Appendix F Derivation Details of Definition 2
Definition 5.
We say that a blocking coalition weakly blocks a coalition structure if every agent weakly prefers to and there exists at least one agent who strictly prefers to . A coalition structure admitting no weakly blocking coalition , for some , is called inner stable.
Theorem 4 (Brânzei & Larson (2009)).
If a CAG is symmetric, then the social-welfare maximizing partition exhibits inner stability.
Theorem 4 directly holds for the newly defined in this paper, since it is irrelevant to the detailed representation (feasible domain) of a preference value function (see Theorem 2 and 5 in the previous work (Brânzei & Larson, 2009)).
Lemma 1.
If a CAG is symmetric, then maximizing the social welfare under a grand coalition results in strict core stability.
Proof.
F.1 Derivation of Dynamic Variational Strict Core
In an OSB-CAG, at any timestep , under an arbitrary state along with a temporary team (including the learner ), denoted as , and the temporary team’s joint action , the coalition reward can be equivalently expressed as a preference value of an agent belonging to a temporary team such that . The temporary team can be interpreted as the grand coalition at any timestep . Thereby, reaching the strict core stability at any timestep is equivalent to maximizing the social welfare at the timestep. Different from the previous work (Brânzei & Larson, 2009) that given the predetermined preference values, the coalition structure is as a decision variable to reach the strict core; in this paper, we predetermine a temporary team, as the target coalition structure, and the learner ’s action is as an extended decision variable to change the preference values (coalition rewards) in order to reach the variational strict core (VSC) that is defined with the same criterion as the strict core, but with different target variables as elements to form the solution set. The learner ’s action is generated by its policy . By Assumption 3, we can get that the learner’s action is able to influence teammates’ actions. Therefore, the teammates’ coalition rewards as an evaluation of their policies will also be varied accordingly. This explains that the learner’s action can be seen as a decision variable that is able to change teammates’ coalition rewards. By Lemma 1, if a dynamic affinity graph at timestep is symmetric, we can express the VSC for any timestep (under an arbitrary along with a temporary team , a joint agent type , the teammates’ policies with respect to their agent types and the state) to find the learner’s optimal action (rather than find a coalition structure in the previous work) as follows:
(12) |
Note that the strict core defined in Eq. (12) implicitly assumes that the teammates’ reaction is instantaneous (happening at the same timestep). Recall that our aim is to find the learner’s optimal stationary policy that generates actions across timesteps (in a long horizon), in order to influence the temporary teammates occurring at any timestep to collaborate (meeting the strict core stability). We now generalize the VSC defined in Eq. (12) by considering the process of generating states, teammates, agent types and teammates’ actions, named as dynamic variational strict core (DVSC). The DSVC is defined as follows:
(13) |
where and ; denotes the expectation that also implicitly depends on , .
Note that the VSC defined in Eq. (13) weakens the implicit assumption of the strict core defined in Eq. (12). In more details, it allows the teammates to react at the successor timesteps instead of the mandatory instantaneous reaction at the same timestep. Nevertheless, this requires that the learner has potential for adapting to the teammates (through interaction with teammates for a period). By Assumption 4 and 5, the learner’s adaption to the temporary teammates is possible.
Appendix G Mathematical Proofs
G.1 The Proof of Proposition 1
Proposition 1.
for can be expressed in terms of the following well-defined probability distributions: , for , and for .
Proof.
To ease the proof, we assume that and are discrete variables with no loss of generality. We prove that can be expressed as the probability distributions we have defined, as follows:
To complete the above proof, we need to further show the expression of as follows:
Apparently, we are required to prove that admits factorization into the probability distributions we have defined. We now conduct this by mathematical induction as follows:
Base case: As per the definition, is a predefined probability distribution to express for .
Induction case: Assume the induction hypothesis that admits factorization into the probability distributions we have defined, for any .
Next, we aim to prove that admits factorization into the probability distributions we have defined, based on the induction hypothesis, such that
where
Conclusion: is proved to admit factorization into the probability distributions we have defined for any . ∎
G.2 The Proof of Theorem 1
Theorem 5 (Brânzei & Larson (2009)).
In a CAG with an affinity graph , if for all , , then the grand coalition is in the strict core.
Lemma 2.
In a CAG with an affinity graph and the generalised preference value function , if the following conditions are satisfied such that
(14) |
then the grand coalition is in the strict core.
Proof.
Recall that we have generalised the preference value function in this paper (see Appendix E). Theorem 5 only holds for the case where the preference value function is defined as in Eq. (9). As a result, we first investigate the conditions that makes Theorem 5 still hold for the generalised preference value function in Eq. (10). As discussed before, we can transform the generalised preference value function to the feasible domain of the original preference value function by translation such that
It is apparent that the domain of is aligned with that of . Therefore, we can substitute for . Since Theorem 5 only considers the grand coalition, we can temporarily ignore the case of that . For any of , we can rewrite the expression as follows:
where
By the condition that , for , from Theorem 5, we can directly obtain the conditions to enable the grand coalition being in the strict core such that
(15) |
∎
Theorem 1.
In an OSB-CAG, for any dynamic affinity graph at any timestep , if there exists a joint action , for any agent , satisfying for any , then DVSC always exists.
Proof.
To avoid losing the generality, we consider an arbitrary dynamic affinity graph for a temporary team at an arbitrary timestep . For any state and any joint action , the affinity weight of any can be represented as a corresponding such that . Similarly, each agent ’s preference reward for the coalition including only itself can also be represented as a corresponding such that . Thereafter, we can apply Lemma 2 to the situation here at a single timestep . Substituting the above variables into Eq. (14) in Lemma 2, it is not difficult to observe that if for any state , there exists a joint action such that , then there always exists a satisfying the condition that , for all , for any state . Analogously, we can obtain the same results for all timesteps as above, which achieves the long-horizon objective as defined in the DVSC. Therefore, we can conclude that for any dynamic affinity graph at any timestep , if there exists a joint action , for any agent , satisfying for any , then the DVSC defined in Eq. (4) always exists. ∎
G.3 The Proof of Theorem 2
Lemma 3.
Under Assumption 2, it is valid to have the expressions that and , with the learner ’s policy .
Proof.
Suppose that agent or leaves the environment at timestep , then we can have the expression that by the condition in Assumption 2 that for if agent or leaves the environment at timestep as follows:
Similarly, by the condition in Assumption 2 that for if agent leaves the environment at timestep , we can derive the result that . ∎
Theorem 2.
Under Assumption 2, if , then the joint Q-value of the learner’s policy can be expressed as follows:
where and .
G.4 The Proof of the Conditions of Symmetry for Various Dynamic Affinity Graphs
Proposition 3.
For the learner and any teammate or , the constraints and , for any and , are necessary for a star dynamic affinity graph to be symmetric.
Proof.
Recall that a symmetric dynamic affinity graph needs to satisfy the following condition that , for all , for any state and any joint action . In the dynamic affinity graph as a star graph, the affinity weights of any or can be represented as follows:
It is not difficult to observe that for all and the following conditions that
are necessary for that the star dynamic affinity graph is symmetric. In more details, that is a necessary condition for the existence of the one-to-one correspondence that . ∎
Proposition 4.
For any two agents or , the constraints and , for any and , are necessary for the complete dynamic affinity graph to be symmetric.
Proof.
Recall that a symmetric dynamic affinity graph needs to satisfy the following condition that , for all , for any state and any joint action . In the dynamic affinity graph as a complete graph, the affinity weights of any can be represented as follows:
It is not difficult to observe that for all and the following conditions that
are necessary for that the complete dynamic affinity graph is symmetric. In more details, that is a necessary condition for the existence of the one-to-one correspondence that . ∎
G.5 The Proof of Theorem 3
Theorem 3.
Under Assumption 2 and an arbitrary learner’s deterministic stationary policy , the Bellman equation for the OSB-CAG with DVSC as a solution concept is expressed as follows: .
Proof.
We derive Eq. (6) as follows.
By the result of Theorem 2, we can represent the joint Q-value under an arbitrary learner’s deterministic stationary policy referred to as as follows:
(19) |
Next, we can expand the preference Q-value of each agent following the fashion of the Bellman equation such that
(20) |
Then, we can sum up Eq. (20) for all possible agents belonging to the temporary team and get an equation to evaluate the influence of the learner’s policy to a temporary team such that
(21) |
Note that Eq. (21) does not hold if , since it is problematic to expand the preference Q-value of an agent but at timestep , which can be seen as a singularity of this equation. More specifically, is impossible, given that at least , implying agent ’s preference for collaborating with other agents, at a timestep . ∎
Appendix H Experimental Settings
We evaluate our proposed CIAO in two existing environments, LBF and Wolfpack, both configured with open team settings (Rahman et al., 2021). In these settings, teammates are randomly selected to enter the environment and remain for a specified number of timesteps. If a teammate surpasses its allocated lifetime, it is removed from the environment and placed in a re-entry queue with a randomly assigned waiting time. The randomized re-entry queue results in varied compositions of teammates in a temporary team. When the number of agents in the environment does not reach its maximum, agents in the re-entry queue are introduced to the environment. Specifically, in the Wolfpack environment, we uniformly determine the active duration by selecting a value between 25 and 35 timesteps, while the dead duration is uniformly sampled between 15 and 25 timesteps. Conversely, the durations for LBF are somewhat shorter, with the active duration uniformly sampled between 15 and 25 timesteps, and the dead duration between 10 and 20 timesteps.
The teammate policies adhere to the experimental settings used for testing GPL (Rahman et al., 2021), which encompass a range of heuristic policies and pre-trained policies. Specifically, for Wolfpack, the teammate set includes the following agents: random agent, greedy agent, greedy probabilistic agent, teammate-aware agents, GNN-Based teammate-aware agents, graph DQN agents, greedy waiting agents, greedy probabilistic waiting agents, and greedy team-aware waiting agents. In the case of LBF, a combination of heuristics and A2C agents is employed as the teammate policy set. For more detailed information about teammate policies, we recommend referring to Appendix B.4 of GPL’s paper.
In our investigation of different agent-type sets within LBF experiments (see Appendix I.2), we deliberately exclude the A2C agent from the original agent-type set, thereby establishing a distinct agent-type subset. It’s crucial to acknowledge that the A2C agent provided by GPL is designed for scenarios with a maximum of 5 agents. Tailored to scenarios involving a greater number of agents, specifically up to 9, we undertake the additional step of training an A2C agent tailored to these expanded requirements.
In our experiments of studying the generalizability of CIAO, we constructed the agent-type sets for training and testing, respectively, for Wolfpack and LBF. The details are shown in Tab. 1.
Scenario Name | Training | Testing |
---|---|---|
Wolfpack-Int | GreedyPredatorAgent, GreedyProbabilisticAgent, TeammateAwarePredator, DistilledCoopAStarAgent, GraphDQNAgent | GraphDQNAgent, RandomAgent, GreedyWaitingAgent, GreedyProbabilisticWaitingAgent, TeammateAwareWaitingAgent |
Wolfpack-Exc | GreedyPredatorAgent, GreedyProbabilisticAgent, TeammateAwarePredator, DistilledCoopAStarAgent, GraphDQNAgent | RandomAgent, GreedyWaitingAgent, GreedyProbabilisticWaitingAgent, TeammateAwareWaitingAgent |
LBF-Int | H8, H7, H6, H5, A2C0 | A2C0, H1, H2, H3, H4 |
LBF-Exc | H8, H7, H6, H5, A2C0 | H1, H2, H3, H4 |
H.1 Detailed Hyperparameters and Computing Resources
We summarize the values of the common hyperparameters of algorithms that are used in our experiments, as shown in Tabs. 2 and 3. The optimizer we use during training is Adam (Kingma & Ba, 2014), with the default hyperparameters except learning rate. All algorithms in experiments are implemented in PyTorch (Paszke et al., 2019).
Hyperparameter | Value |
---|---|
lr | 0.00025 |
gamma | 0.99 |
max_num_steps | 1000000 |
eps_length | 200 |
update_frequency | 4 |
saving_frequency | 50 |
pair_comp | bmm |
num_envs | 16 |
tau | 0.001 |
eval_eps | 5 |
weight_predict | 1.0 |
num_players_train | 3 |
num_players_test | 5 for a maximum of 5 agents |
9 for a maximum of 9 agents | |
exclude_A2Cagent | True for the agent-type set excluding A2C agent |
False for the default agent-type sets | |
intersection_generalization | True for the agent-type sets for training and testing are intersected |
False for the default agent-type sets | |
exclusion_generalization | True for the agent-type sets for training and testing are mutually exclusive |
False for the default agent-type sets | |
seed | 0 |
eval_init_seed | 2500 |
Hyperparameter | Value |
---|---|
lr | 0.00025 |
gamma | 0.99 |
num_episodes | 4000 |
update_frequency | 4 |
saving_frequency | 50 |
pair_comp | bmm |
num_envs | 16 |
tau | 0.001 |
eval_eps | 5 |
weight_predict | 1.0 |
num_players_train | 3 |
num_players_test | 5 for a maximum of 5 agents |
9 for a maximum of 9 agents | |
intersection_generalization | True for the agent-type sets for training and testing are intersected |
False for the default agent-type sets | |
exclusion_generalization | True for the agent-type sets for training and testing are mutually exclusive |
False for the default agent-type sets | |
seed | 0 |
eval_init_seed | 2500 |
close_penalty | 0.5 |
Then, we list the exclusive hyperparameters of all algorithms implemented in this work, as shown in Tab. 4.
Algorithm | weight_regularizer | graph | pair_range | indiv_range |
---|---|---|---|---|
GPL | 0.0 | complete | free | free |
CIAO-S | 0.5 | star | pos | pos |
CIAO-S-NP | 0.5 | star | neg | pos |
CIAO-S-FI | 0.5 | star | pos | free |
CIAO-S-ZI | 0.5 | star | pos | zero |
CIAO-S-NI | 0.5 | star | pos | neg |
CIAO-C | 0.5 | complete | pos | pos |
CIAO-C-NP | 0.5 | complete | neg | pos |
CIAO-C-FI | 0.5 | complete | pos | free |
CIAO-C-ZI | 0.5 | complete | pos | zero |
CIAO-C-NI | 0.5 | complete | pos | neg |
All experiments have been run on Xeon Gold 6230 with 30 CPU cores and 30 GB primary memory. An experiment conducted on Wolfpack requires approximately 11 hours, whereas an experiment on LBF typically takes around 12 hours.
Appendix I Additional Experimental Results
I.1 Additional Evaluation on Small Number of Agents
We present a performance comparison between CIAO and GPL across various scenarios involving a maximum of 3 agents, as illustrated in Fig. 9. The results indicate comparable performances on LBF, while CIAO-S significantly outperforms the other algorithms in the Wolfpack scenario. This observation leads to the conclusion that the star graph structure is better suited for Wolfpack. The rationale behind this outcome is that, in instances with a small number of agents in Wolfpack, conveying the learner’s ’instructions’ through one teammate to another is less effective. This contrasts with the scenario depicted in Fig. 3(b), where a larger number of agents necessitates transmitting the learner’s instructions through an intermediary teammate. The consistency of these findings reinforces the argument for the star graph structure’s superiority in Wolfpack scenarios.
I.2 LBF with Agent-Type Sets Excluding A2C Agent
We extend our evaluation of CIAO to LBF considering the agent-type set without the agent-type trained by RL (A2C agent), as depicted in Fig. 10. A comparison between Fig. 10 and Fig. 3 leads to the conclusion that CIAO-S exhibits comparatively robust performance across different agent-type sets, whereas CIAO-C demonstrates robustness primarily in scenarios with a larger number of agents. The underlying reasons for CIAO-C’s limited robustness in situations with a small number of agents remain a topic for future investigation. Additionally, exploring the correlation between the performance of these algorithms in testing and RL-based agent-types is a valuable topic for further research.
I.3 Additional Ablation Study on LBF with Agent-Type Sets Excluding A2C Agent
We present a comprehensive performance comparison among CIAO-C, CIAO-S, and their respective ablation variants on LBF, excluding the A2C agent. Figs. 11 and 12 illustrate the results for CIAO-C and CIAO-S, respectively. In the majority of situations, our hypothesis regarding the non-negative individual utility range is validated. However, we note that the unregularized individual utility exhibits satisfactory performance but is prone to instability. Additionally, our theoretical expectation of a non-negative pairwise utility range is violated for CIAO-C in scenarios involving a maximum of 3 and 5 agents. The root cause of this deviation requires further investigation, suggesting a potential avenue for future research into dynamic affinity graph structures.
I.4 Additional Ablation Study on CIAO with No Regularizers
We conduct a performance comparison between CIAO and its ablation variant, excluding considerations of regularizers. In Fig. 13, the regularization losses during training are depicted, affirming the importance of incorporating regularizers. Notably, the effectiveness of regularizers is not consistently robust in the context of LBF, as shown in Figs. 14 and 15. Two potential explanations arise: (1) unique properties of the LBF environment may diminish the impact of regularizers, and (2) the regularization, driven by a sufficient condition to address DVSC as an RL problem, may lack consideration of other eligible conditions. The exploration of these possibilities is deferred to the future research.