1. Introduction
Passenger electric vehicles have moved in a decade from a rounding error in the electric load to an infrastructural pressure. NREL’s TEMPO high-electrification scenario projects U.S. light-duty EV stock near 180 million by 2050, with 1120 TWh of annual charging demand and more than 160 GW of coincident peak load on the contiguous-US grid [
1]; even today, the Caltech Adaptive Charging Network records MWh-scale workplace charging demand across dozens of EVSE ports [
2]. Whether this demand becomes a grid problem or a grid asset depends on how well a system operator can
dynamically aggregate per-vehicle flexibility into a single reliable cluster-level signal and disaggregate a dispatch command back into executable per-vehicle set-points.
The technical obstacle is that the feasibility of each vehicle is a polytope in SoC, power and energy, defined by its arrival time, departure time, energy requirement and nameplate rate, yet the cluster must respond to a grid-level command that lives on the single dimension of aggregate power. The exact Minkowski sum of
N per-vehicle polytopes describes the true set of cluster-level dispatchable trajectories, but its representation complexity grows super-polynomially in
N and is intractable beyond a few hundred vehicles in the general case [
3,
4]. The EV-specific structure, namely separable power boxes plus a single inter-temporal energy constraint per vehicle at
with 15 min resolution, allows us to push the exact offline sum to
(
Section 3.7), but online inference at
is still out of reach for any exact construction. Prior art splits along two lines. Geometry-based aggregators replace the true envelope with a zonotope, a ball, or a linear programming outer bound [
5,
6]; these enjoy analytical guarantees but, in our reimplementation on the datasets used here (
Section 5), overshoot the true envelope by 10–25% of envelope width and lose most of the inter-temporal coupling that makes EV flexibility valuable. Learning-based aggregators use deep sequence models to predict flexibility or to solve the dispatch problem directly [
7,
8]; these scale to large clusters but treat feasibility as a soft penalty, and in our reimplementation roughly 3–15% of charging sessions violate either a state-of-charge bound or an energy requirement at the departure instant. Existing methods have rarely demonstrated an amortized sequence–model aggregator that jointly predicts a cluster envelope and a compatible per-vehicle dispatch at large scale, with feasibility repair embedded inside the recurrent state update rather than applied as a post hoc correction.
We address this gap with an architectural combination tailored to EV cluster aggregation: a sequence model that is multi-channel in the vehicle dimension, applies history-dependent feasibility repair inside the recurrence, and closes the loop between envelope prediction and disaggregated dispatch. We build this inductive bias on top of three recent results from the Mamba state-space sequence modelling literature: the MIMO reformulation of the Mamba-3 recurrence, which allows one state update to carry the trajectories of many channels in parallel without decoder latency overhead [
9]; the Routing Mamba mixture-of-experts projection, which lets a small number of experts represent a large number of behavioural sub-populations with sparse activation [
10]; and the dual-path PowerMamba architecture, which demonstrates that a selective state-space backbone can match or exceed Transformer forecast accuracy on power system time series while using roughly 43% fewer parameters than the strongest baseline it compares against [
11]. Our contribution is to fuse these ingredients into a single constraint-aware Mamba-based cluster aggregator and to wrap it in an aggregation–disaggregation closed loop that enforces per-vehicle feasibility at every step with respect to the specified or imputed per-vehicle polytope; in our evaluation no feasibility violation was observed on any ACN-Data, ElaadNL or dsgrid-TEMPO session
with respect to the specified or imputed per-vehicle polytope, yielding an end-to-end dynamic aggregation and control method for heterogeneous EV clusters. The framework supports bidirectional V2G/G2V whenever a vehicle’s polytope admits a non-zero discharge rate
, but the public datasets we use for evaluation (ACN-Data, ElaadNL) are charge-only; bidirectional behaviour is exercised in this paper only through the synthetic dsgrid-TEMPO 10,000-vehicle stress test.
Concretely, PC-M3 contributes: (i) a vehicle-as-channel use of the MIMO Mamba recurrence for EV cluster aggregation; (ii) a history-dependent per-vehicle feasibility projection fused into the recurrent update, so that the hidden state receives the correction signal at every step rather than only after the forward pass; (iii) a Routing-Mamba expert layer that absorbs behavioural heterogeneity without manual clustering; and (iv) a closed aggregation–disaggregation training loop, benchmarked in
Section 5.2 against LP/MILP/MPC and learned baselines.
We evaluate PC-M3 on three open datasets that together cover behaviour, geography, and scale: ACN-Data [
2] with the ACN-Sim simulator [
12] (114,503 real workplace charging sessions and a closed-loop test-bed), ElaadNL [
13] (≈10,400 Dutch public charging events for cross-regional generalisation) and NREL dsgrid-TEMPO [
14] (county-resolved hourly profiles, subset for a 10,000-vehicle synthetic stress test). Headline outcomes are summarised in the abstract; complete numbers, ablations and the baseline comparison are reported in
Section 5. The remainder of the paper is organised as follows:
Section 2 surveys related work,
Section 3 develops PC-M3,
Section 4 specifies the experimental protocol,
Section 5 reports the results,
Section 6 discusses them,
Section 7 concludes, and the appendices collect notation, proofs, extended statistics and the per-vehicle parameter imputation.
3. Proposed Model: A Mamba State-Space Aggregator for EV Clusters
We refer to the composite model as the Physics-Constrained Mamba-3 MIMO Aggregator (PC-M3).
Section 3.1 formalises the cluster-level aggregation problem,
Section 3.2 the per-vehicle polytope,
Section 3.3 the Mamba-3 MIMO backbone,
Section 3.4 the in-loop differentiable feasibility projection,
Section 3.5 the Routing-Mamba expert layer,
Section 3.6 the aggregation–disaggregation closed loop, and
Section 3.7 the training losses and complexity.
3.1. Problem Formulation and Overview
A cluster of
N EVs connects to a charging network over a discrete horizon
at a uniform step of duration
. Throughout the paper
h (i.e., 15 min), and all energy and power quantities are expressed in compatible SI units as specified below. Vehicle
i is described by an arrival time
, a departure time
, an initial state-of-charge
, an energy requirement
(kWh) to be delivered before
, a usable battery capacity
(kWh), a maximum charging rate
(kW), and, if the vehicle supports vehicle-to-grid service, a maximum discharge rate
(kW). The control variable is the charging power
(kW), with
whenever
. With
in hours and
in kW, the state-of-charge obeys
, where
is charging efficiency. The cluster aggregator sees an upstream dispatch target
(MW) sent by a system operator or a virtual power plant, and must return two objects at every forward pass: an
aggregate flexibility envelope (MW) that bounds the feasible cluster-level power at time
t, and an
individual dispatch (kW) that tracks
while every
and its induced
lie inside the per-vehicle polytope. We write
(MW) for the executed cluster power.
Figure 1 shows the architecture.
3.2. Per-Vehicle Feasibility Polytope and Minkowski Aggregation
For each vehicle
i in the cluster, collect the horizon control vector
. The feasibility set is the polytope
The state-of-charge trajectory
is an affine function of
, so
is a bounded polytope with
facets. The
true cluster flexibility set is the Minkowski sum
which is again a polytope but whose vertex enumeration scales super-polynomially with
N [
4]. Our goal is to learn a parametric map
whose image tightly bounds the projection of
onto the
t-th coordinate, together with a companion map that returns feasible
consistent with any command
.
3.3. Mamba-3 MIMO Backbone
We first recall the selective MIMO update from Mamba-3 [
9], in a form that is convenient for cluster-level aggregation. At time step
t, the hidden state
evolves according to
where
is the input and
is the output at rank
R. The parameters
and the discretisation step
are all input-dependent (selective), and the discretisation is trapezoidal:
with
complex-valued and block-diagonal so that the state tracks rich oscillatory dynamics. Compared with Mamba-2, Mamba-3 halves the state size at matched perplexity and attains its quality gains by increasing
R rather than
D, which keeps training cost proportional to
rather than to
[
9].
Vehicle-as-channel assignment. We assign
each EV in the cluster to one input–output channel of a single MIMO Mamba-3 recurrence, so that the rank of the MIMO rewrite grows with the cluster size
N. The per-step input
carries the current status of every vehicle (availability indicator, SoC, energy deficit to departure, and tokenised session features); the per-step output
is the candidate charging power for each vehicle at step
t. The MIMO decoder folds what would otherwise be
N parallel SISO SSM runs into a single tensor contraction per step. Asymptotically (
), a forward pass scales as
in time and
in memory; the
term is parallel along the channel axis and, in our profile on an A100, wall clock latency grows slowly in
N over the evaluated range (
Section 5.8).
Practical scope and caveat. The original Mamba-3 experiments use MIMO rank
in a language modelling context [
9]; our vehicle-as-channel construction therefore
pushes the MIMO rewrite well outside the regime in which it was validated. We do not inherit any quality guarantees from [
9] at
; what we inherit is the tensor contraction form of the update, which we use as the parallel primitive for the cluster axis. We validate the construction on an A100 by profiling the fused selective scan kernel at
(see
Section 5.8): peak memory stays within 3.8 GB and latency stays below 0.35 s at
, with a measured linear scaling consistent with the
term. Scaling beyond a few
vehicles is a separate engineering problem that we discuss in
Section 6; the numbers reported in this paper are only claimed for
.
Variable cluster size at train and inference. We compile the model with a maximum channel count
and pad shorter clusters with masked dummy channels whose input, output and gradients are zeroed by the availability indicator; masked dummy channels are excluded from the loss and output aggregation; in profiling we use the active channel count unless otherwise stated. Because
depends only on
(
Section 3.5) and the envelope head is a symmetric linear sum, PC-M3 is permutation-equivariant in the vehicle axis, which we verified by random permutation tests on the per-vehicle dispatch trajectories.
3.4. Differentiable Feasibility Projection in the Recurrence
A vanilla MIMO Mamba-3 does not respect
, and projecting the output
onto
after the forward pass breaks the inter-temporal coupling that makes the aggregation useful. We instead embed the projection
inside the state transition. Let
denote the metric projection onto the time-
t slice of
conditional on the partial history. The output equation becomes
where
is a learned Kalman-like gain that propagates the projection correction back into the state. Once the past trajectory
is fixed,
reduces to a clamp onto a one-dimensional interval
(Proposition A1,
Appendix B); the interval is the intersection of (i) the power box
, (ii) the upper SoC bound
, (iii) the lower SoC bound
and (iv) a forward-looking “must-charge-now” bound
that guarantees the energy-by-departure constraint can still be met by charging at
for the remaining
steps, where
and
. The clamp admits a closed-form sub-gradient (Proposition A1) and is fused with the selective scan kernel so that projection and state update share a single GPU launch. The aggregate envelope
is read off the same hidden state through a separate linear head
supervised against the Minkowski envelope.
The clamp itself is a standard Euclidean projection onto an interval, of the same family as the safety layers and differentiable optimisation layers used in prior constrained learning [
24,
25]. What is specific to PC-M3 is how the interval is constructed from the EV energy deadline constraints and where the projection sits in the architecture: the correction is fed back into the hidden state through
instead of being applied as a post-processing step, so every subsequent state transition is aware of the feasibility correction made at the current step. This yields a tighter coupling between envelope prediction and per-vehicle dispatch than a post hoc projection achieves.
3.5. Routing-Mamba Expert Layer
An EV cluster is behaviourally heterogeneous along stay duration, requested energy, and arrival time, and a single dense projection is a poor inductive bias. Rather than hand-crafting sub-populations, we follow Routing Mamba [
10] and insert a small mixture-of-experts layer in front of the MIMO projection matrix
. For each vehicle
i, a router
produces a sparse gating vector over
E expert projections
, and the effective projection is
. The routing is top-
k with
: each of the
N vehicles activates exactly 2 of the
E experts at each step, yielding
vehicle-to-expert assignments per step (out of the
that a dense projection would realise). Under balanced routing each expert sees on average
assignments per step; no more than
E distinct experts can ever be active simultaneously, by definition. The router shares its decision with a parallel gate output expert pair, in line with the original Routing Mamba design [
10], which reports matching dense-Mamba quality at roughly
fewer active parameters and ∼23% fewer per-token FLOPs than a dense Mamba block of equivalent total parameter count. Without any supervised clustering label, the learned router consistently routes sessions along the two dominant ACN-Data axes, namely stay duration and energy-by-departure, and the per-expert centroids cluster post hoc (by agglomerative clustering, complete-link, on the standardised stay-duration/energy-demand centroids of the eight experts) into four behaviourally interpretable archetypes
short-stay top-up,
standard workday,
extended day-stay and
high-energy deep-charge. These four archetypes are used later in the case-study analysis as an interpretation device; the model itself routes to the eight underlying experts. We report the per-archetype centroids and their dispatch contributions in
Appendix D; the four-archetype agglomeration is a presentation device, not a constraint imposed on the routing.
3.6. Aggregation–Disaggregation Closed Loop
PC-M3 sits inside a two-way loop with the upstream VPP. Downward: the VPP receives , performs its own dispatch and returns a command ; PC-M3 re-runs conditioned on and emits per-vehicle trajectories whose MW sum tracks . Upward: the executed power feeds the residual into a consistency loss. This penalises the gap between the envelope boundary and the reachable disaggregated sum, removing the “feasible envelope but un-executable” failure mode of stand-alone learned aggregators.
3.7. Training Losses and Complexity
The overall training objective is a weighted sum of four terms:
with
,
,
,
. The envelope loss
has two regimes, selected by cluster size. For
we compute exact per-time envelope rails by solving the corresponding separable linear programs offline, using these exact coordinate projections of the Minkowski sum as the reference for the one-dimensional Hausdorff metric. We then use a rail-wise mean-squared error against this reference, which upper-bounds the squared 1D Hausdorff distance:
For
, exact enumeration is intractable; the reference is a certified inner–outer sandwich consisting of an inner zonotope
inscribed in the true envelope and an LP-certified outer bound
containing it [
5,
6]. We use a zero-penalty-inside-the-band loss against this sandwich:
where
is the one-sided distance of
x from the closed interval
(zero when
x lies inside the certified band containing the true rail, and linear outside). The overall envelope loss is
No Minkowski computation is performed at inference. The individual loss
is the MSE between the predicted per-vehicle dispatch and the targets obtained from a single centralised QP over the full cluster and 96-step horizon per training episode.
is the squared tracking residual on random commands drawn from the envelope boundary, and
is the switch–transformer load balance loss [
35]. The per-step time and memory complexities are
and
, respectively, both linear in
N.
6. Discussion
Across the three datasets, embedding the per-vehicle polytope as a differentiable in-loop projection inside a MIMO state-space recurrence delivers two coupled effects. The Hausdorff improvement reflects a structural change: in prior methods the envelope is a free-standing estimate consumed by an external controller, and per-vehicle feasibility is re-secured at dispatch time through a separate projection whose compatibility with the envelope is not guaranteed; in PC-M3 envelope and dispatch share a hidden state, so the consistency-trained loop drives the envelope towards reachability and the step-wise projection enforces per-vehicle feasibility at every step relative to the specified or imputed per-vehicle polytope. The same mechanism explains the closed-loop result. MPC retains higher feasibility than PowerMamba with post-projection but lower tracking quality than PC-M3, which suggests that the envelope–dispatch unification is doing most of the work rather than the raw modelling capacity of the backbone.
Cross-regional transfer to ElaadNL costs only 0.7 pp of envelope quality and 0.04 MW of tracking RMSE despite a 2.34 h shorter mean stay and a much larger share of public charging sessions. The projection enforces feasibility on the imputed Dutch polytope in the same way as on the imputed Californian one; only the soft statistics of the Mamba-3 backbone and the MoE router need to generalise, and the router re-weights its experts on the new distribution at no retraining cost.
Training above
uses the certified inner–outer sandwich rather than the exact Minkowski sum (
Section 3.7), and inference performs no Minkowski computation. The 3.8% Hausdorff number on the 10,000-vehicle dsgrid-TEMPO cluster is therefore measured against the sandwich midpoint and inherits a reference error bounded by half the sandwich width on that cluster (
Table 4); the 3.4% and 4.1% numbers on ACN-Data and ElaadNL do not carry this caveat.
A further limitation concerns observability. ACN-Data and ElaadNL do not expose true battery capacity or true state-of-charge. Consequently, the zero-violation results on these datasets certify feasibility only with respect to the measured session fields and the imputation model in
Appendix D (
Table A4); they should not be interpreted as a validation of unobserved real BMS states. The full sensitivity analysis in
Table A5 shows that the zero-violation structural property of the in-loop projection is preserved across all tested perturbations of the imputed parameters, but this is a property of the projection relative to the perturbed polytope, not a guarantee about unobserved true constraints. The next validation step is to evaluate PC-M3 on datasets with true vehicle-side BMS measurements.
The limitations are three. First, the differentiable projection is fast because the per-vehicle polytope has a separable box structure with one inter-temporal energy constraint; more complex polytopes that couple multiple vehicles through, for example, shared charger infrastructure, lift this assumption and increase the projection cost. A sizeable practical class of networks (Level 1 residential, Level 2 workplace without active load sharing) satisfies separability, but charger sharing behaviour at DC fast charging hubs does not, and extending PC-M3 to the shared infrastructure case is an open problem. Second, PC-M3 assumes that the arrival time and requested energy are known at connection; in deployed networks where the user revises the requested energy mid-session, the projection has to be re-run from the revision step onward, which costs one additional forward pass on the affected vehicle channel but does not change the cluster-level latency. Third, the vehicle-as-channel construction matches the cluster size to the MIMO channel count of the recurrence. This is a non-standard use of the Mamba-3 MIMO rewrite (the original paper only tested rank
in a language modelling setting), and we therefore do not inherit any of the quality scaling claims of Mamba-3 at
. Our evidence is strictly empirical: the compiled kernel is stable up to the
channel count used in this paper (
Section 3.3), but neither the quality nor the kernel feasibility at the 100,000-vehicle metropolitan-VPP regime is established and reaching it would require either a per-block hierarchy of routers or a sparse MIMO decomposition.
The LP/MILP comparison in
Section 5.2 sharpens the picture. Exact optimisation attains lower tracking error and yields explicit optimality certificates whenever the problem fits within the receding horizon time budget and remains the natural tool for small fleets and offline scheduling. PC-M3 sits at a different point on the latency–quality curve, retaining sub-second inference and per-vehicle feasibility at the 1000–10,000 vehicle scale that characterises future large VPPs, where the LP/MILP solvers stop terminating in real time.
More broadly, physics-informed neural networks typically encode constraints through a residual loss [
37,
38]; this is architecture-agnostic but only soft, and it is difficult to scale with the constraint dimension. PC-M3 trades architecture specificity for step-wise enforcement: Proposition A1 shows that the time-
t slice reduces to a clamp onto a provably non-empty interval whenever the vehicle is on-time feasible, and the forward-looking “must-charge-now” bound carries the energy-by-departure constraint forward. We stop short of a full-horizon theorem, which would require global control of
under prediction error, but we observe zero feasibility violations on all evaluated episodes relative to the specified or imputed per-vehicle polytope. This trade-off is worth making whenever the constraint set is known, separable and step-wise enforcement is needed; we leave extensions to other constraint-structured domains to future work.
7. Conclusions and Future Work
We presented PC-M3, a constraint-aware Mamba state-space aggregator that maps a heterogeneous EV cluster to (i) an aggregate flexibility envelope and (ii) per-vehicle dispatch trajectories in a single forward pass. Each vehicle is one channel of a Mamba-3 MIMO recurrence, the per-vehicle polytope is enforced as a differentiable in-loop clamp, behavioural heterogeneity is absorbed by a sparse Routing-Mamba expert layer, and a consistency-trained aggregation–disaggregation loop binds envelope to executed dispatch. On ACN-Data and ElaadNL the model attains 3.4% and 4.1% normalised envelope Hausdorff distance against exact per-time envelope rails, on a 10,000-vehicle dsgrid-TEMPO synthetic cluster 3.8% against a sandwich proxy, 0.82 MW closed-loop tracking RMSE against 1.45 MW for MPC, and 0.34 s inference on 10,000 vehicles. Bidirectional V2G/G2V is supported by the formulation but exercised only on the synthetic stress test here; transfer to real bidirectional corpora is left to future work.
Three directions deserve priority in future work: (i) extending the differentiable projection to shared-infrastructure polytopes (DC fast-charging hubs, mixed AC–DC depots); (ii) scaling the per-cluster channel count through sparse MIMO decomposition or hierarchical routing for the 100,000-vehicle metropolitan-VPP regime; and (iii) coupling a battery-degradation co-optimisation head so that short-term flexibility is balanced against long-term battery economics.