Repository navigation
Weight Separately Solved Scenarios by Their Probability in the Results - #242
Merged
Merged
Conversation
The objective weights each scenario by its input probability, also when the scenarios are solved one at a time, since the weights are fixed when the objective is built. The probabilities were set to 1.0 around each solve and after the loop, which changed only the console output and made the cost summary sum the scenarios. They now keep their input values, so the cost summary reports the expected cost, as the objective and the run status do.
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.
Problem
Without investment decisions and without a RES or emission target,
StageIterativeSolvingsolves each period and scenario separately. Before each solve it setspScenProbof that scenario to 1.0, and after the solve to 0.0. However, the objective does not readpScenProbat solve time:TotalObjectiveFunctionevaluates the scenario weights once, with the input probabilities, when the objective is built. The changes ofpScenProbtherefore affect only the console summary, and every solve still weights its scenario by the input probability. After the loop,pScenProbis reset to 1.0 for every scenario, so the cost summary sums the scenarios instead of weighting them. In contrast, the objective,total_cost_meurand the marginal prices, which divide the duals bypPeriodProb, all use the input probabilities.None of the shipped cases has more than one scenario per period, so neither the cases nor the tests reach this path.
Observed behaviour
Case
9n7y, each period reduced to 24 h in one stage, with a second scenariosc02(demand 10 % higher), each scenario with probability 0.5; solved with HiGHS on master after #240:vTotalSCost) andtotal_cost_meur(MEUR)sc01(EUR/MWh)With two scenarios solved separately, the cost summary is 2.0 times the expected cost, whereas the marginal price of
sc01equals that of the single-scenario case. Hence, the solves and the duals are correct, and only the reporting is affected.Solution
The changes of
pScenProbaround each solve and the reset after the loop are removed. The scenario probabilities keep their input values throughout, so every writer weights the scenarios as the objective does. The joint solve already kept the input probabilities, so both solve paths now follow one convention. The map, which selects the scenario of probability 1.0, already falls back to the first scenario when none has probability 1.0.After the change
The same cases:
total_cost_meur(MEUR)sc01(EUR/MWh)Notes
tests/test_stage_costs.pygains a third solve test with the two scenarios above (about 15 s in total). It fails on master, where the probabilities are reset to 1.0.