Only consider primary flows in the topological sort#949
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #949 +/- ##
==========================================
+ Coverage 84.88% 84.96% +0.07%
==========================================
Files 50 50
Lines 5364 5419 +55
Branches 5364 5419 +55
==========================================
+ Hits 4553 4604 +51
- Misses 579 581 +2
- Partials 232 234 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dalonsoa
approved these changes
Oct 20, 2025
Collaborator
dalonsoa
left a comment
There was a problem hiding this comment.
This looks really good, and I think it makes sense thinking on circularities.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Since non-primary outputs are not considered in the investment algorithm (i.e. agents only consider processes for which the demanded commodity is the primary output), we don't need to include non-primary flows in the topological sort. This may help a little bit with the circularities problem because some flow cycles may disappear (or shrink) if you only consider primary flows. See the discussion in #914
Another benefit of this PR is that we can annotate the outputted DOT graphs to highlight primary vs non-primary flows. Here I've made it so non-primary flows appear as dashed lines.