Skip to main content
Version: 🚧 Alpha 🚧

7. Automatic Road Repair

This step repairs the road with the highest destruction_coeff at a configurable interval.

Formulation​

  • Add a repair_time parameter, set to 2 hours by default.
  • Every repair_time hours, select the road with the highest destruction_coeff and reset it to 1.

Model Definition​

parameters​

The repair_time variable sets the interval in hours. The experiment exposes it as a parameter.

global {
int repair_time <- 2;

reflex repair_road when: every(repair_time #hour) {
road the_road_to_repair <- road with_max_of (each.destruction_coeff);
ask the_road_to_repair {
destruction_coeff <- 1.0;
}
}
}
experiment road_traffic mode: gui {
parameter "Number of hours between two road repairs" var: repair_time category: "Road" unit: "h";
}

road repairing​

The complete model also recalculates graph weights from the updated road coefficients, so future routes account for repairs.

Complete Model​

gama.library/models/Tutorials/Road%20Traffic/models/Model%2007.gaml
loading...