首页 > 解决方案 > NetLogo:使用 SDM 中“库存”的值作为 ABM 的输入

问题描述

我做了两个简单的模型;NetLogo 中的一个系统动力学模型和一个基于代理的模型。SDM 有一个存量“游客”,其价值取决于流入和流出。每次报价都会重新计算该值。游客们在 ABM 的每一刻都在萌芽。现在,我想使用 TouristStock 的值作为基于代理的模型中每个滴答声都发芽的海龟的输入。做这个的最好方式是什么?我已经检查了模型库中的示例代码(如 Tabonuco Yagromo 模型),但这对我来说没有任何意义。将这些模型相互集成的最佳方式是什么?提前致谢!

ABM的相关代码如下:

to go

  clear-turtles

  ;sprouts turtles only on patches with value beach AND patches that are close to the lagoon (calculated in ArcMap)
  ;the initial number of tourists is multiplied by the percentage of tourists that were satisfied in the previous tick.
  ;percentage of tourists that were not satisfied is subtracted from 100 and divided by 100 to make it a factor between 0-1.

  ask n-of (initial-number-tourists * ((100 - percent-dissatisfied) / 100)) (patches with [ beach_close_to_lagoon = 1])
  [
    sprout 1 [
      set color black
      set size 10
    ]
  ]

  ask turtles [
    set neighbor min-one-of other turtles [distance myself]  ;; choose my nearest tourist based on distance
    set distance-tourist distance neighbor                   ; measure/calculate distance of closest neighboring tourist
  ]

  ask turtles
  [ ifelse distance-tourist > 5
      [ set satisfied? True]
      [ set satisfied? False ] ]

  update-turtles                                             ;before the end of each tick, the satisfaction of each turtle is updated
  update-globals                                             ;before the end of each tick, the percentage of satisfied tourists is updated in globals

  ;clear-turtles                        ;because each tick represents one day, the tourists will leave the beach after one tick so the turtles will die

  tick

end

标签: netlogohybridpython-turtleagent-based-modelingsystemdynamics

解决方案


推荐阅读