Skip to content
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

Adding user-configurable slack type #239

Merged
merged 6 commits into from
Aug 17, 2021

Conversation

bknueven
Copy link
Collaborator

No description provided.

@bknueven bknueven requested a review from jeanpaulwatson June 26, 2021 03:42
@bknueven bknueven marked this pull request as draft June 26, 2021 05:30
@bknueven
Copy link
Collaborator Author

#238 should be merged first for its bug fixes.

Copy link
Collaborator

@michaelbynum michaelbynum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this looks great. I like the Enum for controlling the slacks. However, I do have a couple comments/questions that may or may not be important.

for i, val in _md_violation_penalties.items():
_branch_penalties = {}
_branches_with_slack = []
for bn, branch in branches.items():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have some sort of options or configuration object to control whether or nor things like slacks get added rather than inferring it from what is in the data dict. If someone wants to solve with slacks and then without, they have to modify the data dict. Perhaps more importantly, it looks like slacks will get added even if slack_type == SlackType.NONE.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing behavior (in main) allows the user to add slacks to any transmission line by setting the violation_penalty to something other than None.

Perhaps slack_type == SlackType.NONE should override the violation_penalties set for the individual branches? And we leave them alone if the slack_type is anything else?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it should also be noted that in the case that somebody wants to solve with slacks and without: provided they don't set individual violation_penalty attributes on a branch, no update to the data dictionary is required. They can optionally set the transmission_flow_violation_cost system attribute to set the system-wide transmission violation cost.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would be fine with that. We could also raise an error if slack_type == SlackType.NONE and violation_penalties are specified.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opted to ignore the violation_penalty and issue a warning. That seems to be most common for data incongruities in Egret, probably because its my preference, and I think Egret chooses reasonable defaults which saves the user time if they don't otherwise need to modify their inputs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Thanks.

@@ -37,7 +38,7 @@
]
)

def generate_model( model_data, uc_formulation, relax_binaries=False, ptdf_options=None, PTDF_matrix_dict=None ):
def generate_model( model_data, uc_formulation, relax_binaries=False, ptdf_options=None, PTDF_matrix_dict=None, slack_type=SlackType.BUS_BALANCE):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the default slack type be SlackType.NONE?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To maintain the existing behavior of Egret, this is the correct default. I can make the case for all three:

  1. SlackType.BUS_BALANCE is the existing unit commitment model
  2. SlackType.TRANSMISSION_LIMITS is probably most common in industry practice
  3. SlackType.NONE is probably most common in academic models.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

@@ -84,6 +89,7 @@ def _generate_model( model_data,
_relax_binaries = False,
_ptdf_options = None,
_PTDF_matrix_dict = None,
_slack_type = SlackType.TRANSMISSION_LIMITS,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct default?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should match above, I agree.

@bknueven bknueven marked this pull request as ready for review August 17, 2021 15:09
@michaelbynum
Copy link
Collaborator

Approved, pending passing tests.

@bknueven bknueven merged commit 9a9c29c into grid-parity-exchange:main Aug 17, 2021
@bknueven bknueven deleted the system_wide_slack branch August 17, 2021 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants