The applet requires Java 5 or higher. Java must be enabled in your browser settings. Mac users must have Mac OS X 10.4 or higher. Windows and Linux users may obtain the latest Java from Oracle's Java site.
powered by NetLogo
view/download model file: club_goods_and_social_interaction.nlogo
(a general understanding of what the model is trying to show or explain)
(what rules the agents use to create the overall behavior of the model)
(how to use the model, including a description of each of the items in the Interface tab)
(suggested things for the user to notice while running the model)
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
(models in the NetLogo Models Library and elsewhere which are of related interest)
(a reference to the model’s URL on the web if it has one, as well as any other necessary credits, citations, and links)
globals [space]
breed [agents agent]
agents-own [benefit cost]
to setup
clear-all
setup-patches
setup-agents
reset-ticks
end
to setup-patches
ask patches [
if pxcor >= 0 and pycor <= 0 [set pcolor green]
if pxcor <= 0 and pycor <= 0 [set pcolor green]
]
end
to setup-agents
create-agents number-agents
ask agents [
setxy (-16 + random 33) (1 + random 16)
set shape "person"
set color red
set benefit nonmembers-benefit
set cost nonmembers-price-per-visit
]
ask n-of number-members agents [
setxy random-xcor random-ycor
set color yellow
set cost members-price-per-visit
set benefit (members-benefit + (Fee / periodicity-of-fee))
]
end
to go
move-agents
modify-status
do-plots
tick
end
to move-agents
ask agents with [color = yellow and pcolor = green] [
if random-float 1 < members-prob-exit
or (economic-comparison? and random 50 < members-price-per-visit
and random 50 >= members-benefit + (Fee / periodicity-of-fee))[move-to patch (-16 + random 33)(1 + random 16)]
]
ask agents with [color = yellow and pcolor = black] [
if random-float 1 < members-prob-enter
or (economic-comparison? and random 50 > members-price-per-visit
and random 50 <= members-benefit + (Fee / periodicity-of-fee))[move-to patch (-16 + random 33)(-1 - random 16)]
]
ask agents with [color = red and pcolor = green] [
if random-float 1 < nonmembers-prob-exit
or (economic-comparison? and random 50 < nonmembers-price-per-visit
and random 50 >= nonmembers-benefit) [move-to patch (-16 + random 33)(1 + random 16)]
]
ask agents with [color = red and pcolor = black] [
if random-float 1 < nonmembers-prob-enter
or (economic-comparison? and random 50 > nonmembers-price-per-visit
and random 50 <= nonmembers-benefit) [move-to patch (-16 + random 33)(-1 - random 16)]
]
end
to modify-status
set number-members (count agents with [color = yellow and pcolor = green] + count agents with [color = yellow and pcolor = black])
;;set number-members count agents with [color = yellow]
ask agents with [color = red and pcolor = black] [
if social-effects? and any? agents with [color = yellow and pcolor = black] in-radius 2 [
set color yellow
]
]
ask agents with [color = yellow and pcolor = green] [
if social-effects? and count agents with [pcolor = green] >= (number-agents / 2) [
set color red
set nonmembers-benefit random 10
set members-benefit random 10
]
]
ask agents with [color = yellow and pcolor = green] [
if social-effects? and count agents with [pcolor = green] <= (number-agents / 15) [
set color red
set nonmembers-benefit random 10
set members-benefit random 10
]
]
end
to do-plots
set-current-plot "total members"
set-current-plot-pen "members in club"
plot count agents with [color = yellow and pcolor = green]
set-current-plot-pen "members outside club"
plot count agents with [color = yellow and pcolor = black]
set-current-plot "total nonmembers"
set-current-plot-pen "nonmembers in club"
plot count agents with [color = red and pcolor = green]
set-current-plot-pen "nonmembers outside club"
plot count agents with [color = red and pcolor = black]
end