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

Allow for fixing investments #1007

Open
wants to merge 47 commits into
base: dev
Choose a base branch
from

Conversation

jokochems
Copy link
Member

Closes #1005

  • Introduces an attribute fix_investments to class Model
  • Iterates over investment flows resp. variables and fixes them.
  • Raises an error in case model has not yet been solved.

@jokochems jokochems self-assigned this Oct 31, 2023
@jokochems jokochems linked an issue Oct 31, 2023 that may be closed by this pull request
@pep8speaks
Copy link

pep8speaks commented Oct 31, 2023

Hello @jokochems! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2023-12-08 16:40:39 UTC

@jokochems
Copy link
Member Author

This is a draft with yet untested functionality, just to get a first impression. I need to add tests as well as to touch the GenericInvestmentStorageBlock as well as the SinkDSM investment blocks.

@jokochems jokochems marked this pull request as ready for review November 1, 2023 17:06
@jokochems
Copy link
Member Author

jokochems commented Dec 8, 2023

Though the future of this feature is subject to debate, I came across an issue which might be of interest:

  • I'm solving a really large model instance and have deactivated the crossover algorithm of the solver due to complexity and runtime reasons and use barrier algorithm for solving (which provides a super-close to optimum solution, but with slight numerical unprecision).
  • Thus, one solution for my particular problem would be to round investment variables before a repeated solve. I think, I'll add that as an optional feature add-on (since I kind of require it super short notice).
  • We can still discuss on how to proceed, @p-snft. I see your points concerning the maintability and structure issues (also reaching beyond this PR) - I just don't have the capacities at the moment to provide a more general approach.

Copy link
Member

@p-snft p-snft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do see your personal need for this adjustment. However, I fear that this is introducing code dept for a very limited use case. There are several use cases that require a very similar functionality but would not be possible with this one:

  • Optimise investment as well as operation including demand rate for electricity. Then fixing the investments but leaving the peak demand as a variable. This would not work as optimising the peak load is not distinguished from investments.
  • Optimise day ahead energy trading based on a forecast. Then switch to slightly different energy demands and optimise intra-day trading.
  • Run a multi-period investment model, then fix the sizes just of the technologies that have a long planning phase (but not e.g. small scale PV installations) to emulate multiple medium-term scenarios that an still work out once an initial decision is taken.

Unfortunately, I am also lacking the time to implement this in a more generic way. Thus, I propose to leave this open as a reference or until someone find the time to do it.

@jokochems
Copy link
Member Author

I do see your personal need for this adjustment. However, I fear that this is introducing code dept for a very limited use case. There are several use cases that require a very similar functionality but would not be possible with this one:

  • Optimise investment as well as operation including demand rate for electricity. Then fixing the investments but leaving the peak demand as a variable. This would not work as optimising the peak load is not distinguished from investments.
  • Optimise day ahead energy trading based on a forecast. Then switch to slightly different energy demands and optimise intra-day trading.
  • Run a multi-period investment model, then fix the sizes just of the technologies that have a long planning phase (but not e.g. small scale PV installations) to emulate multiple medium-term scenarios that an still work out once an initial decision is taken.

Unfortunately, I am also lacking the time to implement this in a more generic way. Thus, I propose to leave this open as a reference or until someone find the time to do it.

Hi, thanks for the response. I totally understand it and find it a good suggestion to simply leave it open. (Btw: I'm still facing some numerical issues which lead the model to be solved again to be infeasible. But maybe I just have to choose an even higher rounding precision for my particular use case.)

You did not request any particular code changes, did you? This was more on the general need for a revision and it to be more generic.

What would be a cool thing would be to provide a list of variables you want to fix for another run / units you want to exclude from fixing. That might also be dispatch-related ones and allow you to exclude dedicated investment variables as for the example you provided above.

@p-snft
Copy link
Member

p-snft commented Dec 12, 2023

Yes, I did not come up with specific requests.

What would be a cool thing would be to provide a list of variables you want to fix for another run / units you want to exclude from fixing. That might also be dispatch-related ones and allow you to exclude dedicated investment variables as for the example you provided above.

If this was implemented, the approach should be general enough to be merged, I guess.

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

Successfully merging this pull request may close these issues.

Fix investment results in repeated solving
4 participants