Introduction
Microbial communities are complex ecosystems in which multiple species interact through competition for nutrients and cross-feeding via metabolic byproducts. Controlling the evolution of such communities and adjusting their composition is therefore a challenging task.
Typical control objectives include maintaining a desired community state, steering the system from one state to another, maximizing the production of specific metabolites, or reducing the abundance of harmful species.
Control Inputs
Given the evolution equations for species and metabolites (see Consumer-Resource Model for further details on model implementations), we incorporate control inputs that modify the system dynamics according to
where \(u_X\) and \(u_S\) denote control inputs acting on species and resources, respectively. The dependence on \((t, X, S)\) allows for both open- and closed-loop control.
Open-loop control: The control input \(u(t)\) depends only on time.
Closed-loop control: The control input \(u(X, S)\) depends on the current state \((X, S)\) and enables feedback-based adaptation.
Loss Functions
Training a controller requires defining an objective function \(L\).
Let \((X(t), S(t))\) denote the system state, \((X^*, S^*)\) a desired target state, and \(T\) the final time of the control horizon.
Common choices of objective functions include:
Integrated Cost
Penalizes deviations from the target over the entire time horizon:
Terminal Cost
Penalizes only the deviation at the final time:
Control Input Regularization
Adds a penalty on the magnitude of the control input:
where \(u(t, X, S)\) denotes the control input and \(\lambda > 0\) is a regularization parameter balancing tracking accuracy and control effort.
Training
In mGrowthCtrl, control inputs are parameterized using neural ordinary differential equation (ODE) controllers. For further details on neural ODE–based control, see the references below. The neural network parameters are optimized using backpropagation through time (BPTT) after integrating the controlled ODE system in PyTorch.
References
Asikis, T., Böttcher, L., & Antulov-Fantulin, N. (2022). Neural ordinary differential equation control of dynamics on graphs. Physical Review Research, 4(1), 013221.
Böttcher, L., Antulov-Fantulin, N., & Asikis, T. (2022). AI Pontryagin or how artificial neural networks learn to control dynamical systems. Nature Communications, 13(1), 333.
Böttcher, L., & Asikis, T. (2022). Near-optimal control of dynamical systems with neural ordinary differential equations. Machine Learning: Science and Technology, 3(4), 045004.
Böttcher, L. (2026). Control of dynamical systems with neural networks. Nonlinear Dynamics, 114(2), 79.