SpineOpt.jl
SpineOpt.jl copied to clipboard
Bug with reduced stochastic structures.
Mostly a TODO for myself, but if anyone else wants to tackle this, be my guest.
There seems to be a bug if providing a model with input data defining a branching stochastic structure. E.g. defining
parent_stochastic_scenario__child_stochastic_scenario:
realization -> {optimistic, mean, pessimistic}
but limiting the branching on the stochastic_structure__stochastic_scenario
stage seems to result in a couple of issues, e.g.
stochastic_structure__stochastic_scenario:
deterministic -> {realization, mean}
Essentially, the structure is intended to use only the mean
scenario forecast and discard the optimistic
and pessimistic
. At the moment, this seems to result in the following issues:
- Error when processing the stochastic structure in
stochastic_structure.jl:149-151
whenchild_relative_weight
is not defined for non-existing scenarios. - Even if this is fixed, seems like the model comes out as infeasible or unbounded for some currently unknown reason.
Current workaround is to disable the unused stochastic_scenario
s with the is_active
feature.
We could e.g. check for scenarios not used in the stochastic structure and filter them out in preprocessing. Also, I think at the moment each stochastic structure needs to be connected to each stochastic scenario, which can be tedious. We could hence first filter out scenarios that don't appear in any structure, and then add "half-missing" scenarios. That latter part is somewhat more tricky I believe, but it felt a bit odd to having to create a "deterministic" structure that has all the child scenarios.
There is actually some filtering in the code it attempts to do, but it doesn't seem to do a sufficiently thorough job to avoid errors.
Also, I think at the moment each stochastic structure needs to be connected to each stochastic scenario, which can be tedious. We could hence first filter out scenarios that don't appear in any structure, and then add "half-missing" scenarios. That latter part is somewhat more tricky I believe, but it felt a bit odd to having to create a "deterministic" structure that has all the child scenarios.
@mihlema I don't think this is true? (At least I've gotten this to work without this?) All stochastic scenarios need to be mentioned in the parent_stochastic_scenario__child_stochastic_scenario
relationship (if they are to be used anywhere), but stochastic_structure__stochastic_scenario
only needs to account for the ones it actually includes. However, at the moment with this filtering being a little unreliable, I there are cases where one needs to filter out unused stochastic scenarios with the is_active
flag from the database.
@Tasqu What's the current status of this? Is it still relevant / is it necessary / is it nice to have?
@clizbe I honestly had forgotten all about this 😅 It's probably still relevant, as I imagine no-one has happened to fix this by accident. I don't imagine I'll have the time and/or a reason to fix this in the near-term, though.