-
Notifications
You must be signed in to change notification settings - Fork 117
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
Optimal Clustering of Substations for Topology Optimization Using the Louvain Algorithm #620
base: dev_multiagent
Are you sure you want to change the base?
Conversation
Substation Clustering
fix: Removed conflicting numpy library
Hello, Some tests does not appear to pass, but i'm not sure it's due to your PR. As soon as I can i'll fix the "dev_multiagent" branch and tests should pass (hopefully) here too. Sorry for the delay :-/ |
Hi @BDonnot , Thank you! |
Hello, Thanks for this reminder. There is absolutely no problem with this PR. I just need to find enough time to synch this branch with master and make tests pass (which has nothing to do with your code :-/) I'll try to have a look this week. Without any promises though... |
That's great! Thank you |
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.
Thanks for this addition. It's really great 😊
I would personally refactor the clusterutils file and make it a module.
And within this module, you make a LouvainClustering class.
This would have the advantage that, if you (or someone else) wants to add another algorithm it can more easily this way.
Also, can you please write your name as the author of the file 😊 you are the author 😉
Lastly, can you make some unit testing of your class?
(I'll have a few other comments when this will be done)
And sorry for the delay :-/
grid2op/multi_agent/utils.py
Outdated
|
||
|
||
class ClusterUtils: |
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.
Can you instead make a module (folder) names cluster_utils or clusterutils
And have this class named eg "LouvainClustering" to be more explicit 😊
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.
Hi Benjamin @BDonnot !
Addressed this comment by moving the ClusterUtils in to a seperate module and renamed it to LouvainClutering
setup.py
Outdated
@@ -30,6 +30,7 @@ def my_test_suite(): | |||
"tqdm>=4.45.0", | |||
"networkx>=2.4", | |||
"requests>=2.23.0", | |||
"scikit-network>=0.32.1", |
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.
This should be an optional dependency if possible
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.
Moved the scikit-networks dependency to the optional section
Quality Gate failedFailed conditions |
Related Problem & Feature Request
Related Problem
In the official Grid2Op repo; a Multi-Agent Reinforcement Learning(MARL) example is currently being developed under the branch dev_multiagent .
In the current implementation, when creating the multi-agent environment a parameter called ACTION_DOMAINS is passed. This represents a dictionary that maps agent names to a list of substations they control. This approach aims to cluster the grid into smaller subgrids, each managed by an individual agent.
However, the primary issue with the current implementation is the lack of an optimal clustering methodology. Currently; as shown below, the agents and the substations they control are hard-coded (i.e. the substation ids are manually assigned by hand) for the l2rpn_case14_sandbox environment.
This hardcoded clustering approach is not ideal because:
Lack of Flexibility: Hardcoding limits the adaptability of the solution to different environments and scenarios.
Suboptimal Clustering: Without a systematic method for clustering, the current setup may not effectively optimize the agents' performance.
Feature Request
Due to the limitations of the current hardcoded clustering, our team @rootcodelabs is exploring methods to perform this clustering more optimally. Currently, manually assigning IDs to agents and clustering the grid does not adequately consider factors such as connectivity and the inherent relationships between different sections of the grid. This can lead to sub-optimal performance of the agent. To address this, we are utilizing a scalable clustering algorithm that can better partition the grid. This algorithm will ensure optimal clustering, with subgrids sharing more internal connectivity. This approach aims to improve overall performance and scalability by creating clusters that are more logically connected and efficient.
By addressing this issue, we aim to strengthen the current MARL approach implemented within Grid2Op.
Detailed feature request is available at (#613)
Solution: Clustering Substations using the Louvain Algorithm
To improve substation clustering in the Grid2Op environment, our team explored various graph clustering algorithms. The basis for exploring these algorithms lies in their ability to analyze and partition the grid based on connectivity. Graph clustering algorithms help identify communities or clusters within a network, ensuring that closely connected substations are grouped together. This results in more cohesive subgrids and optimized performance. After evaluating multiple such algorithms, we selected the Louvain Algorithm for its superior performance in detecting community structures within large networks and its ability to maximize modularity. This ensures that the resulting clusters have dense internal connections and sparser connections between them, making it particularly suitable for our needs.
Solution Implementation
Sample Execution & Output
Output