模拟市场中的销售-意外的个人水平结果

时间:2019-07-05 02:26:03

标签: netlogo

作为政治经济学模拟的一部分,我希望模拟消费品市场。

从本质上讲,资本家对消费品的需求是相同的,这些需求是他们付给工人并购买资本后所剩现金的结果。系统中有工作的工人(并非全部)对工资的消费品需求相同。目的是涵盖目前的纯交换-没有销售利润。这是总体上的工作,而不是微观上的工作。

截至目前,海龟找到了可行的买家(可以找到正库存的最低价格,在当前版本中,所有价格都相同),购买股票,付款,减价销售和更新需求变量。代码如下,我试图尽可能清楚地注释它。

;;market algorithm in case of market prices being exactly equal

to consumption-market 
  if count(capitalists with [price-it = [price-it] of min-one-of capitalists [price-it] and inv-it > 0]) > 1 [

;;if-condition for price equality case

    ask turtles [
      set C-demanded C-demand
    ]

;;fix period consumption demand so it doesn't keep updating during loop (?)

    ask turtles [
      repeat C-demanded [
        set sale-ID ([employer-ID] of one-of capitalists with [price-it =[price-it] of min-one-of capitalists [price-it] and inv-it > 0])
        set last-price-paid ([price-it] of capitalist sale-ID)

;;for each unit demanded find viable seller and record seller's price. in price equality case, buyers are indifferent to sellers (don't look for lowest price)

        ask capitalist sale-ID [
                set inv-it (inv-it - 1)
                set money-it (money-it + price-it)
                set real-sales-it (real-sales-it + 1)
                set cash-sales-it (cash-sales-it + price-it)
                    if [C-demand] of myself = 0 or [money-it] of myself < [last-price-paid] of myself [stop]
                    if [inv-it] of capitalist [sale-ID] of myself = 0 [stop]
        ]
        set C-demand (C-demand - 1) 
        set money-it (money-it - last-price-paid)
    ]
  ]
]

;;remove from inventory, earn, record sales. close loop is demand is met, money runs out or seller inventory goes dry. mark down own demand, pay for good.

  set real-sales-t (sum [real-sales-it] of capitalists)
  set cash-sales-t (sum [cash-sales-it] of capitalists)

;;record aggregates
end

该代码大部分有效-我最终得到了预期的总销售额,要求零,现金被花费,利润和亏损被抵消为零。但是,由于所有资本家和雇员都要求以相等的价格提供相等数量的商品,所以公司的所有销售/库存也应该相等,并且各个资本家的利润率都应为0。

但是,最终在微观水平上会有细微的变化-各个值徘徊在应有的位置,有时与预期值相差12-15%。

这仅仅是NetLogo语言/基于代理的环境的产物,还是如果我使用不同的编码,是否可以获得预期的结果(完全相等)?

0 个答案:

没有答案