Skip to content

Remove shadow and scarcity pricing strategies - #1589

Open
tsmbland wants to merge 1 commit into
prices_refactorfrom
remove_shadow_scarcity_strategies
Open

tsmbland wants to merge 1 commit into
prices_refactorfrom
remove_shadow_scarcity_strategies

Conversation

@tsmbland

@tsmbland tsmbland commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Description

As described, removing these as user-facing pricing strategies. These require full-system dispatch, which is about to be replaced (or, rather, made optional). Note, the concept of shadow prices still exists, and will be used internally in simulations where full-system dispatch is enabled (which will be turned off by default), but shadow will not be exposed as a user-facing pricing strategy.

The only other functional change is to price calculation in circularities - previously these were seeded with shadow prices, but this isn't possible any more. Instead, we seed with the previous year prices (or previous round of the ironing out loop), or zero.

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

@tsmbland
tsmbland added this pull request to stack #1588 November 10, 2026 16:33
@tsmbland
tsmbland removed this pull request from stack #1588 November 11, 2026 16:29
@tsmbland
tsmbland added this pull request to stack #1594 November 11, 2026 16:29
@tsmbland
tsmbland force-pushed the remove_shadow_scarcity_strategies branch 5 times, most recently from 43d9c70 to 2a4cfc5 Compare November 16, 2026 10:54
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.93103% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.67%. Comparing base (704bdb8) to head (d9d727a).

Files with missing lines Patch % Lines
src/simulation.rs 85.71% 1 Missing and 4 partials ⚠️
src/simulation/prices.rs 88.88% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           prices_refactor    #1589      +/-   ##
===================================================
+ Coverage            82.02%   82.67%   +0.64%     
===================================================
  Files                   69       69              
  Lines                10037     9986      -51     
  Branches             10037     9986      -51     
===================================================
+ Hits                  8233     8256      +23     
+ Misses                1527     1452      -75     
- Partials               277      278       +1     

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

@tsmbland
tsmbland force-pushed the remove_shadow_scarcity_strategies branch 3 times, most recently from b04dc13 to 1395990 Compare November 16, 2026 13:32
@tsmbland
tsmbland requested a balanced review from Copilot November 16, 2026 13:47

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.

🟡 Changes recommended

Unreplaced seed prices can leak into returned market and fallback maps for cyclic commodities without producers or final-year candidates, publishing stale or zero prices instead of omitting them as documented.

1 open issue
What changed in this PR

Removes shadow and scarcity as user-facing pricing strategies in MUSE2, preparing for optional full-system dispatch while retaining internal shadow prices.

Changes:

  • Removes the strategies from pricing logic, input schemas, examples, and regression coverage.
  • Seeds cyclic-market pricing with previous-year or previous-iteration prices, defaulting to zero.
  • Updates documentation, release notes, fixtures, and pricing callers.
File Description
tests/​regression.rs Removes the shadow-pricing regression registration.
tests/​data/​simple_shadow/​commodity_prices.csv Deletes obsolete price expectations.
tests/​data/​simple_shadow/​commodity_flows.csv Deletes obsolete flow expectations.
tests/​data/​simple_shadow/​assets.csv Deletes obsolete asset expectations.
tests/​data/​simple_shadow/​asset_capacities.csv Deletes obsolete capacity expectations.
src/​simulation/​prices.rs Removes pricing strategies and adds previous-price cycle seeding and tests.
src/​simulation/​optimisation.rs Removes the unused activity-dual map helper.
src/​simulation/​activity.rs Removes the unused activity-dual map type.
src/​simulation.rs Passes previous prices into dispatch pricing.
src/​process.rs Updates test commodities to a supported strategy.
src/​input/​process/​flow.rs Updates flow-test pricing strategies.
src/​input/​commodity.rs Removes scarcity validation and updates a test.
src/​fixture.rs Replaces shadow pricing in shared fixtures.
src/​example/​patches.rs Removes the shadow-pricing example variant.
src/​commodity.rs Removes the two pricing-strategy enum variants.
schemas/​input/​model.yaml Removes unsupported fallback strategies.
schemas/​input/​commodities.yaml Updates supported strategies and their descriptions.
docs/​release_notes/​upcoming.md Documents migration requirements and cycle-seeding changes.
docs/​model/​prices.md Updates pricing and circularity documentation.
benches/​assets.rs Supplies empty previous prices for benchmark initialisation.

Review effort: Balanced

Comment thread src/simulation/prices.rs
Comment on lines +371 to +374
let seed = previous_prices
.get(commodity_id, region_id, time_slice)
.unwrap_or(MoneyPerFlow(0.0));
market_prices.insert(commodity_id, region_id, time_slice, seed);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest I'm tempted to go the other way. I.e. if a price can't be calculated in the final year, then always fall back to the most recent price, rather than leaving the price empty. I thought we'd planned to do that at one point?

@tsmbland
tsmbland force-pushed the remove_shadow_scarcity_strategies branch from 1395990 to d9d727a Compare November 16, 2026 15:00
@tsmbland
tsmbland marked this pull request as ready for review November 16, 2026 15:03
@tsmbland
tsmbland requested a review from alexdewar November 16, 2026 15:03

This branch has not been deployed

No deployments
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