다른 연령대의 에이전트의 소셜 네트워크가 링크로 연결된 에이전트의 원형 결과 다음, 유사 NetLogo에 설정된 특정 에이전트 및 품종 간의 특정 링크를 비활성화. 이러한 링크의 전반적인 목적은 해당 링크 간의 접촉을 나타내는 것입니다. 이 모델은 네트워크를 통한 감염 확산을 시뮬레이션합니다. 에이전트는 감염되기 쉬운 링크 이웃과 접촉하게되면 감염 될 가능성이 있으므로 감염되기 쉽습니다. 예를 들어 감염된 개체의 격리 또는 격리를 모델링하고 싶습니다. 즉 다른 사람과의 링크가 완전히 비활성화되거나 링크의 대부분이 비활성화됩니다. 이상적으로는 관찰자 인터페이스의 버튼을 눌러 감염된 에이전트의 링크를 비활성화하십시오. 나는 또한 대다수의 유아들과 아이들과 그들의 서로의 연결이 비활성화되어 아이들 사이에 감염의 능력이 멈추는 학교 폐쇄를 모델링 할 수 있기를 바랍니다. 어른들과의 연결 고리는 더 적 으면 공개되어야하지만, 한 번에 한 번에 하나의 품종을 연결하는 것이 더 낫습니다.효과적으로 소셜 네트워크
breed [ toddlers toddler ]
breed [ children child ]
breed [ adults adult ]
breed [ over45s over45 ]
globals
[
num-nodes
num-infected
num-susceptible
prob-infection-toddler
prob-infection-child
prob-infection-adult
prob-infection-over45
force-of-infection
]
turtles-own
[
temp-infected? ;; temporary infected state
infected? ;; true if agent has been infected
susceptible?
num-infected-neighbors
]
links-own
[
closed?
]
to setup
clear-all
create-toddlers 20
create-children 20
create-adults 20
create-over45s 20
create-network
reset-ticks
layout-circle (sort turtles) max-pxcor - 8
ask turtles
[
facexy 0 0
if who mod 2 = 0 [fd 4]
]
ask turtles
[set susceptible? true]
ask one-of turtles
[
set infected? true
set susceptible? false
set color red
]
display
end
to create-network
let connexions (list
(list toddlers toddlers 5)
(list toddlers children 2)
(list toddlers adults 2)
(list toddlers over45s 1)
(list children toddlers 3)
(list children children 8)
(list children adults 5)
(list children over45s 1)
(list adults toddlers 1)
(list adults children 3)
(list adults adults 6)
(list adults over45s 3)
(list over45s toddlers 1)
(list over45s children 1)
(list over45s adults 5)
(list over45s over45s 5)
)
foreach connexions [
let source-breed item 0 ?
let target-breed item 1 ?
let num-connexions item 2 ?
let reverse-num-connexions item 2 first filter [
item 0 ? = target-breed and item 1 ? = source-breed
] connexions
ask source-breed [
repeat num-connexions [
let possible-targets other target-breed with [
(not member? myself link-neighbors) and
(count link-neighbors with [ breed = source-breed ] < reverse-num-connexions)
]
let target one-of possible-targets
if target != nobody [ create-link-with target ]
]
]
]
ask links [set closed? false]
end
to spread
;;; there is one of these for each age group as they have different probabilities for infection
ask toddlers with [ susceptible? = true ]
[
;;tried changing to something like this but this is the line that throws up an error
ask my-links with [closed? = false][
set num-infected-neighbors count (link-neighbors with [infected? = true])
]
;;should only include active links
set force-of-infection (prob-infection-toddler)^num-infected-neighbors ;;paraphrased equation but num-infected-neigbours is important
if (random-float 1 <= force-of-infection) ;; infect with probability p
[
set temp-infected? true
set susceptible? false
]
]
ask turtles with [temp-infected? = true]
[
set infected? true
set temp-infected? false
]
end
to isolate-infected
;;for all infected individuals deactivate their links
end
to close-schools
ask toddlers
[
ask my-links [set closed? true]
]
end
to close-offices
;; e.g cut the number of links between adults and so on
end
당신은이 두 가지 문제는, 여기에 하나가 비활성화가 (이상적으로 그들은 학교 폐쇄가 끝났다 후 다시 켜거나 감염된 개인이 예를 들어, 복구 후 수) 링크의 어떤 상태에 기초 볼 수 있듯이 엔드 노드가 있거나 그 종족이 번식하고 있습니다.
그리고 비활성화 된 링크를 포함하지 않고 감염된 링크 이웃의 수를 계산의 두 번째 문제. 링크를 숨기더라도 기존 링크가 보이지 않게되고 링크가 중지되지 않습니다. 또한 비활성화 된 링크의 색상을 예를 들어 검은 색으로 변경하는 것으로 생각했습니다. 검은 색이 아니거나 예를 들어 숨겨진 링크 만 계산하도록 감염된 이웃 수를 다시 쓸 수있는 방법이 있습니까 set num-infected-neighbors count (link-neighbors with [infected? = true]
... 링크가 숨겨져 있습니까? = false .... 또는 link-color "! ="black?
)
나는 두 번째 문제는 아마 두 가지의 쉽게 느낄 수 있지만 잘못 될 수있다. 나는이 단계에서 너무 많은 벽돌 벽에 부딪 혔고, 머리는 그 문제에 대해 튀겨졌다. 어떤 도움이라도 대단히 감사하겠습니다. 폐쇄에 대한 링크를 추가-자신의 부울 : 당신의 시간은 이미를 읽어 주셔서 감사합니다, 나는 이전에 그의 도움을 니콜라스 호 Payette 다시
편집 호언 장담 : 감사의 약간이었다 실현?
오픈 링크에 감염된 이웃의 수를 계산 섹션을 변경하는 시도하지만 모두의 아주 기본적인 폐쇄를 제공 "에 가까운-학교"에 this code can't be run by a link error while link 14 15 running SET called by procedure SPREAD called by Button 'Spread'
는 또한 기능에 추가 된 오류 설정에 의한 유아 링크가 폐쇄 되었습니까? 사실
편집에이 여기에 가능한 솔루션
set num-infected-neighbors 0
ask my-links with [closed? = false][
ask other-end [if (infected?) [set num-infected-neighbors num-infected-neighbors + 1 ]]
]
set force-of-infection 1 - (1 - prob-infection-adult)^num-infected-neighbors
편집 될 것이다 : NUM에 감염된-이웃까지 내가 말할 수있는 같은 turtles-own
변수해야하지만, 나는 거북이에 시계를 넣을 때 시뮬레이션을 실행하면 거북이가 가지고있는 num-infected-neighbors가 거북이가 가지고있는 링크 - 이웃의 실제 수를 지속적으로 초과하는 것으로 보입니다. 그것은 또한 잘못되었습니다.
let infectnum 0
set num-infected-neighbors 0
ask my-links with [closed? = false][
ask other-end [if (infected?) [set infectnum infectnum + 1 ]]
;;set num-infected-neighbors count (link-neighbors with [infected? = true])
]
set num-infected-neighbors infectnum
중 하나가 제대로 작동하지 않는 것 ... : 나는
편집 .... 왜하지만 볼 수 없습니다
편집 : 미래의 참조 문제에 대한 해결되었다 -
set num-infected-neighbors length filter [[infected?] of ?]
[other-end] of my-links with [not closed?]
첫 번째 목록이 아닌 폐쇄 링크에 링크 이웃 형성되고, 그 다음은 감염된 사람을 여과한다. num-infected-neighbors는 해당 목록의 길이입니다.
귀하의 의견을 보내 주셔서 감사 드리며, 실제로 구현 한 것보다 코드가 적습니다. 나는 그것을 제거하려고 노력했지만 동시에 가치있는 정보를 남기고 싶지 않았습니다. 실수로 전역 변수를 생략했습니다. – Steve
퍼짐에 관해서, 내가 사용하고있는 공식은 거북이가 가지고있는 전염성 이웃의 수를 세는 것이 필요합니다. 내가 해봤 뭔가를 보여 내 코드를 편집했지만 그것이 나에게 링크 (11) (12)는 절차 스프레드 에 의해 호출 SET 을 실행하는 동안이 코드는 버튼에 의해 호출 링크 오류로 실행할 수 없습니다 "라는 오류를 준다 '확산 ' " – Steve
단순화에 대해 이해합니다. 이 질문에 대해 중요한 것이 무엇인지 파악하기 란 쉽지 않습니다. 질문을 감안할 때, 나는 다른 품종이 모두 필요하다고 생각하지 않습니다. – Mars