Allow asset selection to continue with unmet demand#1365
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1365 +/- ##
==========================================
+ Coverage 89.75% 89.80% +0.05%
==========================================
Files 58 58
Lines 8529 8524 -5
Branches 8529 8524 -5
==========================================
Hits 7655 7655
+ Misses 561 556 -5
Partials 313 313 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adjusts the investment asset-selection loop so that when appraisal yields no remaining feasible options, the simulation does not abort immediately; instead it logs a warning and proceeds, allowing the subsequent full system dispatch to potentially satisfy demand with already-selected assets (as discussed in #1363 / #1363 context).
Changes:
- Replaced an early
bail!on “no feasible options left” with awarn!andbreakfrom the selection loop. - Updated logging imports to include
warn.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .iter() | ||
| .filter(|(_, flow)| **flow > Flow(0.0)) |
alexdewar
left a comment
There was a problem hiding this comment.
LGTM!
I'm wondering if we still need to log the unmet demand though. When we get to the next dispatch run, either it will succeed, in which case we probably don't care or it will fail, in which case the unmet demand for the dispatch run will be logged anyway (admittedly there may be a discrepancy). What do you think? Another option would be to log the numbers at the debug level to make it less noisy.
We can also just merge this now and tweak it later.
Good idea, I'll do that |
Actually I don't think we need this as we can get it from the debug file |
Description
As discussed in #1363, it's possible that, even if asset selection runs out of options, the assets already selected may still be able to meet the full commodity demands in the context of a system dispatch with supply constraints. This at least gives it a chance to try. If it can't, you'll get the warning added here, followed by the usual message about unmet demand from the dispatch, which hopefully should be clear enough.
Fixes # (issue)
Type of change
Key checklist
$ cargo test$ cargo docpresent in the previous release
Further checks