Step2: 人群代理的编写
创建人群族
global {
...
//初始人群数量
int nb_people <- 100;
//路网图形
graph the_graph;
init {
...
//初始化人群族,初始位置为随机一个居住建筑内的任意位置
create people number: nb_people {
location <- any_location_in (one_of (residential_buildings));
}
}
}
species people {
//显示颜色
rgb color <- #yellow ;
//显示方式
aspect base {
draw circle(10) color: color border: #black;
}
}
experiment road_traffic type: gui {
output {
...
display city_display type:opengl {
...
//增加人群族的显示
species people aspect: base ;
}
}
}编写人群行为
初始化人群族
实验设置
Last updated