Equation-based simulations
Main Rules.
- Each termite starts wandering randomly.
- If it bumps into a wood chip, it picks the chip up, and continues to wander randomly.
- When it bumps into another wood chip, it finds a nearby empty space and puts its wood chip down.
- Summary Of The Rules
- search-for-chip
- find-new-pile
- put-down-chip
Describing the rules informally
On setup, the termites and chips are randomly distributed. A termites searches for a chip and when found it drops the chip in the nearest space or pile found. It then moves on to find another chip. This loops on until there are no chips found separately.
Colours of the turtles and associated operations.
Termites are white when carrying not chip. They turn orange when carrying a chip.The chips are yellow while the background is black.
Changing the colors
Termites are now Pink when carrying not chip.They now turn blue when carrying a chip.The chips are now brown
Exercise 3.4
Main Rules.
- The fire starts on the left edge of the forest, and spreads to neighboring trees.
- The fire spreads in four directions: north, east, south, and west.
- The model assumes there is no wind. So, the fire must have trees along its path in order to advance. That is, the fire cannot skip over an unwooded area (patch), so such a patch blocks the fire’s motion in that direction.
Running the model for different values of the slider density and note the proportion of the forest that is burned in each case.The lower the density the lower the percentage of the forest burnt. Thus, when here are many tress, the chances of the fire spreading further becomes higher to.
Hypothesis
When the density of the fire is set to 60. The fire seems to almost always spread out through the forest. Evan then, some trees remain untouched. Setting the density to 59 produced varying results as at times it spread throughout the forest yet other times only consuming a small portion of the forest.
Exercise 3.5
The lower the tolerance, the lower the chances of obtaining mixed groups as men and women become comfortable without people of the opposite sex even though this might mean them staying in “single groups”
Percent tolerance that tends to produce certain percentage of mixing A low percentage of tolerance produced many groups of singles. It also takes time to complete as people are so unhappy.other Factors affecting the male to female ratio within each group The number of groups available and the people at the party also did affect the ratio.
Types of Simulations NetLogo (Part II) WEEK 18 1 Types Of Simulations And Their Purposes
Exercise 1.1 Brief explanations of the different types of simulation illustrated above.
This is also referred to as individual-based simulation as it focuses on representation of behaviors of individuals defined by their own local rules. An example of agent-based simulation is the termites simulation we worked with in part 1.Monte Carlo simulations
This is often used to analyze the risk of an action, attributes or properties that shape the direction of decision making. Matlab’s Simulink supports this kind of simulation.
Agent-based simulations
Equation-Based Simulations
These sorts of simulation make use of know theoretical concepts to depict the expected behaviors of the objects involved in the simulation in a way that the events would fold out in real life provides similar parameters and conditions. An example of such is the simulation of a pendulum in motion. Multiscale Simulations
Models at various scales are utilized concurrently to represent a system. The various models normally concentrate on diverse scales of resolution. Calculating the speed of a bullet through glycerin is an example of multiscale simulation.
Exercise 2.1 Syntax Check. Go to the Interface Tab and type setup in the interactive console under the observer user. What happens? A cursor-like item pops up on the screen / view space. Content on the screen is also cleared as the screen is set up for use.Exercise 2.2
to square
pd
fd 4
rt 90
fd 4
rt 90
fd 4
rt 90
fd 4
end
Draws a square by placing the pen down, move 4 steps, turn 90% clockwise, repeat 4 steps move, turn another 90% clockwise, move 4 steps, turn 90% clockwise and then move 4 steps to complete the square.
Create at least 3 different polygons
to pent
pd
repeat 5 [
fd 4
rt (360 / 5) ]
pu
end
to hexagon
pd
repeat 6 [
fd 4
rt (360 / 6) ]
pu
end
to oct
pd
repeat 8 [
fd 4
rt (360 / 8) ]
pu
end
Non overlapping polygons by combining this procedure with one for turning the orientation of your turtle.
to poly [num-sides length-side]
pd
repeat num-sides [
fd length-side
rt (360 / num-sides) ]
pu
rt 90
pd
end
Week 19 NetLogo (Part III) Exercise 1.1
Computer simulation to answer questions about how these events could possibly have occurred; or about how those events actually did occur.Exercise 2.1
- We investigate a bunch of eating turtles
- In the model one turtle has all the food
- The turtles are spread randomly in the world and they move randomly
- When a turtle meets a turtle with food, it receives some and eats
- The difference between turtles with and without food is by coloring
- At the end, all turtles have food
Exercise 2.2
- Yes, each user in the community received at the message upon being close/nearby in relation to the user who already has the message.The more users within a given area, the more likely that the message will spread to all the users.
It takes longer when the number of users is less in that area distance between user becomes wider hence taking longer to reach out to everyone. Even in large community of users, the message still gets passed to all users.Yes. the length of the program execution at termination is proportional to the size of the community. However, with every few users in a vast area, it would at times take long to reach out to every user.
Exercise 2.3 Yes, each user in the community received at least one of the two messages.
- The more users within a given area, the more likely that the message will spread to all the users.
Multiscale simulations
It takes longer when the number of users is less in that area distance between user becomes wider hence taking longer to reach out to everyone. Even in large community of users, the message still gets passed to all users
4.Yes. When there is no lecture, e.g during a public holiday, all user would get a not-message1.
- Yes. the length of the program execution at termination is proportional to the
size of the community. However, with every few users in a vast area, it would at times take long to reach out to every user.
turtles-own [
message? ;; true or false: has this turtle gotten the message yet?
to setup
clear-all
create-turtles 300 [
set message? false
setxy random-xcor random-ycor
set size 2
]
ask one-of turtles [
set message? true ;; give the message to one of the turtles
]
ask turtles [
recolor ;; color the turtles according to whether they have the message
create-links-with n-of links-per-node other turtles
]
reset-ticks
end
to go
if all? turtles [ message? ] [ stop ]
ask turtles [ communicate ]
ask turtles [ recolor ]
tick
end
;; the core procedure!
to communicate ;; turtle procedure
if any? link-neighbors with [ message? ]
[ set message? true ]
end
;; color turtles with message red, and those without message blue
to recolor ;; turtle procedure
ifelse message?
[ set color red ]
[ set color blue ]
end
Simulations and Experiments Week 20
Exercise 1.1
The Security for the data being transmitted has not been given any consideration. The Various lectures that exist and the fact that users might not be taking similar lectures. Elements and relations that represent the simulation differ in material with physically real objects.
Exercise 1.2
Isomorphism: every property, element or relation of the real-world situation is mapped to a formal property in the simulation;
Exercise 1.3
Security for the data being transmitted.
The Various lectures that exist and the fact that users might not be taking similar lectures.
Elements and relations that represent the simulation differ in material with physically real objects.
Exercise 2.1
Switch messages occurs as a message from one agent does not affect reception of the other agent as before.Yes
- Not affected by community sizes
- Any Size of community
- when there are two users
- Yes.
- When no message has been received from an agent.
- Security and availability of the agents and messages being sent.
Network Structures Week 21 Exercise 2.1
A graph G is an ordered triple G := {V, E, f }
A graph G = (V, E) is planar if it can be “drawn” on the plane without edges crossing except at endpoints. Example: G= {3,6,f:(x^2)} : has 3 vertices and 6 edges
Exercise 2.2
A connected graph is one with any of its nodes reachable from any other node following a sequence of edges or with any of its two nodes are connected by a path. To reach two non adjacent nodes from each other we have to have at least 7 edges
Exercise 2.3
A connected graph is one with any of its nodes reachable from any other node following a sequence of edges or with any of its two nodes are connected by a path. To reach two non adjacent nodes from each other we have to have at least 7 edges. G= {4,7,f:(x^2)}Exercise 2.4
A directed graph is strongly connected if there is a directed path from any node to any other node.
The degree of a node is the number of edges that are linked to it.
In a directed graph we count the number of edges entering
(in-degree) and the number of edges leaving (out-degree) then sum those. Degrees
G= {3,6,f:(x^2)} : Max degree = 3+4=7
Exercise 2.5
A k-length walk in a graph is a succession of k edges, where the second node of each edge is the first node in the following edge of the walk.
Exercise 2.6
Path is a walk in which all the edges and all nodes differ.
Exercise 2.7
A cycle is a closed path in which all edges are different.
Exercise 2.8
The total graph T (G) of a graph G is a graph with the following criteria
- V (T (G)) corresponds to V (G) ∪ E(G)
- two vertices are adjacent in T (G) if and only if their corresponding elements
are either adjacent or incident in G.
Exercise 4.1
- The model does distribute the two messages in equivalent proportions. Random network affects the proportion by varying the output proportion in each execution even when other parameters are kept unchanged
- Yes. They all have nodes and capable of passing data from one node to another.
- The more liars are in the model, the higher the proportion of liars yielded.
- When the Liars slider is set to to 100%.