-
Notifications
You must be signed in to change notification settings - Fork 134
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
Introduce parameter "expected" for Flows #814
base: dev
Are you sure you want to change the base?
Conversation
This value can be used as a hint to the optimiser to speed up minimisation. The fature is actually a reintroduction: Up to oemof v0.3, it was possible to have a time series "actual_value" plus a boolean parameter "fixed". When fixed was false, it was just taken as the initial value for optimisation of the energy system. When compared to this previous implemenataion, having either fix=(series) or expected=(series) might be easier to understand.
For testing the speedup, I consider the following:
With a sufficiently high number of time steps, this should be rather hard to optimised. So:
|
# Conflicts: # src/oemof/solph/flows/_flow.py # tests/test_processing.py
In example there are no performance gains by adding expected values.
Hello @p-snft! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2024-12-11 21:12:11 UTC |
It looks like my implementation does not improve performance in my benchmark/ example case:
Problem is maybe caused by #818. Update: It's not. |
src/oemof/solph/_models.py
Outdated
self.flow[o, i, t].value = ( | ||
self.flows[o, i].value[t] | ||
* self.flows[o, i].nominal_value | ||
) |
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.
This statement does not seem to have any effect. Also, I did not see any hint in the documentation that assignment is possible. (However, it seems to work for the fixed entries.)
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 found examples that show the value being set that way in the documentation (https://pyomo.readthedocs.io/en/stable/working_models.html#changing-the-model-or-data-and-re-solving). Pyomo values are fixed, so thzis method seems to work. However, in the LP files, there is no starting value. Also, there is no run time difference.
As the documentation for Pyomo variables says that initialisation "is particularly important for non-linear models", I feel that the starting value might be simply ignored for linear variables.
I learned that a parameter |
# Conflicts: # src/oemof/solph/_models.py # src/oemof/solph/flows/_flow.py # src/oemof/solph/flows/_investment_flow.py # tests/test_processing.py
The expected value should be a load (in 0 <= load <= 1), as min, max, and fix are also loads.
This value can be used as a hint to the optimiser to speed up
minimisation. The fature is actually a reintroduction:
Up to oemof v0.3, it was possible to have a time series "actual_value"
plus a boolean parameter "fixed". When fixed was false, it was just
taken as the initial value for optimisation of the energy system.
When compared to this previous implemenataion, having either fix=(series)
or expected=(series) might be easier to understand.
Implements #759