Solving Multi-Agent Safe Optimal Control with Distributed Epigraph Form MARL
Solving Multi-Agent Safe Optimal Control with Distributed Epigraph Form MARL
Songyuan Zhang 1 2 , Oswin So 1 2 , Mitchell Black 3 , Zachary Serlin 3 and Chuchu Fan 2 Affiliation: 2 Department of Aeronautics and Astronautics, MIT, Cambridge, Massachusetts, USA Email: {szhang21, oswinso, chuchu}@mit.edu Affiliation: 3 MIT Lincoln Laboratory, Lexington, Massachusetts, USA Email: {mitchell.black, Zachary.Serlin}@ll.mit.edu
Abstract
Tasks for multi-robot systems often require the robots to collaborate and complete a team goal while maintaining safety. This problem is usually formalized as a constrained Markov decision process (CMDP), which targets minimizing a global cost and bringing the mean of constraint violation below a user-defined threshold. Inspired by real-world robotic applications, we define safety as zero constraint violation. While many safe multi-agent reinforcement learning (MARL) algorithms have been proposed to solve CMDPs, these algorithms suffer from unstable training in this setting. To tackle this, we use the epigraph form for constrained optimization to improve training stability and prove that the centralized epigraph form problem can be solved in a distributed fashion by each agent. This results in a novel centralized training distributed execution MARL algorithm named Def-MARL. Simulation experiments on 8 different tasks across 2 different simulators show that Def-MARL achieves the best overall performance, satisfies safety constraints, and maintains stable training. Real-world hardware experiments on Crazyflie quadcopters demonstrate the ability of Def-MARL to safely coordinate agents to complete complex collaborative tasks compared to other methods.[^1][^0]
多机器人系统任务常要求机器人协作完成团队目标并保持安全。该问题通常形式化为约束马尔可夫决策过程(CMDP),目标是最小化全局代价,并使约束违反的均值低于用户设定阈值。受真实机器人应用启发,我们将安全定义为零约束违反。已有许多安全多智能体强化学习(MARL)算法用于求解 CMDP,但在该设定下训练不稳定。为此,我们用约束优化的上图形式(epigraph form)提升训练稳定性,并证明中心化上图形式问题可由各智能体分布式求解。由此得到一种新颖的集中训练、分布执行(CTDE)MARL 算法 Def-MARL。在 2 个仿真器共 8 项任务上的实验表明,Def-MARL 综合表现最佳,满足安全约束且训练稳定。Crazyflie 四旋翼真机实验显示,相对其他方法,Def-MARL 能更安全地协调智能体完成复杂协作任务。[^1][^0]
I Introduction
I 引言
Multi-agent systems (MAS) play an integral role in our aspirations for a more convenient future with examples such as autonomous warehouse operations [37], large-scale autonomous package delivery [45], and traffic routing [76]. These tasks often require designing distributed policies for agents to complete a team goal collaboratively while maintaining safety. To construct distributed policies, multi-agent reinforcement learning (MARL) under the centralized training distributed execution (CTDE) paradigm [84, 25] has emerged as an attractive method. To incorporate the safety constraints, most MARL algorithms either choose to carefully design their objective function to incorporate soft constraints [69, 58, 79, 74, 54, 57], or model the problem using the constrained Markov decision process (CMDP) [3], which asks for the mean constraint violation to stay below a user-defined threshold [32, 38, 18, 41, 26, 90]. However, real-world robotic applications always require zero constraint violation. While this can be addressed by setting the constraint violation threshold to zero in the CMDP, in this setting the popular Lagrangian methods experience training instabilities which result in sharp drops in performance during training, and non-convergence or convergence to poor policies [66, 35, 24, 36].
多智能体系统(MAS)在我们对更便捷未来的设想中扮演关键角色,例如仓储自动化 [37]、大规模自主包裹配送 [45] 与交通路由 [76]。这些任务常需设计分布式策略,使智能体协作完成团队目标并保持安全。在集中训练、分布执行(CTDE)范式 [84, 25] 下,多智能体强化学习(MARL)成为构造分布式策略的有吸引力方法。为纳入安全约束,多数 MARL 算法要么精心设计目标以融入软约束 [69, 58, 79, 74, 54, 57],要么用约束马尔可夫决策过程(CMDP)[3] 建模,要求平均约束违反低于用户阈值 [32, 38, 18, 41, 26, 90]。但真实机器人应用往往要求零约束违反。虽可通过把 CMDP 阈值设为零来处理,此时流行的拉格朗日方法会出现训练不稳定:训练中性能骤降、不收敛或收敛到差策略 [66, 35, 24, 36]。
These concerns have been identified recently, resulting in a series of works that enforce hard constraints [82, 89, 66, 24, 86] using techniques inspired by Hamilton-Jacobi reachability [71, 44, 49, 46, 5] in deep reinforcement learning (RL) for the single-agent case and have been shown to improve safety compared to other safe RL approaches significantly. However, to the best of our knowledge, theories and algorithms for safe RL are still lacking for the multi-agent scenario, especially when policies are executed in a distributed manner. While single-agent RL methods can be directly applied to the MARL setting by treating the MAS as a centralized single agent, the joint action space grows exponentially with the number of agents, preventing these algorithms from scaling to scenarios with a large number of agents [33, 69, 23].
这些顾虑近来被指出,随之出现一系列在单智能体深度强化学习中用哈密顿–雅可比可达性启发的技术强制硬约束的工作 [82, 89, 66, 24, 86],显著提升了相对其他安全 RL 方法的安全性 [71, 44, 49, 46, 5]。但据我们所知,面向多智能体、尤其策略以分布式执行时的安全 RL 理论与算法仍不足。虽可把 MAS 当作中心化单智能体直接套用单智能体 RL,但联合动作空间随智能体数指数增长,难以扩展到大规模场景 [33, 69, 23]。
To tackle the problem of zero constraint violation in multi-agent scenarios with distributed policies[^2] while achieving high collaborative performance, we propose Distributed epigraph form MARL (Def-MARL) (). Instead of considering the CMDP setting, Def-MARL directly tackles the multi-agent safe optimal control problem (MASOCP), whose solution satisfies zero constraint violation. To solve the MASOCP, Def-MARL uses the epigraph form technique [10], which has previously been shown to yield better policies compared to Lagrangian methods in the single-agent setting [66]. To adapt to the multi-agent setting we consider in this work, we prove that the centralized epigraph form of MASOCP can be solved in a distributed fashion by each agent. Using this result, Def-MARL falls under the CTDE paradigm.
为在多智能体场景下以分布式策略[^2] 实现零约束违反并保持高协作性能,我们提出 Distributed epigraph form MARL(Def-MARL)。Def-MARL 不采用 CMDP 设定,直接求解多智能体安全最优控制问题(MASOCP),其解满足零约束违反。求解时使用上图形式技术 [10],该技术此前在单智能体设定中已被证明相对拉格朗日方法能得到更好策略 [66]。针对本文多智能体设定,我们证明 MASOCP 的中心化上图形式可由各智能体分布式求解;据此 Def-MARL 落入 CTDE 范式。
We validate Def-MARL using 8 different tasks from 2 different simulators, multi-particle environments (MPE) [40] and Safe Multi-agent MuJoCo [32], with varying numbers of agents, and compare its performance with existing safe MARL algorithms using the penalty and Lagrangian methods. The results suggest that Def-MARL achieves the best performance while satisfying safety: it is as safe as conservative baselines that achieve high safety but sacrifice performance, while matching the performance of unsafe baselines that sacrifice safety for high performance. In addition, while the baseline methods require different choices of hyperparameters to perform well in different environments and suffer from unstable training because of zero constraint violation threshold, Def-MARL is stable in training using the same hyperparameters across all environments, indicative of the algorithm’s robustness to environmental changes.
我们在多智能体粒子环境(MPE)[40] 与 Safe Multi-agent MuJoCo [32] 两个仿真器共 8 项、智能体数量不等的任务上验证 Def-MARL,并与采用惩罚与拉格朗日方法的现有安全 MARL 算法比较。结果表明 Def-MARL 在满足安全的同时取得最佳性能:安全性可比肩高安全但牺牲性能的保守基线,性能又可匹敌牺牲安全换高性能的激进基线。此外,基线常需为不同环境挑选不同超参,且因零违反阈值而训练不稳;Def-MARL 在全部环境用同一套超参即可稳定训练,体现对环境变化的鲁棒性。
We also perform real-world hardware experiments using the Crazyflie (CF) drones [27] on two complex collaborative tasks and compare Def-MARL with both centralized and decentralized model predictive control (MPC) methods [29]. The results indicate that Def-MARL finishes the tasks with safety rates and success rates, while the MPC methods get stuck in local minima or have unsafe behaviors.
我们还在 Crazyflie(CF)无人机 [27] 上做两项复杂协作真机实验,并与中心化/去中心化模型预测控制(MPC)[29] 比较。结果表明 Def-MARL 以 安全率与成功率完成任务,而 MPC 方法易陷局部最小或不安全行为。
To summarize, our contributions are presented below:
总结而言,本文贡献如下:
- • Drawing on prior work that addresses the training instability of Lagrangian methods in the zero-constraint violation setting, we extend the epigraph form method from single-agent RL to MARL, improving upon the training instability of existing MARL algorithms.
- • 借鉴先前针对零约束违反设定下拉格朗日方法训练不稳的工作,我们将上图形式方法从单智能体 RL 扩展到 MARL,改善现有 MARL 算法的训练稳定性。
- • We present theoretical results showing that the outer problem of the epigraph form can be decomposed and solved in a distributed manner during online execution. This allows Def-MARL to fall under the CTDE paradigm.
- • 我们给出理论结果:上图形式的外层问题可在在线执行时分解并由各智能体分布式求解,从而使 Def-MARL 落入 CTDE 范式。
- • We illustrate through extensive simulations that, without any hyperparameter tuning, Def-MARL achieves stable training and is as safe as the most conservative baseline while simultaneously being as performant as the most aggressive baseline across all environments.
- • 大量仿真表明,无需调超参,Def-MARL 即可稳定训练,并在全部环境中同时达到最保守基线的安全性与最激进基线的性能。
- • We demonstrate on Crazyflie drones in hardware that Def-MARL can safely coordinate agents to complete complex collaborative tasks. Def-MARL performs the task better than centralized/decentralized MPC methods and does not get stuck in suboptimal local minima or exhibit unsafe behaviors.
- • 我们在 Crazyflie 真机上展示 Def-MARL 可安全协调智能体完成复杂协作;相对中心化/去中心化 MPC,表现更好,且不易陷次优局部最小或不安全行为。
II Related work
II 相关工作
Unconstrained MARL. Early works that approach the problem of safety for MARL focus on navigation problems and collision avoidance [14, 13, 21, 64], where safety is achieved by a sparse collision penalty [39], or a shaped reward penalizing getting close to obstacles and neighboring agents [14, 13, 21, 64]. However, adding a penalty to the reward function changes the original objective function, so the resulting policy may not be optimal for the original constraint optimization problem. In addition, the satisfaction of collision avoidance constraints is not necessarily guaranteed by even the optimal policy [47, 21, 39].
无约束 MARL。 早期面向 MARL 安全的工作聚焦导航与避碰 [14, 13, 21, 64],通过稀疏碰撞惩罚 [39],或惩罚靠近障碍与邻智能体的塑形奖励 [14, 13, 21, 64] 实现安全。但把惩罚加进奖励会改变原目标,所得策略未必是原约束优化问题的最优解;即便最优策略也不一定保证满足避碰约束 [47, 21, 39]。
Shielding for Safe MARL. One popular method that provides safety to learning-based methods is using shielding or a safety filter [25]. Here, an unconstrained learning method is paired with a shield or safety filter using techniques such as predictive safety filters [88, 50], control barrier functions [11, 55], or automata [19, 77, 48, 7]. Such shields are often constructed before the learning begins and are used to modify either the feasible actions or the output of the learned policy to maintain safety. One benefit is that safety can be guaranteed during both training and deployment since the shield is constructed before training. However, they require domain expertise to build a valid shield, which can be challenging in the single-agent setting and even more difficult for MAS [25]. Other methods can automatically synthesize shields but face scalability challenges [48, 20]. Another drawback is that the policy after shielding might not consider the same objective as the original policy and may result in noncollaborative behaviors or deadlocks [56, 85, 87].
安全 MARL 的屏蔽。 为学习方法提供安全的流行做法是使用屏蔽或安全滤波器 [25]:无约束学习方法搭配预测安全滤波器 [88, 50]、控制障碍函数 [11, 55] 或自动机 [19, 77, 48, 7] 等构造的屏蔽,在学习开始前建好,用于修改可行动作或所学策略输出以保持安全。优点是训练与部署期都可保证安全;但构建有效屏蔽需要领域专长,单智能体已难,MAS 更甚 [25]。也有自动综合屏蔽的方法,但面临可扩展性挑战 [48, 20]。另一缺点是屏蔽后策略可能不再对应原目标,导致非协作行为或死锁 [56, 85, 87]。
Constrained MARL. In contrast to unconstrained MARL methods, which change the constraint optimization problem to an unconstrained problem, constrained MARL methods explicitly solve the CMDP problem. For the single-agent case, prominent methods for solving CMDPs include primal methods [78], primal-dual methods using Lagrange multipliers [8, 70, 35, 36], and trust-region-based approaches [1, 35]. These methods provide guarantees either in the form of asymptotic convergence guarantees to the optimal (safe) solution [8, 70] using stochastic approximation theory [59, 9], or recursive feasibility of intermediate policies [1, 60] using ideas from trust region optimization [61]. The survey [31] provides an overview of the different methods of solving safety-constrained single-agent RL. In multi-agent cases, however, the problem becomes more difficult because of the non-stationary behavior of other agents, and similar approaches have been presented only recently [32, 38, 18, 41, 26, 90, 15]. However, the CMDP setting they handle makes it difficult for them to handle hard constraints, and results in poor performance with zero constraint violation threshold [24].
约束 MARL。 与把约束问题改成无约束问题的做法不同,约束 MARL 显式求解 CMDP。单智能体侧,主要方法包括原方法 [78]、用拉格朗日乘子的原–对偶方法 [8, 70, 35, 36] 以及基于信任域的方法 [1, 35]。它们或借助随机逼近理论给出渐近收敛到最优(安全)解的保证 [8, 70, 59, 9],或借助信任域优化思想保证中间策略递归可行 [1, 60, 61]。综述 [31] 概述了安全约束单智能体 RL 的各类方法。多智能体情形因其他智能体非平稳而更难,类似方法近年才出现 [32, 38, 18, 41, 26, 90, 15]。但其所处理的 CMDP 设定难以应对硬约束,在零违反阈值下表现较差 [24]。
Model predictive control. Distributed MPC methods have been proposed to handle MAS, incorporating multi-agent path planning, machine learning, and distributed optimization [75, 72, 92, 22, 42, 16, 52]. However, the solution quality of nonlinear optimizers used to solve MPC when the objective function and constraints are nonlinear highly depends on the initial guess [73, 29]. Moreover, the real-time nonlinear optimizers typically require access to (accurate) first and second-order derivatives [53, 29], which present challenges when trying to solve tasks that have non-differentiable or discontinuous cost functions and constraints such as the ones we consider in this work.
模型预测控制。 已有分布式 MPC 用于 MAS,融合多智能体路径规划、机器学习与分布式优化 [75, 72, 92, 22, 42, 16, 52]。但当目标与约束非线性时,求解 MPC 的非线性优化器解质量高度依赖初值猜测 [73, 29];实时非线性优化器通常还需(准确的)一、二阶导数 [53, 29],对本文这类含不可微或间断代价与约束的任务构成挑战。
III Problem setting and preliminaries
III 问题设定与预备知识
III-A Multi-agent safe optimal control problem
III-A 多智能体安全最优控制问题
We consider the multi-agent safe optimal control problem (MASOCP) as defined below. Consider a homogeneous MAS with agents. At time step , the global state and control input are given by and , respectively. The global control vector is defined by concatenation , where is the control input of agent . We consider the general nonlinear discrete-time dynamics for the MAS:
我们考虑如下定义的多智能体安全最优控制问题(MASOCP)。设同质 MAS 有 个智能体。时刻 的全局状态与控制输入分别为 、。全局控制由拼接定义 ,其中 为智能体 的控制。我们考虑 MAS 的一般非线性离散时间动力学:
where is the global dynamics function. We consider the partially observable setting, where each agent has a limited communication radius and can only communicate with other agents or observe the environment within its communication region. Denote as the vector of the information observed by agent at the time step , where is an encoding function of the information shared from neighbors of agent and the observed data of the environment. We allow multi-hop communication between agents, so an agent may communicate with another agent outside its communication region if a communication path exists between them.
其中 为全局动力学。我们考虑部分可观测设定:每个智能体有通信半径 ,只能与通信区域内的其他智能体通信或观测环境。记 为智能体 在时刻 观测到的信息向量, 编码来自邻居的共享信息与环境观测。我们允许多智能体间多跳通信,因而若存在通信路径,智能体也可与通信半径外的智能体通信。
Let the avoid/unsafe set of agent be , for some function . The global avoid set is then defined as , where . In other words, . Given a global cost function describing the task for the agents to accomplish[^3], we aim to find distributed control policies such that starting from any given initial states , the policies keep the agents outside the avoid set and minimize the infinite horizon cost. In other words, denoting as the joint policy such that , we aim to solve the following infinite-horizon MASOCP for a given initial state :
令智能体 的避免/不安全集为 ,其中 。全局避免集定义为 ,其中 。换言之,。给定描述任务的全局代价 [^3],我们希望找到分布式控制策略 ,使得从任意给定初态 出发,策略使智能体保持在避免集 之外并最小化无限时域代价。记联合策略 满足 ,即对给定初态 求解如下无限时域 MASOCP:
Note that the safety constraint (2b) differs from the average constraints considered in CMDPs [3]. Consequently, instead of allowing safety violations to occur as long as the mean constraint violation is below a threshold, this formulation disallows any constraint violation. From hereon, we omit the dynamics constraint (2c) for conciseness.
注意安全约束 (2b) 不同于 CMDP 中考虑的平均约束 [3]。因此,该表述不允许任何约束违反,而不是只要平均违反低于阈值即可。下文为简洁起见省略动力学约束 (2c)。
III-B Epigraph form
III-B 上图形式
Existing methods are unable to solve (2) well. This has been observed previously in the single-agent setting [82, 89, 66, 24]. We show later that the poor performance of methods that tackle the CMDP setting to the constrained problem (2) also translates to the multi-agent setting, as we observe a similar phenomenon in our experiments (Section V). Namely, although unconstrained MARL can be used to solve (2) using the penalty method [51], this does not perform well in practice, where a small penalty results in policies that violate constraints, and a large penalty results in higher total costs. The Lagrangian method [32] can solve the problem theoretically, but it suffers from unstable training and has poor performance in practice when the constraint violation threshold is zero [66, 24]. In this section, we introduce a new method of solving (2) that can mitigate the above problems by extending prior work [66] to the multi-agent setting.
现有方法难以很好求解 (2)。单智能体设定中已有观察 [82, 89, 66, 24]。我们后文表明,把面向 CMDP 的方法套到约束问题 (2) 上的不良表现也会传递到多智能体设定,实验中可见类似现象(第 V 节)。具体地,虽可用惩罚法 [51] 以无约束 MARL 求解 (2),实践中表现不佳:惩罚过小则违约束,过大则总代价升高。拉格朗日方法 [32] 理论上可解,但在零违反阈值时训练不稳、实践表现差 [66, 24]。本节介绍一种通过把先前工作 [66] 扩展到多智能体来缓解上述问题的新求解途径。
Given a constrained optimization problem with objective function (e.g., as in (2a)), and constraints (e.g., (2b)):
给定目标函数为 (例如 (2a) 中 )、约束为 (例如 (2b))的约束优化问题:
its epigraph form [10] is given as
其上图形式 [10] 为
where is an auxiliary variable. In other words, we add a constraint to enforce as an upper bound of the cost , then minimize . The solution to (4) is identical to the original problem (3) [10]. Furthermore, (4) is equivalent [66] to
其中 为辅助变量。换言之,增加约束使 成为代价 的上界,再最小化 。(4) 的解与原问题 (3) 相同 [10]。进一步地,(4) 等价于 [66]
As a result, the original constrained problem (3) is decomposed into the following two subproblems:
于是原约束问题 (3) 分解为如下两个子问题:
- An unconstrained inner problem (5b), where, given an arbitrary desired cost upper bound , we find such that is minimized, i.e., best satisfies the constraints and .
- 无约束内层问题 (5b):给定任意期望代价上界 ,寻找使 最小的 ,即尽可能满足 与 。
- A -dimensional constrained outer problem (5a) over , which finds the smallest cost upper bound such that is indeed a cost upper bound ( and the constraints of the original problem holds.
- 关于 的一维约束外层问题 (5a):寻找最小的代价上界 ,使 确为代价上界()且原问题约束 成立。
Comparison with the Lagrangian method. Another popular way to solve MASOCP (2) is the Lagrangian method [32]. However, it suffers from unstable training when considering the zero constraint violation [66, 35] setting. More specifically, this refers to the case with constraints for non-negative. Since can be negative, we can convert our problem setting (3) to the zero constraint violation setting by taking . Then, (3) reads as
与拉格朗日方法的比较。 求解 MASOCP (2) 的另一流行途径是拉格朗日方法 [32],但在零约束违反设定下训练不稳 [66, 35]。具体指约束形如 且 非负的情形。由于 可为负,可取 把问题设定 (3) 转到零违反设定。于是 (3) 写为
The Lagrangian form of (6) is then
于是 (6) 的拉格朗日形式为
where is the Lagrangian multiplier and is updated with gradient ascent. However, , so continuously increases and never decreases. As scales linearly in when for some , a large value of causes a large gradient w.r.t , and makes the training unstable. Note that for the epigraph form, since does not multiply with the cost function but is added to in (5b), the gradient does not scale with the value of resulting in more stable training. We validate this in our experiments (Section V).
其中 为拉格朗日乘子,用梯度上升更新。然而 ,故 只增不减。当某些 上 时, 随 线性放大,过大的 使相对策略的梯度过大,训练不稳。对上图形式, 在 (5b) 中是加到 上而非与代价相乘,因而 不随 放大,训练更稳。我们在实验(第 V 节)中验证了这一点。
IV Distributed epigraph form multi-agent reinforcement learning
IV 分布式上图形式多智能体强化学习
In this section, we propose the Distributed epigraph form MARL (Def-MARL) algorithm to solve MASOCP (2) using MARL. First, we transfer MASOCP (2) to its epigraph form with an auxiliary variable to model the desired cost upper bound. The epigraph form includes an inner problem and an outer problem. For distributed execution, we provide a theoretical result that the outer problem can be solved distributively by each agent. This allows Def-MARL to fit the CTDE paradigm, where in centralized training, the agents’ policies are trained together given the desired cost upper bound , and in distributed execution, the agents distributively find the smallest cost upper bound that ensures safety.
本节提出用 MARL 求解 MASOCP (2) 的 Distributed epigraph form MARL(Def-MARL)算法。首先把 MASOCP (2) 写成带辅助变量 (期望代价上界)的上图形式,包含内层与外层问题。为支持分布式执行,我们给出理论结果:外层问题可由各智能体分布式求解。于是 Def-MARL 符合 CTDE:集中训练时在给定代价上界 下联合训练各智能体策略;分布执行时各智能体分布式寻找保证安全的最小代价上界 。
IV-A Epigraph form for MASOCP
IV-A MASOCP 的上图形式
To rewrite MASOCP (2) into its epigraph form (5), we first define the cost-value function for a joint policy using the standard optimal control notation [6]:
为把 MASOCP (2) 写成上图形式 (5),先用标准最优控制记号 [6] 定义联合策略 的代价价值函数 :
We also define the constraint-value function as the maximum constraint violation:
同时把约束价值函数 定义为最大约束违反:
Here, we interchange the to define the local per-agent functions . Each uses only the agent’s local observation and thus is distributed. We now introduce the auxiliary variable for the desired upper bound of , allowing us to restate (2) concisely as
这里交换 以定义局部按智能体的函数 。每个 仅用智能体局部观测,因而是分布式的。引入期望上界 的辅助变量 后,可将 (2) 简洁重述为
The epigraph form (5) of (10) then takes the form
于是 (10) 的上图形式 (5) 写为
By interpreting the left-hand side of (11b) as a new policy optimization problem, we define the total value function as the objective function to (11b). This can be simplified as
把 (11b) 左侧解释为新的策略优化问题,我们定义总价值函数 作为 (11b) 的目标。可简化为
Again, we interchange the to define as the per-agent total value function. Using this to rewrite (11) then yields
再次交换 ,定义按智能体总价值 。据此重写 (11) 得到
This decomposes the original problem (2) into an unconstrained inner problem (13b) over policy and a constrained outer problem (13a) over . During offline training, we solve the inner problem (13b): for parameter , find the optimal policy to minimize . Note that the optimal policy of the inner problem depends on . During execution, we solve the outer problem (13a) online to get the minimal that satisfies constraint (13b). Using this in the -conditioned policy found in the inner problem gives us the optimal policy for the overall epigraph form MASOCP (EF-MASOCP).
这将原问题 (2) 分解为关于策略 的无约束内层问题 (13b) 与关于 的约束外层问题 (13a)。离线训练时求解内层 (13b):对参数 ,找最优策略 以最小化 ;注意最优策略依赖 。执行时在线求解外层 (13a) 得到满足约束 (13b) 的最小 ;把该 代入内层得到的 -条件策略 ,即得到整体上图形式 MASOCP(EF-MASOCP)的最优策略。
Fig. 1: Def-MARL algorithm. Randomly sampled initial states and are used to collect trajectories in and using the current policy . In the centralized training (orange blocks), distributed constraint-value functions and policies and a centralized cost-value function are jointly trained. During distributed execution (green blocks), the distributed are used to solve the outer problem (15b) to compute the optimal , which is used in each agent’s -conditioned policy.
图 1:Def-MARL 算法。 用随机采样的初态与 ,在当前策略 下采集 与 轨迹。集中训练(橙色块)中,联合训练分布式约束价值函数 、策略 与中心化代价价值函数 。分布执行(绿色块)中,用分布式 求解外层问题 (15b) 得到最优 ,再送入各智能体的 -条件策略。
To solve the inner problem (13b), the total value function must be amenable to dynamic programming, which we show in the following proposition.
为求解内层 (13b),总价值 须适合动态规划,如下命题所示。
Proposition 1
Dynamic programming can be applied to EF-MASOCP (13), resulting in
命题 1
动态规划可用于 EF-MASOCP (13),得到
The proof of 1 is provided in Appendix A following the proof of the single-agent version [66]. In other words, for a given cost upper bound , the value function at the current state can be computed using the value function at the next state but with a different cost upper bound which itself is a function of . This can be interpreted as a “dynamics” for the cost upper bound . Intuitively, if we wish to satisfy the upper bound but suffer a cost , then the upper bound at the next time step should be smaller by so that the total cost from remains upper bounded by . Additional discussion on 1 is provided in Appendix C.
命题 1 的证明见附录 A,沿用单智能体版本的证明 [66]。换言之,给定代价上界 ,当前状态 的价值可用下一状态 的价值计算,但代价上界变为 ,其本身是 的函数。这可解释为代价上界 的一种“动力学”:若希望满足上界 却已付出代价 ,则下一时刻上界应减小同样数量,以使从 起的总代价仍被 上界约束。关于命题 1 的更多讨论见附录 C。
Remark 1(Effect of on the learned policy)
From (12), for a fixed and , observe that for large enough (i.e., is small enough), we have . Consequently, taking a gradient step on equals taking a gradient step on , which reduces the constraint violation. Otherwise, . Taking gradient steps on equals taking gradient steps on , which reduces the total cost.
注 1( 对所学策略的影响)
由 (12),对固定 与 ,当 足够大(即 足够小)时,。因而对 做梯度步等价于对 做梯度步,从而减小约束违反。否则 ,对 做梯度步等价于对 做梯度步,从而减小总代价。
IV-B Solving the inner problem using MARL
IV-B 用 MARL 求解内层问题
Following So and Fan 2023, we solve the inner problem using centralized training with proximal policy optimization (PPO) [63]. We use a graph neural network (GNN) backbone for the -conditioned policy , cost-value function , and the constraint-value function with parameters , , and , respectively. Note that other neural network (NN) structures can be used as well. The implementation details are introduced in Appendix E.
沿用 So 与 Fan 2023,我们用近端策略优化(PPO)[63] 做集中训练以求解内层问题。-条件策略 、代价价值 与约束价值 均以图神经网络(GNN)为骨干,参数分别为 、、;也可使用其他神经网络结构。实现细节见附录 E。
Policy and value function updates. During centralized training, the NNs are trained to solve the inner problem (13b), i.e., for a randomly sampled , find policy that minimizes the total value function . We follow MAPPO [80] to train the NNs. Specifically, when calculating the advantage with the generated advantage estimation (GAE) [62] for the -th agent, [63], instead of using the cost function [80], we apply the decomposed total value function . We perform trajectory rollouts following the dynamics for (1) and (14) using the learned policy , starting from random sampled and . After collecting the trajectories, we train the cost-value function and the constraint-value function via regression and use the PPO policy loss to update the -conditioned policy .
策略与价值函数更新。 集中训练时,神经网络用于求解内层 (13b):对随机采样的 ,找最小化总价值 的策略 。我们按 MAPPO [80] 训练。具体地,用广义优势估计(GAE)[62] 计算第 个智能体优势 [63] 时,不用代价函数 [80],而用分解后的总价值 。从随机采样的 、 出发,用所学策略 按 动力学 (1) 与 动力学 (14) 做轨迹 rollout;收集轨迹后,用回归训练 与 ,并用 PPO 策略损失更新 -条件策略 。
(a) Target
IV-C Solving the outer problem during distributed execution
IV-C 分布执行时求解外层问题
During execution, we solve the outer problem of EF-MASOCP (13) online. However, the outer problem is still centralized because the constraint (13b) requires the centralized cost-value function . To achieve a distributed policy during execution, we introduce the following theoretical result:
执行时我们在线求解 EF-MASOCP (13) 的外层问题。但外层仍是中心化的,因为约束 (13b) 需要中心化代价价值 。为在执行期得到分布式策略,我们引入如下理论结果:
Theorem 1
Assume no two unique values of achieves the same unique cost. Then, the outer problem of EF-MASOCP (5a) is equivalent to the following:
定理 1
假设不存在两个不同的 取得相同的唯一代价。则 EF-MASOCP 外层问题 (5a) 等价于:
$$\displaystyle z \ \displaystyle=\max_{i}z_{i} \ \displaystyle\begin{split}z_{i}&=\min_{z^{\prime}}\quad z^{\prime}\
&\hskip 16.00008pt\mathrm{s.t.}\quad V_{i}^{h}(o_{i};\pi(\cdot,z^{\prime}))\leq 0,\quad i=1,\cdots,N.\end{split} \tag{15a}$$
The proof is provided in Appendix B. 1 enables computing without the use of the centralized during execution. Specifically, each agent solves the local problem (15b) for , which is a 1-dimensional optimization problem and can be efficiently solved using root-finding methods (e.g., [12]) as in [66], then communicates among the other agents to obtain the maximum (15a). One challenge is that this maximum may not be computable if the agents are not connected. However, in our problem setting, if one agent is not connected, it does not appear in the observations of other connected agents. Therefore, it would not contribute to the constraint-value function of other agents. As a result, it is sufficient for only the connected agents to communicate their . Furthermore, we observe experimentally that the agents can achieve low cost while maintaining safety even if is not communicated (see Section V-C). Thus, we do not include communication for our method. The overall framework of Def-MARL is provided in Figure 1.
证明见附录 B。定理 1 使得执行期可不使用中心化 来计算 。具体地,每个智能体 求解局部问题 (15b) 得到 (一维优化,可用求根方法高效求解,例如 [12],同 [66]),再与其他智能体通信 以取最大 (15a)。挑战在于:若智能体不连通,该最大值可能算不出。但在我们的问题设定中,若某智能体不连通,它不会出现在其他已连通智能体的观测 中,因而不会贡献于其他智能体的约束价值 ;因此只需已连通智能体通信其 即可。此外实验观察到,即使不通信 ,智能体仍可在保持安全的同时取得低代价(见第 V-C 节),故本方法不纳入 通信。Def-MARL 整体框架见图 1。
图 3:改进 MPE()与 Safe Multi-agent MuJoCo 上的比较。Def-MARL 在全部环境中始终最接近左上角,以接近 的安全率取得低代价。圆点为均值,误差棒为一倍标准差。
Dealing with estimation errors. Since there may be errors estimating using NN, we can reduce the resulting safety violation by modifying to add a buffer region. Specifically, for a constant , we modify such that when the constraints are violated and otherwise. We then modify (15b) to , where is a hyperparameter (where we want to emphasize more on safety). This makes more robust to estimation errors of . We study the importance of in Section V-C.
处理估计误差。 用神经网络估计 可能有误差,可通过修改 增加缓冲带来降低安全违反。具体地,对常数 ,使违反约束时 、否则 ;再把 (15b) 改为 ,其中 为超参(希望 以更强调安全)。这使 对 估计误差更鲁棒。我们在第 V-C 节研究 的重要性。
V Simulation experiments
V 仿真实验
In this section, we design simulation experiments to answer the following research questions:
本节设计仿真实验以回答以下研究问题:
(Q1): Does Def-MARL satisfy the safety constraints and achieve low cost with constant hyperparameters across all environments?
(Q1): Def-MARL 能否在固定超参下满足安全约束并取得低代价?
(Q2): Can Def-MARL achieve the global optimum of the original constrained optimization problem?
(Q2): Def-MARL 能否达到原约束优化问题的全局最优?
(Q3): How stable is the training of Def-MARL?
(Q3): Def-MARL 的训练稳定性如何?
(Q4): How well does Def-MARL scale to larger MAS?
(Q4): Def-MARL 对更大规模 MAS 的扩展性如何?
(Q5): Does the learned policy from Def-MARL generalize to larger MAS?
(Q5): Def-MARL 所学策略能否泛化到更大规模 MAS?
Details for the implementation, environments, and hyperparameters are provided in Appendix E.
实现、环境与超参细节见附录 E。
V-A Setup
V-A 设置
Environments. We evaluate Def-MARL in two sets of simulation environments: modified Multi-agent Particle Environments (MPE) [40], and Safe Multi-agent MuJoCo environments [32] (see Figure 2). In MPE, the agents are assumed to have double integrator dynamics with bounded continuous action spaces . We provide the full details of all tasks in Appendix E. To increase the difficulty of the tasks, we add static obstacles to these environments. For Safe Multi-agent MuJoCo environments, we consider Safe HalfCheetah 2x3 and Safe Coupled HalfCheetah 4x3. The agents must collaborate to make the cheetah run as fast as possible without colliding with a moving wall in front. To design the constraint function , we let in all our experiments and when solving the outer problem.
环境。 我们在两套仿真环境中评估 Def-MARL:改进的多智能体粒子环境(MPE)[40],以及 Safe Multi-agent MuJoCo [32](见图 2)。MPE 中智能体为双积分器动力学,动作为有界连续空间 。全部任务细节见附录 E。为增加难度,我们在这些环境中加入 个静态障碍。Safe Multi-agent MuJoCo 中考虑 Safe HalfCheetah 2x3 与 Safe Coupled HalfCheetah 4x3;智能体须协作使猎豹尽量快跑且不与前方移动墙碰撞。设计约束函数 时,全部实验取 ,求解外层时取 。
Baselines. We compare our algorithm with the state-of-the-art (SOTA) MARL algorithm InforMARL [51] with a constraint-penalized cost , where is a penalty parameter, and denote this baseline as Penalty(). We also consider the SOTA safe MARL algorithm MAPPO-Lagrangian [30, 32][^4]. In addition, because the learning rate of the Lagrangian multiplier is tiny () in the official implementation of MAPPO-Lagrangian [32], the value of during training will be largely determined by the initial value of . We thus consider two . Moreover, to compare the training stability, we consider increasing the learning rate of in MAPPO-Lagrangian to .[^5] For a fair comparison, we reimplement MAPPO-Lagrangian using the same GNN backbone as used in Def-MARL and InforMARL, denoted as Lagr() and Lagr(lr) for the increased learning rate one. We run each method for the same number of update steps, which is large enough for all the methods to converge.
基线。 我们与约束惩罚代价 下的 SOTA MARL 算法 InforMARL [51] 比较,,记为 Penalty()。另考虑 SOTA 安全 MARL 算法 MAPPO-Lagrangian [30, 32][^4]。由于官方实现 [32] 中拉格朗日乘子 的学习率极小(),训练中 很大程度上由初值 决定;我们考虑 。为比较训练稳定性,还将 MAPPO-Lagrangian 中 学习率提高到 。[^5]公平起见,我们用与 Def-MARL、InforMARL 相同的 GNN 骨干重实现 MAPPO-Lagrangian,记为 Lagr() 与提高学习率的 Lagr(lr)。各方法更新步数相同,且足够使全部方法收敛。
(a) Def-MARL (ours)
(a) Def-MARL(本文)
图 5:Target 与 Spread 上的训练曲线。 相对 Lagr(lr),Def-MARL 曲线更平滑、更稳定。绘制均值并以 标准差着色。
Evaluation criteria. Following the objective of MASOCP, we use the cost and safety rate as the evaluation criteria for the performance of all algorithms. The cost is the cumulative cost over the trajectory . The safety rate is defined as the ratio of agents that remain safe over the entire trajectory, i.e., , over all agents. Unlike the CMDP setting, we do not report the mean of constraint violations over time but the violation of the hard safety constraints.
评价指标。 按 MASOCP 目标,用代价与安全率评价各算法。代价为轨迹累积代价 ;安全率为整条轨迹保持安全(即 )的智能体比例。不同于 CMDP,我们不报告随时间平均的约束违反,而报告对硬安全约束的违反。
图 6:更大规模改进 MPE 上的比较。 智能体数增加时 Def-MARL 仍处左上角。圆点为均值,误差棒为一倍标准差。
V-B Results
V-B 结果
We train all algorithms with different random seeds and test the converged policies on different initial conditions. As discussed in Section IV-C, we disable the communication of between agents (investigated in Section V-C). We draw the following conclusions.
各算法用 个不同随机种子训练,并在 个不同初态上测试收敛策略。如第 IV-C 节所述,我们关闭智能体间 通信(第 V-C 节再研究)。结论如下。
(Q1): Def-MARL achieves the best performance with constant hyperparameters across all environments. First, we plot the safety rate (y-axis) and cumulative cost (x-axis) for each algorithm in Figure 3. Thus, the closer an algorithm is to the top-left corner, the better it performs. In both MPE and Safe Multi-agent MuJoCo environments, Def-MARL is always closest to the top-left corner, maintaining a low cost while having near safety rate. For the baselines Penalty and Lagr, their performance and safety are highly sensitive to their hyperparameters. While Penalty with and Lagr with generally have low costs, they also have frequent constraint violations. With or , they prioritize safety but at the cost of high cumulative costs. Def-MARL, however, maintains a safety rate similar to the most conservative baselines (Penalty(0.5) and Lagr(5)) but has much lower costs. We point out that no single baseline method behaves considerably better on all the environments: the performance of the baseline methods varies wildly between environments, demonstrating the sensitivity of these algorithms to the choice of hyperparameters. On the contrary, Def-MARL, performs best in all environments, using a single set of constant hyperparameters, which demonstrates its insensitivity to the choice of hyperparameters.
(Q1):Def-MARL 在全部环境用固定超参取得最佳表现。首先在图 3 中绘制各算法安全率(纵轴)与累积代价(横轴);越靠近左上角越好。在 MPE 与 Safe Multi-agent MuJoCo 中,Def-MARL 始终最接近左上角,在接近 安全率下保持低代价。基线 Penalty 与 Lagr 的性能与安全高度依赖超参: 或 时代价低但常违约束; 或 时偏重安全但累积代价高。Def-MARL 的安全率接近最保守基线(Penalty(0.5)、Lagr(5)),代价却低得多。没有单一基线在全部环境都明显更好:基线表现随环境剧烈变化,说明对超参敏感;相反 Def-MARL 用同一套固定超参在全部环境表现最佳,体现对超参不敏感。
(Q2): Def-MARL is able to reach the global optimum of the original problem. An important observation is that for Penalty and Lagr with a non-optimal , the cost function optimized in their training process is different from the original cost function. Consequently, they can have different optimal solutions compared to the original problem. Therefore, even if their training converges, they may not reach the optimal solution to the original problem. In Figure 4, the converged states of Def-MARL and four baselines are shown. Def-MARL reaches the original problem’s global optimum and covers all three goals. On the contrary, the optima of Penalty(0.02) and Lagr(1) are changed by the penalty term, so they choose to leave one agent behind to have a lower safety penalty. With an even more significant penalty, the optima of Penalty(0.5) and Lagr(5) are changed dramatically, and they forget the goal entirely and only focus on safety.
(Q2):Def-MARL 能达到原问题的全局最优。重要观察是:对非最优 的 Penalty 与 Lagr,其训练优化的代价函数与原代价不同,因而最优解也可能不同于原问题;即便训练收敛,也未必到达原问题最优。图 4 展示 Def-MARL 与四条基线的收敛状态:Def-MARL 达到原问题全局最优并覆盖全部三个目标;Penalty(0.02) 与 Lagr(1) 的最优被惩罚项改变,选择留下一个智能体以降低安全惩罚;惩罚更大时,Penalty(0.5) 与 Lagr(5) 的最优被大幅改变,完全忘记目标只顾安全。
| # Agent | 32 | 128 | 512 |
|---|---|---|---|
| Safety rate | |||
| Cost |
TABLE I: Policy Generalization. Testing Def-MARL on Target with more agents after training with agents.
| # Agent | 32 | 128 | 512 |
|---|---|---|---|
| Safety rate | |||
| Cost |
表 I:策略泛化。 以 训练后,在更多智能体的 Target 上测试 Def-MARL。
| Environment | No communication | Communication () | ||
|---|---|---|---|---|
| Safety rate | Cost | Safety rate | Cost | |
| Target | ||||
| Spread | ||||
| Formation | ||||
| Line | ||||
| Corridor | ||||
| ConnectSpread |
| Safety rate | Cost | |
|---|---|---|
TABLE II: Effect of communication (Section IV-C) in different environments.
| Environment | No communication | Communication () | ||
|---|---|---|---|---|
| Safety rate | Cost | Safety rate | Cost | |
| Target | ||||
| Spread | ||||
| Formation | ||||
| Line | ||||
| Corridor | ||||
| ConnectSpread |
| Safety rate | Cost | |
|---|---|---|
表 II:不同环境中 通信的影响(第 IV-C 节)。
(Q3): Training of Def-MARL is more stable. To compare the training stability of Def-MARL and the Lagrangian method Lagr(lr), we plot their cost and safety rate during training in Figure 5. Def-MARL has a smoother curve compared to Lagr(lr), supporting our theoretical analysis in Section III-B. Due to space limits, the plots for other environments and other baseline methods are provided in Section E-D.
(Q3):Def-MARL 训练更稳定。 为比较 Def-MARL 与拉格朗日方法 Lagr(lr) 的训练稳定性,在图 5 绘制训练中的代价与安全率。相对 Lagr(lr),Def-MARL 曲线更平滑,支持第 III-B 节理论分析。篇幅所限,其他环境与基线曲线见第 E-D 节。
(Q4): Def-MARL can scale to more agents while maintaining high performance and safety, but is limited by GPU memory due to centralized training. We test the limits of Def-MARL on the number of agents during training by comparing all methods on with Formation and Line, and with Target (Figure 6). We were unable to increase further due to GPU memory limitations due to the use of centralized training. For this experiment, we omit Lagr(lr) as it has the worst performance in MPE with . Def-MARL is closest to the upper left corner in all environments, and its performance does not decrease with an increasing number of agents.
(Q4):Def-MARL 可扩展到更多智能体并保持高性能与安全,但受集中训练的 GPU 显存限制。我们在 Formation、Line 上比较 ,在 Target 上比较 (图 6),以测试训练期智能体数上限;因集中训练的显存限制未能继续增大 。本实验省略在 的 MPE 上表现最差的 Lagr(lr)。Def-MARL 在全部环境最接近左上角,且性能不随智能体数增加而下降。
(Q5): The trained policy from Def-MARL generalizes to much larger MAS. To test the generalization capabilities of Def-MARL, we test a policy trained with on much larger MASs with up to on Target (Table I) with the same agent density to avoid distribution shift. Def-MARL maintains a high safety rate and low costs despite being applied on a MAS with times more agents.
(Q5):Def-MARL 训练出的策略可泛化到大得多的 MAS。为测试泛化,我们将 训练的策略在保持相同智能体密度(避免分布偏移)的 Target 上测到 (表 I)。即便智能体数增大 倍,Def-MARL 仍保持高安全率与低代价。
V-C Ablation studies
V-C 消融实验
Here we do ablation studies on the communication of , and study the hyperparameter sensitivity of Def-MARL.
这里对 通信做消融,并研究 Def-MARL 的超参敏感性。
Is communicating necessary? As introduced in Section IV-C, theoretically, all connected agents should communicate and reach a consensus on . However, we observe in Section V-B that the agents can perform well even if agents take without communicating to compute the maximum. We perform experiments on MPE () to understand the impact of this approximation in Table III and see that using the approximation does not result in much performance difference compared to communicating and using the maximum.
是否必须通信 ? 如第 IV-C 节所述,理论上所有已连通智能体应通信并就 达成一致。但第 V-B 节观察到,即使各智能体取 、不通信求最大,表现仍然良好。我们在 MPE()上实验以理解该近似的影响(表 III),发现相对通信 并取最大,性能差异不大。
Varying in the outer problem. To robustify our approach against estimation errors in , we solve for a that is slightly more conservative by modifying (15b) to (Section IV-C). We now perform experiments to study the effect of different choices of (Table III) on Line (). The results show that higher values of result in higher safety rates and slightly higher costs, while the reverse is true for smaller . This matches our intuition that modifying (15b) can help improve constraint satisfaction when the learned has estimation errors. We thus recommend choosing close to . We also provide the sensitivity analysis on more hyperparameters in Appendix E.
外层问题中变化 。 为增强对 估计误差的鲁棒性,我们通过把 (15b) 改为 来求略更保守的 (第 IV-C 节)。现于 Line()上研究不同 (表 III):更大 带来更高安全率与略高代价,更小 则相反。这符合直觉——在所学 有估计误差时,修改 (15b) 有助于约束满足。建议取 接近 。更多超参敏感性见附录 E。
VI Hardware experiments
VI 硬件实验
(a) Corridor
Finally, we conduct hardware experiments on a swarm of Crazyflie (CF) drones [27] to demonstrate Def-MARL’s ability to safely coordinate agents to complete complex collaborative tasks in the real world. We consider the following two tasks.
最后,我们在 Crazyflie(CF)无人机群 [27] 上做真机实验,展示 Def-MARL 在真实世界安全协调智能体完成复杂协作任务的能力。考虑如下两项任务。
- • Corridor. A swarm of drones collaboratively gets through a narrow corridor and reaches a set of goals without explicitly assigning drones to goals.
- • Corridor。一群无人机协作穿过狭窄走廊并到达一组目标,无需显式把无人机分配到各目标。
- • Inspect. Two drones collaborate to maintain direct visual contact with a target drone that follows a path shaped like an eight while staying out of the target drone’s avoid zone. Visual contact only occurs when the line of sight to the target drone is not blocked by obstacles.
- • Inspect。两架无人机协作,对沿“8”字形路径飞行的目标机保持直接视觉接触,同时不进入目标机的避免区。仅当到目标机的视线不被障碍遮挡时才算视觉接触。
For both tasks, all drones have collision constraints with other drones and static obstacles. We visualize the tasks in Figure 7.
两项任务中,所有无人机彼此及与静态障碍均有碰撞约束。任务可视化见图 7。
Fig. 8: Hardware Results on Corridor (). Left to right: key frames of the trajectories generated by different algorithms. Arrows with different colors indicate the positions of different drones. Def-MARL (top) finishes the task with success rate because the drones learn to cross the corridor one by one. CMPC and CMPCwA (middle) sometimes get stuck in local minima and cannot finish the task because of the highly nonconvex cost function. DMPC (bottom) has unsafe cases where the agents cross the unsafe radius so they cannot reach the goals because the MPC problem becomes infeasible.
图 8:Corridor()硬件结果。 左至右:不同算法轨迹关键帧。不同颜色箭头表示不同无人机位置。Def-MARL(上)以 成功率完成任务,因无人机学会逐一穿越走廊。CMPC 与 CMPCwA(中)有时陷于局部最小而无法完成任务,因代价高度非凸。DMPC(下)出现不安全情形:智能体越过不安全半径后 MPC 问题不可行,无法到达目标。
Baselines. Def-MARL has demonstrated superior performance among RL methods in simulation experiments. Consequently, we do not consider RL methods as baselines for the hardware experiments. Instead, we present a comparative analysis between Def-MARL and model predictive control (MPC), a widely employed technique in practical robotic applications. Notably, MPC necessitates model dynamics knowledge, whereas Def-MARL does not. We compare Def-MARL against the following two MPC baselines.
基线。 仿真中 Def-MARL 已在 RL 方法中表现最优,故真机实验不以 RL 为基线,而与机器人实践中广泛使用的模型预测控制(MPC)比较。注意 MPC 需要动力学模型知识,Def-MARL 不需要。我们与如下两种 MPC 基线比较。
- • Decentralized. We consider a decentralized MPC method (DMPC), where each drone tries to individually minimize the total cost and prevents collision with other controlled drones by assuming a constant velocity motion model using the current measurement of their velocity.
- • 去中心化。 去中心化 MPC(DMPC):每架无人机各自最小化总代价,并用当前速度测量假设恒速运动模型以避免与其他受控无人机碰撞。
- • Centralized. We also test against a centralized MPC (CMPC) method to better disentangle phenomena related to numerical nonlinear optimization and performing decentralized control. This method uses the same cost function used by Def-MARL.
- • 中心化。 中心化 MPC(CMPC):用于更好分离数值非线性优化与去中心化控制相关现象;所用代价函数与 Def-MARL 相同。
Both MPC methods are implemented in CasADi [4] with the SNOPT nonlinear optimizer [28]. Details for the hardware setup and experiment videos are provided in Appendix F.
两种 MPC 均在 CasADi [4] 中用 SNOPT 非线性优化器 [28] 实现。硬件设置与实验视频见附录 F。
图 9:Def-MARL 在 Corridor()上的硬件结果。 即便在拥挤环境中,Def-MARL 仍保持 成功率。
Fig. 10: Hardware Results on Inspect. The CF drone overlayed with the yellow/green sphere is the target. The sphere turns green when the target is observed and yellow otherwise. The CF drones overlayed with blue spheres are agents, which turn red if the agents become unsafe. The red spheres around the target show the avoid zone that agents cannot enter. Def-MARL finishes the task with safe and collaborative behaviors. For example, they learn to wait on two sides of the obstacles and take turns to observe the target. CMPC gets stuck in local minima and only moves the closest drone to the target, leaving the other drone stationary. DMPC makes both agents chase after the target without collaboration, and even has unsafe cases.
图 10:Inspect 硬件结果。 叠加黄/绿球的 CF 为目标机;观测到目标时球变绿,否则为黄。叠加蓝球的为智能体,不安全时变红。目标周围红球为智能体不可进入的避免区。Def-MARL 以安全协作行为完成任务,例如学会在障碍两侧等待并轮流观测目标。CMPC 陷于局部最小,只让离目标最近的无人机移动、另一架静止。DMPC 使两智能体互不协作地追目标,甚至出现不安全情形。
VI-A Corridor
We run each algorithm from random initial conditions and use the task success rate to measure their performance. The task is defined to be successful if all the goals are covered by the agents and all agents stay safe during the whole task. Accordingly, the success rate is defined as the number of successful tasks divided by . In our tests, the success rates of Def-MARL, CMPC, and DMPC are , , and . To analyze this result, we visualize the trajectory of Def-MARL and some failure cases of the baselines in Figure 8.
各算法从 个随机初态运行,用任务成功率衡量表现。成功定义为所有目标被智能体覆盖且全程安全;成功率即成功任务数除以 。测试中 Def-MARL、CMPC、DMPC 成功率分别为 、、。图 8 可视化 Def-MARL 轨迹与基线部分失败情形。
CMPC is prone to local minima. We first compare Def-MARL with CMPC. Since we sum the distance from each goal to the closest drone, the cost function in this task is very nonconvex. Consequently, CMPC results in very suboptimal solutions, where only the closest drone to the goals attempts to reach the goals, with the remaining drones left on the other side. To alleviate this issue, although the original task does not have an explicit goal allocation, we provide a handicap to the CMPC methods and rerun the experiments with explicitly assigned goals for each drone. This simplifies the optimization problem by removing the discrete nature of goal assignment. We name this baseline CMPCwA (CMPC with assignment). However, even with explicit goal assignments, we still see that sometimes one of the drones in the team gets stuck behind the corridor, resulting in a success rate of . In contrast, Def-MARL does not succumb to this local minimum and completes the task with a success rate of .
CMPC 易陷局部最小。 先比较 Def-MARL 与 CMPC。因代价把每个目标到最近无人机的距离求和,该任务代价高度非凸;CMPC 常得到很次优的解:只有离目标最近的无人机尝试到达,其余留在另一侧。虽原任务无显式目标分配,我们仍给 CMPC 方法“开挂”,为每架无人机显式分配目标后重跑,以去掉目标分配的离散性;记为 CMPCwA(带分配的 CMPC)。即便如此,有时仍有无人机卡在走廊后方,成功率 。相比之下 Def-MARL 不陷入该局部最小,成功率 。
DMPC has unsafe cases. As DMPC without goal assignment will also suffer from similar issues as CMPC, we choose to assign goals for each agent in this baseline. This results in a simpler problem, as explained above. However, unlike CMPCwA, the agents using DMPC do not know the actual actions of the other agents and can only make predictions based on their observations because of the decentralized nature of DMPC. Therefore, collisions may occur if the other agents behave significantly differently from the predictions. In the DMPC row of Figure 8, the agents collide[^6] in the middle of the tasks, causing the MPC optimization problem to become infeasible and preventing the agents from reaching their goals.[^7]
DMPC 存在不安全情形。 无目标分配的 DMPC 也会遭遇与 CMPC 类似的问题,故本基线为各智能体分配目标,问题更简单。但与 CMPCwA 不同,DMPC 因去中心化特性,智能体不知道其他智能体的实际动作,只能基于观测预测;若其他智能体行为与预测显著不同,可能发生碰撞。图 8 的 DMPC 行中,智能体在任务中途碰撞[^6],导致 MPC 优化不可行,无法到达目标。[^7]
Def-MARL can scale up to agents. We also test the scalability of Def-MARL with CF drones in the same environment. Notably, the size of the environment remains unchanged, so the environment becomes much more crowded and thus more challenging. We test Def-MARL with different random initial conditions, and it maintains a success rate of . We visualize one of the trajectories in Figure 9. Note that we were limited to only drones here due to only having drones available. However, given the simulation results, we are hopeful that Def-MARL can scale to larger hardware swarms.
Def-MARL 可扩展到 个智能体。 我们在同一环境用 架 CF 测试可扩展性;环境尺寸不变,因而更拥挤、更具挑战。在 个不同随机初态上测试,成功率仍为 。图 9 可视化其中一条轨迹。此处受限于仅有 架可用无人机;结合仿真结果,我们期望 Def-MARL 可扩展到更大真机集群。
VI-B Inspect
We also run each algorithm from different random initial conditions. Note that the agents may not be able to observe the target at their initial positions at the first step. In this environment, the team of two drones should maximize the duration where the goal is observed by at least one drone. Measuring the task performance by the number of timesteps where the target is not visible, we obtain that the performance of Def-MARL, CMPC, and DMPC are , , and , respectively. We also report the safety rate, defined as the ratio of tasks where all agents stay safe, which are , , and , respectively. We visualize the trajectories of different methods in Figure 10.
各算法同样从 个不同随机初态运行。注意智能体在初始位置第一步未必能观测到目标。该环境中两机应最大化至少一机观测到目标的时长。以目标不可见的时间步数衡量任务表现,Def-MARL、CMPC、DMPC 分别为 、、。另报告安全率(全部智能体保持安全的任务比例),分别为 、、。不同方法轨迹见图 10。
Agents using Def-MARL have better collaboration. The Inspect is designed such that collaboration between the agents is necessary to observe the target without any downtime. One agent cannot observe the target all the time on its own because the agent’s observation can be blocked by obstacles. It also cannot simply follow the target because of the avoid region. Using Def-MARL, the agents learn collaborative behaviors such as waiting on each side of the obstacles and taking turns to observe the target when the target is on their side. The MPC methods, however, do not have such global optimal behavior but get stuck in local minima. For example, CMPC only moves the closest drone to the target, leaving the other drone stationary, while DMPC makes both agents chase after the target without collaboration. Therefore, both MPC methods have small periods of time where neither drone has visual contact with the target. In addition, similar to in Corridor, we observe that DMPC sometimes results in collisions due to the lack of coordination between drones.
Def-MARL 智能体协作更好。 Inspect 的设计使得必须协作才能无间断观测目标:单机无法始终观测(视线可被障碍遮挡),也不能因避免区而简单跟随目标。用 Def-MARL,智能体学会在障碍两侧等待、目标到己侧时轮流观测等协作行为。MPC 方法则无此类全局最优行为,易陷局部最小:CMPC 只移动离目标最近的无人机、另一架静止;DMPC 使两机互不协作地追目标。因此两种 MPC 都会出现两机都看不到目标的短暂时段。与 Corridor 类似,DMPC 有时因缺乏协调而碰撞。
VII Conclusion
VII 结论
To construct safe distributed policies for real-world multi-agent systems, this paper introduces Def-MARL for the multi-agent safe optimal control problem, which defines safety as zero constraint violation. Def-MARL takes advantage of the epigraph form of the original problem to address the training instability of Lagrangian methods in the zero-constraint violation setting. We provide a theoretical result showing that the centralized epigraph form can be solved in a distributed fashion by each agent, which enables distributed execution of Def-MARL. Simulation results on MPE and the Safe Multi-agent MuJoCo environments suggest that, unlike baseline methods, Def-MARL uses a constant set of hyperparameters across all environments, and achieves a safety rate similar to the most conservative baseline and similar performance to the baselines that prioritize performance but violate safety constraints. Hardware results on the Crazyflie drones demonstrate Def-MARL’s ability to solve complex collaborative tasks safely in the real world.
为构造面向真实多智能体系统的安全分布式策略,本文针对将安全定义为零约束违反的多智能体安全最优控制问题提出 Def-MARL。它利用原问题上图形式,应对零违反设定下拉格朗日方法的训练不稳;并给出理论结果:中心化上图形式可由各智能体分布式求解,从而实现分布执行。MPE 与 Safe Multi-agent MuJoCo 仿真表明,相对基线,Def-MARL 在全部环境用同一套超参,安全率接近最保守基线,性能接近偏重性能但违安全的基线。Crazyflie 真机结果展示了 Def-MARL 在真实世界安全求解复杂协作任务的能力。
VIII Limitations
VIII 局限
The theoretical analysis in Section IV-C suggests that the connected agents must communicate and reach a consensus. If the communication on is disabled, although our experiments show that the agents still perform similarly, the theoretical optimality guarantee may not be valid. In addition, the framework does not consider noise, disturbances in the dynamics, or communication delays between agents. Finally, as a safe RL method, although safety can be theoretically guaranteed under the optimal value function and policy, this does not hold under inexact minimization of the losses. We leave tackling these issues as future work.
第 IV-C 节理论分析表明已连通智能体必须通信 并达成一致。若关闭 通信,实验虽显示表现相近,但理论最优性保证可能不再成立。此外框架未考虑噪声、动力学扰动或智能体间通信时延。最后,作为安全 RL 方法,虽在最优价值与策略下安全可理论保证,但在损失非精确最小化时不成立。这些问题留作未来工作。
Acknowledgments
This work was partly supported by the Under Secretary of Defense for Research and Engineering under Air Force Contract No. FA8702-15-D-0001. In addition, Zhang, So, and Fan are supported by the MIT-DSTA program. Any opinions, findings, conclusions, or recommendations expressed in this publication are those of the authors and don’t necessarily reflect the views of the sponsors.
本工作部分得到美国国防部研究与工程副部长办公室支持,空军合同号 FA8702-15-D-0001。此外 Zhang、So 与 Fan 得到 MIT-DSTA 项目支持。本文观点不必然代表资助方立场。
©2025 Massachusetts Institute of Technology.
Delivered to the U.S. Government with Unlimited Rights, as defined in DFARS Part 252.227-7013 or 7014 (Feb 2014). Notwithstanding any copyright notice, U.S. Government rights in this work are defined by DFARS 252.227-7013 or DFARS 252.227-7014 as detailed above. Use of this work other than as specifically authorized by the U.S. Government may violate any copyrights that exist in this work.
按 DFARS Part 252.227-7013 或 7014(2014 年 2 月)定义的无限权利交付美国政府。不论版权声明如何,美国政府在本作品中的权利由上述 DFARS 条款界定。未经美国政府特别授权的使用可能侵犯本作品中存在的任何版权。
References
Achiam et al. [2017] Joshua Achiam, David Held, Aviv Tamar, and Pieter Abbeel. Constrained policy optimization. In International Conference on Machine Learning , pages 22–31. PMLR, 2017.
Agarwal et al. [2020] Akshat Agarwal, Sumit Kumar, Katia Sycara, and Michael Lewis. Learning transferable cooperative behavior in multi-agent team. In International Conference on Autonomous Agents and Multiagent Systems (AAMAS’2020) . IFMAS, 2020.
Altman [2004] Eitan Altman. Constrained Markov decision processes . Routledge, 2004.
Andersson et al. [2019] Joel AE Andersson, Joris Gillis, Greg Horn, James B Rawlings, and Moritz Diehl. Casadi: a software framework for nonlinear optimization and optimal control. Mathematical Programming Computation , 11:1–36, 2019.
Bansal et al. [2017] Somil Bansal, Mo Chen, Sylvia Herbert, and Claire J Tomlin. Hamilton-jacobi reachability: A brief overview and recent advances. In 2017 IEEE 56th Annual Conference on Decision and Control (CDC) , pages 2242–2253. IEEE, 2017.
Bertsekas [2012] Dimitri Bertsekas. Dynamic programming and optimal control: Volume I , volume 4. Athena scientific, 2012.
Bharadwaj et al. [2019] Suda Bharadwaj, Roderik Bloem, Rayna Dimitrova, Bettina Konighofer, and Ufuk Topcu. Synthesis of minimum-cost shields for multi-agent systems. In ACC . IEEE, 2019.
Borkar [2005] Vivek S Borkar. An actor-critic algorithm for constrained markov decision processes. Systems & Control Letters , 54(3):207–213, 2005.
Borkar [2009] Vivek S Borkar. Stochastic Approximation: A Dynamical Systems Viewpoint , volume 48. Springer, 2009.
Boyd and Vandenberghe [2004] Stephen P Boyd and Lieven Vandenberghe. Convex optimization . Cambridge university press, 2004.
Cai et al. [2021] Zhiyuan Cai, Huanhui Cao, Wenjie Lu, Lin Zhang, and Hao Xiong. Safe multi-agent reinforcement learning through decentralized multiple control barrier functions. arXiv preprint arXiv:2103.12553 , 2021.
Chandrupatla [1997] Tirupathi R Chandrupatla. A new hybrid quadratic/bisection algorithm for finding the zero of a nonlinear function without using derivatives. Advances in Engineering Software , 28(3):145–149, 1997.
Chen et al. [2017a] Yu Fan Chen, Michael Everett, Miao Liu, and Jonathan P How. Socially aware motion planning with deep reinforcement learning. In 2017 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS) , pages 1343–1350. IEEE, 2017a.
Chen et al. [2017b] Yu Fan Chen, Miao Liu, Michael Everett, and Jonathan P How. Decentralized non-communicating multiagent collision avoidance with deep reinforcement learning. In 2017 IEEE International Conference on Robotics and Automation (ICRA) , pages 285–292. IEEE, 2017b.
Chen et al. [2024] Ziyi Chen, Yi Zhou, and Heng Huang. On the duality gap of constrained cooperative multi-agent reinforcement learning. In The Twelfth International Conference on Learning Representations , 2024.
Conte et al. [2012] Christian Conte, Tyler Summers, Melanie N Zeilinger, Manfred Morari, and Colin N Jones. Computational aspects of distributed optimization in model predictive control. In 2012 IEEE 51st IEEE conference on decision and control (CDC) , pages 6819–6824. IEEE, 2012.
Dames et al. [2017] Philip Dames, Pratap Tokekar, and Vijay Kumar. Detecting, localizing, and tracking an unknown number of moving targets using a team of mobile robots. The International Journal of Robotics Research , 36(13-14):1540–1553, 2017.
Ding et al. [2023] Dongsheng Ding, Xiaohan Wei, Zhuoran Yang, Zhaoran Wang, and Mihailo Jovanovic. Provably efficient generalized lagrangian policy optimization for safe multi-agent reinforcement learning. In Learning for Dynamics and Control Conference , pages 315–332. PMLR, 2023.
ElSayed-Aly et al. [2021a] Ingy ElSayed-Aly, Suda Bharadwaj, Christopher Amato, Rüdiger Ehlers, Ufuk Topcu, and Lu Feng. Safe multi-agent reinforcement learning via shielding. arXiv preprint arXiv:2101.11196 , 2021a.
ElSayed-Aly et al. [2021b] Ingy ElSayed-Aly, Suda Bharadwaj, Christopher Amato, Rüdiger Ehlers, Ufuk Topcu, and Lu Feng. Safe multi-agent reinforcement learning via shielding. AAMAS ’21, 2021b.
Everett et al. [2018] Michael Everett, Yu Fan Chen, and Jonathan P How. Motion planning among dynamic, decision-making agents with deep reinforcement learning. In 2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS) , pages 3052–3059. IEEE, 2018.
Fedele and Franzè [2023] Giuseppe Fedele and Giuseppe Franzè. A distributed model predictive control strategy for constrained multi-agent systems: The uncertain target capturing scenario. IEEE Transactions on Automation Science and Engineering , 2023.
Foerster et al. [2018] Jakob Foerster, Gregory Farquhar, Triantafyllos Afouras, Nantas Nardelli, and Shimon Whiteson. Counterfactual multi-agent policy gradients. In Proceedings of the AAAI conference on artificial intelligence , volume 32, 2018.
Ganai et al. [2024] Milan Ganai, Zheng Gong, Chenning Yu, Sylvia Herbert, and Sicun Gao. Iterative reachability estimation for safe reinforcement learning. Advances in Neural Information Processing Systems , 36, 2024.
Garg et al. [2024] Kunal Garg, Songyuan Zhang, Oswin So, Charles Dawson, and Chuchu Fan. Learning safe control for multi-robot systems: Methods, verification, and open challenges. Annual Reviews in Control , 57:100948, 2024.
Geng et al. [2023] Nan Geng, Qinbo Bai, Chenyi Liu, Tian Lan, Vaneet Aggarwal, Yuan Yang, and Mingwei Xu. A reinforcement learning framework for vehicular network routing under peak and average constraints. IEEE Transactions on Vehicular Technology , 2023.
Giernacki et al. [2017] Wojciech Giernacki, Mateusz Skwierczyński, Wojciech Witwicki, Paweł Wroński, and Piotr Kozierski. Crazyflie 2.0 quadrotor as a platform for research and education in robotics and control engineering. In 2017 22nd International Conference on Methods and Models in Automation and Robotics (MMAR) , pages 37–42. IEEE, 2017.
Gill et al. [2005] Philip E Gill, Walter Murray, and Michael A Saunders. Snopt: An sqp algorithm for large-scale constrained optimization. SIAM review , 47(1):99–131, 2005.
Grne and Pannek [2013] Lars Grne and Jrgen Pannek. Nonlinear model predictive control: theory and algorithms . Springer Publishing Company, Incorporated, 2013.
Gu et al. [2021] Shangding Gu, Jakub Grudzien Kuba, Munning Wen, Ruiqing Chen, Ziyan Wang, Zheng Tian, Jun Wang, Alois Knoll, and Yaodong Yang. Multi-agent constrained policy optimisation. arXiv preprint arXiv:2110.02793 , 2021.
Gu et al. [2022] Shangding Gu, Long Yang, Yali Du, Guang Chen, Florian Walter, Jun Wang, Yaodong Yang, and Alois Knoll. A review of safe reinforcement learning: Methods, theory and applications. arXiv preprint arXiv:2205.10330 , 2022.
Gu et al. [2023] Shangding Gu, Jakub Grudzien Kuba, Yuanpei Chen, Yali Du, Long Yang, Alois Knoll, and Yaodong Yang. Safe multi-agent reinforcement learning for multi-robot control. Artificial Intelligence , 319:103905, 2023.
Guestrin et al. [2002] Carlos Guestrin, Michail Lagoudakis, and Ronald Parr. Coordinated reinforcement learning. In ICML , volume 2, pages 227–234. Citeseer, 2002.
Hausknecht and Stone [2015] Matthew Hausknecht and Peter Stone. Deep recurrent q-learning for partially observable mdps. In 2015 aaai fall symposium series , 2015.
He et al. [2023] Tairan He, Weiye Zhao, and Changliu Liu. Autocost: Evolving intrinsic cost for zero-violation reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence , volume 37, pages 14847–14855, 2023.
Huang et al. [2024] Weidong Huang, Jiaming Ji, Chunhe Xia, Borong Zhang, and Yaodong Yang. Safedreamer: Safe reinforcement learning with world models. In The Twelfth International Conference on Learning Representations , 2024.
Kattepur et al. [2018] Ajay Kattepur, Hemant Kumar Rath, Anantha Simha, and Arijit Mukherjee. Distributed optimization in multi-agent robotics for industry 4.0 warehouses. In Proceedings of the 33rd Annual ACM Symposium on Applied Computing , pages 808–815, 2018.
Liu et al. [2021] Chenyi Liu, Nan Geng, Vaneet Aggarwal, Tian Lan, Yuan Yang, and Mingwei Xu. Cmix: Deep multi-agent reinforcement learning with peak and average constraints. In Machine Learning and Knowledge Discovery in Databases. Research Track: European Conference, ECML PKDD 2021, Bilbao, Spain, September 13–17, 2021, Proceedings, Part I 21 , pages 157–173. Springer, 2021.
Long et al. [2018] Pinxin Long, Tingxiang Fan, Xinyi Liao, Wenxi Liu, Hao Zhang, and Jia Pan. Towards optimally decentralized multi-robot collision avoidance via deep reinforcement learning. In 2018 IEEE International Conference on Robotics and Automation (ICRA) , pages 6252–6259. IEEE, 2018.
Lowe et al. [2017] Ryan Lowe, Yi I Wu, Aviv Tamar, Jean Harb, OpenAI Pieter Abbeel, and Igor Mordatch. Multi-agent actor-critic for mixed cooperative-competitive environments. Advances in neural information processing systems , 30, 2017.
Lu et al. [2021] Songtao Lu, Kaiqing Zhang, Tianyi Chen, Tamer Başar, and Lior Horesh. Decentralized policy gradient descent ascent for safe multi-agent reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence , volume 35, pages 8767–8775, 2021.
Luis and Schoellig [2019] Carlos E Luis and Angela P Schoellig. Trajectory generation for multiagent point-to-point transitions via distributed model predictive control. IEEE Robotics and Automation Letters , 4(2):375–382, 2019.
Luis et al. [2020] Carlos E Luis, Marijan Vukosavljev, and Angela P Schoellig. Online trajectory generation with distributed model predictive control for multi-robot motion planning. IEEE Robotics and Automation Letters , 5(2):604–611, 2020.
Lygeros [2004] John Lygeros. On reachability and minimum cost optimal control. Automatica , 40(6):917–927, 2004.
Ma et al. [2017] Hang Ma, Jiaoyang Li, TK Kumar, and Sven Koenig. Lifelong multi-agent path finding for online pickup and delivery tasks. arXiv preprint arXiv:1705.10868 , 2017.
Margellos and Lygeros [2011] Kostas Margellos and John Lygeros. Hamilton–jacobi formulation for reach–avoid differential games. IEEE Transactions on automatic control , 56(8):1849–1861, 2011.
Massiani et al. [2023] Pierre-François Massiani, Steve Heim, Friedrich Solowjow, and Sebastian Trimpe. Safe value functions. IEEE Transactions on Automatic Control , 68(5):2743–2757, 2023.
Melcer et al. [2022] Daniel Melcer, Christopher Amato, and Stavros Tripakis. Shield decentralization for safe multi-agent reinforcement learning. In Advances in Neural Information Processing Systems , 2022.
Mitchell et al. [2005] Ian M Mitchell, Alexandre M Bayen, and Claire J Tomlin. A time-dependent hamilton-jacobi formulation of reachable sets for continuous dynamic games. IEEE Transactions on automatic control , 50(7):947–957, 2005.
Muntwiler et al. [2020] Simon Muntwiler, Kim P Wabersich, Andrea Carron, and Melanie N Zeilinger. Distributed model predictive safety certification for learning-based control. IFAC-PapersOnLine , 53(2):5258–5265, 2020.
Nayak et al. [2023] Siddharth Nayak, Kenneth Choi, Wenqi Ding, Sydney Dolan, Karthik Gopalakrishnan, and Hamsa Balakrishnan. Scalable multi-agent reinforcement learning through intelligent information aggregation. In International Conference on Machine Learning , pages 25817–25833. PMLR, 2023.
Nedić and Liu [2018] Angelia Nedić and Ji Liu. Distributed optimization for control. Annual Review of Control, Robotics, and Autonomous Systems , 1:77–103, 2018.
Nocedal and Wright [1999] Jorge Nocedal and Stephen J Wright. Numerical optimization . Springer, 1999.
Peng et al. [2021] Bei Peng, Tabish Rashid, Christian Schroeder de Witt, Pierre-Alexandre Kamienny, Philip Torr, Wendelin Böhmer, and Shimon Whiteson. Facmac: Factored multi-agent centralised policy gradients. Advances in Neural Information Processing Systems , 34:12208–12221, 2021.
Pereira et al. [2022] Marcus A Pereira, Augustinos D Saravanos, Oswin So, and Evangelos A Theodorou. Decentralized safe multi-agent stochastic optimal control using deep fbsdes and admm. arXiv preprint arXiv:2202.10658 , 2022.
Qin et al. [2021] Zengyi Qin, Kaiqing Zhang, Yuxiao Chen, Jingkai Chen, and Chuchu Fan. Learning safe multi-agent control with decentralized neural barrier certificates. In International Conference on Learning Representations , 2021.
Rashid et al. [2020a] Tabish Rashid, Gregory Farquhar, Bei Peng, and Shimon Whiteson. Weighted qmix: Expanding monotonic value function factorisation for deep multi-agent reinforcement learning. Advances in neural information processing systems , 33:10199–10210, 2020a.
Rashid et al. [2020b] Tabish Rashid, Mikayel Samvelyan, Christian Schroeder De Witt, Gregory Farquhar, Jakob Foerster, and Shimon Whiteson. Monotonic value function factorisation for deep multi-agent reinforcement learning. Journal of Machine Learning Research , 21(178):1–51, 2020b.
Robbins and Monro [1951] Herbert Robbins and Sutton Monro. A stochastic approximation method. The Annals of Mathematical Statistics , pages 400–407, 1951.
Satija et al. [2020] Harsh Satija, Philip Amortila, and Joelle Pineau. Constrained markov decision processes via backward value functions. In International Conference on Machine Learning , pages 8502–8511. PMLR, 2020.
Schulman et al. [2015a] John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International Conference on Machine Learning , pages 1889–1897. PMLR, 2015a.
Schulman et al. [2015b] John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. High-dimensional continuous control using generalized advantage estimation. arXiv preprint arXiv:1506.02438 , 2015b.
Schulman et al. [2017] John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347 , 2017.
Semnani et al. [2020] Samaneh Hosseini Semnani, Hugh Liu, Michael Everett, Anton De Ruiter, and Jonathan P How. Multi-agent motion planning for dense and dynamic environments via deep reinforcement learning. IEEE Robotics and Automation Letters , 5(2):3221–3226, 2020.
Shi et al. [2020] Yunsheng Shi, Zhengjie Huang, Shikun Feng, Hui Zhong, Wenjin Wang, and Yu Sun. Masked label prediction: Unified message passing model for semi-supervised classification. arXiv preprint arXiv:2009.03509 , 2020.
So and Fan [2023] Oswin So and Chuchu Fan. Solving stabilize-avoid optimal control via epigraph form and deep reinforcement learning. In Proceedings of Robotics: Science and Systems , 2023.
So et al. [2024] Oswin So, Cheng Ge, and Chuchu Fan. Solving minimum-cost reach avoid using reinforcement learning. In The Thirty-eighth Annual Conference on Neural Information Processing Systems , 2024.
Soria et al. [2021] Enrica Soria, Fabrizio Schiano, and Dario Floreano. Predictive control of aerial swarms in cluttered environments. Nature Machine Intelligence , 3(6):545–554, 2021.
Sunehag et al. [2017] Peter Sunehag, Guy Lever, Audrunas Gruslys, Wojciech Marian Czarnecki, Vinicius Zambaldi, Max Jaderberg, Marc Lanctot, Nicolas Sonnerat, Joel Z Leibo, Karl Tuyls, et al. Value-decomposition networks for cooperative multi-agent learning. arXiv preprint arXiv:1706.05296 , 2017.
Tessler et al. [2019] Chen Tessler, Daniel J. Mankowitz, and Shie Mannor. Reward constrained policy optimization. In International Conference on Learning Representations , 2019.
Tomlin et al. [2000] Claire J Tomlin, John Lygeros, and S Shankar Sastry. A game theoretic approach to controller design for hybrid systems. Proceedings of the IEEE , 88(7):949–970, 2000.
Toumieh and Lambert [2022] Charbel Toumieh and Alain Lambert. Decentralized multi-agent planning using model predictive control and time-aware safe corridors. IEEE Robotics and Automation Letters , 7(4):11110–11117, 2022.
Tsiotras et al. [2011] Panagiotis Tsiotras, Efstathios Bakolas, and Yiming Zhao. Initial guess generation for aircraft landing trajectory optimization. In AIAA Guidance, Navigation, and Control Conference , page 6689, 2011.
Wang et al. [2020] Jianhao Wang, Zhizhou Ren, Terry Liu, Yang Yu, and Chongjie Zhang. Qplex: Duplex dueling multi-agent q-learning. arXiv preprint arXiv:2008.01062 , 2020.
Wang and Ding [2014] Peng Wang and Baocang Ding. A synthesis approach of distributed model predictive control for homogeneous multi-agent system with collision avoidance. International Journal of Control , 87(1):52–63, 2014.
Wu et al. [2020] Tong Wu, Pan Zhou, Kai Liu, Yali Yuan, Xiumin Wang, Huawei Huang, and Dapeng Oliver Wu. Multi-agent deep reinforcement learning for urban traffic light control in vehicular networks. IEEE Transactions on Vehicular Technology , 69(8):8243–8256, 2020.
Xiao et al. [2023] Wenli Xiao, Yiwei Lyu, and John Dolan. Model-based dynamic shielding for safe and efficient multi-agent reinforcement learning. arXiv preprint arXiv:2304.06281 , 2023.
Xu et al. [2021] Tengyu Xu, Yingbin Liang, and Guanghui Lan. Crpo: A new approach for safe reinforcement learning with convergence guarantee. In International Conference on Machine Learning , pages 11480–11491. PMLR, 2021.
Yang et al. [2020] Yaodong Yang, Jianye Hao, Ben Liao, Kun Shao, Guangyong Chen, Wulong Liu, and Hongyao Tang. Qatten: A general framework for cooperative multiagent reinforcement learning. arXiv preprint arXiv:2002.03939 , 2020.
Yu et al. [2022a] Chao Yu, Akash Velu, Eugene Vinitsky, Jiaxuan Gao, Yu Wang, Alexandre Bayen, and Yi Wu. The surprising effectiveness of ppo in cooperative multi-agent games. Advances in Neural Information Processing Systems , 35:24611–24624, 2022a.
Yu et al. [2022b] Dongjie Yu, Haitong Ma, Shengbo Li, and Jianyu Chen. Reachability constrained reinforcement learning. In International conference on machine learning , pages 25636–25655. PMLR, 2022b.
Zanon and Gros [2020] Mario Zanon and Sébastien Gros. Safe reinforcement learning using robust mpc. IEEE Transactions on Automatic Control , 66(8):3638–3652, 2020.
Zhang et al. [2018] Kaiqing Zhang, Zhuoran Yang, Han Liu, Tong Zhang, and Tamer Basar. Fully decentralized multi-agent reinforcement learning with networked agents. In International conference on machine learning , pages 5872–5881. PMLR, 2018.
Zhang et al. [2021] Kaiqing Zhang, Zhuoran Yang, and Tamer Başar. Multi-agent reinforcement learning: A selective overview of theories and algorithms. Handbook of reinforcement learning and control , pages 321–384, 2021.
Zhang et al. [2023] Songyuan Zhang, Kunal Garg, and Chuchu Fan. Neural graph control barrier functions guided distributed collision-avoidance multi-agent control. In Conference on Robot Learning , pages 2373–2392. PMLR, 2023.
Zhang et al. [2025a] Songyuan Zhang, Oswin So, Mitchell Black, and Chuchu Fan. Discrete GCBF proximal policy optimization for multi-agent safe optimal control. In The Thirteenth International Conference on Learning Representations , 2025a.
Zhang et al. [2025b] Songyuan Zhang, Oswin So, Kunal Garg, and Chuchu Fan. GCBF+: A neural graph control barrier function framework for distributed safe multiagent control. IEEE Transactions on Robotics , 41:1533–1552, 2025b.
Zhang et al. [2019] Wenbo Zhang, Osbert Bastani, and Vijay Kumar. Mamps: Safe multi-agent reinforcement learning via model predictive shielding. arXiv preprint arXiv:1910.12639 , 2019.
Zhao et al. [2021] Weiye Zhao, Tairan He, and Changliu Liu. Model-free safe control for zero-violation reinforcement learning. In 5th Annual Conference on Robot Learning , 2021.
Zhao et al. [2024] Youpeng Zhao, Yaodong Yang, Zhenbo Lu, Wengang Zhou, and Houqiang Li. Multi-agent first order constrained optimization in policy space. Advances in Neural Information Processing Systems , 36, 2024.
Zhou et al. [2017] Dingjiang Zhou, Zijian Wang, Saptarshi Bandyopadhyay, and Mac Schwager. Fast, on-line collision avoidance for dynamic vehicles using buffered voronoi cells. IEEE Robotics and Automation Letters , 2(2):1047–1054, 2017.
Zhu et al. [2020] Edward L Zhu, Yvonne R Stürz, Ugo Rosolia, and Francesco Borrelli. Trajectory optimization for nonlinear multi-agent systems using decentralized learning model predictive control. In 2020 59th IEEE Conference on Decision and Control (CDC) , pages 6198–6203. IEEE, 2020.
Appendix A Proof of Proposition 1
Proof:
\displaystyle V(x^{k},z^{k};\pi) \\ \displaystyle=\max\left\{\max_{p\geq k}h(x^{p}),\sum_{p\geq k}l(x^{p},\pi(x^{p}))-z^{k}\right\} \\ \displaystyle=\max\left\{\max\{h(x^{k}),\max_{p\geq k+1}h(x^{p})\},\sum_{p\geq k+1}l(x^{p},\pi(x^{p}))+l(x^{k},\pi(x^{k}))-z^{k}\right\} \\ \displaystyle=\max\left\{\max\{h(x^{k}),\max_{p\geq k+1}h(x^{p})\},\sum_{p\geq k+1}l(x^{p},\pi(x^{p}))-{\underbrace{\color[rgb]{0,0,0}\Big[z^{k}-l(x^{k},\pi(x^{k}))\Big]}_{\coloneqq z^{k+1}}}\right\} \\ \displaystyle=\max\left\{h(x^{k}),\max\left\{\max_{p\geq k+1}h(x^{p}),\sum_{p\geq k+1}l(x^{p},\pi(x^{p}))-z^{k+1}\right\}\right\} \\ \displaystyle=\max\left\{h(x^{k}),V(x^{k+1},z^{k+1};\pi)\right\},
Appendix B Proof of Theorem 1
To prove 1, first, we prove several lemmas:
为证明定理 1,我们先证明若干引理:
Lemma 1
Before proving this lemma, we first prove the following lemma.
在证明本引理之前,先证明如下引理。
Lemma 2
Proof:
We are now ready to prove 1.
我们现在可以证明定理 1。
Proof:
We also prove the following lemma.
我们还证明如下引理。
Lemma 3
Proof:
We can now prove 1, which follows as a consequence of 1 and 3.
现在可证明定理 1,它是引理 1 与引理 3 的推论。
Proof:
Appendix C Discussion on Importance of 1
Establishing 1 is key to Def-MARL. Namely,
建立命题 1 对 Def-MARL 关键。具体而言:
- Satisfying dynamic programming implies that the value function is Markovian. In other words, for a given , the value at the th timestep is only a function of and instead of the and the entire trajectory up to the th timestep.
- 满足动态规划意味着价值函数是马尔可夫的。换言之,给定 ,第 步价值仅是 与 的函数,而非 与到第 步的整条轨迹。
- Consequently, this implies that the optimal policy will also be Markovian and is only a function of and .
- 因而最优策略也是马尔可夫的,仅是 与 的函数。
- Rephrased differently, since the value function is Markovian, this implies that, for a given and , the value at the th timestep is equal to the value (at the initial timestep) of a new problem where we start with and .
- 换种说法:因价值函数马尔可夫,给定 与 ,第 步价值等于以 、 起步的新问题在初始时刻的价值。
- Since we relate the value function of consecutive timesteps, given a value function estimator, we can now control the bias-variance tradeoff of the value function estimate by using k-step estimates instead of the Monte Carlo estimates.
- 由于关联相邻时刻价值,给定价值估计器,可用 k 步估计代替蒙特卡洛估计来控制价值估计的偏差–方差权衡。
- Instead of only using the k-step estimates for a single choice of k, we can compute a weighted average of the k-step estimates as in GAE to further control the bias-variance tradeoff.
- 除单一 k 的 k 步估计外,还可像 GAE 那样对多个 k 步估计做加权平均,进一步控制偏差–方差权衡。
Appendix D Algorithm Pseudocode
We describe the centralized training process of Def-MARL in Algorithm 1 and the distributed execution process in Algorithm 2.
算法 1 描述 Def-MARL 集中训练过程,算法 2 描述分布执行过程。
Initialize: Policy NN , cost value function NN , constraint value function NN .
while Training not end do
Randomly sampling initial conditions , and the initial .
Use to sample trajectories , with dynamics (14).
Calculate the cost value function and the constraint value function .
Calculate GAE with the total value function (12).
Update the value functions and using TD error.
Update the -conditioned policy using PPO loss.
end while
Algorithm 1 Def-MARL centralized training
初始化: 策略网络 ,代价价值网络 ,约束价值网络 。
while 训练未结束 do
随机采样初态 与初始 。
用 按 动力学 (14) 采样轨迹 。
计算代价价值 与约束价值 。
用总价值 (12) 计算 GAE。
用 TD 误差更新价值函数 与 。
用 PPO 损失更新 -条件策略 。
end while
算法 1 Def-MARL 集中训练
Input: Learned policy NN , constraint value function NN .
for do
Get for each agent by solving the distributed EF-MASOCP outer problem (15b).
if communication enabled then
The connected agents communicate and reach a consensus .
Set for all agents in the connected graph.
end if
Get decentralized policy .
Execute control .
end for
Algorithm 2 Def-MARL distributed execution
输入: 已学策略网络 ,约束价值网络 。
for do
通过求解分布式 EF-MASOCP 外层问题 (15b) 得到各智能体的 。
if 启用 通信 then
已连通智能体 通信 并达成一致 。
对连通图中所有智能体设 。
end if
得到去中心化策略 。
执行控制 。
end for
算法 2 Def-MARL 分布执行
Appendix E Simulation experiments
E-A Computation resources
E-A 计算资源
The experiments are run on a 13th Gen Intel(R) Core(TM) i7-13700KF CPU with 64GB RAM and an NVIDIA GeForce RTX 3090 GPU. The training time is around hours ( steps) for Def-MARL and Lagr, and around hours for Penalty.
实验在第 13 代 Intel(R) Core(TM) i7-13700KF CPU(64GB 内存)与 NVIDIA GeForce RTX 3090 GPU 上运行。Def-MARL 与 Lagr 训练约 小时( 步),Penalty 约 小时。
E-B Environments
E-B 环境
E-B1 Multi-partical environments (MPE)
We use directed graphs to represent MPE, where is the set of nodes containing the objects in the multi-agent environment (e.g., agents , goals , landmarks , and obstacles ). is the set of edges, denoting the information flow from a sender node to a receiver agent . An edge exists only if the communication between node and can happen, which means the distance between node and should be within the communication radius in partially observable environments. We define the neighborhood of agent as . The node feature includes the states of the node and a one-hot encoding of the type of the node (e.g., agent, goal, landmark, or obstacle), e.g., for agent nodes, for goal nodes, and for obstacle nodes. The edge feature includes the information passed between the sender node and the receiver node (e.g., relative positions and velocities).
E-B1 多智能体粒子环境(MPE)
我们用有向图 表示 MPE,其中 为多智能体环境中对象的节点集(如智能体 、目标 、地标 、障碍 )。 为边集,表示从发送节点 到接收智能体 的信息流。边 仅当节点 与 可通信时存在,即部分可观测环境中二者距离须在通信半径 内。智能体 的邻域定义为 。节点特征 含节点状态 与节点类型 one-hot(如智能体、目标、地标或障碍),例如智能体 、目标 、障碍 。边特征 含发送节点 与接收节点 之间传递的信息(如相对位置与速度)。
We consider MPE: Target, Spread, Formation, Line, Corridor, and ConnectSpread. In each environment, the agents need to work collaboratively to finish some tasks:
我们考虑 6 个 MPE:Target、Spread、Formation、Line、Corridor 与 ConnectSpread。各环境中智能体需协作完成任务:
- • Target [51]: Each agent tries to reach its preassigned goal.
- • Target [51]:各智能体尝试到达预先分配的目标。
- • Spread [17]: The agents are given a set of (not preassigned) goals to cover.
- • Spread [17]:智能体需覆盖一组(未预先分配的)目标。
- • Formation [2]: Given a landmark, the agents should spread evenly on a circle with the landmark as the center and a given radius.
- • Formation [2]:给定地标,智能体应均匀分布在以该地标为圆心、给定半径的圆上。
- • Line [2]: Given two landmarks, the agents should spread evenly on the line between the landmarks.
- • Line [2]:给定两个地标,智能体应均匀分布在两地标之间的线段上。
- • Corridor: A set of agents and goals are separated by a narrow corridor, whose width is smaller than where is the radius of agents. The agents should go through the corridor and cover the goals.
- • Corridor:一组智能体与目标被狭窄走廊隔开,走廊宽度小于 ( 为智能体半径)。智能体须穿过走廊并覆盖目标。
- • ConnectSpread: A set of agents and goals are separated by a large obstacle with a diameter larger than the communication radius . The agents should cover the goals without colliding with obstacles or each other while also maintaining the connectivity of all agents.
- • ConnectSpread:一组智能体与目标被直径大于通信半径 的大障碍隔开。智能体须在不与障碍或彼此碰撞的同时覆盖目标,并保持全体连通。
We consider agents for all environments and and agents in the Formation and Line environments. To make the environments more difficult than the original ones [51], we add static obstacles in the first environments.
全部环境取 ;Formation 与 Line 另取 、。为比原环境 [51] 更难,前 4 个环境各加 个静态障碍。
In our modified MPE, the state of the agent is given by , where is the position of agent , and is the velocity. The control inputs are given by , i.e., the acceleration along each axis. The joint state is defined by concatenation: . The agents are modeled as double integrators with dynamics
改进 MPE 中,智能体 状态为 ,其中 为位置, 为速度。控制输入 为各轴加速度。联合状态由拼接定义:。智能体建模为双积分器,动力学为
The agents’ control inputs are limited by , and the velocities are limited by . The agents have a radius , and the communication radius is assumed to be . The area side length is for the Corridor and the ConnectSpread environments and for other environments. The radius of the obstacles is in the Corridor environment, in the ConnectSpread environment, and for other environments. All environments use a simulation time step of s and a total horizon of .
控制输入限制在 ,速度限制在 。智能体半径 ,通信半径 。区域边长 在 Corridor 与 ConnectSpread 为 ,其余为 。障碍半径 在 Corridor 为 ,ConnectSpread 为 ,其余为 。全部环境仿真步长 s,总时域 。
The observation of the agents includes the node features of itself, its neighbors , and the edge features of the edge connecting agent and its neighbors. The node features include neighbors’ states and its type ( for agents, for goals and landmarks, and for the obstacles). The edge features are the relative states .
智能体观测 含自身与邻居 的节点特征,以及连接自身与邻居的边特征。节点特征含邻居状态 及其类型(智能体 ,目标与地标 ,障碍 );边特征为相对状态 。
The constraint function contains two parts for all environments except for ConnnectSpread, including agent-agent and agent-obstacles collisions. In the ConnectSpread environment, another constraint regarding the connectivity of the agent graph is considered. For the agent-agent collision, we use the function defined as
除 ConnectSpread 外,约束函数 含智能体–智能体与智能体–障碍碰撞两部分;ConnectSpread 另加智能体图连通性约束。对智能体–智能体碰撞,使用如下 函数
where is the sign function, and in all our experiments. This represents a linear function w.r.t. the inter-agent distance with a discontinuity at the safe-unsafe boundary (Figure 11). For the agent-obstacle collision, we use
其中 为符号函数,全部实验 。该函数相对智能体间距为线性,并在安全/不安全边界处间断(图 11)。对智能体–障碍碰撞,使用
where is the observed obstacle set of agent . Then, the total function is defined as for environments except for ConnectSpread. For ConnectSpread, we also consider the connectivity constraint
其中 为智能体 观测到的障碍集。除 ConnectSpread 外,总 定义为 。对 ConnectSpread,还考虑连通性约束
where is the required maximum distance for connected agents such that if the distance between two agents is larger than , they are considered disconnected. Note that this cost is only valid with agent number . For a larger number of agents, the second-largest eigenvalue of the graph Laplacian matrix can be used. Still, since we only use this environment with agents, we use this cost to decrease the complexity. Then, the total function of the ConnectSpread environment is defined as .
其中 为判定连通的最大距离阈值:两智能体距离大于 则视为断开。注意该代价仅在 时适用;更多智能体可用图拉普拉斯第二大特征值,但本环境只用 个智能体,故采用该代价以降低复杂度。ConnectSpread 总 定义为 。
图 11: 随距离的变化。
Two types of cost functions are used in the environments. The first type is the Target cost used in the Target environment, which is defined as
环境使用两类代价。第一类为 Target 环境所用的 Target 代价,定义为
The first term penalizes the agents if they cannot reach the goal, the second term penalizes the agents if they cannot reach the goal exactly, and the third term encourages small controls. The second type is the Spread cost used in all other environments, defined as
第一项惩罚未达目标,第二项惩罚未精确到达,第三项鼓励小控制。第二类为其余环境所用的 Spread 代价,定义为
Instead of matching the agents to their preassigned goals, each goal finds its nearest agent and penalizes the whole team with the distance between them. In this way, the optimal policy of the agents is to cover all goals collaboratively.
不再把智能体匹配到预先分配目标,而是每个目标找最近智能体并用其间距离惩罚整个团队;因而最优策略是协作覆盖全部目标。
E-B2 Safe multi-agent MuJoCo environments
We also test on the Safe HalfCheetah(2x3) and Safe Coupled HalfCheetah(4x3) tasks from the Safe Multi-Agent Mujoco benchmark suite [32]. Each agent controls a subset of joints and must cooperate to minimize the cost (which we take to be the negative of the reward in the original work) while avoiding violating safety constraints. The task is parametrized by the two numbers in the parentheses, where the first number denotes the number of agents, while the second number denotes the number of joints controlled by each agent. The goal for the Safe HalfCheetah and Safe Coupled HalfCheetah tasks is to maximize the forward velocity but avoid colliding with a wall in front that moves forward at a predefined velocity.
E-B2 Safe multi-agent MuJoCo 环境
我们还在 Safe Multi-Agent Mujoco 基准 [32] 的 Safe HalfCheetah(2x3) 与 Safe Coupled HalfCheetah(4x3) 上测试。各智能体控制一部分关节,须协作最小化代价(取原工作奖励的相反数)并避免违安全约束。括号中第一个数字为智能体数,第二个为每智能体控制的关节数。目标是最大化前进速度,同时避免与前方以预定速度前进的墙碰撞。
Note: Although this is not a homogeneous MAS, since each agent has the same control space (albeit with different dynamics), we can convert this into a homogeneous MAS by augmenting the state space with a one-hot vector to identify each agent, then augmenting the dynamics to use the appropriate per-agent dynamics function. This is the approach taken in the official implementation of Safe Multi-Agent Mujoco from Gu et al. 2023. For more details, see Gu et al. 2023.
注: 虽非同质 MAS,但因各智能体控制空间相同(动力学可不同),可通过用 one-hot 向量增广状态空间标识智能体、并增广动力学以使用对应按智能体动力学,将其转为同质 MAS。这是 Gu 等 2023 官方实现所采用的做法。细节见 Gu 等 2023。
E-C Implementation details and hyperparameters
E-C 实现细节与超参数
We parameterize the -conditioned policy , cost-value function , and the constraint-value function using graph transformers [65] with parameters , , and , respectively. Note that the policy and the constraint-value function are decentralized and take only the local observation as input, while the cost-value function is centralized. In each layer of the graph transformer, the node features are updated with , where are learnable weight matrices, and the is the attention weight between agent and agent computed as , where is the first dimension of . In this way, the observation is encoded. If the environment allows -hop information passing, we can apply the node feature update times so that agent can receive information from its -hop neighbors. After the information passing, the updated node features are concatenated with the encoded vector , then passed to another NN or a recurrent neural network (RNN) [34] to obtain the outputs. and have the same structure as introduced above with different output dimensions because they are decentralized. For the centralized , the averaged node features after information passing are concatenated with the encoded and passed to the final layer (NN or RNN) to obtain the global cost value for the whole MAS.
我们用图 Transformer [65] 参数化 -条件策略 、代价价值 与约束价值 ,参数分别为 、、。策略与约束价值去中心化,仅以局部观测 为输入;代价价值中心化。图 Transformer 每层节点特征更新为 ,其中 为可学习权重,注意力 , 为 第一维。由此编码观测 。若环境允许多跳信息, 跳信息可对节点特征更新 次,使智能体 收到 跳邻居信息。信息传递后,更新节点特征 与编码后的 向量 拼接,再经另一网络或 RNN [34] 得到输出。 与 结构同上、输出维不同(去中心化);中心化 则对信息传递后平均节点特征与编码 拼接,再经最终层得到整 MAS 的全局代价值。
When updating the neural networks, we follow the PPO [63] structure. First, we calculate the target cost-value function and the target constraint-value function using GAE estimation [62], and then backpropagate the following mean-square error to update the value function parameters and :
更新网络时遵循 PPO [63] 结构。先用 GAE [62] 计算目标代价价值 与目标约束价值 ,再反向传播如下均方误差以更新价值参数 、:
where is the number of samples. Then, we calculate the advantages for each agent with the total value function following the same process as in PPO by replacing with , and backpropagate the following PPO policy loss to update the policy parameters :
其中 为样本数。随后用总价值 按 PPO 流程(以 替换 )计算各智能体优势 ,再反向传播如下 PPO 策略损失以更新策略参数 :
Most of the hyperparameters of Def-MARL are shared with Penalty and Lagr. The values of the share hyperparameters are provided in Table IV.
Def-MARL 多数超参与 Penalty、Lagr 共享,共享超参取值见表 IV。
| Hyperparameter | Value | Hyperparameter | Value |
|---|---|---|---|
| policy GNN layers | 2 | RNN type | GRU |
| massage passing dimension | 32 | RNN data chunk length | 16 |
| GNN output dimension | 64 | RNN layers | 1 |
| number of attention heads | 3 | number of sampling environments | 128 |
| activation functions | ReLU | gradient clip norm | 2 |
| GNN head layers | (32, 32) | entropy coefficient | 0.01 |
| optimizer | Adam | GAE | 0.95 |
| discount | 0.99 | clip | 0.25 |
| policy learning rate | 3e-4 | PPO epoch | 1 |
| learning rate | 1e-3 | batch size | 16384 |
| network initialization | Orthogonal | layer normalization | True |
TABLE IV: Shared hyperparameters of Def-MARL, Penalty, and Lagr.
| Hyperparameter | Value | Hyperparameter | Value |
|---|---|---|---|
| policy GNN layers | 2 | RNN type | GRU |
| massage passing dimension | 32 | RNN data chunk length | 16 |
| GNN output dimension | 64 | RNN layers | 1 |
| number of attention heads | 3 | number of sampling environments | 128 |
| activation functions | ReLU | gradient clip norm | 2 |
| GNN head layers | (32, 32) | entropy coefficient | 0.01 |
| optimizer | Adam | GAE | 0.95 |
| discount | 0.99 | clip | 0.25 |
| policy learning rate | 3e-4 | PPO epoch | 1 |
| learning rate | 1e-3 | batch size | 16384 |
| network initialization | Orthogonal | layer normalization | True |
表 IV:Def-MARL、Penalty 与 Lagr 的共享超参数。
Apart from the shared hyperparameters, Def-MARL has additional hyperparameters, as shown in Table V. In addition, and are the lower and upper bounds of while sampling in training. Since represents an estimate of the minimum cost incurred by the MAS, we set it to a small negative number . We set differently depending on the complexity of the environment. For MPE, with maximum simulation timestep , we estimate it in the MPE environments using the following equation:
除共享超参外,Def-MARL 另有表 V 所示超参。此外 、 为训练采样 的上下界。因 表示 MAS 最小代价的估计,设为较小负数 。 随环境复杂度而异;对最大仿真步数 的 MPE,用下式估计:
where is a conservative estimate of the maximum cost . This is conservative in the sense that this reflects the case where 1) the agents and goals are initialized with the maximum possible distance (); 2) the agents do not reach their goal throughout their trajectory; 3) the agents incur the maximum control cost for all timesteps. , , and denote the corresponding weights of the different cost terms in the cost function in (58) and (59). For the multi-agent MuJoCo environments, we first train the agents with (unconstrained) MAPPO with different random seeds, record the largest cost incurred, double it, and then use that as .
其中 为最大代价 的保守估计,对应:1) 智能体与目标以最大可能距离初始化();2) 全程未达目标;3) 全程付出最大控制代价。、、 为代价 中各项权重(见 (58)(59))。对多智能体 MuJoCo,先用不同种子的(无约束)MAPPO 训练,记录最大代价再翻倍作为 。
| Hyperparameter | Value |
|---|---|
| GNN layers | 2 for ConnectSpread, 1 for others |
| encoding dimension | 8 |
| outer problem solver | Chandrupatla’s method [12] |
TABLE V: Hyperparameters of Def-MARL.
| Hyperparameter | Value |
|---|---|
| GNN layers | 2 for ConnectSpread, 1 for others |
| encoding dimension | 8 |
| outer problem solver | Chandrupatla’s method [12] |
表 V:Def-MARL 超参数。
All the hyperparameters remain the same in all environments or are pointed out in the tables except for the training steps. The training step is in the Target and the Spread environments, in the Line environment, and in other MPE. For the Safe Multi-agent MuJoCo environments, we set the training step to .
除训练步数外,全部超参在各环境保持相同或见表中说明。Target 与 Spread 训练 步,Line 为 ,其余 MPE 为 ;Safe Multi-agent MuJoCo 为 步。
E-D Training curves
E-D 训练曲线
To show the training stability of Def-MARL, we have shown the cost and safety rate of Def-MARL and Lagr(lr) during training in the Target and Spread environments in the main pages (Figure 5). Due to page limits, we provide the plots for other environments here in Figure 12, Figure 13, and Figure 14. The figures show that Def-MARL achieves stable training in all environments. Specifically, as shown in Figure 13, while Lagr(lr) suffers from training instability because the constraint violation threshold is zero (as discussed in Section III-B), Def-MARL is much more stable.
为展示 Def-MARL 训练稳定性,正文已在 Target 与 Spread 给出 Def-MARL 与 Lagr(lr) 训练中的代价与安全率(图 5)。篇幅所限,其他环境曲线见图 12、图 13 与图 14。图表明 Def-MARL 在全部环境训练稳定;尤其图 13 显示,因零违反阈值 Lagr(lr) 训练不稳(第 III-B 节),而 Def-MARL 稳定得多。
图 12:Def-MARL 与基线在 MPE 训练中的代价与安全率。
图 13:Def-MARL 与 Lagr(lr) 在 MPE 训练中的代价与安全率。
图 14:Def-MARL 与全部基线在 Safe Multi-agent MuJoCo 训练中的代价与安全率。
E-E More comparison with the Lagrangian method
E-E 与拉格朗日方法的更多比较
In this section, we provide more comparisons between Def-MARL and the Lagrangian method, where we change the constraint-value function of the Lagrangian method from the sum-over-time (SoT) form to the max-over-time (MoT) form. Using the MoT form, the constraint-value function of the Lagrangian method becomes the same as the one used in Def-MARL (Equation 9). We create more baselines using this approach with different learning rates (lr) of the Lagrangian multiplier , where . The baselines are called Lagr-MoT. We compare Def-MARL with the new baselines in the Target environment, and the results are presented in Figure 15. We can observe that the Lagrangian method has very different performance with different learning rates of . With , the learned policy is unsafe, and with or , the training is unstable and the cost of the converged policy is much higher than Def-MARL. In addition, we also plot the values during training in Figure 15. It shows that keeps increasing without converging to some value, which also suggests the instability of the Lagrangian method.
本节进一步比较 Def-MARL 与拉格朗日方法:把后者约束价值从时间求和(SoT)改为时间最大(MoT),使拉格朗日方法的约束价值与 Def-MARL(式 9)相同。据此用不同拉格朗日乘子 学习率 构造 3 条新基线,称为 Lagr-MoT。在 Target 上与 Def-MARL 比较,结果见图 15。可见不同 学习率下拉格朗日方法表现差异很大: 时策略不安全; 或 时训练不稳且收敛策略代价远高于 Def-MARL。图 15 还绘制训练中 值,显示 持续增大而不收敛到某值,也说明拉格朗日方法不稳定。
图 15:Target 环境中 Def-MARL 与不同 学习率的 Lagr-MoT 训练代价、安全率,以及训练中的 值。
E-F Sensitivity analysis on the choice of
E-F 选择的敏感性分析
In Section E-C, we have introduced how to determine the sampling interval of . Here, we perform experiments in the Spread environment to study the sensitivity of Def-MARL on the choice of . In this experiment, we scale the value of used for sampling , and denote by the original value used in the experiments in the main pages, i.e., uses the same value as in the main pages. We report the safety rates and the costs of the Def-MARL policies trained with different in Table VI. We see that both safety and costs do not change much even when our estimate of the maximum cost changes by up to . If is too large (e.g., ), the policy becomes too conservative because not enough samples of that are near are observed, reducing the sample efficiency. On the other hand, when is too small (e.g., ), there may be states where the optimal does not fall within the sampled range. This causes the rootfinding step to be inaccurate, as will be queried at values of that were not seen during training, resulting in safety violations.
第 E-C 节介绍了如何确定 的采样区间。这里在 Spread 上实验研究 Def-MARL 对 选择的敏感性。将采样所用 相对正文原值 缩放,即 与正文相同。表 VI 报告不同 下所学策略的安全率与代价:即使最大代价估计变化达 ,安全与代价变化也不大。若 过大(如 ),因靠近 的 样本不足,策略过于保守、采样效率下降;若过小(如 ),可能出现最优 不在采样范围内,求根时会在训练未见过的 上查询 ,导致安全违反。
| Safety rate | Cost | |
|---|---|---|
TABLE VI: Safety and Cost of Def-MARL policies trained with different .
| Safety rate | Cost | |
|---|---|---|
表 VI:不同 下 Def-MARL 策略的安全率与代价。
E-G Effect of communication with more agents
E-G 更多智能体时 通信的影响
To test the effect of communication with more agents, we increase the number of agents to (at constant density) in Target environment during the test (Table VII). Without communication, we only see a drop in safety rate going from to . With communication, safety does not decrease with increased .
为测试更多智能体时 通信的影响,测试期在 Target 上将智能体数增至 (密度不变)(表 VII)。无通信时,从 到 安全率仅降 ;有 通信时,安全率不随 增加而下降。
| No communication | Communication () | |||
|---|---|---|---|---|
| Safety rate | Cost | Safety rate | Cost | |
| 32 | ||||
| 128 | ||||
| 512 |
TABLE VII: Effect of communication in larger scale environments.
| No communication | Communication () | |||
|---|---|---|---|---|
| Safety rate | Cost | Safety rate | Cost | |
| 32 | ||||
| 128 | ||||
| 512 |
表 VII:更大规模环境中 通信的影响。
E-H Code
E-H 代码
The code of our algorithm and the baselines are provided on our project website https://mit-realm.github.io/def-marl/.
算法与基线代码见项目主页 https://mit-realm.github.io/def-marl/。
Appendix F Hardware experiments
F-A Implementation details
F-A 实现细节
Hardware platform. We perform hardware experiments using a swarm of Crazyflie (CF) 2.1 platform [27]. We use two Crazyradios to communicate with the CFs and use the Lighthouse localization system to perform localization with four SteamVR Base Station 2.0. The computation is split into two parts: Onboard computation is performed on the CF microcontroller unit (MCU), and the offboard computation is performed on a laptop connected to the CFs over Crazyradio. We use the crazyswarm2 ROS2 package to communicate with the CFs, and a single ROS2 node for the off-board computations at 50Hz.
硬件平台。 真机实验使用 Crazyflie(CF)2.1 平台群 [27]。用两台 Crazyradio 与 CF 通信,并用四台 SteamVR Base Station 2.0 的 Lighthouse 定位系统定位。计算分两部分:机载在 CF 微控制器(MCU)上,机下在通过 Crazyradio 连接 CF 的笔记本上。用 crazyswarm2 ROS2 包通信,单一 ROS2 节点以 50Hz 做机下计算。
Control framework. Given a state estimation of the CFs using the Lighthouse system, the laptop inputs the states to the algorithm models (Def-MARL, CMPC, or DMPC), which then outputs the accelerations. Then, the laptop computes the desired next positions, velocities, and accelerations for the CFs, and sends the information to the CF MCU. After receiving the information, the CF MCU uses the onboard PID controller to track the desired position, velocity, and acceleration, which outputs the motor commands. Distributed execution is simulated on the laptop by only giving each agent local information as input to their distributed policies.
控制框架。 给定 Lighthouse 状态估计后,笔记本把状态输入算法模型(Def-MARL、CMPC 或 DMPC),输出加速度;再计算 CF 的期望下一位置、速度与加速度并发送到 CF MCU;MCU 用机载 PID 跟踪期望量并输出电机指令。分布式执行在笔记本上模拟:仅把局部信息作为各分布式策略输入。
F-B Tasks
F-B 任务
Corridor. The Corridor task uses the same cost and constraint function as the simulation Corridor environment, which has been introduced in Section E-B.
Corridor。 Corridor 任务使用与仿真 Corridor 环境相同的代价与约束函数,见第 E-B 节。
Inspect. In this task, two CF drones need to work collaboratively to observe a moving target CF drone while maintaining collision-free with each other and the obstacles. The constraint function is defined the same as the simulation environments defined as with and defined in (55) and (56). The cost function is given by
Inspect。 本任务中两架 CF 须协作观测移动目标 CF,同时彼此及与障碍保持无碰撞。约束 与仿真相同:,、 见 (55)(56)。代价为
where if the target is observable by at least one agent and otherwise. For , we have if the target is observable by agent , otherwise, it is defined as the distance between the farthest observed point on the agent-target line and the target. Finally, is defined as .
其中若至少一智能体可观测目标则 ,否则为 。对 :若智能体 可观测目标则为 ,否则为智能体–目标连线上最远已观测点到目标的距离。最后 。
F-C Videos
F-C 视频
The videos of our hardware experiments are provided in the supplementary materials named ‘Corridor.mp4’ and ‘Inspect.mp4’.
真机实验视频见补充材料 ‘Corridor.mp4’ 与 ‘Inspect.mp4’。
Appendix G Convergence
In this section, we analyze the convergence of the inner RL problem (13b) to a locally optimal policy.
本节分析内层 RL 问题 (13b) 向局部最优策略的收敛。
Since we solve the inner RL problem (13b) in a centralized fashion, it can be seen as an instantiation of single-agent RL, but with a per-agent independent policy. Define the augmented state as , which follows the dynamics defined as
因内层 (13b) 以中心化方式求解,可视为带按智能体独立策略的单智能体 RL 实例。定义增广状态 为 ,动力学 定义为
The inner RL problem (13b) can then be stated as
于是内层 RL 问题 (13b) 可陈述为
This is an instance of a single-agent RL avoid problem. Consequently, applying the results from [81, Theorem 5.5] or [67, Theorem 4] gives us that the policy converges almost surely to a locally optimal policy.
这是单智能体 RL avoid 问题的实例。因而应用 [81, Theorem 5.5] 或 [67, Theorem 4] 的结果,可得策略 几乎必然收敛到局部最优策略。
Appendix H On the equivalence of the MASOCP and its epigraph form
In Section III-B, we state that the Epigraph form (5) of a constrained optimization problem is equivalent to the original problem (3). This has been proved in So and Fan 2023. To make this paper more self-contained, we also include the proof here.
第 III-B 节指出约束优化问题的上图形式 (5) 与原问题 (3) 等价;So 与 Fan 2023 已证明。为使本文更自洽,此处亦给出证明。
Proof:
For a constrained optimization problem (3), its epigraph form [10, pp 134] is given by
证明:
对约束优化问题 (3),其上图形式 [10, pp 134] 为
where is an auxiliary variable. Here, (68b) and (68c) can be combined, which leads to the following problem:
其中 为辅助变量。可将 (68b) 与 (68c) 合并,得到:
Using this form, So and Fan 2023 shows that the minimization of can be moved into the constraint, which yields
在此形式下,So 与 Fan 2023 表明可把对 的最小化移入约束,得到
This is the same as (5). ∎
这与 (5) 相同。∎











