You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be easier to pin down issues like #1045 if we checked the status of the optimisation before collecting the results.
More context:
When an energy system model is infeasible, solph.Model.solve() will just warn ("UserWarning: Optimization ended with status warning and termination condition infeasible") return without an error. Then, latter solph.processing.results(model) will just seem to work (but not return meaningful results), but processing.meta_results(model) throws a KeyError. This is because it cannot find the objective value in an infeasible model.
As you see, the error handling is not intuitive at all. I see some options:
Model.solve():
Warn if the problem is infeasible.
Fail if the problem is infeasible. (I would opt for this, as solving fails.)
processing.results() with (non-existing) "results":
Warn if there are no results. (I would opt for this, as the function can be used to extract input data. Although it is not the design way to do things, I don't see why we should disallow this. If solving already fails, it is unlikely that somebody does this existentially. Thus, a warning should do.)
Fail if there are no results.
As it will fail anyway, there are no options for processing.meta_results(). We should handle that in our code and provide a meaningful error message.
The text was updated successfully, but these errors were encountered:
p-snft
changed the title
Results processing should check if optimisation succeeded
Automatically check if optimisation succeeds or fails (infeasible models)
Nov 14, 2024
It would be easier to pin down issues like #1045 if we checked the status of the optimisation before collecting the results.
More context:
When an energy system model is infeasible,
solph.Model.solve()
will just warn ("UserWarning: Optimization ended with status warning and termination condition infeasible") return without an error. Then, lattersolph.processing.results(model)
will just seem to work (but not return meaningful results), butprocessing.meta_results(model)
throws aKeyError
. This is because it cannot find the objective value in an infeasible model.As you see, the error handling is not intuitive at all. I see some options:
Model.solve():
processing.results() with (non-existing) "results":
As it will fail anyway, there are no options for
processing.meta_results()
. We should handle that in our code and provide a meaningful error message.The text was updated successfully, but these errors were encountered: