Skip to content

LevelDemand in terms of absolute error - #2515

Merged
SouthEndMusic merged 4 commits into
mainfrom
leveldemand_with_absolute_error
Aug 5, 2025
Merged

SouthEndMusic merged 4 commits into
mainfrom
leveldemand_with_absolute_error

Conversation

@SouthEndMusic

@SouthEndMusic SouthEndMusic commented Aug 4, 2025 •

Copy link
Copy Markdown
Collaborator

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:

$$ E \ge s(h_\text{min}^p) - S_\text{end} $$

$$ E \ge S_\text{end} - s(h_\text{max}^p) $$

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

@SouthEndMusic

Copy link
Copy Markdown
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.

Comment thread core/src/allocation_init.jl Resolved
@SouthEndMusic
SouthEndMusic merged commit e4b9fbd into main Aug 5, 2025
@SouthEndMusic
SouthEndMusic deleted the leveldemand_with_absolute_error branch August 5, 2025 10:54
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.

Use absolute errors for LevelDemand

2 participants