-
Notifications
You must be signed in to change notification settings - Fork 2
Tweaks to parent assets PR #1127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -181,10 +181,7 @@ impl VariableMap { | |||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| /// Create a map of commodity flows for each asset's coeffs at every time slice. | ||||||||||
| /// | ||||||||||
| /// Note that this only includes commodity flows which relate to existing assets, so not every | ||||||||||
| /// commodity in the simulation will necessarily be represented. | ||||||||||
| /// Create a map of commodity flows for each asset's coeffs at every time slice | ||||||||||
| fn create_flow_map<'a>( | ||||||||||
| existing_assets: &[AssetRef], | ||||||||||
| time_slice_info: &TimeSliceInfo, | ||||||||||
|
|
@@ -238,9 +235,6 @@ pub struct Solution<'a> { | |||||||||
| impl Solution<'_> { | ||||||||||
| /// Create a map of commodity flows for each asset's coeffs at every time slice. | ||||||||||
| /// | ||||||||||
| /// Note that this only includes commodity flows which relate to existing assets, so not every | ||||||||||
| /// commodity in the simulation will necessarily be represented. | ||||||||||
| /// | ||||||||||
| /// Note: The flow map is actually already created and is taken from `self` when this method is | ||||||||||
| /// called (hence it can only be called once). The reason for this is because we need to convert | ||||||||||
| /// back from parent assets to child assets. We can remove this hack once we have updated all | ||||||||||
|
|
@@ -420,11 +414,11 @@ fn filter_input_prices( | |||||||||
| .collect() | ||||||||||
| } | ||||||||||
|
|
||||||||||
| /// Get the parent for each asset. | ||||||||||
| /// Get the parent for each asset, if it has one, or itself. | ||||||||||
| /// | ||||||||||
| /// Child assets are converted to their parents and non-divisible assets are returned as is. Each | ||||||||||
| /// parent asset is returned only once. | ||||||||||
|
Comment on lines
419
to
420
|
||||||||||
| /// Child assets are converted to their parents and non-divisible assets are returned as is. Each | |
| /// parent asset is returned only once. | |
| /// Child assets are converted to their parent asset, and assets with no parent are returned as-is. | |
| /// Each parent asset is returned at most once. |
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parent_assets is now built via get_parent_or_self(...), so the vector may contain non-parent assets as well (assets with no parent). Renaming this local to something like existing_assets_deduped / dispatch_assets would better reflect the contents and avoid confusion in later checks like parent_assets.contains(asset).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc comment for
create_flow_mapno longer mentions that the returnedFlowMapis sparse (it only contains commodities implied by assets/flows, not necessarily every commodity in the simulation). Given the implementation only iteratesasset.iter_flows()and then prunes parent assets, callers may incorrectly assume full commodity coverage—please reintroduce/replace that caveat in the rustdoc so the output is not misleading.