네트워크 기반 시장을 시뮬레이션하는 모델을 만들고 있습니다. 이 모델에서 거북이 / 노드 는 거북이 소유 변수 인 포인트 라는 보상을받습니다 .
이제 주어진 학위를 가진 노드가 갖는 평균 포인트 수에 대한 노드의 정도 그래프를 그리려고합니다. 인터페이스 탭에서 플롯을 생성하여이 작업을 시도했지만이 작업을 수행 할 수 없습니다.
다음은 플롯 설정 창 이미지입니다.
내가 어떻게이 일을 할 수 있는지 아는 사람 있나요?
Also, I keep getting these "Runtime error: Can't find the maximum of an empty list" in all the plots/histograms I create. It is not a big deal at the moment as they seem to work fine, however if you know why these appear please let me know!
Thanks beforehand,
Carlos
For simplicity and to avoid overloading your plot setup, I like to use to-report
procedures for things like this. As a quick example try this setup:
turtles-own [ points degree ]
to setup
ca
crt 50 [
set degree 5 + random 5
set points random 10
setxy random-xcor random-ycor
]
reset-ticks
end
Make a to-report
each for a list of existing degrees, the average points of turtles that have each degree, and the maximum of those average point values:
to-report degrees-list
report sort remove-duplicates [degree] of turtles
end
to-report avg-points-list
let avg-list map [ i ->
mean [points] of turtles with [ degree = i ]
] degrees-list
report avg-list
end
to-report max-avg
report precision ( max avg-points-list + 1 ) 2
end
이 예에서는 degrees-list
보고서 [ 1 2 3 4 5 ]
, avg-points-list
같은 보고서 [6.5 3.9285714285714284 6 3.75 4.2]
및 비슷한 보고서 를 작성합니다. 물론 정확한 값은 설정이 무작위이기 때문에 달라질 수 있습니다.max-avg
7.5
이제 플롯 창을 설정할 수 있습니다.
실제 플로팅은 의 해당 값에 대해 점 값을 플로팅 하는 데 사용 되는의 foreach
기본 요소에 의해 처리됩니다 . 다음과 같은 플롯을 제공해야합니다.plot pen
plotxy
avg-points-list
degrees-list
그것이 당신이 추구하는 것과 같은 희망입니다!
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다