SpineOpt.jl
SpineOpt.jl copied to clipboard
Retrieving lowest resolution for user constraints
Currently the resolution for creating the user_constraint is determined based on the resolution of all potentially involved variable. For example, looking at the resolution with regards to the unit*, we retrieve the lowest resolution ~as follows (simplified):
t_lowest_resolution(
ind.t in unit_flow_indices if u in unit__{from;to\}node__user_constraint(user_constraint=uc);
ind.t in units_on_indices if u in unit__user_constraint(user_constraint=uc);
ind.t in units_invested_available_indices if u in unit__user_constraint(user_constraint=uc);
)
However, as both the units_on
and the units_invested
variables are associated with the same user_constraint
relationship, it will always be the lowest resolution of both these variables - even if only one of them is actually included in the constraint.
I believe an easy fix for the retrieving of the constraint indices could be the following:
t_lowest_resolution(
ind.t in unit_flow_indices if u in unit__{from;to\}node__user_constraint(user_constraint=uc);
ind.t in units_on_indices if u in unit__user_constraint(user_constraint=uc) && units_on_coefficient(unit=u, user_constraint=uc) != 0;
ind.t in units_invested_available_indices if u in unit__user_constraint(user_constraint=uc)&& units_invested_available_coefficient(unit=u, user_constraint=uc) != 0;
)
A more elegant solution would be to set the default value of both coefficients to null
. Then the following could be implemented (with some additional adaptions within the constraint):
t_lowest_resolution(
ind.t in unit_flow_indices if u in unit__{from;to\}node__user_constraint(user_constraint=uc);
ind.t in units_on_indices if u in indices(units_on_coefficient;user_constraint=uc);
ind.t in units_invested_available_indices if u in indices(units_invested_available_coefficient;user_constraint=uc);
)
Any thoughts @DillonJ @manuelma ?
*The same is true for node__user_constraint
Hi @mihlema
Nice spot - I agree that the more elegant solution is a null default value for the coefficients and making the required modifications, I guess so that we don't get nothings. Using a default value of zero was lazy and it should have been written to work with nulls to begin with. (adding that this was my handywork!)
@mihlema Is this still relevant or have we worked past it?
I don’t think anyone has implemented this. So this is still an open bug in the user constraint.On Nov 17, 2023, at 15:40, Lauren Clisby @.***> wrote: @mihlema Is this still relevant or have we worked past it?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>