-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
# Conflicts: # CPG_CityScope_GAMA/models/CityScope_main.gaml
- Loading branch information
Showing
17 changed files
with
1,306 additions
and
11 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/** | ||
* Name: pie | ||
* Author: Tri | ||
* Description: | ||
* Tags: Tag1, Tag2, TagN | ||
*/ | ||
|
||
model pie_charts | ||
|
||
/* Insert your model definition here */ | ||
|
||
/* | ||
global{ | ||
list<rgb> color_list <- [rgb(3,169,244),rgb(255,235,59),rgb(255,152,0),rgb(255,87,34)]; | ||
list<float> valeurs <- [4,7,22]; | ||
|
||
init{ | ||
create pie{ | ||
labels <- ["Chat","Chien","Poulet"]; | ||
labels_h_offset <- [15,15,18]; | ||
values <- valeurs; | ||
colors <- [color_list[1],color_list[2],color_list[3]]; | ||
location <-{50,50}; | ||
diameter <- 50; | ||
inner_diameter <- 40; | ||
font_size <- round(diameter/30); | ||
type <- "ring"; | ||
} | ||
} | ||
|
||
reflex change{ | ||
loop i from: 0 to: length(valeurs)-1{ | ||
valeurs[i] <- max([0,valeurs[i] -2 + rnd(4)]); | ||
} | ||
ask first(pie) { | ||
do calculate_pies; | ||
do update_values(valeurs); | ||
} | ||
|
||
} | ||
|
||
}*/ | ||
|
||
species pie{ | ||
/* general parameters that must be set by the user */ | ||
string id; | ||
string type <- "pie"; // among "pie", "ring" | ||
list<string> labels; // labels of the categories to be displayed | ||
list<float> values; // values to be displayed | ||
list<rgb> colors; // colors of the different categories | ||
|
||
/* display parameters */ | ||
float diameter <- 50.0; // pie or ring diameter | ||
float inner_diameter <- 40.0; // ring inner diameter | ||
int nb_points <- 72; // number of points on the outer circle, useful to set the level of detail | ||
float labels_v_offset <- 1.3; // vertical offset for labels | ||
list<float> labels_h_offset; // horizontal offset for strings which are displayed on the left side of the chart. Necessary until the string display is fixed in Gama | ||
float font_size <- 20.0; | ||
float line_width <- float(round(diameter/30)); | ||
|
||
/* parameters for internal use */ | ||
list<list<point>> pies <-[]; | ||
list<list<point>> label_lines <-[]; | ||
list<point> label_locations <-[]; | ||
|
||
list<point> calculate_slice(int start_index, int end_index){ // calculate the vertices coordinates for one slice of the pie | ||
list<point> vertices <- (type = "ring")?[]:[location]; | ||
loop i from: start_index to: end_index{ | ||
vertices << {location.x + sin(i/nb_points * 360)*diameter/2, location.y -cos(i/nb_points * 360)*diameter/2}; | ||
} | ||
if type = "ring"{ | ||
loop i from: start_index to: end_index { | ||
vertices << {location.x + sin((end_index+start_index-i)/nb_points * 360)*inner_diameter/2, location.y -cos((end_index+start_index-i)/nb_points * 360)*inner_diameter/2}; | ||
} | ||
} | ||
return vertices; | ||
} | ||
|
||
action update_values(list<float> val){// function use to update the values | ||
self.values <- val; | ||
} | ||
|
||
action calculate_pies{// main function for drawing the pie | ||
int nb_pies <- length(values); | ||
pies <- []; | ||
label_lines <- []; | ||
label_locations <- []; | ||
list<int> pies_indexes <- [0]; | ||
if (sum(values) = 0) { // if all values are equal to 0 | ||
pies <- [calculate_slice(0,nb_points), [],[]]; | ||
label_lines <- [[location + {diameter/2,0},location + {diameter/1.3,0}],[location + {diameter/2,0},location + {diameter/1.3,0}],[location + {diameter/2,0},location + {diameter/1.3,0}]]; | ||
label_locations <- [location + {diameter/1.3,0},location + {diameter/1.3,0},location + {diameter/1.3,0}]; | ||
}else{ // in the general case | ||
list<float> cum_sum <- [0.0]; | ||
loop i from: 0 to: nb_pies-1{ | ||
cum_sum << last(cum_sum) + values[i]/sum(values) * nb_points; | ||
} | ||
pies_indexes <- cum_sum collect (round(each)); | ||
loop i from:0 to: nb_pies-1{ | ||
pies << calculate_slice(pies_indexes[i],pies_indexes[i+1]); | ||
float angle <- (pies_indexes[i+1] + pies_indexes[i]) * 180 / nb_points; | ||
label_locations << location+{2+signum(sin(angle))*(diameter/1.3) - int(sin(angle)<0)* labels_h_offset[i],-cos(angle)*diameter/1.5+labels_v_offset}; | ||
//label_lines << [location+{sin(angle)*diameter/2.2,-cos(angle)*diameter/2.2}, location+{sin(angle)*diameter/1.5,-cos(angle)*diameter/1.5},location+{signum(sin(angle))*diameter/1.3,-cos(angle)*diameter/1.5}]; | ||
label_lines << [location+{sin(angle)*diameter/2,-cos(angle)*diameter/2}, location+{sin(angle)*diameter/1.5,-cos(angle)*diameter/1.5},location+{signum(sin(angle))*diameter/1.3,-cos(angle)*diameter/1.5}]; | ||
} | ||
} | ||
} | ||
|
||
|
||
aspect default{ | ||
loop i from:0 to: length(values)-1{ | ||
draw polygon(pies[i]) color: colors[i] ; | ||
draw polyline(label_lines[i]) color: colors[i] width: line_width; | ||
draw labels[i] font: font("Helvetica",font_size,#plain) at: label_locations[i] color: colors[i] ; | ||
} | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
/* | ||
experiment "Pie Charts" type: gui{ | ||
|
||
output { | ||
display camembert type: opengl background: color_list[0] { | ||
species pie aspect:default; | ||
} | ||
|
||
} | ||
}*/ |
8 changes: 8 additions & 0 deletions
8
CPG_CityScope_GAMA/includes/game_IT/ActivityTablePerProfile.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
,00:00,01:00,02:00,03:00,04:00,05:00,06:00,07:00,08:00,09:00,10:00,11:00,12:00,13:00,14:00,15:00,16:00,17:00,18:00,19:00,20:00,21:00,22:00,23:00 | ||
High School Student,RM,RM,RM,RM,RM,RM,RM,RM,,HS,HS,HS,HS,HS,HS,HS,HS,Park,Park,Park,,RM,RM,RM | ||
College student,RS|Night,RS|Night,RS,RS,RS,RS,RS,RS,,Uni,Uni,Uni,Uni,Uni,Uni,Uni,Park,Park,,RS,RS,RS|Night,RS|Night,RS|Night | ||
Young professional,RS|Night|Restaurant,RS|Night|Restaurant,RS,RS,RS,RS,RS,OS,OS,OS,OS,OS,OS,OS,OS,OS,OS|Park,OS|Park,OS|Park,RS,RS,RS|Night|Restaurant,RS|Night|Restaurant,RS|Night|Restaurant | ||
Home maker,RM|Restaurant,RM|Restaurant,RM,RM,RM,RM,RM,RM,RM,RM,Shopping,Shopping,Shopping,Shopping,,,Park,Park,Park,RM,RM,RM,RM,RM|Restaurant | ||
Executives,RL|Restaurant,RL|Restaurant,RL,RL,RL,RL,RL,OL,OL,OL,OL,OL,OL,OL,OL,OL,OL,OL,Cultural,Cultural,RL,RL,RL,RL|Restaurant | ||
Mid-career workers,RL|Restaurant,RL|Restaurant,RL,RL,RL,RL,RL,OL,OL,OL,OL,OL,OL,OL,OL,OL,OL,OL,Cultural,Cultural,RL,RL,RL,RL|Restaurant | ||
Retirees,RM|Restaurant,RM|Restaurant,RM,RM,RM,RM,RM,RM,RM,RM,RM,RM,RM,RM,RM,RM,RM|Park,RM|Park,RM,RM,RM,RM,RM,RM|Restaurant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Nb Criteria,4,,,,,,,,,,,,,,, | ||
Nb Trip Objective,4,,,,,,,,,,,,,,, | ||
Purpose,O|Uni|HS,,,,R,,,,Park|Restaurant|Night|Cultural,,,,Shopping,,, | ||
Characteristics,Price,Time,Social Pattern,Difficulty,Price,Time,Social Pattern,Difficulty,Price,Time,Social Pattern,Difficulty,Price,Time,Social Pattern,Difficulty | ||
Role,,,,,,,,,,,,,,,, | ||
High School Student,-1,-0.5,1,-0.5,-1,-0.5,1,-0.5,-1,-0.15,1,-0.25,-1,-0.25,1,-0.75 | ||
College student,-0.9,-0.75,1,-0.65,-0.9,-0.75,1,-0.65,-0.75,-0.5,1,-0.5,-0.75,-0.5,1,-0.85 | ||
Young professional,-0.7,-0.9,0.9,-0.75,-0.7,-0.9,0.9,-0.75,-0.7,-0.9,0.9,-0.75,-0.7,-0.9,0.9,-0.75 | ||
Home maker,0,0,0,0,0,0,0,0,-0.5,-0.85,0.8,-0.9,-0.5,-0.85,0.8,-0.9 | ||
Mid-career workers,0,-1,0.2,-1,0,-1,0.2,-1,0,-1,0.2,-1,0,-1,0.2,-1 | ||
Executives,0,-1,0.2,-1,0,-1,0.2,-1,0,-1,0.2,-1,0,-1,0.2,-1 | ||
Retirees,0,0,0,0,0,0,0,0,-0.5,0,0,-1,-0.5,0,0,-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
,color,width,speed | ||
walking,green,2,3 | ||
bike,yellow,3,5 | ||
eScooter,orange,4,20 | ||
PEV,red,5,20 | ||
Shared Vehicles (Taxi/Carpooling/...),red,5,20 | ||
car,red,5,20 | ||
Motorcycles/scooters,orange,5,20 | ||
Track based vehicles (subway,red,5,20 | ||
bus,blue,5,20 | ||
Delivery (Trucks,red,5,20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
color proba car proba bike proportion | ||
High School Student lightblue 0.05 0.8 0.2 | ||
College student blue 0.25 0.8 0.1 | ||
Young professional green 0.8 0.7 0.1 | ||
Home maker orange 0.3 0.4 0.1 | ||
Mid-career workers yellow 0.9 0.4 0.2 | ||
Executives red 0.95 0.4 0.1 | ||
Retirees darkorange 0.5 0.3 0.2 |
11 changes: 11 additions & 0 deletions
11
CPG_CityScope_GAMA/includes/game_IT/ModeCharacteristics.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
,Fix price per trip,Price/km,waiting time per segment (minutes),Time/km,Social Pattern,Difficulty / per trip | ||
walking,0,0.001,0.2,15,0.1,0 | ||
bike,0,0.01,1,8,0.5,0.1 | ||
eScooter; eboard; estuff,0,0.15,1.5,,0.75,0 | ||
PEV,0,0.1,3,6,1,0.3 | ||
Shared Vehicles (Taxi/Carpooling/...),0,0.7,5,,0.5,0.4 | ||
car,0,0.32,2.5,,1,0.2 | ||
Motorcycles/scooters,0,0.18,2,,0.3,0.1 | ||
Track based vehicles (subway; train; ...),2.5,0,5,2,0.2, | ||
bus,0,0,10,3,0.15,0.5 | ||
Delivery (Trucks; Vans; ...),0,0.2,3,,1,1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -615,7 +615,3 @@ experiment CityScopeMainVirtual type: gui{ | |
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.