-
Notifications
You must be signed in to change notification settings - Fork 5
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: optimize per source #1927
base: main
Are you sure you want to change the base?
Conversation
Note (@visr @gijsber): this PR changes (again) how |
Hi @SouthEndMusic , I prefer the new behaviour. The old behaviour did not have my preference but seemed like unavoidable at that time. |
Another point of attention: I think I already assumed this before, but I will rely on it now/again: for flow demands only flows in the direction of the edge count, not the other way. I think this is a reasonable assumption and requires less complexity |
Maintaining the allocation developer docs seems a bit of a chore, especially with the call stacks in place in combination with inline documentation. @FaridAlavi, I'd be interested to hear what you think the value of this documentation page is from your perspective. |
Optimizing per source
Fixes #565
What happens now in optimizing per subnetwork per priority (see
optimize_priority!
):set_capacities_flow_demand_outflow!
: Set the capacity of outflow edge of a node with a flow demand (Inf ifpriority == flow demand priority
, 0 otherwise)set_objective_priority!
: Set the equal ratio objective function (a term per demand of the current priority)allocate_to_users_from_connected_basin!
: Do allocation without optimization where users are directly connected to basins that can supply flowallocate_priority!
: solve the optimization problemassign_allocations!
: copy the allocated values to the proper places (either for UserDemand or a subnetwork treated as a UserDemand node)save_demands_and_allocations!
: Write allocation result data to the allocation record (record_demand
) for theallocation.arrow
outputsave_allocation_flows!
: Write allocation flow data to the allocation record (record_flow
) for theallocation_flow.arrow
outputWhat has to change when optimizing per source:
AllocationModel
struct and add this toAllocationModel
constructor inallocation_init.jl
. Types of sources (in order used for now, 'use flow available within subnetwork first'): edge designated as source, basin with level demand, main network to subnetwork, connector node with flow demand (buffer)allocate_priority!
adjust_*
functions for use within this loop and make sureflow_priority
is cumulative over all sourcessave_demands_and_allocarions!
andsave_allocation_flows!
after the loopallocation.qmd
instances)Limiting flow demand buffer inflow
Fixes #1504
Fixes #1709 (hopefully)
A bit of background here: nodes that have a flow demand have a flow buffer, which is implemented so that if the flow that goes from a source to a node with a flow demand has nowhere to go afterwards, it can be stored in the flow buffer to potentially be allocated downstream in subsequent optimizations.
Currently the flow into the flow buffer is unconstrained, meaning that for each optimization an arbitrary amount of flow can end up in the buffer. The objective only cares about the flow over the edge into the node with the flow demand, not about the flow into the buffer. Changes:
0
orInf
constraintsallocation.qmd
instances)