Skip to content

Add a fallback price to investment appraisal#1420

Draft
tsmbland wants to merge 7 commits into
mainfrom
fallback_price
Draft

Add a fallback price to investment appraisal#1420
tsmbland wants to merge 7 commits into
mainfrom
fallback_price

Conversation

@tsmbland

@tsmbland tsmbland commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Description

Modifying the appraisal mini-optimisation to encourage assets to dispatch, as discussed with @ahawkes. I've updated the documentation to fully describe the new approach and reasoning, so I'll refer you to that rather than describing the approach here.

Fixes #1368
Fixes #1384
Makes #1347 much less likely, but we should still come up with a fix for that (even just clarifying the error message)

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

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.47%. Comparing base (b363e64) to head (a4b37d2).

Files with missing lines Patch % Lines
src/simulation/prices.rs 91.17% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           investment_docs    #1420      +/-   ##
===================================================
+ Coverage            86.80%   89.47%   +2.66%     
===================================================
  Files                   59       59              
  Lines                 8384     8419      +35     
  Branches              8384     8419      +35     
===================================================
+ Hits                  7278     7533     +255     
+ Misses                 790      564     -226     
- Partials               316      322       +6     

☔ View full report in Codecov by Harness.
📢 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 introduces a fallback price concept for the investment-appraisal mini-dispatch optimisation, intended to encourage candidate assets to dispatch when shadow prices alone would lead to zero/near-zero activity (addressing scenarios described in #1384/#1347 and aiming to fix #1368). It adds a configurable fallback_price_strategy, computes fallback prices alongside existing market/shadow prices, and updates appraisal coefficients and regression fixtures accordingly.

Changes:

  • Add fallback_price_strategy to model.toml parameters + JSON schema, and document the new mini-dispatch objective formulation.
  • Extend price calculation to produce a third price set (Prices::fallback) derived via the configured strategy.
  • Update investment appraisal activity coefficients and refresh regression expected outputs across examples.

Reviewed changes

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

Show a summary per file
File Description
tests/regression.rs Regression test definitions updated (but circularity tests still not re-enabled).
tests/data/two_regions/commodity_prices.csv Updated expected prices for two-regions regression outputs.
tests/data/two_regions/commodity_flows.csv Updated expected flows for two-regions regression outputs.
tests/data/two_regions/asset_capacities.csv Updated expected capacities for two-regions regression outputs.
tests/data/two_outputs/assets.csv Updated expected asset list for two-outputs regression outputs.
tests/data/two_outputs/asset_capacities.csv Updated expected capacities for two-outputs regression outputs.
tests/data/simple/debug_solver.csv Updated expected solver debug objective values for simple example.
tests/data/simple/commodity_prices.csv Updated expected prices for simple regression outputs.
tests/data/simple/commodity_flows.csv Updated expected flows for simple regression outputs.
tests/data/simple/assets.csv Updated expected commissioned assets for simple regression outputs.
tests/data/simple/asset_capacities.csv Updated expected capacities for simple regression outputs.
tests/data/simple_shadow/commodity_prices.csv Updated expected prices for simple_shadow patched regression outputs.
tests/data/simple_shadow/commodity_flows.csv Updated expected flows for simple_shadow patched regression outputs.
tests/data/simple_shadow/assets.csv Updated expected commissioned assets for simple_shadow patched regression outputs.
tests/data/simple_shadow/asset_capacities.csv Updated expected capacities for simple_shadow patched regression outputs.
tests/data/simple_npv/commodity_prices.csv Updated expected prices for simple_npv patched regression outputs.
tests/data/simple_npv/assets.csv Updated expected commissioned assets for simple_npv patched regression outputs.
tests/data/simple_npv/asset_capacities.csv Updated expected capacities for simple_npv patched regression outputs.
tests/data/simple_marginal/commodity_prices.csv Updated expected prices for simple_marginal patched regression outputs.
tests/data/simple_marginal/commodity_flows.csv Updated expected flows for simple_marginal patched regression outputs.
tests/data/simple_marginal/assets.csv Updated expected commissioned assets for simple_marginal patched regression outputs.
tests/data/simple_marginal/asset_capacities.csv Updated expected capacities for simple_marginal patched regression outputs.
tests/data/simple_marginal_average/commodity_prices.csv Updated expected prices for simple_marginal_average patched regression outputs.
tests/data/simple_marginal_average/commodity_flows.csv Updated expected flows for simple_marginal_average patched regression outputs.
tests/data/simple_marginal_average/assets.csv Updated expected commissioned assets for simple_marginal_average patched regression outputs.
tests/data/simple_marginal_average/asset_capacities.csv Updated expected capacities for simple_marginal_average patched regression outputs.
tests/data/simple_ironing_out/commodity_prices.csv Updated expected prices for simple_ironing_out patched regression outputs.
tests/data/simple_ironing_out/assets.csv Updated expected commissioned assets for simple_ironing_out patched regression outputs.
tests/data/simple_ironing_out/asset_capacities.csv Updated expected capacities for simple_ironing_out patched regression outputs.
tests/data/simple_full/commodity_prices.csv Updated expected prices for simple_full patched regression outputs.
tests/data/simple_full/commodity_flows.csv Updated expected flows for simple_full patched regression outputs.
tests/data/simple_full/assets.csv Updated expected commissioned assets for simple_full patched regression outputs.
tests/data/simple_full/asset_capacities.csv Updated expected capacities for simple_full patched regression outputs.
tests/data/simple_divisible/commodity_prices.csv Updated expected prices for simple_divisible patched regression outputs.
tests/data/simple_divisible/asset_capacities.csv Updated expected capacities for simple_divisible patched regression outputs.
tests/data/missing_commodity/commodity_prices.csv Updated expected prices for missing_commodity regression outputs.
tests/data/missing_commodity/assets.csv Updated expected commissioned assets for missing_commodity regression outputs.
tests/data/missing_commodity/asset_capacities.csv Updated expected capacities for missing_commodity regression outputs.
tests/data/circularity/commodity_prices.csv Added/updated expected prices for circularity example at 2040.
tests/data/circularity/assets.csv Added/updated expected commissioned assets for circularity example at 2040.
tests/data/circularity/asset_capacities.csv Added/updated expected capacities for circularity example at 2040.
tests/data/circularity_npv/commodity_prices.csv Added/updated expected prices for circularity_npv patched example at 2040.
tests/data/circularity_npv/assets.csv Added/updated expected commissioned assets for circularity_npv patched example at 2040.
tests/data/circularity_npv/asset_capacities.csv Added/updated expected capacities for circularity_npv patched example at 2040.
src/simulation/prices.rs Add Prices::fallback and compute fallback prices using a strategy override.
src/simulation/investment/appraisal/coefficients.rs Incorporate fallback prices into mini-dispatch activity coefficients.
src/model/parameters.rs Add fallback_price_strategy parameter with default value.
src/commodity.rs Make PricingStrategy Copy to simplify passing strategy overrides.
schemas/input/model.yaml Document and validate fallback_price_strategy in the input schema.
docs/model/investment.md Document fallback prices and the updated mini-dispatch coefficient formulation.

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

Comment thread tests/regression.rs
Comment thread src/simulation/investment/appraisal/coefficients.rs
Base automatically changed from investment_docs to main July 17, 2026 13:13
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.

Investments thrown by zero/questionable shadow prices Make circularity_npv example work again and re-enable regression test

2 participants