【问题标题】:Agent-based and individual-based modeling (Railsback and Grimm, 2019) NetLogo Business Model基于代理和基于个体的建模(Railsback 和 Grimm,2019)NetLogo 商业模式
【发布时间】:2021-10-25 04:39:53
【问题描述】:

我正在尝试通过这本书来学习基于代理的建模,但是我在实现第 10 章中的模型时遇到了麻烦。已经发布了一个关于这个模型的问题,但是这本书的第二版已经发布了发布,我认为模型已经改变,因为效用函数和之前提出的问题中的一些值不匹配。

我的模型确实有效,但是当我尝试在 BehaviourSpace 中运行实验时,我的结果与书中的结果大不相同。有没有其他人尝试过这个模型或者可以发现其他错误?

谢谢!

我的代码:

globals [ decision-time-horizon ]

turtles-own [ location wealth ]
patches-own [ annual-profit annual-risk ]

to setup
  clear-all

  set decision-time-horizon 5

  ask patches
  [
    set annual-profit random-exponential 5000
    set annual-risk 0.01 + random-float ( 0.1 - 0.01 )
    set pcolor scale-color grey annual-profit 1 5000
  ]

  create-turtles 25
  [
    setxy random-xcor random-ycor
    move-to one-of patches with [not any? turtles-here]
    set wealth 0
    set color red
    set shape "house"
  ]

  reset-ticks
end

to go
  ask turtles 
  [ 
    reposition 
    pen-down 
  ]
  tick

end

to reposition
  let potential-destinations neighbors with
    [ not any? turtles-here ]
  set potential-destinations
    ( patch-set potential-destinations patch-here)

  ; identify the best one of the destinations
  let best-patch max-one-of potential-destinations
  [ utility-for myself]
  ; now move there
  move-to best-patch

end

to-report utility-for [ a-turtle ]
  ; a patch-context reporter that calculates utility
  ; for an investor turtle in this patch
  ; first get the turtle's current wealth
  let turtles-wealth [ wealth ] of a-turtle

  ; then calculate the investor's utility given by its wealth and
  ; relevant patch variables
  let utility ( turtles-wealth + ( annual-profit * decision-time-horizon )) * (( 1 - annual-risk ) ^ decision-time-horizon)

  report utility

end

【问题讨论】:

    标签: netlogo agent-based-modeling


    【解决方案1】:

    你说得对,这个模型在我们的第 2 版中有所不同。

    我没有仔细检查您的代码非常,但我没有发现任何真正的错误。但是,您缺少更新海龟财富每个时间步长的代码,包括确定投资是否失败(财富变为零)。

    我们书的网站 (www.railsback-grimm-abm-book.com) 邀请像您这样自学的人向我们寻求解决方案。如果您想访问它们,请联系我们。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-04-26
      • 2015-12-16
      • 2017-03-31
      • 2011-06-21
      • 2011-05-13
      • 1970-01-01
      • 2012-02-06
      • 2010-09-15
      相关资源
      最近更新 更多