-
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
Understanding spatial clustering #354
Comments
Hi @edwardsmarc,
Yeah that's all correct!
Nah, when using a min set objective, the targets and linear constraints are effectively doing the same thing. When using a budget limited objective though (e.,g. min shortfall objective), then this would have a difference because the targets are treated as "soft constraints" (this means you're willing to accept a solution that doesn't meet the constraint, but gets as close as possible) instead of "hard constraints" (this means you won't ever accept a solution that doesn't meet the constraints).
Nah, the overall objective function (i.e. the metric being minimized or maximized during optimization) for the optimization process is a combination of the primary objective (e.g.
Yeah, since the costs are zero, the overall objective function focusses entirely on the the spatial fragmentation (via
IIRC, in older versions of prioritizr, the
Yeah, that's right. I think the idea here was to (1) try and speed up the optimization process and (2) promote spatial clustering around the really important planning units selected in the solution.
Although I think the WTW tool is using symmetric connectivity, when using asymmetric connectivity the data is specified like this. Imagine we have 100 planning units, so we have 100 rows and 100 columns. The cell How does that sound? Let me know if you have any further questions? |
OK, so because the cost is zero there is no way to 'minimize' cost because the sum will always be zero. That makes sense. So the problem is being driven by the connectivity objective which is to maximise the sum of the connectivity values. And the targets will still all be met because we're using |
Yeah - that's correct! |
Thanks for bearing with me while I got up to speed with all that! Now I understand the code I think I can answer my own question which I'll record here for others to discuss: A user reported some strange results when using increasing spatial clustering %'s in WTW. Clustering worked fine but then above a certain value the solution started filling in from the north west corner: This example shows the min_set solution, and solutions with 30% (s30) and 50% (s50) spatial clustering. My conclusion is that all the targets are met but there is still unused budget in the max_cost target. Since the min_set objective is essentially deactivated due to the zero cost values, it just uses up the max_cost budget by selecting PUs starting from the top of the matrix. I can confirm that the solution with spatial clustering set to 50% does actually include 50% more PUs in the solution. |
@jeffreyhanson - One thing that is not clear to me is why prioritizr uses up all the max_cost budget. The max_cost target has a sense of |
Yeah, when using the To avoid this behaivor, potential options include (1) checking if all the targets are met in the min shortfall prioritization and, if so, then running a min set prioritization to generate a solution that meets the targets for minimum cost or (2) directly interfacing with the Gurobi software to run multi-objective optimization (note that this approach wouldn't work for the CBC solver, since it doesn't provide an equivalent API for multi-objective optimization). Although you could try playing with the |
Thanks @jeffreyhanson, that behavior with I just ran some tests where I run the min_set problem (i.e. no area budget and no clustering in WTW). Then I run the same problem with 30% and 50% clustering. In all cases the solution uses the max_cost budget exactly. For example, one of my min_set runs has a solution with 45,120 planning units. The 30% spatial clustering solution uses 58,656 (i.e. 45,120 * 1.3) planning units and the 50% spatial clustering solution uses 67,680 (i.e. 45,120 * 1.5) planning units. In both cases the species goals are easily met, but it always uses up the full budget of planning units by adding pus from the top of the map. |
Hmm, it's not surprising that it always uses up the |
Not using any weights so the costs should just be the connectivity values. I'll do some more digging. I'll extract the connectivity values as a raster to see exactly what it's operating on. |
@jeffreyhanson - hoping you can confirm my understanding of the spatial clustering code and answer my questions below.
If spatial clustering is turned on, the following happens when running fct_min_set_result():
An initial solution is run using no clustering. The most irreplaceable PUs are identified and locked in to the second prioritizr problem that generates the clustered run.
For the clustering problem, a PU cost of zero is used, and a new feature is added where all PU's have a value of one, and an associated max_cost target of
initial solution cost * boundary_gap + 1
. The number of PUs selected cannot exceed the max_cost. So a boundary gap of 0.5 adds an additional 50% of budget to play with when trying to cluster PUs.add_connectivity_penalty()
. A penalty value of 1 is used to balance the connectivity objective with the min_set objective of meeting targets.- Question 3 - how is the connectivity objective weighted compared to the min_set objective when a penalty of 1 is used?
add_connectivity_penalty()
and notadd_asym_connectivity_penalties()
.con_data@x <- rwr_raw[con_data@i + 1] + cost[con_data@j + 1]
.The text was updated successfully, but these errors were encountered: