Add commodity balance epsilon to force candidate assets to activate#1387
Add commodity balance epsilon to force candidate assets to activate#1387tsmbland wants to merge 6 commits into
Conversation
b0ae14b to
cdd07ec
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## price_calculation_dispatch_without_candidates #1387 +/- ##
=================================================================================
+ Coverage 89.57% 89.59% +0.02%
=================================================================================
Files 58 58
Lines 8351 8364 +13
Branches 8351 8364 +13
=================================================================================
+ Hits 7480 7494 +14
Misses 554 554
+ Partials 317 316 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Previously, the following models finished with the warning introduced in #1365:
Now, it's the following:
So, fixed I think for |
There was a problem hiding this comment.
Pull request overview
This PR introduces a small epsilon adjustment to commodity balance constraints in dispatch optimisation to encourage candidate assets to become active, with the aim of reducing zero shadow prices in cases where a commodity would otherwise be unused in a given year.
Changes:
- Add an epsilon term to commodity balance constraint lower bounds when candidate assets can produce the commodity, to force non-zero activity and improve dual (shadow price) signals.
- Thread candidate asset information into constraint construction so the epsilon can be applied conditionally.
- Update regression test fixtures (prices/flows/duals/objectives/assets/capacities) to reflect the new optimisation behaviour.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/simulation/optimisation/constraints.rs | Adds candidate-aware epsilon logic to commodity balance constraint lower bounds. |
| src/simulation/optimisation.rs | Passes candidate_assets into constraint creation. |
| tests/data/simple/debug_solver.csv | Updates expected objective values under the new constraints. |
| tests/data/simple/debug_commodity_balance_duals.csv | Updates expected commodity balance duals (fewer zero duals). |
| tests/data/simple/debug_appraisal_results_time_slices.csv | Updates expected appraisal results time-slice outputs affected by dispatch changes. |
| tests/data/missing_commodity/commodity_prices.csv | Updates expected commodity prices under the new dual behaviour. |
| tests/data/missing_commodity/commodity_flows.csv | Updates expected commodity flows under the new dispatch solution. |
| tests/data/missing_commodity/assets.csv | Updates expected asset set ordering/IDs for the scenario outputs. |
| tests/data/missing_commodity/asset_capacities.csv | Updates expected capacities consistent with the new solution. |
| tests/data/circularity/commodity_prices.csv | Updates expected prices affected by the epsilon-driven activation. |
| tests/data/circularity/assets.csv | Updates expected asset listing/IDs for circularity scenario outputs. |
| tests/data/circularity/asset_capacities.csv | Updates expected capacities consistent with circularity scenario outputs. |
| tests/data/circularity_npv/commodity_prices.csv | Updates expected prices for the NPV variant scenario. |
| tests/data/circularity_npv/commodity_flows.csv | Updates expected flows for the NPV variant scenario. |
| tests/data/circularity_npv/assets.csv | Updates expected asset listing/IDs for the NPV variant scenario. |
| tests/data/circularity_npv/asset_capacities.csv | Updates expected capacities for the NPV variant scenario. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
As discussed in #1386, adding an epsilon to the commodity balance constraints to force candidate assets to dispatch. You can see in
debug_commodity_balance_duals.csvfor the "final with candidates" runs (where shadow prices come from), that a lot of the zeros are gone.Doesn't eliminate all problems with zero shadow prices, as discussed below. But a step in the right direction.
Have based on #1389 as this also has a small affect on flows in the dispatch run with candidates, which would impact the market price calculation before #1389
I've played around with the value of
COMMODITY_BALANCE_EPSILON_FOR_CANDIDATES, and it seems pretty sensitive to the value, as explained here. Adam seems ok to go ahead with this and keep an eye on it. There's also an alternative suggestion with a different approach for getting shadow prices, which we may get. If we're happy to merge this then I'll open up a separate issue about those points.Fixes #1386
Type of change
Key checklist
$ cargo test$ cargo docpresent in the previous release
Further checks