我试图将一个变量从一个过程作为输入传递到另一个过程netlogo

时间:2015-03-30 22:06:31

标签: netlogo

我正在尝试将formBuyerAggressiveness传递给bidTargetPrice过程。它正在给一位预期的记者"错误信息。到目前为止,这是我的代码。

to bidTargetPrice [tradeID]

   let buyerAggressiveness [formBuyerAggresiveness] of tradeID

  ; if ( buyerAggresiveness <= 1 ) [
   ifelse (- 1 < buyerAggresiveness) and (buyerAggresiveness <= 0)
        [report equilibriumPrice * (1 - ( ( ( e ^ (- buyerAggresiveness * theta ) ) - 1) / (e ^ theta - 1) ) )
          ]

        [report equilibriumPrice + ( (value - equilibriumPrice) * ( ( (e ^ (buyerAggresiveness * theta) ) - 1 ) / ( (e ^ theta) - 1) ) )
          ]
 ;  ]

以下是我在上述程序中所述的程序。我打算将买家激进参数传递给有助于形成价格的收购。

to formBuyerAggresiveness 
     ;define some local parameters


      ifelse (transactionPrice > 0.0 ) 
        [ ifelse (bidTargetPrice >= transactionPrice) 
             [ let desiredAggressiveness ( ( (1 - C2 ) * rshout) - C1 ) ;rshout is the degree of aggressiveness that would form a price equal to the  last bid
               report buyerAggressiveness (degreeOfAggressiveness  + B1 * (desiredAggressiveness - degreeOfAggressiveness) )             ;degreeOfAggressiveness is a random of individual trader aggressiveness from -1 to 1 range. *defined during init user/buyer
             ]

             [ let desiredAggressiveness ( ( (1 + C2 ) * rshout) + C1 ) ;buyer must be more aggresive
             report degreeOfAggressiveness  + B1 * (desiredAggressiveness - degreeOfAggressiveness)
              ] 
        ]

         [ if (bid?) and (bidTargetPrice <= bestBid) 
            [let desiredAggressiveness ( ( (1 + C2 ) * rshout) + C1 )
             report degreeOfAggressiveness  + B1 * (desiredAggressiveness - degreeOfAggressiveness)
              ]
         ]
end           

1 个答案:

答案 0 :(得分:1)

问题在于行let buyerAggressiveness [formBuyerAggresiveness] of tradeID。有错误消息告诉您[formBuyerAggresiveness]不是记者。短语[attrA] of myagent仅在myagent(i)为代理且(ii)具有此属性时有效。

要解决此问题,您至少有两个选择。

  1. 为您的代理人提供aggressiveness属性,并为set编写一个程序,然后您可以使用[aggressiveness] of myagent
  2. 进行访问
  3. 编写记者,将代理作为参数并返回该代理的侵略性值