Skip to content

Add single bid DRL strategy #576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 1, 2025
Merged

Add single bid DRL strategy #576

merged 5 commits into from
May 1, 2025

Conversation

nick-harder
Copy link
Member

@nick-harder nick-harder commented Apr 16, 2025

Pull Request

Description

Adds a single-bid DRL strategy. To be merged after #574.

Proposed Changes

  • Add a new single-bid DRL strategy for power plants to enable compatible simulations with storage units as well as the simulation of renewable energy generators
  • Make the DRL bidding strategies' initialization more flexible by allowing changes to the default observation and action dimensions
  • Refactor DRL strategy tests to use parametrization for improved modularity

Testing

Added a new test for the bidding strategy.

Checklist

Please check all applicable items:

  • Code changes are sufficiently documented (docstrings, inline comments, doc folder updates)
  • New unit tests added for new features or bug fixes
  • Existing tests pass with the changes
  • Reinforcement learning examples are operational (for DRL-related changes)
  • Code tested with both local and Docker databases
  • Code follows project style guidelines and best practices
  • Changes are backwards compatible, or deprecation notices added
  • New dependencies added to pyproject.toml
  • A note for the release notes doc/release_notes.rst of the upcoming release is included
  • Consent to release this PR's code under the GNU Affero General Public License v3.0

- make the DRL bidding strategies initialization more flexible with the ability to change default obs and act dimensions
- refactor rl strategies tests to use parametrization
@nick-harder nick-harder requested review from Copilot, kim-mskw and maurerle and removed request for Copilot April 16, 2025 14:52
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new single-bid DRL strategy, refactors existing DRL strategy tests to use parametrization, and updates the reinforcement learning algorithms to support dynamic agent counts and weight transfers.

  • Introduces RLStrategySingleBid with a simplified bidding structure
  • Refactors fixtures and tests in test_rl_strategies.py and adds extensive tests in test_matd3.py
  • Updates learning strategy and algorithm modules for more flexible policy initialization and weight transfer

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_rl_strategies.py Refactored tests to use parametrization and renamed fixtures for clarity
tests/test_matd3.py Added extensive tests for saving, loading, and weight transfers in TD3
assume/strategies/learning_strategies.py Introduced BaseLearningStrategy and RLStrategySingleBid, along with minor refactoring in RLStrategy
assume/scenario/loader_csv.py Updated prompt messages and warning texts regarding overwriting policies
assume/reinforcement_learning/learning_utils.py Added utility functions for hidden size extraction, agent inference, and weight transfer
assume/reinforcement_learning/learning_role.py Modified exploration mode logic with a new loaded-only parameter
assume/reinforcement_learning/algorithms/matd3.py Enhanced critic parameter loading to support agent count differences and weight transfers
Files not reviewed (1)
  • docs/source/release_notes.rst: Language not supported
Comments suppressed due to low confidence (1)

assume/strategies/learning_strategies.py:195

  • The variable name 'obd_dim' appears ambiguous and is likely a typo. Consider renaming it to 'obs_dim' for clarity and consistency with the rest of the code.
obd_dim = kwargs.pop("obs_dim", 38)

@nick-harder nick-harder changed the title Add single bid rl strategy Add single bid DRL strategy Apr 16, 2025
Copy link

codecov bot commented Apr 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.59%. Comparing base (c035460) to head (76d0c43).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #576      +/-   ##
==========================================
+ Coverage   79.51%   79.59%   +0.07%     
==========================================
  Files          52       52              
  Lines        7342     7370      +28     
==========================================
+ Hits         5838     5866      +28     
  Misses       1504     1504              
Flag Coverage Δ
pytest 79.59% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nick-harder
Copy link
Member Author

@kim-mskw a review here would be really nice :-)

@kim-mskw kim-mskw merged commit 7d3e920 into main May 1, 2025
9 checks passed
@kim-mskw kim-mskw deleted the add-single-bid-rl-strategy branch May 1, 2025 20:04
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.

2 participants