Get Instant Help From 5000+ Experts For

Writing Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

# Types Of Computer Simulations And NetLogo Programming For Agent-Based Essay Simulations.

8 Pages / 1,852 Words Published On: 17-09-2020

## Equation-based simulations

Types of computer simulation are: • equation-based simulations: these are most commonly used in the physical sciences and other sciences where there is governing theory that can guide the construction of mathematical models based on differential equations. Equation based simulations can either be particle-based, where there are n many discrete bodies and a set of differential equations governing their interaction (e.g. a simulation of a galaxy formation),

they can be field-based, where there is a set of equations governing the time evolution of a continuous medium or field (e.g. a simulation of a fluid). • agent-based (or individual-based) simulations: these are most common in the social and behavioral sciences, though we also find them in such disciplines as artificial life, epidemiology, ecology, and any discipline in which the networked 1 interaction of many individuals is being studied. NetLogo is an example of a language for agent-based simulations.

Agent-based simulations are similar to particle-based simulations in that they represent the behavior of n-many discrete individuals (agents). But unlike equation-particle-based simulations, there are no global differential equations that govern the motions of the individuals. Rather, in agent-based simulations, the behavior of the individuals is dictated by their own local rules. • multiscale simulations: these couple together modeling elements from different scales of description.

A good example of this would be a model that simulates the dynamics of matter as a field undergoing stress and strain but zooms into particular regions of the material where important small scale effects are taking place, and models those smaller regions with relatively more fine-grained modeling methods. Multiscale simulation methods can be further broken down into serial multiscale and parallel multiscale methods. The more traditional method is serial multi-scale modeling. The idea here is to choose a region, simulate it at the lower level of description, summarize the results into a set of parameters digestible by the higher level model, and pass them up to into the part of the algorithm calculating at the higher level.

When the different scales interact strongly to produce the observed behavior, what is required is an approach that simulates each region simultaneously. This is called parallel multiscale modeling. • Monte Carlo simulations: these are computer algorithms that use randomness to calculate the properties of a mathematical model and where the randomness of the algorithm is not a feature of the target model. A nice example is the use of a random algorithm to calculate the value of π. If you draw a unit square on a piece of paper and inscribe a circle in it, and then randomly drop a collection of objects inside the square, the proportion of objects that land in the circle would be roughly equal to π/4.

## Agent-based simulations

A computer simulation that simulated a procedure like that would be called a MC simulation for calculating π. Exercise 1.1 Give brief explanations in your own wording of the different types of simulation illustrated above. Offer cases of experiments that would fit each type of simulation method. 2 NetLogo In NetLogo there are two methods for communicating with the agents: commands and reports. A command is an action that must be performed by the agent, whereas a report calculates a value and returns it.

Commands usually begin with verbs (i.e. 2 actions, such as create , die , jump , inspect , clear , etc.), whereas reports are nouns or phrases that give information on the value obtained (such as distance , sum , max , etc. The commands and reports created in NetLogo are called primitives, whereas those defined by the user for a specific model are usually known by the generic term of procedures. Each procedure is defined by a noun preceded by the keyword to and ending with the keyword end.

In NetLogo it is important to know what type of agents can execute each command. Let’s setup a world with one turtle. Exercise 2.1 Go in the Code tab and type the following: to setup clear-all crt 1 end Click the Check button to verify the syntax is correct. Go to the Interface Tab and type setup in the interactive console under the observer user. What happens?

By default, when a new turtle is created, it is located at the origin of coordinates of the world, but with a random orientation and color. Let’s now make our turtle draw a square of side 4. Exercise 2.2 Go in the Code tab and type the following: to square pd fd 4 rt 90 fd 4 rt 90 fd 4 rt 90 fd 4 end Can you interpret these intuitive commands? The commands pd,pu are respectively for pen down and pen up and are used to let the turtle draw while moving (if pen is down) or moving without drawing (if pen is up.) Click the Check button to verify the syntax is correct. Go to the Interface Tab, select the turtle user and type square in the interactive console. Modify the 3 code above to add one or two additional sides to the polygon.

Create at least 3 different polygons and report the code you have created. You can also use the procedure to square2 pd repeat 4 [ fd 4 rt 90 ] pu end Do you understand the code and what the differences are? Explain. A general procedure is now the following: to polygon [num-sides length-side] pd repeat num-sides [ fd length-side rt (360 / num-sides) ] pu end This is a function that takes two values, one for the number of sides and one for the length of each side. How would you run this procedure? Draw multiple non overlapping polygons by combining this procedure with one for turning the orientation of your turtle.

## Multiscale simulations

Report here the instructions you used. 2.1 Recursion We can now add recursion to this algorithm. We want to combine the repeat procedure above with another parameter for the angle of rotation and the number of times this has to happen. Exercise 2.3 Experiment with the execution of the following code to create figures: to poly-rep [ length-side angle repetitions ] pd repeat repetitions [ fd length-side rt angle] 4 pu end Creat at least three distinct polygons of different length-side, with a different number of sides and different angle. 2.2 If-then Another essential structure to learn is conditional branching.

In NetLogo the possibilities are all variations of the basic schema ifelse condition [ actions-YES ] [ actions-NO ] Exercise 2.4 Experiment with the execution of the following code: to poly-decision [ length-side angle repetitions ] pd repeat repetitions [ fd length-side ifelse ( random 2 = 0 ) [ pd ] [ pu ] rt angle ] pu end What difference does introducing the conditional into this procedure make? Explain the condition, then change it so that if satisfied it turns right by 45 degree, otherwise it turns to the left by 45 degrees. 2.3 Loops In NetLogo loops are defined according to the following easy structure loop [ action ] Exercise .

2.5 Experiment with the execution of the following code: 5 to poly-endless [ length-side angle ] pd loop [ fd length-side rt angle ] pu end What is the difference with the previous procedure? What happens when you run it? Can you change the procedure so that it goes backward for the length of the side of the polygon? To halt the loop you can only use the stop instruction. Exercise 2.6 Modify the above code to include a stop procedure that is enforced if an angle greater than 180 is reached.

2.4 Recursive Calls We can call a procedure inside itself, i.e. construct a recursive procedure. to do-something [ ... ... do-something [ .. ]] Exercise 2.7 Complete the following code to generate a recursive call to poly-recursive [ length-side angle ] pd fd length-side rt angle [...] pu end Modify it further to change the length side and the angle value at each call: for example, use an if condition that stops if the length-side is greater than some value of your choice and at each iteration increases the length side by 0.1 (similarly for the angle value).

6 2.5 While Loops In NetLogo while-loops are defined according to the following easy structure while [ condition ] [ actions ] Exercise 2.8 Write a polygon procedure with length side and angle parameters as above. The procedure write sides of the given length and at the given angle until the angle is less than some degree value. Now modify it to allow the angle to increase by 1 degree at each iteration.

Cite This Work

To export a reference to this article please select a referencing stye below:

My Assignment Help. (2020). Types Of Computer Simulations And NetLogo Programming For Agent-Based Essay Simulations.. Retrieved from https://myassignmenthelp.com/free-samples/csd-3203-history-and-philosophy-of-computing.

"Types Of Computer Simulations And NetLogo Programming For Agent-Based Essay Simulations.." My Assignment Help, 2020, https://myassignmenthelp.com/free-samples/csd-3203-history-and-philosophy-of-computing.

My Assignment Help (2020) Types Of Computer Simulations And NetLogo Programming For Agent-Based Essay Simulations. [Online]. Available from: https://myassignmenthelp.com/free-samples/csd-3203-history-and-philosophy-of-computing
[Accessed 25 September 2023].

My Assignment Help. 'Types Of Computer Simulations And NetLogo Programming For Agent-Based Essay Simulations.' (My Assignment Help, 2020) <https://myassignmenthelp.com/free-samples/csd-3203-history-and-philosophy-of-computing> accessed 25 September 2023.

My Assignment Help. Types Of Computer Simulations And NetLogo Programming For Agent-Based Essay Simulations. [Internet]. My Assignment Help. 2020 [cited 25 September 2023]. Available from: https://myassignmenthelp.com/free-samples/csd-3203-history-and-philosophy-of-computing.

Stuck on Any Question

Our best expert will help you with the answer of your question with best explanation.

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing: Proofread your work by experts and improve grade at Lowest cost

250 words
5% Cashback

On APP - grab it while it lasts!

Download app now (or) Scan the QR code

*Offer eligible for first 3 orders ordered through app!

Have any Query?
Payment required!

Only one step away from your solution of order no.