You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
The text was updated successfully, but these errors were encountered:
What
This is issue is for completing the main structure of allocation optimization.
How
There are the following steps:
if
statement inupdate_allocation!
. To check whether the model has a subnetwork, use the following function: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 functionallocate!
. Ifcollect_demands == false
the function should behave as it currently does, otherwise:In$\infty$ (or deactivate the source constraints entirely if possible);
adjust_source_flows!
, make sure the capacities of the sources that are connections from the main network to the subnetwork are set toIn
assign_allocations!
, make sure the allocations are written toallocation.subnetwork_demands
instead ofuser.allocated
.At the beginning of
update_allocation!
, loop over the allocation models of the subnetworks to compute the subnetwork demands, i.e. callallocate!
on the subnetworks withcollect_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 fromallocation.subnetwork_demands
.In
adjust_source_flows!
for a subnetwork whencollect_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 withsuccesful_retcode
.The text was updated successfully, but these errors were encountered: