Repository navigation
Conversation
02eb149 to
7c3ebb8
Compare
76d0e13 to
d231c0b
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## competitive_algorithm_market_prices #1585 +/- ##
=======================================================================
- Coverage 82.31% 82.15% -0.17%
=======================================================================
Files 68 69 +1
Lines 9812 9998 +186
Branches 9812 9998 +186
=======================================================================
+ Hits 8077 8214 +137
- Misses 1456 1507 +51
+ Partials 279 277 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cacabfc to
312a17a
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Critical dispatch issues can leave demand unmet despite sufficient committed capacity and allow mothballed capacity to support activities beyond an asset’s active availability.
2 open issues
What changed in this PR
Adds infrastructure to return asset activities alongside agent selections in MUSE2, with committed assets and separate dispatch and investment modes. The simulation still uses investment mode and does not yet consume the returned activities.
Changes:
- Introduces shared activity/flow maps and a
Selectioncontainer. - Updates competitive and portfolio algorithms to return activities and support committed assets.
- Propagates selections through market orchestration and updates tests and benchmarks.
| File | Description |
|---|---|
src/simulation/optimisation.rs |
Reuses the shared flow-map conversion. |
src/simulation/market.rs |
Propagates run modes and selections through markets and cycles. |
src/simulation/investment/portfolio/optimisation.rs |
Adds fixed capacity variables for committed assets. |
src/simulation/investment/portfolio.rs |
Returns selections with activities and adds committed-asset tests. |
src/simulation/investment/competitive/optimisation.rs |
Extracts a reusable fixed-asset solver. |
src/simulation/investment/competitive/metrics.rs |
Uses the shared activity-map type. |
src/simulation/investment/competitive.rs |
Dispatches committed assets and returns final activities. |
src/simulation/investment.rs |
Defines run modes and asset options; aggregates selections. |
src/simulation/activity.rs |
Adds activity/flow types, selection helpers and tests. |
src/simulation.rs |
Adapts the investment caller to the new result type. |
src/output.rs |
Imports the relocated flow-map type. |
src/graph/investment.rs |
Updates a function name in a documentation comment. |
benches/assets.rs |
Adapts benchmark setup to the revised competitive API. |
Review effort: Balanced
| if !committed_assets.is_empty() { | ||
| (previous_solution, unmet_demand) = | ||
| solve_for_assets(model, &selected_assets, commodity, &coefficients, demand)?; |
There was a problem hiding this comment.
No I think this is fine and consistent with the approach
| Some(upper) => problem.add_column(cost, 0.0..=upper.value()), | ||
| None => problem.add_column(cost, 0.0..), | ||
| let var = if i < num_committed { | ||
| let capacity = asset.total_capacity().value(); |
There was a problem hiding this comment.
Technically true so I'll change it, but in practice committed assets (i.e. existing assets in the base year) will never be mothballed.
3527155 to
e17110e
Compare

Description
This adds infrastructure to allow us to extract activities from agent-level optimisations. We don't actually use these yet, but we will.
In the base year things will be different: we need to work out how agents will dispatch their existing assets, without investing in new ones. I've added the concept of "committed" assets (i.e. assets that have to be kept and used), and two different agent run modes: dispatch (just dispatch committed assets) and invest (invest/retain assets and dispatch them), the former applying to the base year and the latter to all other years. This will be wired up properly in a future PR.
Probably should have broken this into two PRs, but too fiddly now.
Fixes # (issue)
Type of change
Key checklist
$ cargo test$ cargo docpresent in the previous release
Further checks