Numbering convention for agents across multiple geometries

25 views
Skip to first unread message

predic...@gmail.com

unread,
Nov 12, 2014, 3:01:07 AM11/12/14
to gama-p...@googlegroups.com

Hi

I have noticed in the attached example provided by Patrick that individual agents numbering goes anti-clockwise for the perimeter shop agents for one building. The numbering  then goes to the "next" building geometry to number the second set of  "perimeter" shop  agents 
Then comes back to the "first" building geometry to number the "inner shops" of the "first" building geometry. 

Is it possible to keep the sequential numbering for all agents confined to "within" one outer geometry shape. Once completed for one outer geometry they increment sequentially "within" the next geometry. 

Appreciate your help

Chris

shoplocation_model_display_map_size_895x1001_cycle_0_time_1415353529231.png
shop_location.gaml

Patrick Taillandier

unread,
Nov 12, 2014, 6:05:30 AM11/12/14
to gama-p...@googlegroups.com
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.

Cheers,

Patrick 

--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
To post to this group, send email to gama-p...@googlegroups.com.
Visit this group at http://groups.google.com/group/gama-platform.
For more options, visit https://groups.google.com/d/optout.

shoplocation_model_display_map_size_895x997_cycle_0_time_1415790130412.png

predic...@gmail.com

unread,
Nov 13, 2014, 2:29:45 AM11/13/14
to gama-p...@googlegroups.com
Excellent Patrick

Thanks for revised coding. 
Now clear.

Chris
Reply all
Reply to author
Forward
0 new messages