--- pretty_name: Three-Body Trajectory Benchmark tags: - physics - n-body - three-body-problem - dynamical-systems - gravitational-simulation - trajectory-prediction - graph-neural-networks task_categories: - time-series-forecasting --- # Three-Body Trajectory Benchmark This dataset contains two-dimensional gravitational three-body trajectories used in a master's thesis on neural prediction of dynamical systems. The benchmark is designed for training and evaluating models that generate future states autoregressively from an initial state. Each trajectory contains three equal-mass bodies interacting through mutual gravitational interaction. The data were generated with the REBOUND simulation package using the IAS15 integrator. All simulations use gravitational constant `G = 1`, body mass `m = 1`, time step `dt = 0.05`, and 200 sampled states per trajectory. ## Files | File | Role | Number of trajectories | |---|---:|---:| | `train.h5` | training split | 1000 | | `val.h5` | validation split | 600 | | `test.h5` | test split | 600 | The validation and test splits are balanced across five trajectory classes defined by the closest encounter reached during the trajectory. The training split follows the same class balance. ## State Format The main dataset inside each HDF5 file is named `trajectories` and has shape: ```text (n_trajectories, 200, 3, 5) ``` The last dimension stores the state of one body: ```text [x, y, vx, vy, m] ``` where `x, y` are planar coordinates, `vx, vy` are planar velocity components, and `m` is the body mass. Each file also contains an `energies` dataset with shape: ```text (n_trajectories, 200) ``` This stores the total mechanical energy of the corresponding trajectory at each sampled time step. ## Trajectory Classes Trajectories are grouped by the minimum pairwise Euclidean distance reached between any two bodies during the full trajectory: | Class | Criterion | |---|---:| | `close` | `0.00 <= d_min < 0.02` | | `near` | `0.02 <= d_min < 0.05` | | `mid` | `0.05 <= d_min < 0.15` | | `wide` | `0.15 <= d_min < 0.50` | | `far` | `0.50 <= d_min` | The HDF5 files include the following stratification fields: | Dataset / attribute | Description | |---|---| | `encounter_bin_id` | integer class id for each trajectory | | `encounter_bin_name` | class name for each trajectory | | `min_pairwise_distance` | minimum pairwise distance for each trajectory | | `encounter_bins_json` | JSON description of the class boundaries | ## Generation Procedure Initial positions are sampled from a zero-mean Gaussian distribution with standard deviation `1.0`. Initial velocities are sampled from a zero-mean Gaussian distribution with standard deviation `0.5`. After sampling, the center-of-mass position and velocity are subtracted so that the generated system does not contain global translation or drift. Candidate trajectories are rejected if any two bodies approach closer than `10^-3` or if any coordinate leaves the box `[-5, 5] x [-5, 5]`. Accepted trajectories are then assigned to one of the five trajectory classes according to their minimum pairwise distance. ## Loading Example ```python import h5py with h5py.File("train.h5", "r") as f: trajectories = f["trajectories"][:] # (1000, 200, 3, 5) energies = f["energies"][:] # (1000, 200) class_names = f["encounter_bin_name"][:] # (1000,) d_min = f["min_pairwise_distance"][:] # (1000,) first_state = trajectories[0, 0] # (3, 5) ``` ## Intended Use The dataset is intended for studying autoregressive trajectory prediction in gravitational three-body systems. It can be used to compare neural models across both trajectory accuracy and energy conservation, and to analyze how model behavior changes between smooth trajectories and close-encounter trajectories. The dataset was used in the thesis experiments to train and evaluate E(n)-Equivariant Graph Neural Networks and Hamiltonian Graph Neural Networks under a shared training and evaluation protocol.