TeamsInCommunity

No preview image

1 collaborator

Default-person Tamar Novik (Author)

Tags

networks 

Tagged by Tamar Novik over 11 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.4 • Viewed 651 times • Downloaded 136 times • Run 0 times
Download the 'TeamsInCommunity' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Info tab cannot be displayed because of an encoding error

Comments and Questions

Is this still alive? (Question)

Hello, I like the idea of this model. But I have been unable to download it (the file appears to be corrupt and the .zip file won't unpack). I cannot run it in NetLogo web either, because of an unimplemented primitive error message

Posted about 8 years ago

Click to Run Model

globals 
[
  max-team-size 
  density 
  density-team-portion
  density-history
  density-team-portion-history
  history-depth
]


turtles-own
[
  explored?       ;; mark turtles we have already visited
  team-id         ;; current team id (changes every tick)
  downtime        ;; the number of time steps passed since the agent last collaborated
]

links-own
[
  link-explored?  ;; mark links we have already visited
  team-tick       ;; last tick in which link was part of a team
]



;;;;;;;;;;;;;;;;;;;;;;;;
;;; Setup Procedures ;;;
;;;;;;;;;;;;;;;;;;;;;;;;

to setup 
  clear-all
  set max-team-size 6
  init-history
  set-default-shape turtles "circle"
  make-turtles
  ask turtles [set color yellow]
  ask turtles [set size 1]
  ask turtles [set explored? false]
  ask turtles [set team-id (2 * community-size / team-size)]
  reset-ticks
  ask turtles
  [
    create-links-with other turtles
    [
      ;; all links start with no team or message age and will appear black
      set team-tick -100
      set hidden? true
    ]
  ]
  ask links [set link-explored? false]
end 

to make-turtles
  create-turtles community-size [ setxy random-xcor random-ycor ]
  layout-circle turtles max-pxcor - 1
end 

to init-history
  set density-history[]
  set density-team-portion-history[]
  set history-depth 10
  let history-counter history-depth
end 

;;;;;;;;;;;;;;;;;;;;;;;
;;; Main Procedures ;;;
;;;;;;;;;;;;;;;;;;;;;;;

to go 
  ;; assemble a new team
  build-teams ;choosing teams randomly (groups of team-size)
  add-messages; add interactions between community members
  update-stats
  tick
end 

;; choose turtles to be in a new team

to build-teams
  loop
  [
    let current-turtle one-of turtles with [ not explored? ]
    if current-turtle = nobody [ stop ]
    ask current-turtle [explore]
  ]
end 



;; adds turtle to a team

to explore
  if explored? [stop]
  loop
  [
    ;; some teams may be smaller than others (if community size is not dividable by team-size)
    let number-of-teams floor (community-size / team-size + 0.9999999)
    let current-team-id random number-of-teams
    let turtles-in-team count turtles with [team-id = current-team-id]
    if turtles-in-team < team-size
    [
      set team-id current-team-id
      set color (current-team-id * 20 + 5)
      let id who
      ;; refreshing all links between this turtle and his teammates
      ask link-neighbors [if team-id = current-team-id [ask link id who [set team-tick ticks]]]
      set explored? true 
      stop
    ]
  ]
end 

to add-messages
  ask turtles
  [
    ;; reset parameters - turtle is not explored and invalid team id is assigned
    set explored? false
    set team-id (2 * community-size / team-size)
  ]
  ask links
  [
    set link-explored? false    
  ]
  ;; go over all links and determine if they should be refreshed (i.e. a message is sent)
  loop
  [
    let current-link one-of links with [ not link-explored? ]
    if current-link = nobody [ stop ]
    ask current-link
    [
      ;; link color represents the reason for message exchange - 
      ;; if this is due to turtles belonging to the same team link will be blue, if this is a random message exchange link will be red
      let link_color red
      let team-age ticks - team-tick
      ifelse team-age > max-downtime-team [set team-age max-downtime-team][set link_color blue]
      
      ;; message probability is determined by a weighted average of the last time both sides belonged to the same team and a constant factor representing a random message exchange
      ;; team size also affects message probability in the sense that larger teams generate smaller intimacy and result in a lower probability for message exchange
      let message_prob ((teamwork-weight * (max-downtime-team - team-age) / max-downtime-team) * 
        ((100 - team-intimacy-factor) + (team-intimacy-factor * ((max-team-size - team-size) / (max-team-size - 1)))) / 100) +
        ((100 - teamwork-weight) / 100 * random-message-prob)
        
      ;; if message probability is larger than a random probability, a message was posted, and link will be drawn
      let message_passed? random 100 < message_prob

      ifelse message_passed?
      [
        set hidden? false
        set color link_color ;;scale-color gray message_prob 0 100
        set thickness message_prob / 200
      ]
      [
        set hidden? true
      ]

      set link-explored? true
    ]
  ]
end 

to update-stats
  let max-density (community-size * (community-size - 1) / 2)
  let num-of-messages count links with [not hidden?] 
  let num-of-team-messages count links with [not hidden? and color = blue]
  let curr-density 100 * num-of-messages / max-density
  let curr-density-team-portion 0
  if num-of-messages > 0 
  [
    set curr-density-team-portion 100 * num-of-team-messages / num-of-messages
  ]
  ifelse ticks < history-depth
  [
    set density-history lput curr-density density-history
    set density-team-portion-history lput curr-density-team-portion density-team-portion-history
  ]
  [
    set density-history replace-item (ticks mod history-depth) density-history curr-density
    set density-team-portion-history replace-item (ticks mod history-depth) density-team-portion-history curr-density-team-portion
  ]
  
  set density mean density-history
  set density-team-portion mean density-team-portion-history
end 

There are 14 versions of this model.

Uploaded by When Description Download
Tamar Novik over 11 years ago fd Download this version
Tamar Novik over 11 years ago defaults Download this version
Tamar Novik over 11 years ago defaults Download this version
Tamar Novik over 11 years ago final with Info Tab Download this version
Tamar Novik over 11 years ago trtr Download this version
Tamar Novik over 11 years ago another try Download this version
Tamar Novik over 11 years ago 3rd try to upload Download this version
Tamar Novik over 11 years ago open day version Download this version
Tamar Novik over 11 years ago open day version Download this version
Tamar Novik over 11 years ago defaults Download this version
Tamar Novik over 11 years ago added colors to team member and density Download this version
Tamar Novik over 11 years ago A first fully working model! Download this version
Tamar Novik over 11 years ago added links Download this version
Tamar Novik over 11 years ago Initial upload Download this version

Attached files

File Type Description Last updated
מסמכים מודלים.docx word קישורים לעבודה מסכמת וליומן אישי over 11 years ago, by Tamar Novik Download
פוסטר תמר נוביק.ppt powerpoint poster over 11 years ago, by Tamar Novik Download

This model does not have any ancestors.

This model does not have any descendants.