← Back to Autonomy
A visual monograph · Multi-agent control

From Consensus
to Containment

How a network of agents learns to agree, to follow, and finally to settle inside a territory shaped by many leaders at once.

Act IConsensus

Picture six people in a room, each holding up a number. They can only see their neighbors — not everyone. Each agent nudges their own number toward the average of whatever they can see. Wait a few seconds. What happens?

They converge. Not to any number in particular — to a common number, determined by the initial values and the graph of who-sees-whom. This is the simplest problem in cooperative control, and almost every other problem on this page is a variation on it.

Figure 1 · Interactive
Consensus on a connected graph
Six agents. Each curve is one agent's value over time. Every agent integrates ẋᵢ = Σⱼ aᵢⱼ(xⱼ − xᵢ) — pull toward each visible neighbor. The endpoints collapse onto a single value, the consensus.

The math is one line. Let L be the graph Laplacian. Then ẋ = −Lx, and if the graph has a single connected component the solution exponentially approaches (1/n) 1 1ᵀ x(0) — the mean of the starting values. The dynamics are doing nothing fancier than a weighted averaging, over and over, forever.

The three matrices that run the show

Three matrices encode everything about a consensus network. The adjacency matrix A records who listens to whom. The in-degree matrix D counts how many neighbors each agent has. The Laplacian L = D − A combines them into the operator that drives the dynamics.

Figure 2 · Interactive
Adjacency, in-degree, and Laplacian
Click any off-diagonal cell in the A matrix — or any edge in the graph — to toggle it on or off. The D and L matrices (and the row-sums on the right) update live. Try the preset topologies to see how structure shapes the Laplacian.

Three properties of L fall straight out of the definition and they are all you need to understand consensus:

L · 1 = 0 (each row sums to zero)

This is why any constant vector is a fixed point of ẋ = −Lx. If every agent already agrees, nothing pulls them apart.

λ = 0 is an eigenvalue of L, with eigenvector 1

The dimension of the zero-eigenspace equals the number of connected components. For a single connected graph, there is exactly one direction in which L does nothing — the agreement direction. Every other eigenvalue is strictly positive, so e−Lt crushes every other direction. Whatever component of x(0) disagrees decays; whatever component agrees survives.

xᵀ L x = ½ · Σᵢⱼ aᵢⱼ (xⱼ − xᵢ)²

This quadratic form is a disagreement energy. It is zero only when neighbors match, positive otherwise. The consensus dynamics are gradient descent on this energy, weighted by the graph.

What changes for leader-follower

When some agents are leaders — agents not pulled by anyone — the Laplacian breaks into blocks. Label the followers first, the leaders second, and L has the form

L = [[ L₁ L₂ ], [ 0 0 ]]

The bottom rows are zero because leaders ignore everyone. L₁ is the follower-to-follower block; L₂ is the leader-to-follower block. The convex weights that show up in containment — the NLIs — are rows of the matrix

Φ = − L₁⁻¹ L₂

A theorem from graph theory guarantees each row of Φ has non-negative entries that sum to one. That sum-to-one is the mathematical reason containment works: each follower's steady-state target is a convex combination of leader states, and a convex combination of points in a hull still lies in the hull.

Act IILeader & Followers

Now add one special agent — a leader — whose value is not pulled toward the others. It moves under its own will. Everyone else is still averaging with their neighbors, but some of them can see the leader. Those agents feel a second force: a pull toward the leader's value.

Figure 3 · Interactive
One leader, five followers
The red star is the leader — its trajectory is prescribed (or, in the third mode, controlled by you). Followers (ink circles) pull toward their neighbors and, for those with a direct edge to the leader, toward the leader itself. After a transient they all track the leader's trajectory.

This is leader-following consensus. It works even though most followers cannot see the leader directly: information propagates through the follower graph. One or two "pinned" followers are enough to drag the whole swarm along.

But notice the restriction: there is one target trajectory. Everyone ends up doing the same thing. For many real problems — a convoy covering a road, a sensor net surrounding a threat, a formation maintaining a shape — we want agents to converge to different places, together. That needs more than one leader.

Act IIIContainment

Give the network several leaders. Not to compete, but to jointly define a region: the convex hull of their positions. The followers' job is no longer to agree on a point. It is to end up somewhere inside that hull — any point is fine, so long as it is bounded by the leaders.

Figure 4 · Interactive
Three leaders, a convex hull, six followers
Crimson stars are leaders — drag them. The shaded polygon is their convex hull: the "safe region". The six ink circles are followers. Each follower steers toward a weighted blend of the leaders it can reach, and the result is always a point inside the hull. Move the leaders and watch the hull (and the followers) follow.
The containment problem is the consensus problem, wearing geometry. Instead of one agreed-upon value, agents agree to live inside a territory they did not individually choose.

Why is this hard? Because the "target" for each follower is no longer a single trajectory. It is a time-varying combination of several leaders' states. And the coefficients of that combination — how much each leader counts for each follower — depend on the structure of the communication graph, in a way that is not obvious from any one agent's local view.

For a follower i, the right target turns out to be

y*ᵢ(t) = Σₖ ϕᵢₖ · yₖ(t)

where the non-negative weights ϕᵢₖ sum to one across all leaders. These weights come from a linear-algebra object — the i-th row of −L₁⁻¹L₂, a block of the graph Laplacian. The paper calls them the normalized levels of influence, or NLIs. Every follower has its own row of weights. Every follower aims at its own convex combination of leader outputs. If all of these combinations are convex, and all the followers hit their targets, every follower lands inside the hull. That is the whole trick.

✦ ✦ ✦

Act IVThe twist: heterogeneity

So far the story has a hidden simplification: all the agents were running the same dynamics. A follower was a follower, a leader was a leader, and they all obeyed one template equation. The real world is not so tidy.

Heterogeneous followers

Follower 1 is a quadrotor, follower 2 is a ground robot, follower 3 is a fixed-wing aircraft. They have different state dimensions, different input channels, different dynamics matrices (Aᵢ, Bᵢ, Cᵢ). The controllers have to be designed per agent.

Heterogeneous leaders

Leader A traces a circle. Leader B drifts linearly. Leader C oscillates. Each has a different exosystem matrix Sₖ. No single reference model describes them all. This is the case the paper attacks.

Figure 5 · Interactive
Three leaders, three different dynamics
Three leaders with genuinely different dynamics: a circler, a drifter, a sinusoid. The dashed triangle is their convex hull at the current instant — the safe region. A single follower tracks a weighted blend of their trajectories. Because the weights are non-negative and sum to one, the follower is mathematically guaranteed to stay inside the hull, no matter how you tune the sliders. Try it — push the weights to any extreme and watch the follower ride the boundary but never leave.

Notice what heterogeneous leaders wreck. In the old theory, a single "virtual leader" with dynamics S described where the whole fleet was going. If all leaders obey the same S, you can pretend there is one meta-leader. If they don't, you can't. Each follower needs its own target dynamics, and those dynamics must assemble — privately, at each follower — from whatever information that follower can gather about its influential leaders.

Act VThe classical recipe

Before we get to the paper's contribution, look at how this kind of problem is usually solved. The toolkit is cooperative output regulation. The ingredients:

Exosystem

A model of the reference to be tracked: ω̇ = Sω, y = Dω. In leader-follower problems the leader is the exosystem.

Regulator equations

Two linear matrix equations in Πᵢ, Γᵢ. Solving them tells you how to transform exosystem states into the steady-state feedforward that cancels tracking error.

Distributed observer

Since most followers cannot measure the leader directly, each runs a consensus-style estimator of the leader's state, sharing guesses with neighbors until estimates converge.

Local controller

A stabilizing feedback on each follower's own state, plus a feedforward built from the observer's estimate of the leader and the regulator-equation solutions.

The classical framework handles heterogeneous followers beautifully. Heterogeneous leaders, though, require extensions. Earlier attempts assumed the leaders could talk to each other, or required undirected graphs, or needed each follower to already know the Laplacian of the whole network. None of these assumptions is actually satisfied in a large, real, possibly time-varying cyber-physical network.

Act VIThe paper's idea

Mazouchi and colleagues break the problem into three layers that can be designed independently. Each layer does exactly one thing.

1 · Local graph discovery

Each follower runs a gossip-style algorithm with its neighbors. After a finite number of rounds it has figured out, on its own: which leaders can actually reach it, which other followers can, and the weights of every edge in that local subgraph. No agent ever needs the global Laplacian.

2 · Virtual exosystem

Using only the influential leaders (those reachable through the graph), the follower assembles a private, block-diagonal reference model S̄ᴿᵢ and D̄ᴿᵢ, and computes its row of NLIs. This is its personal notion of where it is supposed to go.

3 · Adaptive observer + controller

Three parallel consensus-style estimators converge, in cascade, to the true leader dynamics and states — for the influential leaders only. A standard regulator-equation controller closes the loop. The separation principle does the rest.

Net result

A fully distributed solution to the fully-heterogeneous containment problem on a directed graph, with no global information, no shared leader template, and no assumption that leaders cooperate.

The cleverness lives in Layer 1. Instead of each follower estimating every leader and paying the O(all-leaders) cost, each builds a local Laplacian only over the influential part of the graph. The savings compound: smaller observer, cheaper regulator equations, sparser information flow.

How a follower learns the network, round by round

The algorithm is pure gossip. At round zero, every follower knows only who its immediate neighbors are. At each subsequent round, it asks its non-leader neighbors: what have you learned? — and takes the union. After at most a handful of rounds, nothing new arrives, and the follower has discovered every leader and every follower that can reach it. The bound is the longest path in the subgraph, which is at most n.

Figure 6 · Interactive
Distributed graph discovery (Algorithm 1)
Each follower carries a badge showing the set of influential leaders it has discovered so far. At round 0 it knows only the leaders on its own incoming edges. Each step, it unions knowledge with its follower-neighbors. Newly-arrived leaders pulse in ochre. Watch F2 and F3 accumulate the full set while F1 and F4 saturate immediately — their graph positions simply don't reach more leaders.

The same procedure runs in parallel for the follower-neighborhood sets N̄ᴬᵢ and the edge sets Ē ᵢ. Once all three converge, the follower has everything it needs to reconstruct its local Laplacian blocks L̄ᵢ₁ℓ and L̄ᵢ₂ℓ, and from them compute its NLIs via Φ = −L̄ᵢ₁ℓ⁻¹ L̄ᵢ₂ℓ. The entire first layer of the paper is just this, repeated until nothing changes.

Figure 7 · Interactive
NLIs and local subgraphs
A network of four followers (ink) and three leaders (crimson). Click a follower. Highlighted nodes and edges are its local subgraph — the agents it can reach and the edges it needs. The badges on leaders show the NLI weights ϕᵢₖ: how much each leader contributes to that follower's target. Unreached leaders have weight zero and are ignored.

Watch what changes as you click through the followers. Follower 1 sits deep in the graph and has access to all three leaders — its NLIs spread across the board. Follower 4 may be reachable from only one or two leaders, and its NLIs collapse onto them. Each follower sees a different miniature of the network, and designs its controller against that miniature, not the whole thing.

Act VIIWhy the three-layer split matters

The paper's architecture is an exercise in separation. Each layer converges on its own timescale, and the proof of the whole follows from the proofs of the parts:

graph discovery → NLIs fixed → observer converges → controller stabilizes → error → 0

Because each step is upstream of the next, and each step's error decays exponentially, the cascade collapses to the usual separation-principle argument. This is why Theorem 2 reads almost as a corollary: all the work was done in Theorem 1 and in the graph-discovery proposition.

The paper's real contribution is not a new control law. It is a reformulation: every follower solves its own small output-regulation problem, against its own private exosystem, built from its own view of the network.

CodaWhat this costs, what it buys

Nothing is free. The paper assumes each agent knows whether its neighbors are leaders or followers from their labels (Remark 1 sketches an IP-address analogy). It assumes marginally-stable leader exosystems — fine for ramps and sinusoids, exclusionary for genuinely unstable sources. It assumes the per-follower regulator equations are solvable; no transmission-zero surprises. And it does not address measurement noise, packet loss, switching topology, or delays — any of which would mean another paper.

In exchange, you get something rare: a containment protocol that actually extends to directed graphs with heterogeneous leaders, without any agent holding a global map of the network. That is a meaningful slice of generality, cleanly carved out.

✦ ✦ ✦