面向指数增长的生产选址决策的NetLogo模型

面向指数增长的生产选址决策的NetLogo模型,netlogo,agent-based-modeling,economics,Netlogo,Agent Based Modeling,Economics,我已经创建了一个模型,我正试图用它来复制自动化引起的重新安排生产的现象。 1.我遇到的一个特别问题是,公司的资本呈指数增长,这使得模拟在某一点上崩溃,因为NetLogo无法处理如此大的数字。 2.生产地点的决定取决于国内利润与国外利润之间的比较。根据哪一个较低,这些公司应该迁往“全球北方”或“全球南方”。现在,他们只向北移动,不管我的参数是多少 我在这里根本找不到我的思想错误。任何人事先已经非常感谢了 breed [ firms firm ] ;; defines agentset and

我已经创建了一个模型,我正试图用它来复制自动化引起的重新安排生产的现象。 1.我遇到的一个特别问题是,公司的资本呈指数增长,这使得模拟在某一点上崩溃,因为NetLogo无法处理如此大的数字。 2.生产地点的决定取决于国内利润与国外利润之间的比较。根据哪一个较低,这些公司应该迁往“全球北方”或“全球南方”。现在,他们只向北移动,不管我的参数是多少

我在这里根本找不到我的思想错误。任何人事先已经非常感谢了

breed [ firms firm ]   ;; defines agentset and agents

globals [   ;; general parameters accessible by all agents from all across the world
  labour-unit   ;; either low-, high-skilled labour or robots
  high-skilled-labour-ratio ]   ;; defined through low-skilled-labour-ratio slider as the ratio of labour needs to be 1 in sum


firms-own [   ;; parameters belonging to agents only
  firm-size   ;; divides the firms by size according to their capital
  output    ;; amount of products produced (in units)
  max-level-of-automation    ;; maximal level of efficiency in automation for the specific product line of each firm
  labour-units-at-home   ;; number of workers employed at home
  labour-units-abroad   ;; number of workers employed abroad
  level-of-automation    ;; current efficiency in automation
  actual-low-skilled-labour-ratio   ;; defines the ratio of low-skilled in proportion to high-skilled labour and automation
  actual-high-skilled-labour-ratio   ;; defines the ratio of low-skilled in proportion to high-skilled labour and automation
  robots   ;; number of robots utilised for production
  low-skilled-labour   ;; number of low-skilled-workers (in number of persons) ASSUMPTION: Unlimited availability of low-skilled workers on the labour market
  high-skilled-labour   ;; number of high-skilled-workers (in number of persons) ASSUMPTION: Unlimited availability of high-skilled workers on the labour market
  raw-material-costs   ;; fix costs for raw materials
  budget-for-labour-costs   ;; planned budget available for paying labour wages
  actual-labour-costs   ;; actual budget spent on labour wages
  automation-costs   ;; costs for maintaining and running automated production (e.g. energy costs)
  capital   ;; assumed to be equal to the output (in €)
  revenue   ;; output multiplied by the price per product (in €)
  profit-at-home   ;; revenue minus R&D investment
  profit-abroad   ;; revenue minus R&D investment and foreign surcharges
  r&d-investment   ;; particular share of capital invested in R&D
  foreign-surcharges   ;; additional costs for firms producing abroad such as shipping costs or import tariffs
  relocation-costs   ;; share of profit which would be needed to relocate production
  offshored?   ;; true or false
  reshored?   ;; true or false
  relocated?   ;; true or false
]


to setup
  clear-all   ;; resets all global variables to zero
  clear-all-plots   ;; clears every plot in the model
  setup-economy   ;; create the world division in Germany and the producer countries in the global South
  setup-industry   ;; create the industry
  reset-ticks   ;; resets the tick counter to zero
end


to setup-economy   ;; sets up the geography of the model
  create-firms number-of-firms   ;; number of firms to be defined through slider
  ask patches with [ pycor > 0 ] [
    set pcolor 98 ]   ;; colours Germany in a shade of blue
  ask patches with [ pycor = 0 ] [
    set pcolor white ]   ;; colours the equator white
  ask patches with [ pycor < 0 ] [
  set pcolor 48 ]   ;; colours producing countries in the global South in a shade of yellow
end


to setup-industry   ;; sets up the economy of the model
  setup-firms   ;; see auxiliary code below
  offshoring   ;; defines the amount of firms which have decided to offshore in the past
  state-of-the-art   ;; see auxiliary code below
  costs-calculation   ;; see auxiliary code below
  labour-automation-ratio   ;; see auxiliary code below
  employment   ;; see auxiliary code below
  output-calculation   ;; see auxiliary code below
  revenue-calculation   ;; see auxiliary code below
  r&d-calculation   ;; see auxiliary code below
  profit-calculation   ;; see auxiliary code below
  firms-size-ratio   ;; see auxiliary code below
end


to go   ;; let's go...!!
  tick   ;; advances the tick counter by one
  ask firms [
    ifelse ( offshored? = false ) [
      set capital capital + profit-at-home ] [   ;; sum of the capital and profit (values from the previous time period)
      set capital capital + profit-abroad ] ]
  technological-progress   ;; see auxiliary code below
  costs-calculation
  labour-automation-ratio
  employment
  output-calculation
  revenue-calculation
  r&d-calculation
  profit-calculation
  location-decision   ;; see auxiliary code below
  firms-size-ratio
  bankruptcy
  if ticks = 500 [ stop ]   ;; makes the modell run the same length each simulation
end


to-report random-between [ min-num max-num ]   ;; auxiliary code
   report random-float (max-num - min-num) + min-num
end


to setup-firms   ;; auxiliary code: initial configuration of firms
  ask firms [
    set capital random 1000
    set max-level-of-automation 0 + random-float 1   ;; random between >0 and <1 and will stay fix, because it is unrealistic that it'll be technologically feasible to automise production of all products equally
    set level-of-automation 0 ]   ;; initially all firms have a random output
end


to offshoring   ;; auxiliary code: when it is less likely to automate the product line, the higher the incentive to offshore where manual labour is cheaper
  ask firms [
    set offshored? false   ;; initially all firms report that they have not offshored
    set reshored? false   ;; no firm has initially reshored
    set relocated? false   ;; no firm has initially relocated
    let offshored-firms ( min-n-of ( count firms * ( share-of-offshored-firms / 100 ) ) firms [ max-level-of-automation ] )   ;; specific share of all firms have decided to produce abroad (see: slider on interface)
      ask offshored-firms [
        setxy random-xcor random-between ( -10 ) -1   ;; spread randomly abroad
        set offshored? true ] ]
  ask firms with [ offshored? = false ] [
    setxy random-xcor random-between ( 10 ) 1 ]   ;; all firms at home are randomly spread across Germany
end


to state-of-the-art   ;; auxiliary code: firms' state of the art of technology
  ask n-of ( count firms * ( share-of-automated-firms / 100 ) ) firms [   ;; particular share of firms which already utilise automated robots
    set level-of-automation random-between ( 0.01 ) max-level-of-automation ]   ;; share of production tasks already automated but less than or equal to their maximum-level-of-automation
  ask firms [
    set color scale-color orange level-of-automation 0 1 ]   ;; firms are black when they are not automated and shade into a ligther orange the more their level of automation increases
end


to technological-progress   ;; auxiliary code: efficiency of automation increases proportional to R&D investment
  ask firms [
    ifelse ( ( level-of-automation + r&d-investment ) < max-level-of-automation ) [   ;; R&D investment cannot increase the level of automation beyond its maximum level
      set level-of-automation level-of-automation + r&d-investment ] [
      set level-of-automation max-level-of-automation  ] ]  ;; maximum of automation has been reached
  ask firms [
    set color scale-color orange level-of-automation 0 1 ]
end


to costs-calculation   ;; auxiliary code: capital is used for production costs and the costs for labour
  ask firms [
    set raw-material-costs capital * ( share-of-raw-material-costs / 100 )   ;; specific share of capital (t0) which is used for raw materials (to be defined in interface)
    set budget-for-labour-costs capital - raw-material-costs ]   ;; specific share of capital (t0) which is used for labour
end


to-report share-of-labour-costs   ;; auxiliary code: reports the share used for labour
  report ceiling ( 100 - share-of-raw-material-costs )
end


to labour-automation-ratio   ;; auxiliary code: labour is proportionally divided between the robots, low- and high-skilled labour defined through their ratio
  ask firms [
    set high-skilled-labour-ratio 1 - low-skilled-labour-ratio   ;; labour ratio adds up to 1 in its sum
    ifelse ( level-of-automation >= robots-kill-jobs-threshold ) [   ;; specific threshold defining the level of automation at which low-skilled labour becomes obsolete
      set actual-low-skilled-labour-ratio 0
      set actual-high-skilled-labour-ratio 1 - level-of-automation ] [
    set actual-low-skilled-labour-ratio ( 1 - level-of-automation ) * low-skilled-labour-ratio   ;; 1 labour unit is the sum of the low-, high-skilled-labour-ratio and the level-of-automation
    set actual-high-skilled-labour-ratio ( 1 - level-of-automation ) * high-skilled-labour-ratio ] ]
end


to employment   ;; auxiliary code: defines the type of labour units employed
  ask firms [
    ;; the ratios determine the varying shares of the three different types of labour units
    let share-of-robots budget-for-labour-costs * level-of-automation
    let share-of-low-skilled-labour budget-for-labour-costs * actual-low-skilled-labour-ratio   ;; defines how many workers can be employed dependening on the disposability of labour costs and the level of wages at home
    let share-of-high-skilled-labour budget-for-labour-costs * actual-high-skilled-labour-ratio
    ;; the disposibility of labour costs and the proportional shares of labour determine the actual number of the varying types of labour units at home by costs and wages
    ;floor: reports the largest integer less than or equal to the number as a decimal number would not be realistic here as the unit of measurment are people
    ifelse ( offshored? = false ) [
      set robots floor ( share-of-robots / robot-costs )
      set low-skilled-labour floor ( share-of-low-skilled-labour / wages-low-skilled-labour-at-home )
      set high-skilled-labour floor ( share-of-high-skilled-labour / wages-high-skilled-labour-at-home )
      set labour-units-at-home robots + low-skilled-labour + high-skilled-labour ] [
      ;; the disposibility of labour costs and the proportional shares of labour determine the actual number of the varying types of labour units abroad by costs and wages
      set robots floor ( share-of-robots / robot-costs )
      set low-skilled-labour floor ( share-of-low-skilled-labour / wages-low-skilled-labour-abroad )
      set high-skilled-labour floor ( share-of-high-skilled-labour / wages-high-skilled-labour-abroad )
      set labour-units-abroad robots + low-skilled-labour + high-skilled-labour ]
    ;; as no decimal number can be used to calculate the number of labour units the planned budget for labour costs and its actual amount differ
    ifelse ( offshored? = false ) [
      set actual-labour-costs (
        robots * robot-costs ) + (
        low-skilled-labour * wages-low-skilled-labour-at-home ) + (
        high-skilled-labour * wages-high-skilled-labour-at-home ) ] [
      set actual-labour-costs (
        robots * robot-costs ) + (
        low-skilled-labour * wages-low-skilled-labour-abroad ) + (
        high-skilled-labour * wages-high-skilled-labour-abroad ) ] ]
end


to output-calculation   ;; auxiliary code: each labour unit achieves to produce a specific amount of output which is defined through their productivity
  ask firms [
      set output ( ( low-skilled-labour + high-skilled-labour ) * labour-productivity ) + (   ;; amount of products produced per manual labour unit employed
      robots * robot-productivity ) ]  ;; amount of products produced per robot utilised
end


to revenue-calculation   ;; auxiliary code: it is assumed that all output is sold to the defined sales price of the product
  ask firms [
    set revenue output * sales-price-per-product ]
end


to r&d-calculation   ;; auxiliary code: share of revenue which is used for R&D investment
  ask firms [
    set r&d-investment revenue * ( share-for-r&d-investment / 100 )
    if level-of-automation = max-level-of-automation [
      set r&d-investment 0 ] ]
end


to profit-calculation   ;; auxiliary code: the profit calculation for the firms which produce at home and abroad differs due to additional costs for foreign surcharges
  ask firms [
    set foreign-surcharges revenue * ( share-for-foreign-surcharges / 100 )
    set profit-at-home revenue - raw-material-costs - actual-labour-costs - r&d-investment
    set profit-abroad revenue - raw-material-costs - actual-labour-costs - r&d-investment - foreign-surcharges ]
end


to location-decision   ;; auxiliary code: if the profit of a firm is smaller even after substracting relocation costs of its profit if it would relocate, than the relocation decision is: yes!
  ask firms with [ offshored? = false ] [
    set relocation-costs ( share-for-relocation-costs / 100 ) * profit-at-home   ;; share of profit which would be needed to relocate production
    if ( profit-at-home < ( profit-abroad - relocation-costs ) ) [
      move-to one-of patches with [ pcolor = 48 and not any? turtles-here ]
      set offshored? true
      set reshored? false
      set relocated? true ] ]
  ask firms with [ offshored? = true ] [
    set relocation-costs ( share-for-relocation-costs / 100 ) * profit-abroad
    if ( profit-abroad < ( profit-at-home - relocation-costs ) ) [
      move-to one-of patches with [ pcolor = 98 and not any? turtles-here ]
      set offshored? false
      set reshored? true
      set relocated? true ] ]
end
培育[公司];;定义代理集和代理
globals[;;全球所有代理均可访问的通用参数
劳动力单位;低技能、高技能劳动力或机器人
高技能劳动力比率];;通过低技能劳动力比率滑块定义为劳动力比率总和必须为1
公司拥有只属于代理人的参数
公司规模;;根据资本大小划分公司
产量;生产的产品数量(单位)
最高自动化水平;;各公司特定产品线的最高自动化效率水平
在家的劳动单位;在家雇用的工人人数
国外劳工单位;在国外雇佣的工人人数
自动化水平;;自动化的当前效率
实际低技能劳动力比率;;定义低技能劳动力与高技能劳动力和自动化的比例
实际高技能劳动力比率;;定义低技能劳动力与高技能劳动力和自动化的比例
机器人;;用于生产的机器人数量
低技能劳动力;低技能工人数量(以人数计)假设:劳动力市场上无限制地提供低技能工人
高技能劳动力;;高技能工人的数量(以人数计)假设:劳动力市场上高技能工人的无限可用性
原材料成本;固定原材料成本
劳动成本预算;;可用于支付劳动工资的计划预算
实际劳动成本;用于劳动工资的实际预算
自动化成本;;维护和运行自动化生产的成本(如能源成本)
资本;假设等于产出(单位:欧元)
收入;产量乘以每种产品的价格(单位:欧元)
国内利润;收入减去研发投资
国外利润;收入减去研发投资和国外附加费
研发投资;投入研发的特定资本份额
国外附加费;;国外生产企业的额外成本,如运输成本或进口关税
搬迁成本;搬迁生产所需的利润份额
离岸?;对还是错
重新寄宿?;对还是错
重新定位?;对还是错
]
设置
清除所有;;将所有全局变量重置为零
清除所有地块;;清除模型中的每个绘图
建立经济;;在德国和全球南方的生产国创建世界分部
设置行业;;创建行业
重置刻度;;将滴答计数器重置为零
结束
建立经济;;设置模型的地理位置
创建公司数量;;通过滑块定义的公司数量
使用[pycor>0]询问修补程序[
设置pcolor 98];;把德国涂成蓝色
使用[pycor=0]询问修补程序[
设置“颜色为白色];;把赤道涂成白色
使用[pycor<0]询问修补程序[
设置pcolor 48];;颜色生产国在全球南部的黄色阴影
结束
设立产业;;建立模型的经济性
设立公司;;参见下面的辅助代码
离岸外包;;定义过去决定离岸的公司数量
最先进的参见下面的辅助代码
成本计算;;参见下面的辅助代码
劳动自动化比率;;参见下面的辅助代码
就业;;;参见下面的辅助代码
产量计算;;参见下面的辅助代码
收入计算;;参见下面的辅助代码
研发计算;;参见下面的辅助代码
利润计算;;参见下面的辅助代码
企业规模比率;;参见下面的辅助代码
结束
外带;;走吧。。。!!
打上钩将滴答计数器前进一步
询问公司[
ifelse(离岸?=假)[
设定资本+国内利润][;;资本和利润之和(上一时间段的值)
设定资本+国外利润]]
技术进步;;参见下面的辅助代码
成本计算
劳动自动化比率
就业
产量计算
收入计算
研发成本计算
利润计算
选址决策;;参见下面的辅助代码
企业规模比率
破产
如果滴答声=500[停止];;使模型在每次模拟中运行相同的长度
结束
在[min num max num]之间报告随机数;;辅助代码
报告随机浮动(最大数值-最小数值)+最小数值
结束
设立公司;;辅助代码:公司的初始配置
询问公司[
随机设置资本1000
设置最大自动化水平0+随机浮动1;;随机介于>0和=机器人杀死作业阈值之间)[;;特定阈值定义低技能劳动力过时的自动化水平
将实际低技能劳动力比率设置为0
设定实际高技能劳动力比率1-自动化水平][
设置实际低技能劳动力比率(1-自动化水平)*低技能劳动力比率;;1个劳动力单位是低技能劳动力比率、高技能劳动力比率和自动化水平之和
设定实际高技能劳动力比率(