Summary
I'm developing a land-use model with a forested World and turtles that have the ability to convert the forest into crop land. Turtles (in this specific case companies) have the ability to move to a destination-patch within their range of mobility and clear the forest in a radius around them (to turn it into cropland). The goal is to have the companies choose their destination-patches based on the predicted profit from converting the patches around it, i.e., making economical decisions as to where to move in the landscape. Profit (or land-rent in my model) is a function of cost of conversion, maintenance cost, and potential penalties, subtracted from the patch-yield. Thus, the ideal destination-patch is a patch whose cluster of patches around it has the highest sum of predicted profits. I made a little figure to help visualizing the concept: concept of cluster profit in radius
What I did so far So far, I have the following procedures relevant to seeking the maximum land-rent patch: 1) moving the companies to the patch with the maximum predicted land rent 2)reporting the maximum predicted land rent, using a to-report function. I've also tried a ask-patches function instead, but to no avail. Patches have a penalty associated to them, depending on whether they are part of a protected area, and can be owned-by a certain actor (depending on where they are located and who converts them).
Problem/Goal What I need is a structure that asks each patch within a given radius of the turtle (company) to calculate the land-rent for each patch in another given radius. In other words, I want the turtle to be able to say: if I go to this patch xy which is in my radius of movement, I get the maximum land-rent out of converting all the patches around that patch xy. The code below does not produce any error messages, but from the turtles behavior, it doesn't seem it's running correctly either. Turtles move across the World randomly, and directly run into areas that are protected (incurring heavy fines for encroaching), causing them to go bankrupt.
patches-own
owned-by ;; "R" indicated it's unoccupied forest
protected-area ;; whether the patch is part of a protected area
encroachment-fine ;; the $-amount a turtle is fined for converting this patch of forest
GUI inputs
company-conversion-radius ;in what radius around themselves companies can convert land
to move-to-max-rent-C
ifelse any? patches in-radius (company-conversion-radius * 2 - 1) with [owned-by = "R"] [ ;here, companies 'scan' their environment for any patches that have forest (expressed through owned-by = "R"), if there are forested patches, companies move to the destination-patch that promises the highest profit (land-rent)
let destination-C max-rent-C
move-to destination-C
]
;; if no forest patch within their scanning-radius, they face the nearest forest patch anywhere and move towards it
[
face min-one-of patches with [owned-by = "R"] [distance myself]
move-to patch-ahead company-conversion-radius
]
end
to-report max-rent-C
ask patches in-radius (company-conversion-radius * 2 - 1) [
let available-conversion-patches count patches in-radius company-conversion-radius with [owned-by = "R"]
report max-one-of patches in-radius company-conversion-radius with [owned-by = "R"] [;;formula for calculating land rent]
]
end
I found this thread ask turtle to perform calculations from patch set, but it seemed not to quite answer my problem as it only ask for calculations around the turtle, not around the patches the turtle can reach.