Skip to content

Correctly use prices and features in battery environment#72

Merged
ADGEfficiency merged 8 commits intomainfrom
fix/battery-feature-usage
May 10, 2025
Merged

Correctly use prices and features in battery environment#72
ADGEfficiency merged 8 commits intomainfrom
fix/battery-feature-usage

Conversation

@ADGEfficiency
Copy link
Copy Markdown
Owner

@ADGEfficiency ADGEfficiency commented May 8, 2025

Summary

  • Fixed the battery environment to properly incorporate both price data and features
  • Updated observation space structure to correctly include feature dimensions
  • Added tests to verify feature integration
  • Rewrite the arbitrage example

Details

This PR addresses issue #69 by making the following improvements:

Features

  • Added proper feature handling in the battery environment's observation space
  • Implemented feature dimension detection based on input data shape
  • Updated make_env function to create features from prices when none are provided

Fixes

  • Fixed the observation space shape to include feature dimensions plus state of charge
  • Updated the reward calculation to correctly use electricity prices
  • Ensured feature and price data arrays have matching lengths
  • Added proper type hints for numpy arrays

Tests

  • Added a new test case specifically for verifying feature integration
  • Updated all existing tests to include both price and feature data
  • Test cases now verify that observations correctly include both feature data and battery state

- Added proper feature handling in battery environment
- Updated observation space to include feature dimensions
- Improved feature initialization in make_env
- Added test for observation with features
- Fixed reward calculation logic using electricity prices
- Updated existing tests to use both prices and features

Closes #69

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ADGEfficiency ADGEfficiency changed the title fix: correctly use prices and features in battery environment Correctly use prices and features in battery environment May 8, 2025
ADGEfficiency and others added 7 commits May 9, 2025 01:21
- Fix 'shape' attribute access by using isinstance() instead of hasattr()
- Change observation_space to use np.float64 for consistency
- Fix feature_obs creation to handle arrays properly
- Update _get_obs() to return np.float64 arrays

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Update Battery class to properly handle features array
- Add proper typing for battery parameters
- Increase test coverage requirement from 50% to 90%
- Fix test_make_env to use correct feature format

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Reduce training steps and evaluation episodes
- Simplify network architecture
- Reduce data size and feature dimensions
- Reduce number of test cases

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ADGEfficiency ADGEfficiency merged commit 47ec603 into main May 10, 2025
4 checks passed
@ADGEfficiency ADGEfficiency deleted the fix/battery-feature-usage branch May 10, 2025 05:37
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.

1 participant