Skip to content

Add benchmark environments#338

Merged
Mark2000 merged 6 commits into
developfrom
feature/benchmark-envs
May 19, 2026
Merged

Add benchmark environments#338
Mark2000 merged 6 commits into
developfrom
feature/benchmark-envs

Conversation

@Mark2000

@Mark2000 Mark2000 commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Description

Closes #339

Adds benchmark environments. Run with:

python bsk_rl/benchmarks/benchmark.py' -o results_dir -e nadir_science:nadir_science

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How should this pull request be reviewed?

  • By commit
  • All changes at once

Future Work

Test benchmarks automatically: #340

Checklist

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation and release notes
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Copilot AI review requested due to automatic review settings April 21, 2026 23:54
@Mark2000 Mark2000 force-pushed the feature/benchmark-envs branch from f4e79b1 to dfae80a Compare April 21, 2026 23:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a lightweight benchmark harness (env templates + a Ray RLlib PPO training entrypoint) to support repeatable training runs against specific benchmark environments, and fixes a Basilisk support-data path fallback bug.

Changes:

  • Fix Basilisk dataFetcher ImportError fallback path variable naming in WorldModel setup.
  • Add benchmarks/train.py RLlib PPO training script with checkpointing and dynamic benchmark loading.
  • Add a first benchmark environment (nadir_science) plus a small Benchmark dataclass template.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
src/bsk_rl/sim/world.py Fixes fallback Basilisk path variable used when dataFetcher API is unavailable.
benchmarks/train.py New RLlib PPO training/continue script for benchmark runs (checkpoint mgmt, dynamic env import).
benchmarks/nadir_science.py Defines a benchmark environment configuration (satellite model + env/training args).
benchmarks/env_template.py Introduces a simple Benchmark dataclass container for env/training configuration.
Comments suppressed due to low confidence (2)

benchmarks/train.py:359

  • The script initializes Ray and a PPO algorithm but never calls ppo.stop() / ray.shutdown() before exiting. This can leave worker processes running (especially in interactive or repeated benchmark runs) and can hold onto temp dirs/object store resources. Consider adding a try/finally around training to ensure cleanup.
    benchmarks/nadir_science.py:133
  • These print(...) statements will execute at import time, which is noisy when using the dynamic import in benchmarks/train.py and makes it harder to use these benchmarks as a library. Consider removing them or switching to logging guarded by if __name__ == "__main__" / a verbosity flag.

training_args = dict(
    lr=3e-5,
    gamma=0.999,
    train_batch_size=1000,
    num_sgd_iter=10,
    use_kl_loss=False,
    clip_param=0.1,
    grad_clip=0.5,
)

nadir_science_benchmark = Benchmark(
    env_args=env_args,
    policies=policies,
    policy_mapping_fn=policy_mapping_fn,
    module_specs=module_specs,
    training_args=training_args,
)


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread benchmarks/benchmark.py
Comment thread benchmarks/benchmark.py
Comment thread benchmarks/train.py Outdated
Comment thread src/bsk_rl/sim/world.py
Comment thread benchmarks/benchmark.py
Comment thread benchmarks/benchmark.py Outdated
@Mark2000 Mark2000 force-pushed the feature/benchmark-envs branch 2 times, most recently from 5828acc to ed7c2ff Compare May 7, 2026 18:05
@Mark2000 Mark2000 changed the title Feature/benchmark envs Add benchmark environments May 18, 2026
Mark2000 added a commit that referenced this pull request May 19, 2026
@Mark2000 Mark2000 force-pushed the feature/benchmark-envs branch from 7788f2e to abe870e Compare May 19, 2026 00:01
Mark2000 added a commit that referenced this pull request May 19, 2026
@Mark2000 Mark2000 force-pushed the feature/benchmark-envs branch from abe870e to bddd388 Compare May 19, 2026 00:39
Mark2000 added a commit that referenced this pull request May 19, 2026
@Mark2000 Mark2000 force-pushed the feature/benchmark-envs branch from bddd388 to a26b102 Compare May 19, 2026 00:57
Mark2000 added a commit that referenced this pull request May 19, 2026
@Mark2000 Mark2000 force-pushed the feature/benchmark-envs branch from a26b102 to e2033bd Compare May 19, 2026 01:16
Mark2000 added a commit that referenced this pull request May 19, 2026
@Mark2000 Mark2000 force-pushed the feature/benchmark-envs branch from e2033bd to 80a7101 Compare May 19, 2026 01:50
Mark2000 added a commit that referenced this pull request May 19, 2026
@Mark2000 Mark2000 force-pushed the feature/benchmark-envs branch 2 times, most recently from f89a0f0 to 0282dce Compare May 19, 2026 01:52
@Mark2000 Mark2000 requested a review from Copilot May 19, 2026 03:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 4 comments.

Comment thread src/bsk_rl/utils/orbital.py
Comment thread benchmarks/benchmark.py
Comment thread benchmarks/aeos.py Outdated
Comment thread benchmarks/benchmark.py
@Mark2000 Mark2000 force-pushed the feature/benchmark-envs branch from 2d543dc to 243b457 Compare May 19, 2026 03:16
@Mark2000 Mark2000 merged commit 1342733 into develop May 19, 2026
13 of 14 checks passed
Mark2000 added a commit that referenced this pull request May 19, 2026
@Mark2000 Mark2000 deleted the feature/benchmark-envs branch May 19, 2026 20:18
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.

Add benchmark environments

2 participants