-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix divergence case #870
Fix divergence case #870
Conversation
@@ -58,7 +59,10 @@ public double getSensitivityFailureOvercost() { | |||
} | |||
|
|||
public void setSensitivityFailureOvercost(double sensitivityFailureOvercost) { | |||
this.sensitivityFailureOvercost = sensitivityFailureOvercost; | |||
if (sensitivityFailureOvercost < 0) { | |||
BUSINESS_WARNS.warn("The value {} for `sensitivity-failure-overcost` is smaller than 0. This would encourage the optimizer to make the loadflow diverge. Thus, it will be set to + {}", sensitivityFailureOvercost, -sensitivityFailureOvercost); |
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.
throw exception instead (we do it elsewhere when the parameter is wrong, for example in setPstSensitivityThreshold)
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 talked about it with Philippe and we copied the logic of the method setCurativeMinObjImprovement
in class ObjectiveFunctionParameters
. I can modify the code but I prefer that you discuss it with him before.
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.
ok then, for now. but i think we should harmonize the parameters more, and see what is done in other powsybl projects
Signed-off-by: belthlemar <martin.belthle@rte-france.com>
Signed-off-by: belthlemar <martin.belthle@rte-france.com>
Signed-off-by: belthlemar <martin.belthle@rte-france.com>
Signed-off-by: belthlemar <martin.belthle@rte-france.com>
Signed-off-by: belthlemar <martin.belthle@rte-france.com>
Signed-off-by: belthlemar <martin.belthle@rte-france.com>
f625586
to
2e161cb
Compare
Fix divergence cases, and 2nd PRAO falling back to initial situation Signed-off-by: belthlemar <martin.belthle@rte-france.com>
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
AlgoLeague ticket 129.
What kind of change does this PR introduce?
Bug fixes
What is the current behavior?
Part 1 : If the RAO does a second preventive and fallbacks to the initial situation in the end, it encounters this error :
The RaoResult object should not be modified outside of its usual routine
.It's because its variable
optimizationStepsExecuted
went fromFIRST_PREVENTIVE_ONLY
toSECOND_PREVENTIVE_FELLBACK_TO_INITIAL_SITUATION
which was not allowed.Part 2 :
Example:
CASTOR applies PRAs. These actions make a contingency perimeter "Co-1 curative" diverge.
So, it skips this perimeter and marks it as a SkippedOptimizationResultImpl.
When merging preventive and curative perimeters, it filters out this perimeter from the cost evaluation.
This means even though CASTOR made a perimeter diverge, in the end it does not see it.
To correct this behavior, we also have to change the value returned by the 2 methods
getVirtualCost
as even if CASTOR considered this perimeter it would still not see the virtual cost associated.What is the new behavior (if this is a feature change)?
Part 1 : The exception no longer occurs as this change is allowed.
Part 2 :
sensitivityFailureOvercost
which corresponds to the one filled in the RAO Parameters. The method getVirtualCost() now returns this cost. The same goes for getVirtualCost(virtualCostName) which returnssensitivityFailureOvercost
if called with "sensitivity-failure-cost" and 0 otherwise.So, if the same example occurs, the RAO will go through every contingency perimeter and for the ones with loadflow divergence, it will add the sensitivityFailureOvercost to the virtual cost.
Does this PR introduce a breaking change or deprecate an API?
Other information:
The farao-cucumber-branch
swe-divergence
contains a test case and every test passed on Jenkins.