Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Literate NetLogo
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OESA
Literate NetLogo
Commits
4e8c2b29
Commit
4e8c2b29
authored
4 years ago
by
Martin Lange
Browse files
Options
Downloads
Patches
Plain Diff
simple infection model, slider for beta
parent
31642fc0
No related branches found
Branches containing commit
No related tags found
1 merge request
!3
Building the Rabies model from ODD
Pipeline
#15927
passed with stage
in 13 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+42
-0
42 additions, 0 deletions
README.md
nlogo/Model.nlogo
+21
-6
21 additions, 6 deletions
nlogo/Model.nlogo
with
63 additions
and
6 deletions
README.md
+
42
−
0
View file @
4e8c2b29
...
...
@@ -14,6 +14,7 @@ Each patch has a disease state.
;- State variables
patches-own [
state
infected-neighbours
]
```
...
...
@@ -41,10 +42,12 @@ set R 3
```
netlogo
;- Go
to go
infect-patches
update-patches
tick
end
; ==> Infection.
; ==> Update patches.
```
...
...
@@ -57,6 +60,14 @@ end
to setup
clear-all
; ==> Setup disease states.
ask patches [
set state S
]
ask one-of patches [
set state I
]
update-patches
reset-ticks
end
...
...
@@ -66,6 +77,37 @@ end
### Submodels
#### Infection
```
netlogo
;- Infection
to infect-patches
ask patches [
set infected-neighbours 0
]
ask patches with [ state = I ] [
ask neighbors [
set infected-neighbours infected-neighbours + 1
]
]
ask patches with [ state = S ] [
if random-float 1 < calc-infection-prob [
set state I
]
]
end
; ==> Infection probability.
```
```
netlogo
;- Infection probability
to-report calc-infection-prob
report 1 - (1 - beta) ^ infected-neighbours
end
```
#### Visualization
```
netlogo
...
...
This diff is collapsed.
Click to expand it.
nlogo/Model.nlogo
+
21
−
6
View file @
4e8c2b29
__includes["Code.nls"]
@#$#@#$#@
GRAPHICS-WINDOW
2
2
0
2
3
0
10
7
3
3
7
4
3
524
-1
-1
...
...
@@ -30,7 +30,7 @@ ticks
BUTTON
10
10
8
0
11
0
50
NIL
setup
...
...
@@ -45,9 +45,9 @@ NIL
1
BUTTON
90
115
10
160
215
50
NIL
go
...
...
@@ -59,7 +59,22 @@ NIL
NIL
NIL
NIL
0
SLIDER
10
62
215
95
beta
beta
0
1
0.2
0.01
1
NIL
HORIZONTAL
@#$#@#$#@
## WHAT IS IT?
...
...
@@ -90,5 +105,5 @@ true
Line -7500403 true 150 150 90 180
Line -7500403 true 150 150 210 180
@#$#@#$#@
0
1
@#$#@#$#@
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment