Repository navigation
LevelDemand in terms of absolute error - #2515
Merged
Merged
Conversation
Collaborator
Author
|
I made another simplification here: we used to penalize having more flow trough a UserDemand node than the demand. But @gijsber pointed out that we never want more flow to go into a UserDemand node than the demand, and water should not be 'forced' trough a UserDemand node if it has nowhere else to go. |
verheem
reviewed
Aug 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2505
With this PR the LevelDemand is defined in a very straightforward way. Given the target levels$h_\min^p$ and $h_\max^p$ for priority $p$ , the storage at the end of the allocation timestep $S_\text{end}$ the profile $s(h)$ and the absolute error $E$ , we have:
which is well defined independent of the state of the model. This does suffer from uniqueness problems, because the error reduces the same for very Basin when some storage is allocated to it. As far as I can see, the cleanest way to obtain an error formulation that yields uniqueness of the optimal solution is to use quadratic errors.
I did another simplification in this PR: For all demand nodes there is now a single error term, instead of separate upper and lower error terms.
@jarsarasty