Hostname: page-component-74656f9884-rdgjk Total loading time: 0 Render date: 2026-11-06T14:02:21.300Z Has data issue: false hasContentIssue false

Deep reinforcement learning for tracking a moving target in jellyfish-like swimming

Published online by Cambridge University Press:  15 August 2025

Yihao Chen
Affiliation:
State Key Laboratory for Turbulence and Complex Systems, School of Mechanics and Engineering Science, Peking University, Beijing 100871, PR China
Yue Yang*
Affiliation:
HEDPS-CAPT, Peking University, Beijing 100871, PR China
*
Corresponding author: Yue Yang, yyg@pku.edu.cn

Abstract

A deep reinforcement learning method for training a jellyfish-like swimmer to effectively track a moving target in a two-dimensional flow was developed. This swimmer is a flexible object equipped with a muscle model based on torsional springs. We employed a deep Q-network (DQN) that takes the swimmer’s geometry and dynamic parameters as inputs, and outputs actions that are the forces applied to the swimmer. In particular, an action regulation was introduced to mitigate the interference from complex fluid–structure interactions. The goal of these actions is to navigate the swimmer to a target point in the shortest possible time. In the DQN training, the data on the swimmer’s motions were obtained from simulations using the immersed boundary method. During tracking a moving target, there is an inherent delay between the application of forces and the corresponding response of the swimmer’s body due to hydrodynamic interactions between the shedding vortices and the swimmer’s own locomotion. Our tests demonstrate that the swimmer, with the DQN agent and action regulation, is able to dynamically adjust its course based on its instantaneous state. This work extends the application scope of machine learning in controlling flexible objects within fluid environments.

Information

Type
JFM Papers
Copyright
© The Author(s), 2025. Published by Cambridge University Press
Figure 0

Figure 1. Diagram for the overall workflow. (a) Data obtained from multiple simulations are used for offline training. (b) Geometry and state of the jellyfish-like swimmer. The red parts indicate where the forces are applied. (c) Action space with four actions $A_i$, $i=0,1,2,3$, representing typical jellyfish actions (from left to right): symmetric forces on the two sides, larger force on the right-hand side, larger force on the left-hand side, and no force. (d) Multiple simulations with random actions (left-hand dashed box) and collection of the experience tuple $(\boldsymbol{s}_{t},a_{t},r_{t},\boldsymbol{s}_{t+\Delta t},D)$ (right-hand dashed box). (e) The DQN module receives the state vector and outputs a Q-value for each action. The action with the highest Q-value is finally chosen. ( f) The trained agent is tested in various tracking tasks. Supplementary movies 1 and 2 illustrate how the swimmer tracks a moving target.

Figure 1

Figure 2. The jellyfish-like model swimmer consists of 159 Lagrangian points. Every pair of adjacent points is connected by a spring, and every three adjacent points are connected by a beam. Black solid lines and dashed lines represent springs and beams, respectively. Different colours correspond to different beams. The discrete fibre beam model of three neighbouring points is shown on the right. The three circles represent three neighbouring points of a beam model (red dashed line), $\boldsymbol{ X}_{\!L},\boldsymbol{ X}_{\!M},\boldsymbol{ X}_{\!R}$ are the displacement vectors, and $\boldsymbol{ F}_{\!L},\boldsymbol{ F}_{\!M},\boldsymbol{F}_{\!R}$ are the Lagrangian forces of the beam’s left, middle and right points, respectively.

Figure 2

Table 1. Parameters in the simulation for jellyfish-like swimming.

Figure 3

Table 2. Action regulation: forces are applied only during the first and third quarters of each period, except for $A_0$ and $A_3$, which can last for the next quarter following specific actions.

Figure 4

Figure 3. Contour of the reward function $r(\boldsymbol{s},a)$ with typical parameters $\mathcal A=20$, $\mathcal B=10$ and $d=0.1$.

Figure 5

Figure 4. (a–c) Swimmer’s trajectories for tracking fixed targets (front left, straight and front right). Red dots represent the start and target points. (d) The process of making a right turn by the swimmer with action regulation, along with the contour of the vorticity magnitude, at $t/T=0,0.2,0.4,0.6,0.8,1$. The action sequence is $A_1$, $A_3$, $A_0$ and $A_0$. (e) Swimmer’s trajectory for tracking the front right target, along with the contour of the vorticity magnitude. ( f) Temporal evolution of $\theta$ and $\varOmega$ for tracking the front right target.

Figure 6

Figure 5. The process of making a right turn by the swimmer without action regulation, along with the contour of the vorticity magnitude, at $t/T=0,0.2,0.4,0.7,0.8,1$. The action sequence is $A_1$, $A_1$, $A_0$ and $A_0$, with asymmetric forces in the second quarter. The trailing vortices with opposite signs are generated in different quarters. They cancel out with each other (highlighted in the blue circle), reducing the propulsion efficiency.

Figure 7

Figure 6. (a) Trajectories of the swimmer’s mass centre (red–blue line) and the moving target (green line). The red and blue line segments denote the actions with and without forces, respectively. Six snapshots are presented with the swimmer shape (black curves), vorticity distribution around the swimmer (colour contours), and the target point positions (green dots) at the six time points. (b) Temporal evolution of $\theta$ and $\varOmega$ for tracking the moving target. The circular target trajectory tracking is also presented in supplementary movie 1.

Figure 8

Figure 7. Trajectories of the swimmer’s mass centre (blue line) and the moving target (green line). Red arrows represent the direction of the target’s movement. Blue and green dots with different numbers represent the positions of the swimmer and target at the same moments, at $t/T=9,18,\ldots ,90$. Red dots represent the starting points of the swimmer and target. The figure-eight target trajectory tracking is also presented in supplementary movie 2.

Figure 9

Figure 8. (a) Temporal evolution of $\theta$ and $\varOmega$ in the figure-eight target trajectory tracking. Here, $\theta$ changes significantly around $t/T=45$ (near station 5 in figure 7) where the swimmer surpasses the target. (b) The swimmer positions relative to the target when it surpasses the target at $t/T=40,44,45,50$. Green dots and lines represent the position and trajectory of the target, respectively. The swimmer first moves close to the target, at which point the target changes its trajectory from clockwise to anticlockwise. This S-shaped manoeuvre makes it challenging for the DQN agent, which relies solely on the current state, to keep up, resulting in the swimmer temporarily deviating further from the target.

Figure 10

Figure 9. Input power of the swimmer during the figure-eight target trajectory tracking.

Figure 11

Figure 10. Scatter plots of $\theta$ and $\varOmega$ with different actions output by the DQN agent in the figure-eight target trajectory tracking. The data in the first and third quarters with action regulation are not included. (a) Scatter plot for $d\geqslant d_0$. The data points in the dashed box indicate that the agent frequently selects $A_0$ for small $\theta$. (b) Scatter plot for $d\lt d_0$.

Figure 12

Figure 11. Trajectories of tracking a fixed target (green dot) at (a) ${Re}=20$ and (b) ${Re}=2000$, along with the vorticity contour at the ending time. The red and blue line segments denote the actions with and without forces, respectively.

Figure 13

Figure 12. Scatter plot of $d$ and $\theta$. Blue and red dots represent samples from the raw dataset and the synthetic training dataset, respectively.

Figure 14

Figure 13. Structure of the duelling network. The number in parentheses denotes the number of neurals for the input and output dimension for a linear layer. Each linear layer follows a ReLU activation layer. The agent’s network consists of feature net, advantage net and value net. The output of feature net is the input of advantage net and value net. The sum of the two nets’ output is the final output of the agent, the Q-value for four actions.

Figure 15

Algorithm 1 Training of the network

Figure 16

Figure 14. Comparison of the tracking performance with two DQN agents and the baseline strategy. Trajectories of the swimmer and surrounding vortices are plotted. The red and blue line segments on the swimmer’s trajectory denote the actions with and without forces, respectively. Green dots denote the target point. Plots for (a) agent 1, (b) agent 2, (c) baseline strategy $a=A_0$ for $|\theta |\lt \unicode{x03C0} /6$, $a=A_1$ for $\theta \gt \unicode{x03C0} /6$, and $a=A_2$ for $\theta \lt -\unicode{x03C0} /6$. The total times to complete the tracking task for agents 1 and 2 are $11.75T$ and $14.25T$, respectively.

Figure 17

Figure 15. Convergence of the loss value in one training process without supervised learning, and the corresponding tracking performance (insets a–d) with $(1,1.5,2,2.5,3)\times 10^{6}$ training steps. As training step increases, the performance of the agent is not guaranteed to become better.

Figure 18

Figure 16. Histogram of OPE values over 400 trajectories.

Figure 19

Figure 17. (a) The swimmer position relative to the target at $t/T=72$ (station 8 in figure 7). (b) Evolution of $\alpha$, and the actions chosen at a series of times.

Figure 20

Figure 18. The vorticity contour and velocity field at $t/T=45$ (at station 5 in figure 7), along with the mass centre trajectory (grey line). The flow induced by previous actions of the swimmer is not negligible. It drags the swimmer to move right upwards (marked by the blue arrow), deviating from the figure-eight target trajectory.

Figure 21

Figure 19. Trajectories of the SAC agent with noisy input for tracking fixed targets: (a) front left, (b) straight, and (c) front right.

Supplementary material: File

Chen and Yang supplementary movie 1

Circular target trajectory tracking. Trajectories of the swimmer’s mass centre (red-blue line) and the moving target (green line), along with the vorticity contour (red for positive values and blue for negative values). The red and blue line segments denote the actions with and without forces, respectively.
Download Chen and Yang supplementary movie 1(File)
File 5.1 MB
Supplementary material: File

Chen and Yang supplementary movie 2

Figure-eight target trajectory tracking. Trajectories of the swimmer’s mass centre (red-blue line) and the moving target (green line), along with the vorticity contour (red for positive values and blue for negative values). The red and blue line segments denote the actions with and without forces, respectively.
Download Chen and Yang supplementary movie 2(File)
File 15.3 MB