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

Allocation based on equal ratio #1348

Closed
gijsber opened this issue Apr 3, 2024 · 5 comments · Fixed by #1366
Closed

Allocation based on equal ratio #1348

gijsber opened this issue Apr 3, 2024 · 5 comments · Fixed by #1366
Labels
allocation Allocation layer

Comments

@gijsber
Copy link
Contributor

gijsber commented Apr 3, 2024

What
Allocation should be done with equal ratio among demands with the same priority.

Why
As requested/agreed upon at TKI-workshop (April 2,2024)

@github-project-automation github-project-automation bot moved this to To do in Ribasim Apr 3, 2024
@gijsber gijsber added the allocation Allocation layer label Apr 3, 2024
@gijsber gijsber moved this from To do to What's next in Ribasim Apr 3, 2024
@SouthEndMusic
Copy link
Collaborator

This amounts to switching to the linear_relative objective function from #751. Are we sure we don't want to have the option for objective functions back? Maybe let the modelers experiment with them?

@Huite
Copy link
Contributor

Huite commented Apr 3, 2024

I think almost every hydrologists wants this ratio based approach 99% of the time.

If you don't find that convincing: anything that leaves some aspect of the distribution undefined is not a usable objective function. The reason is that it breaks the reproducibility of your simulations. If I have user A and user B with the same priorities and the objective function is equally happy with the following results:

  • A 100% B 0%
  • A 50% B 50%
  • A 0% B 100%

It will pick one seemingly "at random" (behind the scenes maybe based on node number or graph traversal order or whatever).

This could mean that if you remove node A, change your mind and add it again, maybe it will now "randomly" prioritize the other one instead. In that case you have two models which are essentially fully equivalent, but with potentially radically different outcomes.

@visr
Copy link
Member

visr commented Apr 3, 2024

Wait, yesterday I also thought what was suggested was the same as switching to linear_relative. But that merely implies that it is the fraction that counts, not that it is the same fraction for everyone in the same priority. The same fraction is indeed nicer, and more constrained.

For linear_relative, if A and B have the same demand and priority, my understanding is that all three of @Huite's bullets are still the same value, which we want to avoid.

@SouthEndMusic
Copy link
Collaborator

@Huite I completely agree that the problem should be fully constrained and in some abstract sense continuous, in that small changes to the model should lead to small changes in the allocation outcome. The current objective function indeed has a problem in that regard.

@visr you are right, but we are heading back to the discussions we had about fair distribution of flows much earlier on in the allocation discussions. You are essentially talking about maximizing the minimum fraction allocated, but that has its own flaws. The problem there is that the optimizer doesn't care about bringing more flow to some user unless it can raise the allocated fraction of all users.

I think the quadratic_relative objective function steers towards this fair fractional distribution. It might be worth another shot getting this to work reliably, especially now that we use a newer version of HiGHS.

@SouthEndMusic SouthEndMusic moved this from What's next to 👀 In review in Ribasim Apr 10, 2024
@SouthEndMusic
Copy link
Collaborator

The objective function that results in these equal ratios is slightly different from the ones used before, see #1366.

SouthEndMusic added a commit that referenced this issue Apr 12, 2024
Fixes #1348.

The objective function I found that leads to equal fraction allocation
has terms of the form

$$
d\left(1 - \frac{F}{d}\right)^2 = \left(\sqrt{d} -
\frac{F}{\sqrt{d}}\right)^2 = \frac{F^2}{d} - 2F + d.
$$

I can't explain yet why this works.
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Ribasim Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
allocation Allocation layer
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants