ABM Basics 2 & 3 (1) Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What does ABM stand for

A

Agent Based Modelling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In an ABM what do we use to represent the terrain?

A

Patches

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What can turtles do in Netlogo?

A

Turtles can move, act and change the properties of the patches. Their behaviours and interactions can be defined using set rules, conditions or random events

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the purpose of the “random” command?

A

The purpose is to introduce variability or unpredictability into simulations or models

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a “floating-point number”?

A

A decimal number (e.g., 0.23)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What would you write to place turtle 0 at a random x-coordinate and y-coordinate = 2 in the command centre?

A

> ask turtle 0 [set xcor random-xcor set ycor 2]
ask turtle 0 [setxy random-xcor 2]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the primary purpose of using conditionals?

A

To allow agents or patches to make decisions based on conditions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

In which situation would you use the IF conditional without an accompanying ELSE?

A

An agent needs to perform an action if a condition is met; meaning NO ACTION when NOT MET

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How can we tell turtles to move forward 2 patches if their colour is red, move forward 1 patch otherwise?

A

> ask turtles [ ifelse color = red [forward 2] [forward 1] ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the purpose of a list?

A

A list is meant to group and manage multiple values together

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What line of code would you write to create a list called my_list comprising the elements 2 and 3?

A

set my_list [2 3]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What would you write to add a value (5) to the beginning of an existing list called my_list?

A

set my_list fput 5 my_list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What would you write to add a value (6) to the end of an existing list called my_list?

A

set my_list lput 6 my_list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What’s the difference between Global Variable and Local Variable?

A

Global variables are known to all procedure, local variables are only known to one procedure you are creating the variable in

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

how can we create a list of 10 random numbers between 0 and 100 using the repeat command?

A

let the_list []
repeat 10
[
set the_list lput (random 101) the_list
]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

how can we create a list of 10 random numbers between 0 and 100 using the ‘while’ command?

A

let the_list []
while [length the_list , 10]
[
set the_list lput (random 101) the_list
]

17
Q

list_a is: [ 1 3 5 7 ], how can we create a new list (b_list) that contains the square value of the items in list_a?

A

let the_list [1 3 5 7 ]
foreach list_a
[
x -> set list_b lput (x*x) list_b
]

18
Q

What’s the difference of using the following loop structures? Repeat, while and forreach

A

Repeat - when you want the code to run the instructions several times
While - when you want the code to run the instructions as long as the condition remains true
Forreach - when you want the code to run a set of instructions for each of the elements within a set of elements

19
Q

You want to create a procedure called rainbow-sheep in a separated file from the rest of the Wolf sheep predation code. This procedure should ask sheep to change to a random colour. What do you do?

A

Write the procedure rainbow-sheep in Notepad and save it as a .nls file

File name will be rainbowCode.nls

Code:
To rainbow-sheep
Ask sheep [ set color random 141 ]
End

20
Q

What’s the purpose of a CSV:from-row?

A

Csv:from-row: takes data from a row and creates a list that contains the elements in the row

21
Q

How do you read a .csv file?

A

file-close-all

if not file-exists? “name of file.csv”
[
user-message “No file ‘name of file.csv’ exists!”
Stop
]
file-open “london_crime.csv”

while [ not file-at-end? ]
[
let data csv: from-row file-read-line
]

file-close