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: running_corruption.nlogo
The project “Running corruption” models the behavior of two types of agents: the buyers and the sellers (i.e. suppliers and purchasing office managers of firms). We try to simulate a world where economic interactions take part between them, affecting the society’s general level of corruption.
Set the HOW MANY BUYERS and the HOW MANY SELLERS sliders to control the number of agents. Set the INITIAL HONESTY LEVEL slider, which works only before starting the simulation. Then click the SETUP button to create the world. The blue agents are the buyers, the yellow ones are the sellers. Click GO to start the simulation. By modifyng the RULE OF LAW, the DEMOCRATIC ACCOUNTABILITY and the number of buyers and sellers, the agent’s behavior will be modified, obtaining honest or corrupt transactions.
The program assigns each agent a propensity to be corrupt, which determs whether the transactions will be honest instead of corrupt. This propensity is determined on a random microvariable combined with such variables the user can modify in the interface. The interaction between the agents could be controlled by setting the radius on the HOW DISTANT? slider. The agents will extend or reduce their view. Based on whether the agents around them will be honest or corrupt, their propensity to the corruption will be affected, modifying their behavior.
Try to make the agents interacting as maximum as possible. However, the program will have to make a lot of calculus, so it will become slow. Let’s have a cup of tea!
You might introduce interactions as in the model “Segregation - Uri Wilensky”. Many sellers could be “unhappy” since they don’t have enough same-color neighbors. The unhappy agents move to new locations in the vicinity. But in the new locations, the surrounding agents’s behavior will be affected, and other sellers will be prompted to leave.
Uri Wilensky (1997). Segregation.
Pietro Terna (2012). Interacting buyers and sellers.
breed [sellers seller]
breed [buyers buyer]
buyers-own [microVariable Propensity]
sellers-own [microVariable Propensity]
globals [#Agents radius T numberCorrupt numberNon GHL honestyLevel NT s b ]
to setup
clear-all
reset-ticks
set honestyLevel initialHonestyLevel
create
setMicroVariable
setVariable
end
to create
if howManyBuyers + howManySellers > count patches - 50
[ user-message (word "This society only has room for "( count patches - 50) " agents.")
stop ]
create-buyers howManyBuyers
[setxy random-xcor random-ycor
findNewSpot
set color blue
set shape "house"
]
create-sellers howManySellers
[setxy random-xcor random-ycor
findNewSpot
set color yellow
set shape "person"
]
end
to findNewSpot
while [any? other turtles-here]
[lt random 360 repeat 5 [fd 0.5] ]
move-to patch-here
end
to setMicroVariable
ask buyers
[
set microVariable random-float 10 + 0.5
]
ask sellers
[
set microVariable random-float 8 + 0.5
]
end
to setVariable
set #Agents howManyBuyers + howManySellers
set radius howDistant?
set GHL honestyLevel * 0.461 + ruleOfLaw * 0.204 + democraticAccountability * 0.180 + ((ln #Agents ) * -0.2)
if GHL < 0 [set GHL 0]
ask turtles
[
setPropensity
]
end
to setPropensity
set Propensity (GHL * (0.1) + microVariable * 0.7)
end
to go
set-current-plot "General Honesty Level"
plot GHL
bornDie
getThreshold
checkAround
act
fixNewLevelHonesty
setVariable
tick
end
to bornDie
if howManyBuyers + howManySellers > count patches - 50
[ user-message (word "This society only has room for "( count patches - 50) " agents.")
stop ]
ask one-of turtles
[
set b howManyBuyers - count buyers
while [b != 0]
[ifelse b < 0 [kill][generate]]
set s howManySellers - count sellers
while [s != 0]
[ifelse s < 0 [kill][generate]]
]
end
to kill
ask n-of abs(b) buyers [die]
ask n-of abs(s) sellers [die]
bornDie
end
to generate
ask one-of patches with[not any? turtles-here]
[
sprout-buyers b [setxy random-xcor random-ycor
set color blue
set shape "house"
set microVariable random-float 10 + 0.5
setPropensity
findNewSpot
]
sprout-sellers s [setxy random-xcor random-ycor
set color yellow
set shape "person"
set microVariable random-float 8 + 0.5
setPropensity
findNewSpot
]
bornDie
]
end
to getThreshold
set numberCorrupt 0
set numberNon 0
set T 6 + (0.4 * standard-deviation [Propensity] of turtles)
end
to checkAround
ask turtles
[
while [any? other turtles with [breed = [breed] of myself] in-radius radius with [color = red or color = green ]]
[lookAround stop]
]
end
to lookAround
let r count other turtles in-radius radius with [breed = [breed] of myself and color = red ] / (count other turtles in-radius radius with [breed = [breed] of myself and color = green ] +
count other turtles in-radius radius with [breed = [breed] of myself and color = red ] )
ifelse r > 0.5 [set Propensity Propensity - (1 + random-float 0.5 + r)] [set Propensity Propensity + (2 + random-float 0.5 - r)]
if Propensity < 0 [set Propensity 0]
end
to act
ask sellers
[
move
negotiate
countTransaction
getColor
findNewSpot
]
end
to move
while [not any? buyers-here]
[lt random 360 fd 1 move]
end
to negotiate
let jb item 0 [Propensity] of buyers-here
let js item 0 [Propensity] of sellers-here
if T < jb and T < js [ifelse random-float 1 < 0.05 [set NT 1] [set NT 0]]
if T > jb and T > js [ifelse random-float 1 < 0.95 [set NT 1] [set NT 0]]
if T < jb and T > js [ifelse random-float 1 < 0.6 [set NT 1] [set NT 0]]
if T > jb and T < js [ifelse random-float 1 < 0.4 [set NT 1] [set NT 0]]
end
to countTransaction
ifelse NT = 0 [set numberNon numberNon + 1] [set numberCorrupt numberCorrupt + 1]
end
to getColor
ask turtles-here
[
ifelse NT = 0 [set color green set size 1.3] [set color red set size 1]
]
end
to fixNewLevelHonesty
set-current-plot "% transactions"
set-current-plot-pen "Total transactions"
plot 100
set-current-plot-pen "Total /2"
plot 50
set-current-plot-pen "Non corrupt "
plot (numberNon / (numberCorrupt + numberNon)) * 100
set-current-plot "# Agents"
set-current-plot-pen "# Sellers "
plot count sellers
set-current-plot-pen "# Buyers"
plot count buyers
set-current-plot "Interaction"
set-current-plot-pen "How distant? "
plot howDistant?
let r numberCorrupt / (numberCorrupt + numberNon)
ifelse r > 0.5 [set honestyLevel GHL + (10 * r *(1.66 - exp r) - random-float (r * 3))] [set honestyLevel GHL - (5 * (0.65 + ln (r + 0.01)) + random-float 2)]
if honestyLevel < 0 [set honestyLevel 0]
end
; Copyright 2012 Silvia Casale - Matteo Kersbamer - Luca Piero Aldo Rosazza Gat.