Canonical RHS excerpt from the registered callable used for this benchmark cell. Expand it to verify the state equations; it is not a standalone runnable fixture.
Show canonical RHS excerpt
def rhs_E3(t, y):
states = y.reshape(_N_AGENTS, 4)
d = np.zeros_like(states)
center_drift = np.array([0.5 * t, 0.2 * t])
for i in range(_N_AGENTS):
xi, yi, vxi, vyi = states[i]
target = _FORMATION[i] + center_drift
fx = _K_FORM * (target[0] - xi) - _D_FORM * vxi
fy = _K_FORM * (target[1] - yi) - _D_FORM * vyi
for j in range(_N_AGENTS):
if _ADJ[i, j] > 0:
dx = states[j, 0] - xi - (_FORMATION[j, 0] - _FORMATION[i, 0])
dy = states[j, 1] - yi - (_FORMATION[j, 1] - _FORMATION[i, 1])
fx += _K_FORM * 0.5 * dx
fy += _K_FORM * 0.5 * dy
d[i, 0] = vxi
d[i, 1] = vyi
d[i, 2] = fx
d[i, 3] = fy
return d.ravel()- Parameters
- _ADJ = [0, 1, 0, 0, 0, 1, …] [shape=(6, 6), min=0, max=1]
- _D_FORM = 1
- _FORMATION = [3, 0, 1.5, 2.6, -1.5, 2.6, -3, 0, -1.5, -2.6, 1.5, -2.6]
- _K_FORM = 2
- _N_AGENTS = 6
- Initial condition
- y(0) = [3, 0, 0, 0, 1.6, 2.6, …] [shape=(24,), min=-2.7, max=3]
- Horizon
- t ∈ [0, 60]
Canonical RHS excerpt captured from the same registered callable used for the published benchmark. Frozen closure values are summarized below; helper imports and solver settings are intentionally omitted.