action build_square_plots {
list<geometry> plots_list <- to_squares(shape, shape.width / 2);
loop while: (plots_list with_max_of each.area).area > 200000#m2 {
geometry p <- (plots_list with_max_of each.area);
plots_list >> p;
plots_list <- plots_list + to_squares(p, p.width / 2);
}
float target_mean_area <- 1500#m2;
// Probabilistic correction: some plots are split further, not all
loop g over: copy(plots_list) {
float current_mean_area <- (plots_list mean_of each.area);
float prob <- (current_mean_area - target_mean_area) / target_mean_area;
prob <- max(0.0, min(1.0, prob)); // keep probability in [0,1]
if flip(prob) {
plots_list >> g;
plots_list <- plots_list + to_squares(g, g.width / 2);
}
}
// Probabilistic correction: some plots are split further, not all
loop g over: copy(plots_list) {
// Probabilistic correction: some plots are split further, not all
list<geometry> l_c <- copy(plots_list);
loop g over: l_c {
--
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 view this discussion visit https://groups.google.com/d/msgid/gama-platform/5295b044-3948-4e55-9826-7a415af2ec45n%40googlegroups.com.
reflex do_dry_land_use when:(season.current_season = DRY){
ask households {
myself.income <- myself.income + sum_of(my_plots , each.income_generated);
float additional_income <- 0.0;
loop plott over: copy(my_plots) {
if plott.soil_height > 0 {
float brick_income <- 0;
if self.income < self.min_income_hh {
float needed_income <- myself.min_income_hh - self.income;
int soil_layers_bricked <- 0;
ask plott {
land_use <- 5; // BRICK
int needed_layers <- ceil(needed_income / (area_plot * brick_income_p_layer));
soil_layers_bricked <- min(needed_layers, soil_height);
//brick_income <- area_plot*brick_income_p_layer * soil_layers_bricked; //ceil = round up; for now => bias towards reducing one plot completely and keep other plots with more soil, not some soil off each plot
soil_height <- soil_height - soil_layers_bricked;
}
brick_income <- plott.area_plot * brick_income_p_layer * soil_layers_bricked;
additional_income <- brick_income;
}
else if self.income >= self.min_income_hh {
bool market_worth_it <- (market_income* plott.area_plot - weight_dist_to_infra_market*plott.dist_to_water) > 0;
if market_worth_it {
ask plott {
land_use <- 2; // market gardening
}
additional_income <- plott.area_plot*market_income;
}
else if ! market_worth_it {
ask plott {
land_use <- 3; // bare land
}
}
}
}
else if plott.soil_height = 0 {
bool market_worth_it <- (market_income* plott.area_plot - weight_dist_to_infra_market*plott.dist_to_water) > 0;
if market_worth_it {
ask plott {
land_use <- 2; // market gardening
}
additional_income <- plott.area_plot*market_income;
}
else if !market_worth_it and self.income < min_income_hh {
float brick_income <- 0.0;
ask plott {
land_use <- 7;
brick_income <- area_plot*brick_income_p_layer * soil_height; //ceil = round up; for now => bias towards reducing one plot completely and keep other plots with more soil, not some soil off each plo
soil_height <- 0;
} // swamp because low soil and sold
additional_income <- brick_income + plott.price;
my_plots >> plott;
}
else if ! market_worth_it and self.income >= min_income_hh {
ask plott {
land_use <- 4; // swamp land (because low and not used)
}
}
}
}
self.income <- self.income + additional_income;
}
}
if market_worth_it {...}
else {
if income < min_income_hh {...}
else {...}
}
Best,To view this discussion visit https://groups.google.com/d/msgid/gama-platform/d90cc078-a3e7-41a1-b68d-8f7d2ecfee34n%40googlegroups.com.