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
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.
...
@@ -14,6 +14,7 @@ Each patch has a disease state.
;- State variables
;- State variables
patches-own [
patches-own [
state
state
infected-neighbours
]
]
```
```
...
@@ -41,10 +42,12 @@ set R 3
...
@@ -41,10 +42,12 @@ set R 3
```
netlogo
```
netlogo
;- Go
;- Go
to go
to go
infect-patches
update-patches
update-patches
tick
tick
end
end
; ==> Infection.
; ==> Update patches.
; ==> Update patches.
```
```
...
@@ -57,6 +60,14 @@ end
...
@@ -57,6 +60,14 @@ end
to setup
to setup
clear-all
clear-all
; ==> Setup disease states.
; ==> Setup disease states.
ask patches [
set state S
]
ask one-of patches [
set state I
]
update-patches
update-patches
reset-ticks
reset-ticks
end
end
...
@@ -66,6 +77,37 @@ end
...
@@ -66,6 +77,37 @@ end
### Submodels
### 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
#### Visualization
```
netlogo
```
netlogo
...
...
This diff is collapsed.
Click to expand it.
nlogo/Model.nlogo
+
21
−
6
View file @
4e8c2b29
__includes["Code.nls"]
__includes["Code.nls"]
@#$#@#$#@
@#$#@#$#@
GRAPHICS-WINDOW
GRAPHICS-WINDOW
2
2
0
2
3
0
10
10
7
3
3
7
4
3
524
524
-1
-1
-1
-1
...
@@ -30,7 +30,7 @@ ticks
...
@@ -30,7 +30,7 @@ ticks
BUTTON
BUTTON
10
10
10
10
8
0
11
0
50
50
NIL
NIL
setup
setup
...
@@ -45,9 +45,9 @@ NIL
...
@@ -45,9 +45,9 @@ NIL
1
1
BUTTON
BUTTON
90
115
10
10
160
215
50
50
NIL
NIL
go
go
...
@@ -59,7 +59,22 @@ NIL
...
@@ -59,7 +59,22 @@ NIL
NIL
NIL
NIL
NIL
NIL
NIL
0
SLIDER
10
62
215
95
beta
beta
0
1
1
0.2
0.01
1
NIL
HORIZONTAL
@#$#@#$#@
@#$#@#$#@
## WHAT IS IT?
## WHAT IS IT?
...
@@ -90,5 +105,5 @@ true
...
@@ -90,5 +105,5 @@ true
Line -7500403 true 150 150 90 180
Line -7500403 true 150 150 90 180
Line -7500403 true 150 150 210 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