Initial plots allocation

The problem consist on how to localize the N agents (farms) of the model in the space and how to allocate plots to them till reaching their initial capacity for each land type.

The problem is complicated by the fact that we already have an informative layer, consisting of the land use, and we have to keep this layer and apply the farm allocation over it.

The function in charge of performing the initial land allocation is Manager_farmers::locateMyAgents().

The first stage is to collect the vectors of free plots by soil type and randomly swap each of them.

The second stage is to loop over the farms and assign them a random location picking up a plot from the vectors defined on the previous stage according with the farm type. The idea is that rare land use types have the precedence over common land use types. So if a farm has both fruit land and arable land, the farmstead will be placed within a fruit land type. When we define the farmstead position we also assign the matching plot to the farm, preferably as a owner plot.

The third stage is to assign the plots. Do do so, we perform a set of steps.
We firstly join the remained free plots (those not assigned to any farm) in a unique vector and randomly mix them.
Then we loops over them assigning each of them to the closer farm that has still an uncompleted capacity for that specific soil type.
To find the closer farm we loop over the neighbors plots, using increasing distances till we find a plot guesting a suitable farm.
Neighbors plots are returned by the function Pixel::getPixelsAtDistLevel(distLevel), but it has to be stated that such function return an approximated set only, as it pick up the pixels over rectangular masks instead of circular ones.

Finally the function upgrade the image of the farmstead, rented and owned plots layers and send them to the GUI.

This is not a optimization algorithm as plots are not assigned to farms in a way that minimize the total plots-farmsteads distance. But on the other hand also the real world situation is far from an optimal land (de)fragmentation, as physical bounds and hereditary rules often split the farmer land in various disconnected plots.

The following images show how the owner plots are assigned to each farm (each color is a separate farm) according to this methodology:

Image 1: Plots by owner farm
Full area
Image 2: Plots by owner farm (detail)

model/initialization/plots_allocation.txt · Last modified: 2014/05/11 15:38 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki