Skip to content

Conversation

@TOC6
Copy link
Contributor

@TOC6 TOC6 commented Jan 13, 2026

Initial code working. We can build torch geometric datasets, train GNNs on those datasets, and perform some analysis of the results.

TOC6 added 15 commits December 23, 2025 19:00
…his branch: fixed variants problem in boidsAgents, added ground weights option, fixed separation weight getting multiplied twice, updated tqdm,
…imple) GNN model is created, which can be trained, and basic plotting of attention weights is provided.
…working. Training seems to be working too well -- maybe some of the validation data is leaking into the training? Need to figure that out.
…es (which seems to work), run_simulator.py added as new (and better designed) entry point for the simulator, gnn_agent.py added to allow the gnn model to work with the simulator for rollouts, boid_agents.py added to allow for different kinds of agent classes to be used with the simulator, various other fixes and bugs added.
…ata directory to better separate the original data from the training results and make it easier to have multiplet types of input features and models.
… show.)

- Added abstract class in simulator_agents_abstract.py
- Clipped the actions to run trajectories so they don't go beyond the box boundaries.
… 5. Need more tests. Also, pytest code ran successfully.
…ter that train uses to create the model rather than the model being hard coded in train_3DGNN().
…s if running remote tests. Also changed where those folders were placed.
@TOC6 TOC6 linked an issue Jan 13, 2026 that may be closed by this pull request
TOC6 added 6 commits January 13, 2026 18:11
…. This commit has build and train. Last one was just build and it ran successfully.
…. This commit has build and train and show. Last one was build and train, which ran successfully.
…. This commit has build, train and analyze. Last one was build, train, and show, which failed.
…ild, train and analyze all run remotely, but the test for show fails for some reason. Changed the show test to run locally only.
@TOC6 TOC6 requested a review from dimkab January 14, 2026 02:07
Copy link
Collaborator

@dimkab dimkab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the awesome work!

"""
TOC -- 010226 8:52PM
Why are these torch.inf instead of np.inf?
"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you tried to switch to np.inf and rerun tests?

Copy link
Contributor Author

@TOC6 TOC6 Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tests pass with np.inf, so I changed that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have two run_simulator()'s now (this one and the old run_boids_simulator.py) and this is confusing. Since you have run_simulator_main here with boid_agents, is it supposed to replicate the functionality from run_boids_simulator.py? if so, I'd much prefer if there was only one simulator...

Copy link
Contributor Author

@TOC6 TOC6 Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run_simulator() is more general and doesn't always use boids, so it makes sense to keep that name. I removed run_boids_simulator.py.


def convert_dataframe_to_node_features(
df: pd.DataFrame, columns=None, time_window_length=1
):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstring/type hint for return value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added docstrings and type hints for all the new code (I think) -- hopefully, they are accurate and specific enough. Didn't have time to go back to the simulator code.

):
"""
Args:
df (pd.DataFrame): the dataframe containing a description of the agents in the environment
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected format of the df?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

node_feature_columns=None,
label_type: Optional[str] = None,
time_window_length: int = 1,
):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type hint / docstring for return value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

)


def load_dataset(directory: str):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(optional) parameters: seed, batch_size (is >1 supported?), train_size_ratio

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe batch_size>1 will work (it runs) but I have to rethink how I am processing the training results since torch-geometric combines the graphs into a single graph.

Copy link
Contributor Author

@TOC6 TOC6 Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added support in process_results() to handle results generated with batches. I also added train_size_ratio and seed parameters.

)

train_loader = DataLoader(dataset=train_dataset, batch_size=1, shuffle=True)
val_loader = DataLoader(dataset=val_dataset, batch_size=1, shuffle=True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for validation is better to have shuffle=False to compare between epochs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

if not stored_init_pos:
stored_init_pos = True
# print('x shape: ', graph.x.shape)
"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this comment still relevant? if anything, the assumption about attention weights being returned does create dependency to the model type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the stored init pos stuff.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this file used somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, removed it.

#
# Train
#
result = subprocess.run(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any way to have everything here run without spawning a new process? will help debugging the thing...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually never mind that, debugging is not an issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed all those already. :)

scale_positions=1500,
)

if remote_test:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this branch is never executed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I excluded the show_trajectories part of the test for now because I couldn't get it to work. If we add this back it, we will need the remote test check to see if we want to remove the folders.

TOC6 added 5 commits January 15, 2026 14:23
…a numpy array to a scalar.

Got rid of a bunch of unnecessary comments. Added type hints everywhere. Added a notebook to run the 3DGNN code (animating weights doesn't work yet in the notebook, though). Removed the gnn3D_postion_labels_agent_config.yaml files and the run_boids_simulator file.
…. support in process_results() for batched data. Removed now redundant run_boids_simulator.py.
TOC6 added 9 commits January 15, 2026 20:32
…_main() instead of defunct run_boids_simulator(). Updated README.md to say run_simulator where it used to say run_boids_simulator.
… can get past the CI test.

Removed a couple of unused files from the simulator folder.
… wouldn't have conflicts if the default config.yaml file changed. The notebook requires like 5 episodes, while the default was just 1 episode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GNN for 3D Simulator Data -- Redesign

2 participants