A parallel agent-based model in R
The hands-on sessions are about going through the code together and understanding what each line approximately does.
Introduction - 5 minutes
  - Assign someone to be the timekeeper & someone else with experience with R/RStudio to be the screen-sharer.
- Shortly (!) get to know each other.
Agent-based model - 20 minutes
  - Open the file 01_example_sim.Rin RStudio.
- Discuss and run the code until line 28.
- What is the proportion of happiness in the last subpopulation in result_2?
- Compile the C++version of the ABM using the code on line 33.
- Now run the same ABM as in result_2by using the C++ version (line 36). Do you notice the speedup?
- Run the rest of the file. Discuss what is happening.
Parallel programming - 20 minutes
  - Open the file 02_parallel_eval.Rin RStudio.
- Run the file until line 22.
- Run the following code: analysis_function(1). Discuss what this does.
- Now run & discuss the code until line 37. What does the plot show & what does the mean value represent?
- Next, discuss & run the code until line 54. Edit the number of threads so that there are 1 or 2 threads left on your machine. For example, if detectCores()returns 8, then line 48 should ben_threads <- 6orn_threads <- 7.
- Run & discuss the remainder of the file.