-
Notifications
You must be signed in to change notification settings - Fork 2
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
Weights are treated as targets when using area budget #323
Comments
@edwardsmarc I really like the way to put together these problem statements! @jeffreyhanson could you please have a look at this and share your thoughts here? |
Hi, Thank you very much for raising this point @edwardsmarc, and for providing such a detailed deep dive on the behavior! Yeah, you're exactly right, by treating the weights as targets, this causes the solution output to select areas that wouldn't normally be selected to improve representation of the themes/features. Yeah, reformulating the weights using the linear penalties approach could be one way to acheive this. The trick is that the linear penalties need a scaling factor (the How does that sound? |
Thanks for the explanation @jeffreyhanson! That decision makes sense and I agree that the One concern I still have is that weights are treated different when using an area-budget compared to the min-set problem. I think this will be quite confusing to users. With no area budget, the solution will focus on targets but gravitate towards different PUs based on their cost (which is calculated from the weights), but with an area budget the weights become targets and the solution behavior is different. I don't really have a solution to this but maybe it's fine to just document it and communicate the behavior to users. |
Yeah, sorry, I can't think of an easy fix to this issue. I suppose it might be possible to use the weights to update the feature data (i.e. the rij data) some how so that greater emphasis is placed on planning units with a greater weight value? But that might cause issues with the goal setting. |
One more Q for you @jeffreyhanson. What would happen if we used the min_set approach with the weights layer as the cost (i.e. the no area budget method), but then added a linear_contraint for the area budget (by providing the PU areas to add_linear_constraints())? How does the min_set_objective manage the target shortfall when it can't meet all targets? |
Yeah, the min set approach treats the targets as "hard" constraints -- meaning they must be met by the solutino. So if you formulated a problem where it was impossible to meet the targets, then the solver would produce an error saying that the problem is infeasible (i.e., meaning there's no feasible/valid solution). |
We could consider clipping the Weights to the set of planning units with non-zero Theme values. That would prevent any planning units being selected that do not contribute to at least one Theme, and it would remove the confusing behavior in my example at the top of this issue. Under this proposal, Weights would only influence the final solution if they overlap with Themes, which is closer to the min set behavior. Realistically, with large problems there are unlikely to be many PUs without any Theme values. But at least it will make more logical solutions when using fewer Themes. |
Solution here would be to change the following code in
to
so only PUs with themes, includes or excludes are considered in the solution. Would need to check this does not have any negative impact on the second prioritizr call when clustering is requested. |
This is more complicated than I suggested with the above fix. Currently Fix needs to limit |
Solution also needs to adjust Weight targets so the sum of the weights is calculated for the Otherwise the Goal for the Weight will be greater than the amount possible in the solution (which is limited to the |
Fix has been implemented in https://github.com/NCC-CNC/wheretowork/tree/issue-%23323-Weights and anecdotally works. For a simple problem with one theme and one weight, the min_set and min_shortfall solutions are now exactly the same.
More testing is needed though and we'll want to add some unit tests. Users have expressed concern about using Weights as Goals when area budget is applied. I'd like to do some comparisons of how different Weight factors influence a solution when using no area-budget vs. area budget. Any findings should be added to #342. |
After discussing this Weights implementation with some users, they expressed that it would be useful if the targets for the Weights were given lower priority than the Themes. i.e. can the Theme goals be given a higher priority in the solution than the Weights goals such that the min_shortfall calculation will attempt to meet the Theme goals first, then address the Weight goals. @jeffreyhanson I'm wondering if this can be achieved with add_feature_weights()? How are weights applied in this add_feature_weights()? (I traced the code into the rcpp function but couldn't find a mathematical explanation for how the weights effect the objective function). |
Yeah that's exactly correct - the One approach could be to try updating the app so users could specify weight values for each Theme and Weight? This might be a bit complicated to implement because you'd probably need to add new sliders for each and every Theme/Weight, and possibly update the parameter file format to store this information. Another approach could be to add a new parameter to the app that expresses the relative weight value for Themes and Weights? E.g., this parameter ranges between 0 and 1. If 0 then all Weights have 0.01 weight value and Themes have a 1 weight value; if 1 then all Weights have a 1 weight value and all Themes have a 0.1 Weight value, and if 0.5 (the default) then all Weights and Themes have a 0.5 weight value. Note I suggest a weight of 0.01 so that Weights/Themes have some tiny influence - which is useful in case the budget is so high that the targets for the higher weighted Themes/Weights can all be met. Or maybe there's a better way to implement this? What do do you think? |
Thanks @jeffreyhanson for the confirmation and explanation of how the weights are applied! I really like the idea of providing a slider for the relative weight values. I could see it being useful in 2 cases:
The obvious concern here is that adding more complexity will confuse users. I think the best approach is to gather further feedback from users once the fix on my branch is implemented. That fix (masking out PUs that don't have themes, includes or excludes) might be enough to get reasonable Weights behavior. If not, or if users want more control in the future, then we have |
No worries! Yeah that all sounds great. I definitely agree about avoiding uneeded complexity and getting feedback from users. |
Problem
When using an area budget, if weights are selected they get added as additional targets. The weight layer is rescaled between 0-100 and the target is calculated as the sum of the weight values * the weight proportion from the UI slider. This is repeated for each selected positive weight (negative weights are dealt with using linear_constraints).
The solver is then treating Themes and Weights as if they are equal during the optimization. This results in solutions where PUs are selected to meet the Weight target even when the Theme target is still not met.
Example
Here's a very simple example where a binary species target is set to 100% (yellow square) and the KBA layer (green areas) is set as a Weight with value 100:
When running with no area budget, the result is as expected. The full species range is selected in the solution, weights are ignored because they don't overlap the species range:
When running with an area budget of 1%, the expected result would be that the entire 1% budget should overlap the species range. But as shown below, it gets divided between the species and the weight (note that the striations inside the species range are expected because WTW has no way to prioritize PUs within that area):
Solution
It seems like penalties (e.g. add_linear_penalites()) would be preferable by adding a secondary objective to the prioritization. But maybe this would make the problem too large and slow down processing?
The text was updated successfully, but these errors were encountered: