Repository navigation
Added support for investment relations - #58
Conversation
|
I like the general concept. I have to take a closer look at it and will come back to you with a more detailed feedback. I will create a new commit in which I do some general adjustments regarding the style while I will look through it and commit this before I write my direct comments on the code. |
JulStraus
left a comment
There was a problem hiding this comment.
I did a few EMX approach adjustments in the individual commits. These are mostly style related as well as an improvement on the docstrings.
I overall like the concept. It would require a specific API for simplified implantation for anything from EMX, but these are the not too difficult to implement. I would like to highlight the following things which should be discussed:
max_investments,min_investments, andexcludes_capacityare based on investment actions. This implies thatexcludes_capacitydoes not enforce that a capacity is retired if it is already existing before another technology capacity is added. I think @hellemo also would like the latter. It could be however easily added, if desired.- The individual limits or ratios are always numbers. This makes sense if we want to some it for all periods, but could be wrong if we do want different values in the different periods. As an example, I would allow
capacity_ratioinrequires_capacity,couple_capacity, andprecede_capacityto be aTimeProfile. max_budgetis the undiscounted budget. Should it go towards the discounted budget? If so, it would require a discounting rate.- There are also other potential varieties which we could include. As an example, we could also base some of the investments on additional binary variables or alternatively disjunctions.
There are a few things which must be adjusted. The following changes should be fixed within this PR:
precede_capacityis in my opinion wrong due to the summation, see the specific comment.- Improvement on the tests.
The current tests are in my opinion not good, as they pretty much focus only on the termination status. - Update of
NEWS.md(Under the header unversioned, if we decide to have some parts in a different PR) - Documentation:
The documentation requires more information in the library as I currently only reference the docstrings in the public library.
In another PR (or this), we should fix the documentation. It requires a description of the constraints in math_desc.md before the section Utility functions called Constraints for investment relationships and in a section below Lifetime modes called Investment relationships. The latter explains the core concept.
I could fix the second PR regarding the documentation.
|
Some more updates from my side. |
|
I reworked the testsets now and renamed We could split it up into 3 based on the testset structure, but I am not certain that it would be beneficial, mostly as all the concepts are individual with new code. It is hence also ok to leave it like that. I would however like to have one page in the documentation (separate PR, I can do it). Aside from that, it looks good to me now |
hellemo
left a comment
There was a problem hiding this comment.
I think this is coming along nicely, thanks!
I have some questions/comments to the API, which is not entirely consistent, and we could perhaps simplify a bit with default values for the prefixes that are typically used.
Several functions use a Vector{<:Tuple{Symbol, <:Any}} for investments, could we provide a method with a default value :cap for all investments for convenience?
Other functions have split the arguments into single elements and prefix (prefix_dep and prefix_pre). Could we either rearrange those and set default value for the prefixes or alternatively rethink the interface to use a Vector of Tuples here as well? (Vectors may not make sense for all, but at least multiple elements might depend on the same element, or exclusivity could be useful for a vector as well.
e.g.:
exclude_investment(
m,
element_1,
element_2,
𝒯::Union{TwoLevel, TwoLevelTree},
prefix_1::Symbol = :cap,
prefix_2::Symbol = :cap,
)I also considered (but did not conclude) whether it would be nice to allow to specify the actual strategic periods and default to the current behaviour, i.e. 𝒯ᴵⁿᵛ = strategic_periods(𝒯), which would allow to limit the scope of the constraints if desired and save a function call if you have the periods readily available.
something like:
exclude_investment(
m,
element_1,
element_2,
𝒯::Union{TwoLevel, TwoLevelTree},
prefix_1::Symbol = :cap,
prefix_2::Symbol = :cap,
𝒯_inv = strategic_periods(𝒯),
)
Setting limits on discounted vs nominal values was raised, I think nominal values would be easiest to understand and use, not sure what would be the use case for specifying discounted values.
I do not think that is reasonable for
While I agree that it is not really intuitive, I do not think it is easily possible to utilize a common format. The reason why we have both
I think we should provide the option for that. Your suggestion could be a solution or alternative we could use the same approach as
Then we should leave it that way :) |
Co-authored-by: hellemo <hellemo@gmail.com>
- Added the documentation for the relations - Updated NEWS.md
|
@trulsf and @hellemo: Once we agree on that it is a sufficiently good state, I will do a last commit for the version number update, merge the PR, and register. |
|
Looks good to me. As a note on further improvements (at a later stage, not as part of this PR) - I would be happy if the offered functionality was symmetrical for capacity and investments. This includes e.g. |
hellemo
left a comment
There was a problem hiding this comment.
The API looks much better now, thanks.
One thing I missed on the previous round was that I think we typically want to be able to model exclusivity over the full set of strategic periods, not per strategic period.
This is an attempt at starting work on modeling investment relations and couplings. If this is interesting to include, there will be a need for a couple of following PRs on documentation and better integration with
EnergyModelsBaseby modifyingEMIExtso that user-facing functionality is a bit more intuitive.I have prioritized relations that are not dependent upon binary variables (as they have more general usage), but it is possible to add more relations that depend upon binary variables (e.g. having a
requires()independent of capacity ratios). There are a lot more possibilities and flexibility that could be added (e.g. lead times), but they can be easily added if we agree on the overall value and design of such an extension.Tests are mostly AI written, so they should be properly checked.