The numbering of agents follows their creation order.
here for instance, first, I create for a building the shops on the outer ring then the inner shops, then I pass to the next building.
model shoplocation
global {
init {
// As I am too lazy to build a shapefile I built the builing geometries by hand....
create building with: [shape::polygon([{15,5},{50,5},{40,40},{5,40}])];
create building with: [shape::polygon([{55,55},{60,45},{90,55},{90,90},{55,90}])];
ask building {
//creation of the first set of shops
//inside the geometry (3 meters)
geometry inside_geom <- shape - 3;
list<point> locs <- points_on(inside_geom,(inside_geom.perimeter / 7));
loop loc over: locs {
create shop with: [shape::square(2) at_location loc];
}
//***********************************
//creation of the second set of shops
geometry interior_rect <- rectangle(min([10, shape.width]), min([20, shape.height]));
list<geometry> squares <- to_squares(interior_rect, 5,false);
loop sq over: squares {
create shop with: [shape::square(2) at_location sq.location];
}
}
}
}
species shop {
aspect default {
draw shape color: #blue;
draw string(int(self)) color: #black size: 3;
}
}
species building {
aspect default {
draw shape color: #gray;
}
}
experiment shoplocation type: gui {
output {
display map {
species building;
species shop;
}
}
}
See the attached snapshot.