Skip to content

Conversation

@tsmbland
Copy link
Collaborator

@tsmbland tsmbland commented Jan 14, 2026

Description

Following up from #1075 we can also do the same for the dispatch where we have capacity variables for assets selected as part of a circularity. This affects dispatch that we run after asset selection, but before divisible assets are split into their individual units. The point of this is to allow capacities to change slightly to balance out any demand/supply mismatches that occur as a result of a circularity. Whereas before, this could set capacities to invalid values not a multiple of unit size, capacities are now restricted to a multiple of unit size.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change to fix an issue)
  • New feature (non-breaking change to add functionality)
  • Refactoring (non-breaking, non-functional change to improve maintainability)
  • Optimization (non-breaking change to speed up the code)
  • Breaking change (whatever its nature)
  • Documentation (improve or add documentation)

Key checklist

  • All tests pass: $ cargo test
  • The documentation builds and looks OK: $ cargo doc
  • Update release notes for the latest release if this PR adds a new feature or fixes a bug
    present in the previous release

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

❌ Patch coverage is 0% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.03%. Comparing base (43d3b50) to head (255c875).

Files with missing lines Patch % Lines
src/simulation/optimisation.rs 0.00% 15 Missing ⚠️
src/simulation/optimisation/constraints.rs 0.00% 6 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                   @@
##           divisible_appraisal    #1078      +/-   ##
=======================================================
- Coverage                82.20%   82.03%   -0.17%     
=======================================================
  Files                       53       53              
  Lines                     7349     7364      +15     
  Branches                  7349     7364      +15     
=======================================================
  Hits                      6041     6041              
- Misses                    1018     1033      +15     
  Partials                   290      290              

☔ 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.

@tsmbland tsmbland marked this pull request as ready for review January 14, 2026 16:38
@tsmbland tsmbland requested a review from Copilot January 14, 2026 16:39
Copy link
Contributor

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 pull request extends the use of integer capacity variables to the dispatch optimization phase for divisible assets (assets with a unit_size). Following the approach from PR #1075, when a divisible asset is selected in a circularity and has flexible capacity, the capacity variable now represents an integer number of units rather than a continuous capacity value. This ensures that capacity adjustments during dispatch remain multiples of the unit size, preventing invalid fractional capacities.

Changes:

  • Modified capacity variable creation to use integer variables for divisible assets with flexible capacity
  • Updated capacity variable retrieval to convert from number of units back to total capacity for divisible assets
  • Adjusted activity constraint limits to account for capacity variables representing unit counts instead of total capacity

Reviewed changes

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

File Description
src/simulation/optimisation.rs Adds integer capacity variables for divisible assets and converts between unit counts and total capacity
src/simulation/optimisation/constraints.rs Scales activity-per-capacity limits by unit size when capacity variable represents unit count

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

@tsmbland tsmbland requested review from Aurashk and alexdewar January 15, 2026 14:44
Base automatically changed from divisible_appraisal to main January 15, 2026 15:03
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