NetLogo에서 인간 에이전트의 동물 에이전트를 회피하려고합니다. 먼저, 한 명의 육식 동물에게 두 가지 행동, "경계"와 "두려운 행동"을 사용하지 못하도록 요청했습니다. 이것은 잘 작동했습니다. 그러나 그때 나는 먹이 동물들 (지금 168 명이지만 잠재적으로 더 많은 사람들)에게 똑같이하도록 요청했고 모델은 달팽이 속도로 느려졌습니다. NetLogo를 처음 접했을 때 나는이 행동을 코딩하는보다 효율적인 방법이 있다고 확신합니다. 이 프로세스를 간소화하는 방법에 대한 제안? 더 좋은 방법이있을 것이라고 확신합니다. 감사!NetLogo에서 에이전트 동작 간소화
to avoid-people ;; test if people too close to predator and prey and animals moves away if is.
ask predator [
ifelse ticks mod 24 >= 5 and ticks mod 24 < 18 [ ;makes sure the animals respond to people during the daytime
humans-near
ifelse any? wary
[ fd 0 ]
[ ]
humans-too-near
if any? scared
[run-away]
] [set wary 0 set scared 0]]
ask preys [
ifelse ticks mod 24 >= 5 and ticks mod 24 < 18 [
humans-near
ifelse any? wary
[ fd 0 ]
[ ]
humans-too-near
if any? scared
[run-away]
] [set wary 0 set scared 0]]
end
; 가까운 인간 및 인간이 너무나 가까운 함수이다 ; 경고 거리 행 개시 거리는 육 용 슬라이더하지만 먹이 값을 설정
to humans-near ;;adds all humans in alert-distance radius of animal to an agent subset for that agent.
ask predator [
set wary humans in-radius alert-distance]
ask preys [
set wary humans in-radius 10]
end
to humans-too-near ;;adds all humans in flight-initiation-distance radius of animal to an agent subset for that agent.
ask predator [
set scared humans in-radius flight-initiation-distance]
ask preys [
set scared humans in-radius 5]
end
to run-away ;;Make animal avoid the human closest to it.
set nearest-human min-one-of scared [distance myself]
turn-away ([heading] of nearest-human) max-separate-turn
end
; 이것은 동물들을 열대 우림과 인간 정착지에서 멀리 떨어 뜨려줍니다.
; 최대-별도의 턴은 육식 동물이 멀리 나는 당신의 코드를 이해하지 못했다
to turn-away [new-heading max-turn]
turn-at-most (subtract-headings heading new-heading) max-turn
ifelse [habitat = typeTrop] of patch-ahead run-distance
[fd run-distance] [turn-away ([heading] of nearest-human) max-separate-turn]
end
to turn-at-most [turn max-turn]
ifelse abs turn > max-turn
[ ifelse turn > 0
[ rt max-turn ]
[ lt max-turn ] ]
[ rt turn ]
end
Wary와 Scared에 대한 코드를 게시하고 너무 오래 걸리는 코드를 게시하면 (사용자 프로파일 러 확장) – Marzy
Wary가 함수인지 어떻게 이해할 수 있습니까? 이 에이전트의 속성은 무엇입니까? – Marzy
이것은 netlogo, http://www.complexityexplorer.org/online-courses/3/segments/1028을 사용하는 좋은 복합 과학 과정입니다. – Marzy