1 / 7

Week 11 DO NOW QUESTIONS

Week 11 DO NOW QUESTIONS.

gazit
Download Presentation

Week 11 DO NOW QUESTIONS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Week 11 DO NOW QUESTIONS

  2. Very often a programmer will want to keep track of a variable as it changes within a program. One of the ways to do this in NetLogo involves using Monitors. Monitors are output windows that show a value based on some underlying code.. The value that the monitor uses to generate its display is either a global variable, a reporter or and expression that evaluates to a value. In the image below, an entry in which field(s) will not have any impact on the value that appears in the monitor. • Reporter field • Decimal place field • Display name field • Font size field • C and D

  3. Suppose that we have built a model that involves agents (turtles) that wander the world eating grass. The grass (individual patches) have a patches-own variable called “grass-energy” which goes down as turtles visit each patch. Each patch is recolored to visually show the grass-energy available in that particular patch. You are interested in keeping track of overall amounts of energy left in the world (aggregate data). The monitor that displays this information probably gets its value from code that looks like which of the line(s) below • a reporter that says Report sum [grass-energy] of patches • a global value called global-grass-energy that is updated anytime any patch changes its grass-energy level. • An expression in the reporter that sums a list containing all the individual values of the custom grass-energy variable. • An expression that says count turtles energy-level. • A, b and c.

  4. If you build a game in NetLogo and create a reporter to display the score. What kind of code might you see in your program? Assume: globals [score] • report scores • if something = true [set score score + 1] • plot score • count turtles = score • turtles-own [score]

  5. Plots are also used to display changes to values within a model as a model runs. There can be multiple values plotted in the model because it is possible to have plots with multiple pens. In a model of disease spreading through a population which lines might be used to plot outcomes? Assume turtles-own [is-sick? Is-infected?] • plot [is-sick?] of turtles • plot count turtles with [is-sick? = true] • plot count turtles with [is-sick? = false] • plot count turtles with [is-infected? = true] • b c and d above.

  6. Assume that you are creating a model that requires a plot. You are not sure how to use plots. Which approach or approaches might help you figure out how plots work. • Use the built in NetLogo manual under Help > NetLogo Manual • Ask somebody who knows how to work with plots. • Add a plot widget to your model’s interface and play with it. • Look at other models that use plots and examine the code. • All of the above.

  7. When modeling the spread of infectious disease there are many factors that can affect the spread of the disease and the ultimate impact of the disease on society. These factors are often called the parameters of a NetLogo model. It is interesting to see the effects that changing these parameters have on the overall system. Consequently, NetLogo programmers often represent these parameters as sliders in their models so that the model can be easily run at different settings. Which variable or variables would be a good parameter or “slider” for an infectious disease model? • wiggle-rate (rate turtle move through the world) • number-contacts-before-infected • profession (“professional” “student” “wage earner”) • initial-population-density • All except c

More Related