Module 1 ppt- all lessons

advertisement
Modeling and Simulation
Module 1: Lesson 1
Introduction to Complex Adaptive Systems and
Computer Modeling and Simulation
Turn & Walk Activity
Simple Rules
• You are an agent
• Form a circle (or not)
• Turn to face the person on your left
• Close your eyes and take three steps in that
heading
Turn & Walk Computer Model
Web-based StarLogo Nova Platform
http://www.slnova.org/GUTS/projects/4591/
• What is the relationship between the
computer model and the real world?
• What was included and what was missing
from the computer model of Turn & Walk?
• What are computer models good for?
Setup and Forever blocks
Complex Adaptive Systems (CAS)
video “Introduction to Complex Systems”
https://www.youtube.com/watch?v=CPHjsWSzOY0
Complex Adaptive Systems (CAS)
Terms to Remember
•
•
•
•
•
•
Agent
Simple rules
Heading
Iteration
Prediction
Emergent patterns
•
•
•
•
•
Scatter
Initial conditions
Outcome
Phenomenon
Adaptive
Modeling and Simulation
Module 1: Lesson 2
Introduction to StarLogo Nova and
Building Painting Turtles
StarLogo Nova
A web-based software program
Computer Science
Concepts
• Instructions
• Computer Program
• Looping
• Iterations
• Public and Private
Galleries
• Remixing
Guided Tour of StarLogo Nova
Follow Guided Introduction to StarLogo Nova to see
the different parts of site.
www.slnova.org
•User Interface
•Terrain & Spaceland area
•Blocks & Drawers (workspace to create your code)
•Account & log in
•My Profile, public & private galleries, creating new project
•Sharing your project
•Remixing your project
Flower Turtles Project
• Start a new blank project.
• Name it ‘Flower Turtles’ with your name(s) in
the title.
• Your challenge: Have turtles create a flower
o create 5 turtles that separate when ‘Setup’button
is pushed.
o have the turtles move and leave trails with their
pens down
• Save your project with both partners names
Flower Turtles Project
In the World Page- create 5 turtles that separate when the setup button is pushed.
In the Turtle Page- have the turtles move & turn to create a flower pattern.
Extensions: Painting Turtles Challenge
• REMIX your Flower Turtle project and call it
“Painting Turtles”
• Your challenge: Paint a masterpiece
o create many turtles
o have the turtles move around the space leaving
trails
o have a slight wiggle to their walk
o Change the colors of the turtles.
• Save your project with both partners names
Terms to Remember
•
•
•
•
Agent
Location
Heading
Steps
•
•
•
•
Iteration
Setup
Runtime
Random
Modeling and Simulation
Module 1: Lesson 3
Conditional Branching
Trailblazer and Bumper Turtles
Review from Lesson 2
• What commands enabled turtles to change
their environment?
• What could an agent leaving trails represent in
a real world scenario?
How turtles can react to their environment
Trailblazer
Instructions
• Starting and ending in the same place.
• Using a pencil, draw the path in the CENTER of squares.
• Pick up ALL the gold while avoiding the hazards.
• Color the squares as necessary according to the following rules:
– Take a step forward.
– If you are standing on a RED square, then turn right by 90 degrees
– Else If you are standing on a BLUE square, then turn left by 90
degrees
– Else If you are standing on a BLACK square, then turn right by 180
degrees
•
Trade your map with your partner.
Discussion and New Concepts
•
•
•
•
Comparing solutions
Computer Science concept: conditionals
New commands: If/Then and If/Then/Else
Boolean statements– Evaluate to either True or False (Yes or No)
• Examples of conditionals in real life?
Setup and Forever blocks
New SLNova Blocks
Bumper Turtles Challenge
• Start with the program called “Bumper Turtles
starter” program
http://www.slnova.org/GUTS/projects/4593/
• Click on the “Paint Landmarks” push button and
see the program execute the code provided. Do
not change the code in Paint Landmarks!
• Remix the project, add your name(s) to the title
• Your challenge is to make the turtles react to the
landmarks created by the “Paint Landmarks”
– Use logic blocks that evaluate the color of the terrain
and tells the turtle how to turn.
Partial Solution
Discussion
• What is the difference between if/then
statements in a row vs. nested if/then/else
statements
• Does execution order matter?
• What could these trails and bumpers
represent in Bumper Turtles model?
• Terms to remember: conditional, Boolean,
evaluation
Modeling and Simulation
Module 1: Lesson 1
Probability with Dice and Data,
Wiggle Walk, and Colliding Turtles
Review from Lesson 3
• What commands enabled agents to react to
their environments?
Review from Lesson 3
• What commands enabled agents to react to
their environments?
• IF/THEN
• IF/THEN/ELSE
Review from Lesson 3
• An example of reacting to the environment:
IF/THEN with a Boolean expression
New in Lesson 4
• Today we are going to learn about probability
(or the likelihood of something happening).
• Then we are going to use probability to make
turtles do a “wiggle” walk.
Chances Are
• Today we are going to learn about probability
• Form small groups and each group gets a cup
and a die.
• Roll the die in the cup and record the result on
your activity sheet.
• Repeat until you have 50 trials.
Chances Are
• What were your results?
• If you used a bar graph to visualize your
results, what would it look like?
• Pool each groups data and see the results for
the class.
• What are the chances of rolling each number
between 1 and 6?
Chances Are
• We can mimic a roll of a die in StarLogo Nova
using the random command.
• Random 6 will return a number between 0
and 5.
Chances Are
• Random can be used within other commands.
For example, used within a left turn
command, what do you think this command
now does?
• If we used this command in an agent’s walk,
what would it’s trail look like?
Wiggle walk
• Next imagine that you were going to roll two
dice instead of one die. Do you think we will
still get a flat distribution?
• In other words, is rolling a pair of ones as
common as rolling a sum of 8?
Wiggle walk
• Fill in all the possible combinations of rolling
two dice.
Student 1
Student 2
-
Wiggle Walk
• What is the most common result of rolling two
dice?
• What is the next most common result?
• If we were to graph out the number of
occurrences of each result, what would it look
like?
Wiggle Walk
• We use this “triangle” distribution when we
want to to make agents walk with some
randomness in their motion but mostly follow
a straight line. We call this a wiggle walk.
Wiggle Walk
• We use this distribution when we want to to
make agents walk with some randomness in
their motion but mostly follow a straight line.
We call this a wiggle walk.
Wiggle Walk
Wiggle Walk
• Try it yourself!
• Open your Bumper Turtle program and make
your agents wiggle when they walk.
• Next you can get rid of the red, black and blue
blocks
Wiggle Walk
• What’s the difference between a walk that
uses one command
• And two commands?
What’s really going on?
Self-test of understanding
Colliding Turtles
New Command: Collision
• Collisions occur when two agents bump into
one another. (They do not need to be
centered on the same patch.)
Colliding Turtles
New Command: Collision- allows for agent to
agent interactions
Colliding Turtles
New Command: Collision with a condition
New StarLogo Nova Blocks
Colliding Turtles
(coding agent to agent interaction)
• Start from a new blank project
• Create 50 blue turtles and 5 red turtles (use 2 ‘create
do’ blocks)
• Have the turtles move forward with a little wiggle in
their walk. (forever block on the turtle page)
• Upon colliding with a red turtle, have turtles react to
that agent (the collidee) by changing their color to red.
• Save your project, make sure your name(s) are in the
title.
• Extension: add a ‘chance’ or probability of a turtle
turning red when it collides with a red turtle.
Review from Lesson 4
• What could collisions represent in the real
world?
• Why do we use probability in models?
End of Lesson 4
Modeling and Simulation
Module 1: Lesson 5
Epidemiology
Modeling the Spread of Disease
Designing and Running Experiments
Review from Lesson 4
• What could collisions represent in the real
world?
• Why do we use probability in models?
Lesson 5
•
•
•
•
Introduction to Epidemiology.
Modeling the spread of a disease.
Creating a slider for transmission rate.
Using the slider value to determine whether
or not to pass a disease from agent to agent.
• Creating a slider for recovery rate.
• Using it to determine if a sick agent recovers.
Introduction to Epidemiology
• Epidemics are the spread of disease
• Epidemiologists study the spread of disease
• One way epidemiologists try to study the
spread of disease is through running
simulations of how a disease spreads. Then
they can test different measures to stop and
epidemic.
What is MRSA?
• MRSA is a bacteria called Methicillin resistant
Staphylococcus Aureus.
• Staphylococcus means grape-cluster in Greek.
• Viewed at 10,000 x magnification.
MRSA
• 30% of a population has some form of
staphylococcus or staph on their skin or nose,
which is known as colonization.
• About 880,000 people are infected with MRSA
each year, out of those, 3% die.
How Does it Spread?
• Direct physical contact
How to treat an infection
• The infection is usually drained, cleaned, and
covered.
• Treated with an appropriate antibiotic.
• Keep it covered and don’t share personal items.
Picture of MRSA cycle
• MRSA transmission
Susceptible
(Healthy)
Colonized
Infected
Community-Associated MRSA Modeled
as a Complex Adaptive System
This is a screen shot from a simplified version of a Community-associated MRSA model
developed by the University of Chicago / Argonne National Laboratory. In this model,
students go from home to school and back again. The agents can be in one of three
states: healthy, infected, or colonized, and can infect others if they are colonized or
infected.
New in Lesson 5
• CS concepts: Variables and Procedures
• We are going to turn our colliding turtles
model to make it into an epidemic model.
• Let’s add a new widget called a slider. We will
use this slider to hold a value called the
transmission rate.
• This rate is the percentage of time a disease
gets passed from one person to another upon
collision.
Variables
• Variables are containers for holding values.
• Think of a variable as a box with a label.
• In StarLogo Nova, Sliders can be used to hold
values and set values as inputs to the model.
Procedures
• Procedures are stacks of commands that
perform a particular function and can be given
a name.
Create a New StarLogo Nova widget
New StarLogo Nova widget
• Change the max value to 100 by typing in 100 next to
max and hitting the return key.
• Click on “Edit Widgets” again to get out into editing
mode and back into play mode.
Use the New Widget
• We now have a way to set the transmission rate
through the user interface with a slider.
• We can get the value of transmission rate in code.
• How do we “pass the disease to the healthy agent
40% of the time after a collision?”
[hint: remember the dice rolls]
Use the Transmission Rate Widget
• We are rolling a 100-sided die. If the result is less
than the transmission rate, pass the disease on.
• How often should we roll less than the transmission
rate?
• What kind of distribution does the roll of a single die
give us?
Save and Test your Model
• Try changing the transmission rate?
• What is missing if you wanted to use your model as
an experimental test bed?
Extension: Adding Recovery
• People sometimes recover from a disease
• How can we use probability to determine
when a sick person recovers?
Adding Recovery
• Recovery will be a new procedure.
• At each step a sick person has a chance of
recovery.
Adding Recovery
• Create a new slider for recovery rate.
• Use that slider in the recover procedure to
determine whether the sick agent recovers
(becomes healthy again).
Adding Recovery
• Create a new slider for recovery rate.
Adding Recovery
• Use that slider in the recover procedure to
determine whether the sick agent recovers
(becomes healthy again or blue).
Save and Test your Model
• Try changing the recovery rate?
• Did you see any new outcomes or patterns?
Review from Lesson 5
• What does this model tell you?
• What is the impact of changing the
transmission rate? And recovery rate?
• What other things move through a population
like a disease?
End of Lesson 5
Modeling and Simulation
Module 1: Lesson 6
Adding Instrumentation
Designing and Running Experiments
Review from Lesson 5
• What are the different ways we have used
probability in this model?
• What is the impact of changing the
transmission rate?
• What was the impact of changing the recovery
rate?
Instrumenting your Model
Definitions:
• Qualitative means relating to, measuring, or
measured by the quality of something (its size,
appearance, value, etc.) rather than its quantity.
• Quantitative means relating to, measuring, or
measured by the quantity of something rather than
its quality.
Instrumenting your Model
• We need some way of tracking the spread of disease.
• What data should we collect?
Instrumenting your Model
• Let’s create a new “line graph” widget called
“Population Healthy and Sick.”
• We’ll use it to track #red (sick) and #blue (healthy)
over time.
Instrumenting your Model
• Drag the line graph off to the side of Spaceland.
• Double click on New Series and change its name to
“CountHealthy” then select blue as its line color.
• Add another Series and change its name to
“CountSick” then select red as its line color.
• Finally, click “Edit Widgets” to leave editing mode
and returning to play mode.
Instrumenting your Model
• We want The World will update the line graph each
time through the forever loop.
Test your Model
• Does the line graph work?
• What patterns can you see that were difficult to see
without the line graph?
Customization
• Researching diseases and adding in real
transmission rate values.
Designing and Running Experiments
• Use the Experimental Design form to describe
your experiment.
• Plan and run your experiment.
• Describe and share your findings.
Review from Lesson 6
• Why is it important to instrument models?
• How can computer models of epidemics be
used to better understand the spread of
disease?
End of Lesson 6
Download