Justina Hendricks

No preview image

1 collaborator

Default-person Raphael Grant (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.4.0 • Viewed 22 times • Downloaded 1 time • Run 0 times
Download the 'Justina Hendricks' 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

globals [
  decision-threshold  ;; Порог, выше которого агент принимает решение
  components          ;; Список компонентов в сети
  giant-component-size ;; Размер самого большого компонента
  component-size       ;; Размер текущего компонента
]

turtles-own [
  internal-motivation   ;; Внутренняя мотивация
  external-motivation   ;; Внешняя мотивация
  social-pressure       ;; Социальное давление
  decision              ;; Решение, принятое агентом
  explored?             ;; Булева переменная для отслеживания того, был ли агент уже исследован
]

to setup
  clear-all
  set decision-threshold 60  ;; Устанавливаем порог для принятия решения
  setup-agents
  setup-network
  reset-ticks
  setup-my-plots  ;; Настройка графиков
end 

to setup-agents
  set-default-shape turtles "person"
  create-turtles 100
  [
    setxy random-xcor random-ycor
    set internal-motivation random-float 100
    set external-motivation random-float 100
    set social-pressure random-float 100
    set decision false
    set color gray
    set explored? false
  ]
end 

to setup-network
  ask turtles [
    let num-links random 4 + 1  ;; каждый агент связывается с 1-4 соседями
    repeat num-links [
      let partner one-of other turtles with [not link-neighbor? myself]
      if partner != nobody [ create-link-with partner ]
    ]
  ]
end 

to go
  ;; Каждый агент принимает решение на основе влияния соседей на каждом шаге
  ask turtles [
    let total-influence internal-motivation + external-motivation + (sum [social-pressure] of link-neighbors)
    
    ;; Вероятностное принятие решения на основе общей мотивации
    if total-influence > decision-threshold [
      if random-float 100 < total-influence / 3 [
        set decision true
      ]
    ]
    ;; Иногда агенты могут изменить свое решение обратно
    if decision = true and random-float 100 < 10 [
      set decision false
    ]
    
    update-color
  ]
  
  find-all-components  ;; Вычисляем компоненты сети
  update-my-plots  ;; Обновление графиков в каждом тике
  tick
end 

to update-color
  if decision = true [
    set color green
  ]
  if decision = false [
    set color gray
  ]
end 

;; Настройка графиков

to setup-my-plots
  set-current-plot "Turtle Count"
  clear-plot
  create-temporary-plot-pen "Decided Turtles"
  create-temporary-plot-pen "Undecided Turtles"
end 

;; Обновление данных графиков

to update-my-plots
  set-current-plot "Turtle Count"
  
  set-current-plot-pen "Decided Turtles"
  plot count turtles with [decision = true]
  
  set-current-plot-pen "Undecided Turtles"
  plot count turtles with [decision = false]
end 

;; Дополнительные процедуры для компонентов сети

to find-all-components
  set components []
  set giant-component-size 0
  ask turtles [ set explored? false ]
  loop [
    let start one-of turtles with [not explored?]
    if start = nobody [ stop ]
    set component-size 0
    ask start [ explore ]
    if component-size > giant-component-size [
      set giant-component-size component-size
    ]
    set components lput component-size components
  ]
end 

to explore  ;; turtle procedure
  if explored? [ stop ]
  set explored? true
  set component-size component-size + 1
  ask link-neighbors [ explore ]
end 
; Copyright 2007 Uri Wilensky.
; See Info tab for full copyright and license.

There is only one version of this model, created 2 months ago by Raphael Grant.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.