-
Notifications
You must be signed in to change notification settings - Fork 54
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
Adding user-configurable slack type #239
Conversation
#238 should be merged first for its bug fixes. |
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.
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(): |
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.
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
.
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.
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?
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.
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.
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.
I think I would be fine with that. We could also raise an error if slack_type == SlackType.NONE
and violation_penalties
are specified.
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.
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.
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.
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): |
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.
Shouldn't the default slack type be SlackType.NONE
?
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.
To maintain the existing behavior of Egret, this is the correct default. I can make the case for all three:
SlackType.BUS_BALANCE
is the existing unit commitment modelSlackType.TRANSMISSION_LIMITS
is probably most common in industry practiceSlackType.NONE
is probably most common in academic models.
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.
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, |
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.
Correct default?
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 match above, I agree.
Approved, pending passing tests. |
No description provided.