Partition parallel branches deterministically - #341
Closed
acostarelli wants to merge 1 commit into
Closed
Conversation
It seems that binning branches by their impedance angle is affected by the order in which you read branches / create bins. This approach updates the "representative" bin angle with the bin median. This is probably not the most efficient approach, but I don't know if this is a hot-spot. I also don't know if this would've ever caused an error. I would imagine if anything this results in fewer bins, but maybe also solves issues that might stem from reading the same vector of branches but in a different order (not sure if that would ever happen though).
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to make partitioning of parallel branches by impedance angle deterministic (i.e., independent of iteration order) by updating each bin’s representative angle using a median-based approach.
Changes:
- Adds
Statistics.medianas the intended mechanism for stabilizing the representative impedance angle per bucket. - Updates
_partition_members_by_impedance_angleto adjust bucket angles during binning. - Updates
Project.tomlto includeStatisticsand reorganizes the[sources]block.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/PowerNetworkMatrices.jl |
Imports median from Statistics for use in impedance-angle bucketing logic. |
src/common.jl |
Updates parallel-branch impedance-angle partitioning logic to revise bucket representative angles. |
Project.toml |
Adds Statistics dependency and adjusts metadata layout (including [sources]). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
606
to
610
| push!(buckets, PSY.ACTransmission[br]) | ||
| else | ||
| push!(buckets[ix], br) | ||
| angles[ix] = median(angles[ix]) | ||
| end |
Member
Author
|
Closed because I messed up, but it didn't throw me an error so I'll look into why. |
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.
It seems that binning branches by their impedance angle is affected by the order in which you read branches / create bins. This approach updates the "representative" bin angle with the bin median. This is probably not the most efficient approach, but I don't know if this is a hot-spot.
I also don't know if this would've ever caused an error. I would imagine if anything this results in fewer bins, but maybe also solves issues that might stem from reading the same vector of branches but in a different order (not sure if that would ever happen though).