Skip to content
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

Automatically check if optimisation succeeds or fails (infeasible models) #1056

Open
p-snft opened this issue Feb 20, 2024 · 1 comment
Open

Comments

@p-snft
Copy link
Member

p-snft commented Feb 20, 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, 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.

@p-snft p-snft self-assigned this Nov 14, 2024
@p-snft p-snft changed the title Results processing should check if optimisation succeeded Automatically check if optimisation succeeds or fails (infeasible models) Nov 14, 2024
@p-snft
Copy link
Member Author

p-snft commented Nov 14, 2024

Might be a topic for oemof/oemof#124

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant