Skip to content

Fix a summation in reserve margin - #19

Open
idelder wants to merge 1 commit into
mainfrom
fix/reserve
Open

Fix a summation in reserve margin#19
idelder wants to merge 1 commit into
mainfrom
fix/reserve

Conversation

@idelder

@idelder idelder commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Should definitely not be summing over that. The prior line already gets all techs in the reserve set so this line just O(n2) product sums them all again.

Signed-off-by: Davey Elder <iandavidelder@gmail.com>
@idelder
idelder requested review from a team and a lite review from Copilot August 14, 2026 17:08

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

This PR fixes an over-counting bug in the reserve margin calculations by removing an unintended extra iteration over M.tech_reserve when summing exchange-technology contributions.

Changes:

  • Removes a redundant for t in M.tech_reserve generator clause in ReserveMarginStatic, preventing duplicated/incorrect capacity summation for exchange techs.
  • Removes the same redundant generator clause in ReserveMarginDynamic, ensuring exchange-tech firm capacity contributions are not multiplied by the size of tech_reserve.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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