WorksEngineering
Control Barrier Functions for Counting Tasks in Multi-Agent Systems
Abstract
Multi-agent systems increasingly operate in dynamic environments and execute complex tasks that require coordination, posing significant computational challenges. Counting tasks, which require a minimum number of agents to satisfy a given condition, arise naturally in such systems. Examples include surveillance tasks, where at least m drones must continuously monitor a critical area, and emergency-response tasks, where at least m robots must converge to an incident location. The identities of the agents assigned to these tasks may change dynamically depending on their states, input bounds, and individual objectives. In this work, we propose a control barrier function (CBF)-based framework for enforcing counting invariance and counting convergence tasks, without explicitly assigning agents or enumerating all possible subteams. We develop a recursion-based method for constructing differentiable CBFs for counting tasks. The resulting CBF constraints are incorporated into quadratic programs, enabling online controller synthesis. Numerical experiments demonstrate scalability to large multi-agent systems, while a multi-drone emergency-response case study illustrates the satisfaction of counting tasks.
Introduction
Multi-agent systems often execute tasks that depend on the number of agents satisfying a condition rather than on their identities. Examples include smart warehouses, where at least drones must continuously patrol storage areas; disaster response, where at least robots must converge to a wildfire perimeter or earthquake impact zone; and energy systems, where a minimum number of backup generators must remain within an operating range to provide reserve capacity. Such counting tasks can be satisfied by different agent subteams, making task allocation critical. However, preassigning agents to tasks may lead to inefficient allocations or infeasibility as operating conditions change. This motivates online controllers that dynamically adapt task allocation based on agents’ states, control capabilities, and individual objectives.
Temporal logics provide an expressive framework for specifying high-level control objectives, including safety, reachability, and sequential or repeated execution of tasks. For multi-agent systems, temporal logics have been used to describe collective behaviors and synthesize controllers with formal guarantees of task satisfaction. In [1], a hierarchical framework produces provably correct control laws for temporal-logic specifications over the position and size of robotic swarms. For counting tasks, [2] introduced counting linear temporal logic (cLTL) and used integer programming to synthesize satisfying plans. This framework was extended
in [3] to handle bounded asynchronous execution among agents. More recently, [4] developed a dual-tree-based value iteration framework to reduce computational cost for cLTL tasks in stochastic homogeneous multi-agent systems. These counting-task approaches rely on discrete system representations and offline synthesis, motivating the development of online methods operating directly in continuous state spaces.
Control barrier functions (CBFs) provide a framework for real-time control synthesis with formal safety guarantees [5, 6]. More recently, CBFs have also been used to enforce temporal-logic specifications [7, 8] and security hyperproperties [9]. Boolean combinations of safety constraints can also be addressed through nonsmooth [10] and smooth [11] CBF compositions. However, a direct use of these composition methods to express counting tasks requires enumerating a combinatorial number of possible agent subteams, increasing the size of the specification and the computational cost of constructing and evaluating the associated CBF. This motivates the development of CBF formulations tailored to counting tasks. Recently, [12] introduced combinatorial CBFs for counting invariance, requiring at least out of agents to remain in a prescribed set at all times. This approach preserves the exact counting safe set and avoids combinatorial enumeration, but imposes one CBF constraint per agent. Enforcing these constraints simultaneously in a quadratic program (QP) can increase computational cost for large teams and pose significant QP feasibility challenges.
In this paper, we develop a CBF-based framework for counting invariance and counting convergence tasks for large multi-agent systems. While counting invariance requires at least of agents to satisfy a prescribed condition at all times, counting convergence requires the system to converge to a configuration in which at least out of agents satisfy such a condition. We associate each agent with a scalar value that is nonnegative if and only if the agent satisfies the prescribed condition. The counting task is therefore equivalent to nonnegativity of the largest value. Since this ordered value is generally nondifferentiable, we construct arbitrarily tight, differentiable lower approximations as candidate CBFs for counting tasks. We also provide a method that efficiently evaluates these CBFs through a forward recursion and their gradients through a backward recursion, without explicit task allocation or combinatorial enumeration of agent subteams. Compared with [12], our framework handles both counting invariance and counting convergence tasks, using one aggregate CBF constraint per task rather than agent-wise constraints. We also establish sufficient conditions for locally Lipschitz continuity of the QP controller under standard feasibility and regularity assumptions.
The remainder of the paper is organized as follows. Sec. II introduces the preliminaries and problem formulation, and Sec. III constructs candidate CBFs for counting tasks. Sec. IV presents the control synthesis framework with guarantees of counting-task satisfaction. Sec. V evaluates the scalability of the proposed method and presents a multi-drone case study, and Sec. VI concludes the paper.
Preliminaries & Problem Formulation
Notation. Let and denote the sets of real and nonnegative real numbers, respectively. The zero vector is denoted . For a vector , denotes its Euclidean norm. Given a nonempty set , denotes the Euclidean distance of from . The cardinality of a set is denoted by . For integers and , the binomial coefficient denotes the number of -element subsets of an -element set, with . A continuous function is class- if it is strictly increasing and . The definition extends to extended class- functions . The notations and are used interchangeably for the exponential function. Continuously differentiable functions are denoted by .
System model
Consider a multi-agent system with agents, indexed by . Each agent follows nonlinear input-affine dynamics, i.e.,
where and are its state and control input, respectively. The functions and , , are locally Lipschitz continuous. Let
denote the stacked state and input, respectively. Note that given a locally Lipschitz controller, the closed-loop system is locally Lipschitz. Then, for any initial condition , there exists a unique maximal solution defined on . The closed-loop system is forward complete if for any .
Control barrier functions
Let be an open set, and define the set as the zero-superlevel set of a function , i.e.,
Definition 2.1. A function is a control barrier function (CBF) for if there exists a locally Lipschitz extended class- function such that, for all ,
Note that Def. 2.1 implies a centralized control framework, that is, each agent’s control input may depend on the joint state . This definition is used in Sec. IV to synthesize online controllers for counting tasks.
Problem formulation
Consider the system in (1), and . Consider the functions , and the sets
Define, for any set , if , and otherwise.
Definition 2.2. A counting invariance task is satisfied if at least out of the agents in (1) belong to at all times, i.e., , .
The identities of the agents satisfying the counting invariance task need not be fixed over time, provided that the required number is maintained.
Definition 2.3. A counting convergence task is satisfied if the joint state of (1) eventually converges to the set as .
Problem 2.4: Design controllers , , such that the system in (1) satisfies the counting invariance task in Def. 2.2 and/or the counting convergence task in Def. 2.3.
To solve Prob. 2.4, we first construct differentiable candidate CBFs for the counting tasks and develop an efficient recursion-based approach for evaluating their values and gradients (cf. Sec. III). Then, we incorporate the corresponding CBF constraints into a QP that enables controller synthesis for counting invariance and convergence without explicitly assigning agents to tasks (cf. Sec. IV).
Candidate CBFs for Counting Tasks
In this section, we develop a method for constructing and efficiently evaluating differentiable CBFs.
Consider the system in (1). Let be a function defining a set . This function is evaluated at each agent’s state, such that if and only if agent belongs to . The construction of candidate CBFs in this section applies to both counting invariance tasks with and counting convergence tasks with . We denote the largest among these values by , , such that . Requiring at least agents to belong to is thus equivalent to requiring . Although evaluating is straightforward, the function is generally nondifferentiable at points where the ordering of the values changes, preventing its direct use as a CBF for counting tasks. Therefore, we seek a differentiable lower approximation to serve as a candidate CBF. Enforcing guarantees , and hence ensures that at least agents belong to .
We start by expressing in terms of sums of ordered values. The sum of the largest values is
with . We denote by the collection of all subsets consisting of agents, i.e., . Then, we can express in terms of the agents’ values as
Intuitively, among all possible subteams of agents, the largest sum is obtained by selecting the agents associated with the largest values. The largest value, , can then be recovered from two consecutive sums as
Note that and are still nondifferentiable. Next, we construct approximations of these two sums and develop a recursion-based method to efficiently evaluate the derived candidate CBF and its gradient.
Construction of candidate CBFs
To obtain a approximation of (5), we approximate the sums and using the LogSumExp function. Recall that, for any and , the following inequality holds
In order to apply it to lower approximate in (4), we define
For , the collection contains subteams, i.e., , corresponding to all ways of selecting agents of the system. Thus, applying (6) to these subteam sums gives , or, equivalently,
We can now construct a lower approximation of , by lower-bounding and upper-bounding . We have
Therefore, implies , which guarantees that at least agents belong to . The conservatism introduced by this approximation can be explicitly bounded as
The approximation becomes arbitrarily tight as , with . We have now obtained a differentiable lower approximation of , i.e., , which serves as a candidate CBF. However, directly evaluating and requires enumerating a combinatorial number of subteams and becomes prohibitive for online computation as the number of agents increases (cf. Figure 2). Next, we show how we can compute these quantities recursively without explicit subteam enumeration.
Figure 2. Experiment (i): Computation times of the recursion-based and combinatorial methods as increases, with .
Forward recursion for efficient CBF evaluation
We compute the candidate CBF by processing all agents sequentially and accumulating the exponential contributions of all possible subteams of each size as in (7). We use stage to indicate that the first agents have been processed. For each stage and subteam size , let us define
At the final stage , all agents have been processed, thus (7) gives
Substituting this into (8) yields
Therefore, evaluating the candidate CBF requires only the terminal quantities and .
To update , we partition the -agent subteams drawn from the first agents into two disjoint groups, according to whether they contain agent . Subteams in the first group exclude agent and are formed by selecting agents from the first agents. Thus, their total contribution is . Subteams in the second group are formed by adding agent to a -agent subteam selected from the first agents. The total contribution of the second group is therefore . Combining the two groups, we obtain
We initialize the recursion by setting for , since the empty subteam contributes one. We also set whenever , because a -agent subteam cannot be formed from only agents. At each stage , we apply (12) for , using values only from stage . This forward recursion produces the two terminal quantities required in (11).
The following example illustrates how the forward recursion evaluates the candidate CBF by updating and reusing intermediate quantities across successive stages.
Example 3.1. Consider a system with , , , and , , , . Figure 1 shows the recursion process, with

Figure 1. Illustration of the forward recursion for and . Green entries equal one, red entries equal zero, and blue entries do not need to be evaluated.
stages in columns and subteam sizes in rows. Horizontal and diagonal arrows represent the two terms in (12). The gray nodes mark the terminal sums and used to evaluate the candidate CBF as in (11).
At stage , the only way to select one agent is to select agent 1. Thus, . At stage , there are two ways to select one agent, either agent 1 or agent 2. Thus, . Moreover, the only way to select two agents is to include both agents 1 and 2. Thus,
At stage , the two-agent subteam excludes agent 3, whereas and include it. Accordingly,
These two contributions correspond to the two arrows entering in Figure 1. At the final stage, and . Since the third-largest value is , (11) yields
For , the approximation is conservative, as expected from the bound in (9), which gives
However, remains a valid lower approximation of . Reducing to and yields and , respectively, showing convergence to as , consistent with the approximation error bounds in (9). ⋄
Since only the two terminal sums are needed to evaluate the candidate CBF in (11), some entries of the recursion do not need to be computed. A -agent subteam at stage can grow to at most agents by stage , so it cannot contribute to either terminal sum if . Thus, the update range can be restricted to
In Figure 1, the blue entries can be omitted for this reason, while the red entries are zero. With this restricted update range, the constant entries are needed only for , as shown in green.
Next, we differentiate the forward recursion to efficiently evaluate the gradient required by the CBF constraint in (3).
Backward recursion for CBF gradient evaluation
We compute the gradient of by differentiating the forward recursion in (12). We first propagate derivatives backward from the terminal quantities, then apply the chain rule to obtain the derivatives with respect to and the agent states , .
For each entry, we define . This derivative accounts for all subsequent stages through which affects the candidate CBF. At the final stage , (11) depends only on and , so we initialize the backward recursion with
and , for . Starting from these terminal derivatives, we proceed backward through stages . By (12), each contributes to two entries at stage : and . Hence, the chain rule sums the contributions through these two entries:
If , the entry contributes only to , giving . As in the forward recursion, entries with are omitted, and their derivatives are set to zero. The constant entries and for require no backward updates.
Once the derivatives at stage are available, we compute the derivative with respect to . Note that appears explicitly in the forward recursion in (12) only at stage . Thus, differentiating (12) gives
Since affects all entries at stage with , we apply the chain rule and sum their contributions to obtain
Finally, multiplying by the gradient of gives the desired state gradient:
Alg. 1 summarizes the forward and backward recursions presented in § 3-B and § 3-C. Given the individual agents’ and their gradients, Lines 1–5 initialize and evaluate the forward recursion, producing the terminal sums required to compute the candidate CBF in line 6. The backward recursion in lines 7–15 reuses the stored intermediate quantities from the forward recursion to compute the gradient with respect to the agent states (line 15). These outputs are used in Sec. IV to formulate the CBF constraints for counting invariance and convergence tasks.
The proposed approach constructs a candidate CBF for counting tasks and efficiently evaluates its value and gradient through forward and backward recursions, without explicitly enumerating agent subteams. Moreover, the approach is permutation invariant: reordering the agents leaves the CBF value unchanged and permutes its gradient components accordingly.
Complexity analysis
Next, we analyze the computational and memory complexity of the proposed method. Direct evaluation of and as in (7) requires enumerating and subteams, respectively. Since computing each subteam sum
Algorithm 1 Recursions for CBF and gradient evaluation
Input: $m$, $\tau$, $h(x_l)$, $\partial h(x_l)/\partial x_l$, $l=1,\ldots,M$
Output: $h_{(m)}$, $\partial h_{(m)}/\partial x_l$, $l=1,\ldots,M$
1: $k_{\min}^{(l)}=\max\{1,m-M+l-1\}$
2: Initialize the forward recursion: $Z_0^{(l)}\leftarrow 1$, $l=0,\ldots,M$, and $Z_k^{(l)}\leftarrow 0$, $k>l$
3: for $l=1,\ldots,M$ do
4: for $k=k_{\min}^{(l)},\ldots,\min\{l,m\}$ do
5: $Z_k^{(l)}\leftarrow Z_k^{(l-1)}+\exp(h(x_l)/\tau)Z_{k-1}^{(l-1)}$
6: $h_{(m)}\leftarrow\tau\ln Z_m^{(M)}-\tau\ln Z_{m-1}^{(M)}-\tau\ln\binom{M}{m}$
7: Initialize the backward recursion:
$\lambda_k^{(l)}\leftarrow 0$, $k=0,\ldots,m$, $l=0,\ldots,M$,
$\lambda_m^{(M)}\leftarrow\tau/Z_m^{(M)}$, $\lambda_{m-1}^{(M)}\leftarrow-\tau/Z_{m-1}^{(M)}$
8: for $l=M,\ldots,1$ do
9: if $l<M$ then
10: for $k=k_{\min}^{(l)},\ldots,\min\{l,m-1\}$ do
11: $\lambda_k^{(l)}\leftarrow\lambda_k^{(l+1)}+\exp(h(x_{l+1})/\tau)\lambda_{k+1}^{(l+1)}$
12: if $m\leq l$ then
13: $\lambda_m^{(l)}\leftarrow\lambda_m^{(l+1)}$
14: $\frac{\partial h_{(m)}}{\partial h(x_l)}\leftarrow\frac{1}{\tau}\exp(h(x_l)/\tau)\sum_{k=k_{\min}^{(l)}}^{\min\{l,m\}}\lambda_k^{(l)}Z_{k-1}^{(l-1)}$
15: $\frac{\partial h_{(m)}}{\partial x_l}\leftarrow\frac{\partial h_{(m)}}{\partial h(x_l)}\frac{\partial h(x_l)}{\partial x_l}$
requires operations, direct enumeration has computational complexity , which is combinatorial in and quickly becomes prohibitive for online computation.
The proposed recursion-based method processes at most entries over stages, with a constant number of operations per entry in both the forward and backward recursions. Thus, the computational complexity is . For , it is more efficient to view the th largest value as the th smallest value, and express it as the difference between the sum of the and smallest values. These sums can be smoothly approximated using the LogSumExp approximation of the minimum. The same forward and backward recursions then apply, with only instead of entries per stage. Thus, the computational complexity is , with worst-case complexity . The backward recursion requires storing intermediate quantities from the forward recursion. Thus, the memory complexity is , or in the worst case.
Controller Synthesis
In this section, we use the candidate CBFs and their gradient developed in § 3 to synthesize controllers for the counting tasks defined in Def. 2.2-2.3. We first establish sufficient conditions for forward invariance and attractivity of sets. We then incorporate the corresponding CBF constraints into an online QP and establish guarantees for satisfaction of the counting tasks.
Proposition 4.1: Consider the system in (1), a function , and a locally Lipschitz extended class- function . Let be an open set that contains the set .
(i) Suppose that is a CBF as in Def. 2.1. Then, any locally Lipschitz controller satisfying
for all renders forward invariant over the maximal interval of existence of each closed-loop solution.
(ii) Let be a closed set with . Suppose there exists a class- function such that
for all . Then, any locally Lipschitz controller satisfying (14) for all renders attractive, provided that the closed-loop solutions are forward complete. That is, for any .
Proof: (i) Let and define . By (14), we have . Comparing the comparison system , with . Since is extended class- and locally Lipschitz, it holds that , . By the comparison lemma [13], , . Hence, every closed-loop trajectory with remains in over .
(ii) Let . Then , since . Define and a class- function . The function is locally absolutely continuous, and (14) gives whenever . When , its derivative is zero almost everywhere, so the inequality holds almost everywhere along the trajectory. Since is locally Lipschitz and class-, comparing with , , yields as and that the closed-loop solution is forward complete. Moreover, , . This follows from (15) for , while otherwise. Since is class- and as , we have , proving attractivity of . ■
We consider the counting invariance and convergence tasks as in Defs. 2.2-2.3, associated with , and functions , defining and , respectively. From (11), we obtain candidate CBFs and . The corresponding sets associated with the CBFs are , . Since (resp. ) provides a lower approximation of the th largest value with respect to (resp. ), we get
To apply Prop. 4.1(ii) to counting convergence tasks, we must verify (15) for the candidate CBF and . The following lemma derives this bound from a corresponding condition on that can be readily checked when choosing .
Lemma 4.2. Suppose there exists a class- function such that
for all . Then (15) holds with , , and .
Proof. Let , , and denote the states corresponding to the largest values . For , . By definition, we have , . Thus, by (18) and , each agent satisfies . Define . Then,
Monotonicity of then gives
The function is class-. Moreover, by (9), , thus , which completes the proof. ■
We synthesize controllers for both counting tasks by solving a convex QP. At each state , the optimal joint input is obtained by solving
where is a locally Lipschitz nominal controller encoding the individual objectives of the agents, are slack variables, and are their respective penalty weights. For , the CBF constraints are defined by
with being locally Lipschitz and extended class-. The gradient of is efficiently evaluated through the backward recursion in (13). The closed-loop trajectories of (1) are obtained by applying , .
Remark 4.3. The QP in (19) allows the two counting tasks to be enforced separately, relaxed or prioritized. In particular, setting (resp. ) enforces the counting invariance (resp. convergence) constraint without relaxation. In this case, satisfaction guarantees can be established for the prioritized task, whenever the QP admits a solution.
The following theorem establishes sufficient conditions under which from (19) guarantees satisfaction of the counting invariance task (with ) and the counting convergence task (with ).
Theorem 4.4. Consider the system in (1) and the counting tasks in Def. 2.2–2.3, with and functions defining , . Let be constructed as in (11), with its value and gradient evaluated using Alg. 1. Assume that and have locally Lipschitz gradients. Consider the controller obtained from the QP in (19), and assume that the resulting closed-loop solutions are forward complete.
(i) Counting invariance. Consider . Let be an open set such that, for every , there exists such that . Then the QP controller in (19) with satisfies the counting invariance task for every .
(ii) Counting convergence. Consider . Suppose that for every , there exists such that . Assume that (18) holds for all with a class- function . Then, the QP controller in (19) with satisfies the counting convergence task for every .
Proof. (i) Since the gradient of is locally Lipschitz, the gradient of is locally Lipschitz, as follows from (13). By the nonvanishing condition , the active constraints of the QP in (19) with are linearly independent on . Note that without input bounds, and by choosing the slack variable sufficiently large, the inequality in (19) is always feasible for all . Together with strong convexity of the objective and local Lipschitz continuity of , , and , , this implies that the unique optimizer is locally Lipschitz on . According to Def. 2.1, we get that the constructed in (11) is indeed a CBF. Then, applying Prop. 4.1(i), together with forward completeness, we get that is forward invariant . Recalling that by (16), the counting invariance task is satisfied for every .
(ii) Similarly, the nonvanishing condition ensures linear independence of the active constraints of the QP in (19) with . Thus, is locally Lipschitz on . Moreover, with the QP being feasible for all , we get that constructed in (11) satisfies (14) for all . Since (18) holds for , by Lemma 4.2, (15) holds for all . Recalling that by (17). By applying Prop. 4.1(ii), together with the forward completeness, we get that is attractive. Hence, the counting convergence task is satisfied for every . ■
Numerical Results
In this section, we evaluate the scalability of the proposed recursion-based method and illustrate controller synthesis for counting invariance and counting convergence tasks through a multi-drone emergency response case study. Simulations were run in MATLAB R2025a on a computer equipped with an AMD Ryzen 7 PRO 8845HS processor and 32 GB of RAM.
Computational performance and scalability
Let denote the total number of agents and the required agent count. We evaluate the computation times required to calculate the CBF and its gradient using the recursion-based method in Sec. III. For comparison, we consider a naïve combinatorial method that explicitly enumerates all subsets of cardinalities and , computes the LogSumExp approximations and from (7), and evaluates the candidate CBF in (8) and its gradient. Both methods yield the same CBF and gradient, but the recursion-based method avoids combinatorial computational complexity by reusing intermediate quantities. Two experiments are conducted in MATLAB: (i) varying from 8 to 20000, with , and (ii) varying from 1 to 241, with . For each experiment, the task function values are randomly generated, and the median computation times over 15 evaluations are reported. We choose
to ensure , according to (9). The results in Fig. 2-3 are consistent with the complexity analysis in Sec. III-D. In Fig. 2, computation time of the proposed approach scales approximately quadratically with at a fixed ratio , remaining below 10 ms even at . In contrast, combinatorial enumeration becomes prohibitive for online computation with only agents. In Fig. 3, computation time scales approximately linearly with for , remaining below 3 ms for all tested values of .
These computation times quantify the cost of evaluating the CBF and its gradient at each sampling instant before solving the QP in (19). The results demonstrate the potential of the proposed method for real-time control of hundreds of agents, even when the task requires a large fraction of the team to satisfy the prescribed condition.
Case study
We illustrate the proposed framework on a multi-drone emergency response scenario. A fleet of drones delivers supplies between villages following an earthquake, with each drone assigned two villages to visit alternately. The emergency response protocol requires at least drones to remain in the standby region
maintaining a reserve in case of potential aftershocks. This defines a counting invariance task as in Def. 2.2. Figure 4 shows the drones in yellow, the villages in gray, and the standby region in blue.
Figure 4. Drone positions at (a) , (b) (before the aftershock), and (c) , (d) (after). Drones (in yellow), villages (in gray), the standby region (in blue), and the emergency region (in red) are shown.
At time , an aftershock activates a counting convergence task as in Def. 2.3 requiring at least drones to converge to the emergency region
shown in red in Figure 4. The standby invariance task is reduced to drones, and its CBF constraint is relaxed using
Figure 3. Experiment (ii): Computation times of the recursion-based method as increases, with .
a slack variable with penalty weight as in (19). The emergency convergence task is enforced without relaxation (), prioritizing the emergency response task over the standby invariance task as described in Remark 4.3.
Each drone follows single-integrator dynamics, i.e.,
where denote its position and velocity, respectively. Both and have locally Lipschitz gradients. Moreover, satisfies (18), by choosing .
Following Sec. III, we construct CBFs for the counting tasks. For , we construct from and . For , we construct and from , , and , , respectively. We evaluate their values and gradients using the forward and backward recursions in Alg. 1. We choose , ensuring that the worst-case approximation error is at most 0.1 for all three counting tasks, according to (9). The resulting CBF constraints are incorporated into the QP in (19) for controller synthesis.
The individual delivery objective of each drone , , is encoded by the nominal input
where is the center of the current target village, and . Whenever a drone reaches within distance 0.2 of its current target village’s center, its target is updated to the other assigned village.
Figure 4(a)-(Figure 4d) show snapshots of the fleet at initial deployment (), before the aftershock (), after the aftershock but before convergence () and after convergence (), respectively. Figure 5 shows the numbers of drones in the standby and emergency regions over time, together with the desired thresholds, i.e., for , and , for . The standby invariance task is satisfied throughout , while the emergency region count first reaches six at , corresponding to a response time of after the aftershock. Figure 6 relates these counts to the exact ordered values and the corresponding CBFs: at least drones belong to a region if and only if , while the CBF is a lower approximation of . At , both counting requirements hold, as confirmed by Figure 4-Figure 6. These results demonstrate that the proposed framework enables controller synthesis for both counting invariance and counting convergence tasks, while accommodating individual objectives.
Figure 5. Drone counts and desired thresholds for the standby invariance and emergency convergence tasks.
Figure 6. CBFs and exact ordered values for the standby invariance and emergency convergence tasks.
Conclusion
This paper proposes an online CBF-based control synthesis framework for counting invariance and counting convergence tasks in continuous-time multi-agent systems. A recursion-based method enables efficient construction and evaluation of differentiable CBFs without explicit task allocation or enumeration of agent subteams. The framework provides theoretical guarantees of counting-task satisfaction and is validated through a multi-drone emergency-response case study. Future work includes extensions to more general cLTL specifications and higher-order dynamics through high-order CBFs [14], experimental validation, and distributed implementations.
References
- [1]M. Kloetzer and C. Belta, “Temporal logic planning and control of robotic swarms by hierarchical abstractions,” IEEE Trans. Robot., vol. 23, no. 2, pp. 320–330, 2007.DOI
- [2]Y. E. Sun, P. Nilsson, and N. Ozay, “Provably-correct coordination of large collections of agents with counting temporal logic constraints,” in Proc. ACM/IEEE Int. Conf. Cyber-Phys. Syst., 2017, pp. 249–258.
- [3]——, “Multirobot coordination with counting temporal logics,” IEEE Trans. Robot., vol. 36, no. 4, pp. 1189–1206, 2019.
- [4]X. Qiu, R. Wang, S. Liu, and S. Haesaert, “Compressing correct-by-design synthesis for stochastic homogeneous multi-agent systems with counting tl,” Proc. 65th IEEE Conf. Decis. Control, to appear, 2026.DOI
- [5]A. D. Ames, J. W. Grizzle, and P. Tabuada, “Control barrier function based quadratic programs with application to adaptive cruise control,” in Proc. 53rd IEEE Conf. Decis. Control, 2014, pp. 6271–6278.DOI
- [6]A. D. Ames, S. Coogan, M. Egerstedt, G. Notomista, K. Sreenath, and P. Tabuada, “Control barrier functions: Theory and applications,” in Proc. 18th Eur. Conf. Control, 2019, pp. 3420–3431.arxiv.org/abs/1903.11199
- [7]L. Lindemann and D. V. Dimarogonas, “Control barrier functions for signal temporal logic tasks,” IEEE Control Syst. Lett., vol. 3, no. 1, pp. 96–101, 2019.DOI
- [8]M. Srinivasan and S. Coogan, “Control of mobile robots using barrier functions under temporal logic specifications,” IEEE Trans. Robot., vol. 37, no. 2, pp. 363–374, 2021.arxiv.org/abs/1908.04903
- [9]G. Mitsos and S. Liu, “Control synthesis for security hyperproperties via control barrier functions,” IEEE Control Syst. Lett., to appear, 2026.DOI
- [10]P. Clotfelter, J. Cortés, and M. Egerstedt, “A nonsmooth approach to controller synthesis for boolean specifications,” IEEE Trans. Autom. Control, vol. 66, no. 11, pp. 5160–5174, 2021.
- [11]T. G. Molnar and A. D. Ames, “Composing control barrier functions for complex safety specifications,” IEEE Control Syst. Lett., vol. 7, pp. 3615–3620, 2023.arxiv.org/abs/2309.06647
- [12]P. Ong, H. Lee, T. G. Molnar, D. Panagou, and A. Ames, “Combinatorial control barrier functions: Nested boolean and p-choose-r compositions of safety constraints,” IEEE Control Syst. Lett., vol. 9, pp. 2705–2710, 2025.DOI
- [13]H. K. Khalil, Nonlinear Systems, 3rd ed. Prentice Hall, 2002.
- [14]W. Xiao and C. Belta, “Higher-order control barrier functions,” IEEE Trans. Autom. Control, vol. 67, no. 7, pp. 3655–3662, 2021.




