Many thanks, Srirama.
I write this code. but it is not working. do you have any suggestion?
global {
file shape_file_destinations <- file("../includes/destinationsbuffer.shp");
file shape_file_road_cyc <- file("../includes/road_cyc3.shp");
file shape_file_dwellings <- file ("../includes/dwellings.shp");
file shape_file_bounds <- file("../includes/bounds.shp");
float satisfaction_coeff<- 10.0;
map<road, int> roads_weight;
geometry shape <- envelope(shape_file_bounds);
graph road_network;
init {
create building from: shape_file_dwellings;
create road from: shape_file_road_cyc with: [road_type:: string(read("Infras")), satisfacation_amount:: int(read("sati"))];
create cyclist {
location <- any_location_in (one_of (building));
the_target <- any_location_in (one_of (destinations));
color <- #blue;
size <- 10.0;
satisfacation <- 0.0;
roads_knowledge <- roads_weight;
}
road_network <- as_edge_graph(road);
create destinations from: shape_file_destinations with: [destinations_type::string(read ("Destinatio"))];
}
species destinations {
string destinations_type<-destinations_type;
int count_of_trips;
float total_satisfacation <- 0.0;
rgb destinations_color <- #gray;
aspect destinations_view {
draw shape color: destinations_color;
}
}
species cyclist skills: [moving]{
map<road, int> roads_knowledge;
float satisfacation;
path path_to_follow;
geometry choosen_segment;
//define node to decide
point next_node;
bool at_home <- false;
int cyclist_satisfaction2;
point the_target;
float size;
rgb color;
reflex compute_road when: location = living_place{
bool node <- road intersects road;
if location = node {
loop nod over: node {
list<geometry> segments <- path_to_follow.segments;
cyclist_satisfaction<-int(segments(location).satisfacation_amount);
choosen_segment<- geometry(path(segment max_of cyclist_satisfaction));
}
}
}
reflex move when: location != the_target {
path path_to_follow <- goto (target: the_target, on:choosen_segment, return_path:true);
aspect default {
draw circle (size) color:color;
}
}
species building {
aspect default {
draw shape color: #gray;
}
}
//Species to represent the roads
species road {
string road_type;
float satisfacation_amount;
bool cyclist_satisfaction;
rgb road_color <- #black;
aspect default {
draw (shape) color: road_color;
}
}
experiment traffic type: gui {
output {
display carte type: opengl{
species building refresh: false;
species road ;
species destinations aspect: destinations_view;
species cyclist;
}
}
}