NetLogo Behavior Space не считается одной из моих пород - PullRequest
0 голосов
/ 02 февраля 2019

Я работаю над моделью для имитации укусов клещей в Нидерландах.Мой код закончен, и теперь я хочу использовать Behavior Space для генерации выходных файлов.У меня есть две породы в моей модели: «жители» и «туристы-2d».Из обеих пород я хочу подсчитать, сколько черепах получили укус клеща.Местная порода работает, а туристическая - нет.Кто-нибудь может мне помочь, как это исправить?Я думаю, это потому, что моя порода туристов происходит из списка, но я не знаю, как это исправить.Даже если я просто использую 'count tourist-2d', выход Behavior Space будет равен 0.

globals [ month month-day week week-day tourist-2d-list ]
breed [ residents resident ]
breed [ tourists-2d tourist-2d ]

to setup
  ca
  file-close-all
  reset-ticks

; ---------- Creating tourist-lists -----------
  set tourist-2d-list (list 1 1 2 4 8 17 38 85 188 420 935 2086 4651 10371 18750 18750 10371 4651 2086 935 420 188 85 38 17 8 4 2 1 1)
end

to go
  set month ceiling(ticks / 30)
  set month-day (ticks mod 30)
  set week ceiling(ticks / 7)
  set week-day (ticks mod 7)

; ---------- Set tick dynamics per month ----------

  if month = 13 and month-day = 1 [reset-ticks]

; ---------- Set 2-day tourist dynamics per week ----------

 initialize-tourists-2d

  tick

 remove-tourists
end


to initialize-tourists-2d
    if week-day = 6 [
    if week > 14 and week < 45 [
      create-tourists-2d item (week - 15) tourist-2d-list [set color pink set shape "person" setxy -14 -7 set stay-period 2 set day-counter 0 ]
    ]
  ]
end

to remove-tourists
  ask tourists-2d [set day-counter (day-counter + 1)
    if day-counter = stay-period [die]
  ]
end

Дополнительная информация к моему коду: tourist-2d-list является глобальным, а tourist-2d - породой.Было бы здорово, если бы кто-нибудь мог мне помочь!

1 Ответ

0 голосов
/ 03 февраля 2019

Пожалуйста, опубликуйте минимальный рабочий пример для такого вопроса.Это будет выглядеть следующим образом:

globals [tourist-2d-list week-day week]
breed [tourists-2d tourist-2d]

to setup
  set tourist-2d-list (list 1 1 2 4 8 17 38 85 188 420 935 2086 4651 10371 18750 18750 
                            10371 4651 2086 935 420 188 85 38 17 8 4 2 1 1)
  reset-ticks
end

to go
  if (ticks > (45 * 7)) [stop]
  set week-day ticks mod 7
  set week (int ticks / 7)
  add-tourists
  tick
end

to add-tourists
if week-day = 6 and week > 14 and week < 45 [
  create-tourists-2d item (week - 15) tourist-2d-list [init-tourist]
  print (count tourists-2d) ;print to debug
]
end

to init-tourist
  ; put initializations here
end

Как видите, счетчик не равен нулю.

...