Markov Chain example
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
THINGS TO NOTICE
(suggested things for the user to notice while running the model)
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
;;Markov model by Ben Davies ;;For more information see https://simulatingcomplexity.wordpress.com/2015/02/10/fun-with-markov-chains-a-tutorial-using-netlogo/ globals [ weather ] patches-own [ growth ] ;;clear the model, create weather variable with two states: wet or dry ;;seed patches with random growth and scale their colour accordingly to setup clear-all set weather one-of [ "WET" "DRY" ] ask patches [ set growth random 11 set pcolor scale-color green growth 10 0 ] reset-ticks end to go markov-rain grow-grass tick if ticks = 500 [ stop ] end ;;if the weather is currently wet AND a randomly drawn value between 0 and 1 is less ;;than the wet-to-dry transition, transition to dry conditions ;;ELSE ;;if the weather is currently dry AND a randomly drawn value between 0 and 1 is less ;;than the wet-to-dry transition, transition to wet conditions to markov-rain ifelse weather = "WET" [ if random-float 1.000 < WTD [ set weather "DRY" ] ] [ if random-float 1.000 < DTW [ set weather "WET" ] ] end ;;if conditions are wet AND grass is not at its maximum, grow grass and recolor patches ;;ELSE ;;if conditions are dry AND grass is not at its minimum, decrease grass and recolor patches to grow-grass ifelse weather = "WET" [ ask patches with [ growth < 10 ] [ set growth growth + 1 set pcolor scale-color green growth 10 0 ] ] [ ask patches with [ growth > 0 ] [ set growth growth - 1 set pcolor scale-color green growth 10 0 ] ] end
There is only one version of this model, created about 10 years ago by benjamin davies.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Markov Chain example.png | preview | Preview for 'Markov Chain example' | about 10 years ago, by benjamin davies | Download |
This model does not have any ancestors.
This model does not have any descendants.