Open
Conversation
Damowerko
commented
May 21, 2025
Owner
Author
Damowerko
left a comment
There was a problem hiding this comment.
Overall good implementation of OPFDataset. One branch is not handled. Commented out code and debug logic should be removed. Some other comments.
src/opf/dataset.py
Outdated
| @@ -183,8 +195,12 @@ def __getitem__(self, index) -> PowerflowData: | |||
| data["branch"].Sf = self.Sf[index] | |||
| data["branch"].St = self.St[index] | |||
Owner
Author
There was a problem hiding this comment.
This case isn't handled.
src/opf/dataset.py
Outdated
| data["bus", "branch", "bus"].Sf = self.Sf[index] | ||
| data["bus", "branch", "bus"].St = self.St[index] | ||
| # remove any branches with br_status=0 | ||
| br_mask = self.br_status[index].bool() |
| def case_path(self): | ||
| return Path(self.data_dir / f"{self.case_name}.json") | ||
| # TODO: eventually move this to front end | ||
| if self.case_name == "case118_ieee": |
Owner
Author
There was a problem hiding this comment.
Is this logic necessary? Can't I simply provide case_name case118_ieee_removed_branch?
|
|
||
| Sd = torch.zeros((n_samples, n_bus, 2)) | ||
| Sd[:, self.powerflow_parameters.load_bus_ids, :] = load | ||
| # branch_status = self.powerflow_parameters ...?? |
Owner
Author
There was a problem hiding this comment.
don't commit commented out code
src/opf/dataset.py
Outdated
| ) | ||
| # I am indexing from the end, so that I can change the size of the training dataset | ||
| # without changing wich samples are used for testing and validation | ||
| # # I am indexing from the end, so that I can change the size of the training dataset |
| # no... this is in NOT solved... missing some logic here | ||
| continue | ||
| end | ||
| println("branch $br_removed_index found to be feasibile") |
Owner
Author
There was a problem hiding this comment.
Remove the debug logging.
| network_data["branch"][branch_to_remove]["br_status"] = 0 | ||
| branch_to_remove = rand(keys(_network_data["branch"])) | ||
| _network_data["branch"][branch_to_remove]["br_status"] = 0 | ||
| # br_removed_index = parse(Int, branch_to_remove) |
Owner
Author
There was a problem hiding this comment.
Remove the comented out code.
| "solve_time" => Array{Float64}(undef, n_samples), | ||
| "objective" => Array{Float64}(undef, n_samples), | ||
| ) | ||
| br_removed_index = "" |
| result, solved = label_network(network_data, load) | ||
| result, solved = label_network(_network_data, load) | ||
| if !solved | ||
| # no... this is in NOT solved... missing some logic here |
|
|
||
| check_assumptions!(network_data) | ||
|
|
||
| # data = generate_samples_numpy(network_data, n_samples, min_load, max_load, remove_random_branch) |
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.
No description provided.