Asymmetric broadcast consensus

Asymmetric broadcast consensus preview image

1 collaborator

Profile Luka Grgicevic (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.3.0 • Viewed 56 times • Downloaded 8 times • Run 0 times
Download the 'Asymmetric broadcast consensus' 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

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

turtles-own [past-state present-state color-initial]

; Create nodes

to setup

  clear-all
  ask patches [set pcolor white]
  let average 0
  create-turtles num-nodes [
    set shape "circle"
    setxy random-xcor random-ycor
    set color random 140
    set color-initial color
    set average average + color
  ]

  ; Print the initial average

  print (word "Initial average is: " (average / num-nodes))
  reset-ticks
end 

; Asymmetric broadcast algorithm

to go

 ; Let one node make a broadcast

  ask one-of turtles [

    carefully [

    ; If there are listeners, tell them to change their values somewhere in between, according to the ratio Q

    let P color
    ask link-neighbors [set color (color * Q + P * (1 - Q))]
    ]

    ; If there are no links, remove the node

    [ask turtle who [die]]

  ]

  ; Plot the pens on the graph for each node

    ask turtles [
    create-temporary-plot-pen (word who)
    set-plot-pen-color color-initial
    plot color]

  tick
end 

; Connect the nodes

to setup-spatially-clustered-network

  let num-links (average-node-degree * num-nodes) / 2
  while [count links < num-links ]

  [
    ask one-of turtles
    [
      let choice (min-one-of (other turtles with [not link-neighbor? myself]) [distance myself])
      if choice != nobody [ create-link-with choice ]
    ]
  ]

  ; Make the network look a little prettier

  repeat 10
  [
    layout-spring turtles links 0.3 (world-width / (sqrt num-nodes)) 1
  ]
end 

There is only one version of this model, created over 1 year ago by Luka Grgicevic.

Attached files

File Type Description Last updated
Asymmetric broadcast consensus.png preview Preview for 'Asymmetric broadcast consensus' over 1 year ago, by Luka Grgicevic Download

This model does not have any ancestors.

This model does not have any descendants.