Optimal Control Theory for Pacing
The pacing optimization in Equation pacing optimization treats energy expenditure as a static budget constraint. Optimal control theory provides a fundamentally more powerful formulation by treating the patient’s physiological state as a dynamical system with activity as the control input, enabling optimization over trajectories rather than budgets.
1 Pontryagin Maximum Principle Formulation
Define the state vector \(\mathbf{x}(t) = (E(t), D(t), I(t), F(t))^top\) representing energy reserves, cumulative damage, immune activation, and fatigue perception respectively, with activity intensity \(u(t) \in [0, u_max]\) as the control variable. The system dynamics follow from the models in Chapters Energy Metabolism Models and Integrated Multi-System Models:
\[ dot(\mathbf{x}) = \mathbf{f}(\mathbf{x}, u) = mat( J_\text{production}(\mathbf{x}) - J_\text{demand}(u) - E_\text{repair}(\mathbf{x}); k_\text{damage} \cdot \text{ROS}(u, \mathbf{x}) - k_\text{repair} \cdot R(\mathbf{x}); \sigma(\mathbf{x}, u) - \delta_I \cdot I; \alpha_F \cdot (D + \beta_F \cdot I) - \gamma_F \cdot F ) \tag{1}\]
The patient seeks to maximize total functional capacity over a planning horizon \([0, T]\) while penalizing damage accumulation:
\[ J[u] = \int_0^T [ U(u(t)) - \lambda_D \cdot D(t) - \lambda_F \cdot F(t) ] d t + \Phi(\mathbf{x}(T)) \tag{2}\]
where \(U(u)\) is the utility of activity at intensity \(u\), \(\lambda_D\) and \(\lambda_F\) are penalty weights for damage and fatigue, and \(\Phi(\mathbf{x}(T))\) is a terminal cost penalizing unfavorable end-states. The Pontryagin maximum principle yields necessary conditions for the optimal activity schedule \(u^*(t)\) through the Hamiltonian:
\[ \mathcal{H}(\mathbf{x}, u, \mathbf{\lambda}) = U(u) - \lambda_D D - \lambda_F F + \mathbf{\lambda}^top \mathbf{f}(\mathbf{x}, u) \tag{3}\]
where the costate variables \(\mathbf{\lambda}(t)\) satisfy \(dot(\mathbf{\lambda}) = -\partial \mathcal{H} \\/ \partial \mathbf{x}\). The optimal control satisfies \(\partial \mathcal{H} \\/ \partial u = 0\) at interior points and \(u^* \in {0, u_max}\) on boundaries (bang-bang control).
The optimal control formulation reveals that optimal pacing is not simply “stay below a fixed energy budget.” The costate variable \(\lambda_E(t)\) (shadow price of energy) varies dynamically: energy is more valuable when damage is accumulating or immune activation is high. The model predicts state-dependent pacing rules: (1) rest more aggressively when immune markers are elevated (the energy “price” is higher because repair costs are rising), (2) front-load activity early in the day when energy reserves are highest (convex cost structure makes this optimal), and (3) avoid activity entirely during the 24–72 h post-infectious window (the damage rate \(k_\text{damage}\) is transiently elevated). These rules emerge from the mathematics and cannot be derived from static energy envelope reasoning alone.
2 Hamilton–Jacobi–Bellman Approach for Stochastic Pacing
In practice, energy availability is stochastic: sleep quality, infections, and environmental stressors introduce unpredictable variation. The stochastic extension replaces the deterministic ODE with a stochastic differential equation and solves the Hamilton–Jacobi–Bellman (HJB) equation for the value function \(V(\mathbf{x}, t)\):
\[ -\frac{\partial V}{\partial t} = max_u [ U(u) - \lambda_D D - \lambda_F F + (\nabla V)^top \mathbf{f}(\mathbf{x}, u) + \frac{1}{2} \text{tr}(\mathbf{\Sigma}^top \nabla^2 V , \mathbf{\Sigma}) ] \tag{4}\]
where \(\mathbf{\Sigma}\) is the noise covariance matrix. The HJB solution yields a feedback policy \(u^*(\mathbf{x}, t)\): the optimal activity level as a function of the current physiological state, adaptable in real time. This is precisely what wearable-integrated pacing systems would implement.
The stochastic formulation predicts that the optimal safety margin (gap between activity level and energy envelope) scales as \(\sigma sqrt(T_\text{recovery})\), where \(\sigma\) is the day-to-day variability in energy availability and \(T_\text{recovery}\) is the PEM recovery time. Patients with longer PEM recovery (severe ME/CFS) should maintain proportionally larger safety margins—a quantitative prediction that matches clinical intuition but has never been formally derived. The model further predicts an asymmetric penalty structure: under-activity has linear cost (lost function) while over-activity has convex cost (PEM with superlinear damage), explaining why conservative pacing strategies outperform aggressive ones despite similar average activity levels.