Skip to content

Improve logging and multi-processing. - #62

Open
jangroter wants to merge 2 commits into
TUDelft-CNS-ATM:mainfrom
jangroter:main
Open

Improve logging and multi-processing.#62
jangroter wants to merge 2 commits into
TUDelft-CNS-ATM:mainfrom
jangroter:main

Conversation

@jangroter

Copy link
Copy Markdown
Collaborator

The current multi-processing script has two bugs:

Bug 1 and proposed solution
When initializing the seperate environment instances for the different CPUs each instance uses the same seed. This is solved by using Stable-Baselines3's own SubprocVecEnv class, which handles this naturally.

Bug 2 and proposed solution
The current logger implementation only logs the first environment instance when using multi-processing, the proposed change loops through all the environments done flags and adds them to their own row when necessary. The new log-files contain an additional env_id flag.

Example to demonstrate logging functionality over multiple parallel instances:

timesteps,episodes,env_id,total_reward,total_intrusions,average_drift
81,1,2,-3.268373764085395,0,1.2105088015131091
252,2,0,-34.84157606630309,26,1.0525685793217985
291,3,2,-31.89786281975591,27,0.6996946885365583
351,4,1,-33.25546853487047,26,0.6201255158008938
408,5,0,-76.65059943658756,69,1.4712691224206815

@jangroter

jangroter commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

TODO before merge:

  • Check compatibility of logger with all environments (both multi-processing and single core)

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.

3 participants