entities {
species parcel {
int PIN //* unique identifying integer for a parcel/
int criteria1; //* values for a criteria/
int criteria2;
int criteria3;}
species expenditure { //* this species is represented as points from a shapefile
int ID;
float demand;}
species brand parent: multicriteria_analyzer {
string brand_name;
float avg_size;
reflex make_store_decision { //* I wish to implement a multi-criteria decision based on criteria in parcel species/
do make_store (avg_size);
}
action make_store (float store_size){
create store number: 1 {
size <- store_size;
}
}
}
species store {
float size;
float exp_gathered;
float service_area;
reflex query_exp {
ask expenditure at_distance service_area; //* Here a created store agent will ask for expenditure agents within a certain distance
}
--
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.
model RetailSuitability
//**------------------------------GLOBAL AGENT--------------------------------------------------*/global { // Spatial data file shp_parcels <- file("../includes/3530_parcels.shp"); file shp_expenditures <- file("../includes/DA_ON_2011_expenditures.shp"); file shp_competitors <- file("../includes/Competitors.shp"); file shp_boundary <- file("../includes/CD_3530.shp"); file shp_buffer <- file("../includes/CD_3530_10k_buffer.shp"); file brand_size <- file(".../includes/BrandSize.txt"); geometry shape <- envelope(shp_buffer); // Criteria weights float exp_cw <- 0.4; float area_cw <- 0.2; float ramp_cw <- 0.1; float lc2_cw <- 0.1; float lc3_cw <- 0.05; float lc4_cw <- 0.05; float elev_cw <- 0.01; float slope_cw <- 0.04; float d2dc_cw <- 0.05; // Number of brands, list of parcels, and sample of parcels for brand decisions //int n_brands <- 10; list parcelList <- []; //add PIN to: parcelList; int n_parcels <- 100; reflex model_pause when: time = 1000 { do pause; }
/** -------------------------------INITIALIZATION---------------------------------------------------*/ init { create parcel from: shp_parcels with: [ PIN::int(read("PIN")), area::float(read("Shape_Area")), ramp_tt::float(read("TravelTime")), pLC1::int(read("pLC1")), pLC2::int(read("pLC2")), pLC3::int(read("pLC3")), pLC4::int(read("pLC4")), pLC5::int(read("pLC5")), elevation::int(read("elev_mean")), slope::int(read("slope_mean")), d2dc::float(read("d2DC")) ];
create expenditure from: shp_expenditures with: [ DAID::int(read("DAID")), exp::float(read("EXPM3")) ];
create competitor from: shp_competitors with: [ size::float(read("Area")), name::string(read("BrandName")) ]; create brand from: brand_size with: [ avg_size::float(read("MeanArea")), brand_name::string(read("BrandName")) ]; }}
/** --------------------------------ENTITIES------------------------------------------------------- */ entities { species parcel { int PIN; float area; float ramp_tt; int pLC1; int pLC2; int pLC3; int pLC4; int pLC5; int elevation; int slope; float d2dc; rgb color <- rgb("gray") ; aspect base { draw shape color: color ; } } species expenditure { int DAID; float exp; rgb color <- rgb("blue") ; aspect base { draw shape color: color ; } } species competitor { string name; float size; rgb color <- rgb("red") ; aspect base { draw shape color: color ;
} } species brand parent: multicriteria_analyzer { string brand_name; float avg_size; reflex make_store_decision {
do make_store (avg_size); } action make_store (float store_size){ create store number: 1 { size <- store_size; } } } species store { float size; float exp_gathered; float service_area; reflex query_exp { ask expenditure at_distance service_area; }
reflex gather_exp { } reflex die when: exp_gathered <= 0 { do die; } const color type: rgb <- rgb("blue"); aspect base { draw shape color: color ; } }}
/** ----------------------------EXPERIMENT----------------------------------------------------------*/experiment RetailSuitability type: gui { /** Insert here the definition of the input and output of the model */ parameter "Shapefile for parcels:" var: shp_parcels category: "GIS"; parameter "Shapefile for expenditures:" var: shp_expenditures category: "GIS"; parameter "Shapefile for competitors:" var: shp_competitors category: "GIS";
output { display city_display { species parcel aspect: base ; species expenditure aspect: base ; species competitor aspect: base ; } }}
experiment RetailSuitability type: gui {
/** Insert here the definition of the input and output of the model */
parameter "Shapefile for parcels:" var: shp_parcels category: "GIS";
parameter "Shapefile for expenditures:" var: shp_expenditures category: "GIS";
output {
display city_display type: opengl{
species parcel aspect: base refresh: false;
species expenditure aspect: base ;
}
}
}
reflex make_store_decision {
list<parcel> possible_parcels <- 10 among parcel;
list<list> cands <- parcels_eval(possible_parcels);
int choice <- weighted_means_DM(cands, criteria_WM);
if (choice >= 0) {
ask possible_parcels[choice] {
write name + " : I am the selected parcel !";
}
}
// list<list> candidates <- ;
// int choice <- weighted_means_DM(candidates, criteria_WM);
do make_store (avg_size);
}
list<list> parcels_eval(list<parcel> parcels) {
list<list> candidates <- [];
loop par over: parcels {
list<float> cand <- [];
cand << par.area; // val criterion 1 for parcel "par"
cand << par.elevation; // val criterion 2 for parcel "par"
//... and so on
candidates << cand;
}
return candidates;
}
...