-
Notifications
You must be signed in to change notification settings - Fork 99
RoadTrafficModel_step7
RoiArthurB edited this page Sep 11, 2023
·
9 revisions
This 7th step illustrates how to select in a list of elements that optimizes a given function.
- Add a new parameter,
repair_time
, that is equal to 2. - Every
repair_time
, theroad
with the highestdestruction_coeff
value is repaired (set itsdestruction_coeff
to 1).
We add a new parameter: the repair_time
.
In the global section, we define the repair_time
variable:
int repair_time <- 2 ;
In the experiment section, we define the associated parameter:
parameter "Number of steps between two road repairs" var: repair_time category: "Road" ;
We have to add a reflex method in the global section that is triggered every repair_time
hours. This reflex selects, thanks to the with_max_of
operator the road
agent with the highest destruction_coeff
value, then sets this value at 1.
global {
...
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 ;
}
}
}
https://github.com/gama-platform/gama/blob/GAMA_1.9.2/msi.gama.models/models/Tutorials/Road%20Traffic/models/Model%2007.gaml
- Installation and Launching
- Workspace, Projects and Models
- Editing Models
- Running Experiments
- Running Headless
- Preferences
- Troubleshooting
- Introduction
- Manipulate basic Species
- Global Species
- Defining Advanced Species
- Defining GUI Experiment
- Exploring Models
- Optimizing Model Section
- Multi-Paradigm Modeling
- Manipulate OSM Data
- Diffusion
- Using Database
- Using FIPA ACL
- Using BDI with BEN
- Using Driving Skill
- Manipulate dates
- Manipulate lights
- Using comodel
- Save and restore Simulations
- Using network
- Headless mode
- Using Headless
- Writing Unit Tests
- Ensure model's reproducibility
- Going further with extensions
- Built-in Species
- Built-in Skills
- Built-in Architecture
- Statements
- Data Type
- File Type
- Expressions
- Exhaustive list of GAMA Keywords
- Installing the GIT version
- Developing Extensions
- Introduction to GAMA Java API
- Using GAMA flags
- Creating a release of GAMA
- Documentation generation