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 optimization with main network #922

Closed
5 of 6 tasks
SouthEndMusic opened this issue Jan 8, 2024 · 0 comments · Fixed by #1006
Closed
5 of 6 tasks

Allocation optimization with main network #922

SouthEndMusic opened this issue Jan 8, 2024 · 0 comments · Fixed by #1006
Labels
allocation Allocation layer

Comments

@SouthEndMusic
Copy link
Collaborator

SouthEndMusic commented Jan 8, 2024

What
This is issue is for completing the main structure of allocation optimization.

How
There are the following steps:

  • I think it is quite straightforward to support a model that does not have a main network, where allocation is only solved in one subnetwork. This can be handled with a simple if statement in update_allocation!. To check whether the model has a subnetwork, use the following function:
function has_main_network(allocation::Allocation)::Bool
   return first(allocation.allocation_network_ids) == 1
end

This should always work given the ordering of the allocation network IDs and the validation introduced in #710.

  • Add a kwarg collect_demands::Bool = true to the function allocate!. If collect_demands == false the function should behave as it currently does, otherwise:

  • In adjust_source_flows!, make sure the capacities of the sources that are connections from the main network to the subnetwork are set to $\infty$ (or deactivate the source constraints entirely if possible);

  • In assign_allocations!, make sure the allocations are written to allocation.subnetwork_demands instead of user.allocated.

  • At the beginning of update_allocation!, loop over the allocation models of the subnetworks to compute the subnetwork demands, i.e. call allocate! on the subnetworks with collect_demands = true.

  • In set_objective_priority!, make sure that for the main network allocation the subnetworks are also reflected in the objective function, with the demands coming from allocation.subnetwork_demands.

  • In adjust_source_flows! for a subnetwork when collect_demands = false, for sources that come from the main network, make sure that the source capacity is set to what is allocated to that edge in the main network problem.

  • Add tests:

  • Test whether the optimization problem for the main network is correct;

  • Test whether not more water is allocated within the subnetwork than is allocated to the subnetwork from the main network;.

  • running the main_network_with_subnetworks test model to completion with succesful_retcode.

@SouthEndMusic SouthEndMusic added the allocation Allocation layer label Jan 8, 2024
@github-project-automation github-project-automation bot moved this to To do in Ribasim Jan 8, 2024
@SouthEndMusic SouthEndMusic moved this from To do to What's next in Ribasim Jan 8, 2024
@SouthEndMusic SouthEndMusic moved this from What's next to Sprint backlog in Ribasim Jan 17, 2024
@SouthEndMusic SouthEndMusic moved this from Sprint backlog to 🏗 In progress in Ribasim Jan 22, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Ribasim Feb 1, 2024
SouthEndMusic added a commit that referenced this issue Feb 2, 2024
Fixes #922.

---------

Co-authored-by: Marnix Kraus <[email protected]>
Co-authored-by: Martijn Visser <[email protected]>
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.

1 participant