-
Notifications
You must be signed in to change notification settings - Fork 2
Asset capacity enum #1087
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
Asset capacity enum #1087
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1087 +/- ##
==========================================
+ Coverage 82.15% 82.25% +0.10%
==========================================
Files 55 55
Lines 7496 7576 +80
Branches 7496 7576 +80
==========================================
+ Hits 6158 6232 +74
- Misses 1041 1050 +9
+ Partials 297 294 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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 pull request introduces an AssetCapacity enum to represent asset capacity as either continuous or discrete units, replacing the previous approach of using a Capacity type with optional unit_size checks throughout the codebase. This improves type safety and makes the code more explicit about how capacity is represented.
Changes:
- Introduced
AssetCapacityenum withContinuousandDiscretevariants, including arithmetic and comparison operations - Updated all asset constructors and methods to use
AssetCapacityinstead ofCapacity - Modified optimization and appraisal code to handle both capacity types appropriately
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/asset.rs | Added AssetCapacity enum with trait implementations; updated Asset struct and methods to use the new type; added new_candidate_for_dispatch method |
| src/simulation/optimisation/constraints.rs | Updated constraint logic to pattern match on AssetCapacity variants |
| src/simulation/optimisation.rs | Modified iter_capacity to return AssetCapacity; updated add_capacity_variables to handle both capacity types |
| src/simulation/investment/appraisal/optimisation.rs | Updated function signatures and results to use AssetCapacity |
| src/simulation/investment/appraisal/constraints.rs | Simplified capacity constraint logic using pattern matching |
| src/simulation/investment/appraisal.rs | Updated function signatures to use AssetCapacity |
| src/simulation/investment.rs | Updated capacity arithmetic and comparisons to use AssetCapacity methods |
| src/simulation.rs | Changed to use new_candidate_for_dispatch for dispatch candidates |
| src/output.rs | Updated to call total_capacity() on AssetCapacity values |
| src/fixture.rs | Updated test fixture to use AssetCapacity::Continuous |
| AGENTS.md | Added coding style preference for named format arguments |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
alexdewar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is just the same as what was in #1079?
Yeah but I accidentally closed that so had to open another PR. Thanks |
|
Ok cool. Just wanted to check there wasn't anything new in here too! |
See #1079 (which I accidentally closed)