Title: Performance Scalability · PowerGridModel · Discussion #24 · GitHub
Open Graph Title: Performance Scalability · PowerGridModel · Discussion #24
X Title: Performance Scalability · PowerGridModel · Discussion #24
Description: Performance Scalability
Open Graph Description: I have been testing the scalability of PGM vs the likes of Pandapower and PowerFactory, and from my findings PGMs performance time scales linearly as a function of the number of network nodes, as o...
X Description: I have been testing the scalability of PGM vs the likes of Pandapower and PowerFactory, and from my findings PGMs performance time scales linearly as a function of the number of network nodes, as o...
Opengraph URL: https://github.com/orgs/PowerGridModel/discussions/24
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Performance Scalability","text":"I have been testing the scalability of PGM vs the likes of Pandapower and PowerFactory, and from my findings PGMs performance time scales linearly as a function of the number of network nodes, as opposed to the others having a trend of n^2.
\nAm I correct with these results, and could you explain as to why it scales like this?
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Hi @ConnorG51 ,
\nThank you for your valuable input. Apologies for our late response. Apparently, there was an issue regarding notifications and we completely missed this discussion.
\n\n- For radial grids, our algorithms scale as
O(N). \n- For meshed grids, however, our algorithms scale as
O(N²), but even then, most steps scale O(N). In addition, depending on what and how you benchmark, we may cache the state, meaning that the O(N)-scaling steps usually dominate the calculations for reasonably small N. Only for extremely large amounts of nodes will the quadratic behavior come into play. I do not have exact numbers at the moment for where that transition happens, but we would be very happy if you are able to share your results with us. Inspiration may come from the benchmark done in this PR \n
\nI hope this answer and the more extensive one below help you continue your research. Please let me know if there's anything else we can help you with. I'm now subscribed to this discussion, so response should be much faster.
\nKind regards,
\nMartijn
\nLong answer
\nIn an attempt to give a more elaborate answer, I will break it down as much as I can. We do several optimizations to try and get the scaling as close to optimal as possible. See also performance guide for a quick overview of tips and tricks a user might use to obtain better performance without going into detail. The different types of optimizations involve the different layers of the core design.
\nConventions
\nLet's call N the total amount of components, n the amount of nodes and e the amount of edges (Branch and Branch3 components) and a the amount of non-edge components that connect to nodes (Appliance) and o the amount of components that connect to other components (Sensor and Fault). Therefore, N = n + e + a + o.
\nNote that:
\n\n- for pretty much all practical use cases:\n
\ne > n > 1 \na > 1 and a may be a > n or a <= n \n
\n \n- for power flow calculation:\n
\no >= 0 \n
\n \n- for state estimation:\n
\no >= n (see the comment on observability) \n
\n \n- for short circuit calculation:\n
\no >= 1 \n
\n \n
\nBreakdown
\nInterfacing
\n\n- input step is
O(n + e + a + o) on average \n- update step is
O(N_{update}) on average\n\n- Depending on the data, in some batch cases, it can be reduced to one single call for the entire batch instead of for every scenario.
\n
\n \n- output step is
O(N) \n
\nTopology
\nTopology step containing graph optimization depends heavily on the type of network:
\n\n- Depth-first search:
O(n + E) \n- If the graph contains cycles containing at least 4 edges: minimum degree ordering is
O(n e + e²/n)\n\n- this can become an expensive step
\n- We are working on some improvements, see also PowerGridModel/power-grid-model#433 and its follow-ups
\n
\n \n- Reorganization of components:
O(N) \n
\nYbus construction
\nO(N)
\n\n- Some steps are skipped when updating if the topology doesn't change
\n
\nSolving
\nThis may depend on the calculation type and solver used. We assuming constant amount of iterations for iterative approaches
\n\n- Preparing of the matrix equation:
O(N) on average\n\n- May depend on type of calculation and solver
\n
\n \n- LU decomposition: O(e²/n)\n
\n- We make use of the fact that the data is expected to be extremely sparse
\n- It relies very heavily on the reorganization of the topology step (depth-first + minimum degree) by means of 'fill-in's (see https://en.wikipedia.org/wiki/Minimum_degree_algorithm)
\n- For some solvers, this happens only once as long as the topology does not change
\n- For others may be required for every iteration (e.g. Newton-Raphson state estimation, see also its documentation)
\n
\n \n- Solving the matrix equation: O(e)
\n
\nSummary/conclusion
\nOverall, depending on what your data looks like, which solver you use and whether you benchmark batches or clean runs from scratch, your scaling may be:
\n\nO(n e) if you take the construction of the model into account (meshed grids)\n\n- (near-)radial grids are significantly faster and may run in
O(n + e) \n- Although the complexity will remain the same, hopefully, the construction will become even faster in the future
\n
\n \nO(e² / n) if you do not take the construction into account \nO(n + e) if you choose a fast solver (e.g. linear power flow), do not update topology, do a single calculation first and then benchmark only runs of the power grid model after that. This allows some type of \"precalculation\" \n- For radial grids, the overall performance is
O(n + e + e²/n) = O(N) \n- For meshed grids, the overall performance is
O(n e) = O(N²) \n
","upvoteCount":1,"url":"https://github.com/orgs/PowerGridModel/discussions/24#discussioncomment-8744444"}}}
| route-pattern | /_view_fragments/Voltron::DiscussionsFragmentsController/show/orgs/:org/:discussion_number/discussion_layout(.:format) |
| route-controller | voltron_discussions_fragments |
| route-action | discussion_layout |
| fetch-nonce | v2:4730062e-ffe9-bafc-450d-45404d4ad1a8 |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | E3CC:5CD99:8D5B46:B881FA:698E96E8 |
| html-safe-nonce | ac176292eade6aa455421fde9eeea878a5b98108cc1377ab9a5d811a98d26f22 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFM0NDOjVDRDk5OjhENUI0NjpCODgxRkE6Njk4RTk2RTgiLCJ2aXNpdG9yX2lkIjoiNTg4NDM1ODQ0MTQ0NzYyNjQ3MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | bbf71909d41a5180a3379cde54d314e2857324cf5a818a2008b1101dfc80f694 |
| hovercard-subject-tag | discussion:6164764 |
| github-keyboard-shortcuts | repository,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/orgs/PowerGridModel/24/discussion_layout |
| twitter:image | https://opengraph.githubassets.com/ea4fcf02cdb55bcef9528bc7ad4f6d00ff6c3abf2ad577b58dc16f33a217fdb7/orgs/PowerGridModel/discussions/24 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ea4fcf02cdb55bcef9528bc7ad4f6d00ff6c3abf2ad577b58dc16f33a217fdb7/orgs/PowerGridModel/discussions/24 |
| og:image:alt | I have been testing the scalability of PGM vs the likes of Pandapower and PowerFactory, and from my findings PGMs performance time scales linearly as a function of the number of network nodes, as o... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb2828a801ee6b7be618f3ac76fbf55def35bbc30f053a9c41bf90210b8b72ba |
| turbo-cache-control | no-preview |
| octolytics-dimension-user_id | 128388838 |
| octolytics-dimension-user_login | PowerGridModel |
| octolytics-dimension-repository_id | 616883724 |
| octolytics-dimension-repository_nwo | PowerGridModel/.github |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 616883724 |
| octolytics-dimension-repository_network_root_nwo | PowerGridModel/.github |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6b91a7e6e46287d26887e3fb7a4161657bab8f7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width