比较netlogo中不同海龟的变量

比较netlogo中不同海龟的变量,netlogo,Netlogo,我从两个代理行业的简单模型开始,我想打印属于每个代理的两个变量中较小的一个。我真的不知道如何比较来自不同代理的两个变量并打印值。代码的相关部分粘贴在下面: to setup-turtles create-I1 1 [ setxy 0 7 set shape "factory" create-active-links-to I2 set color 125 set product product-I1 set raw-material 0.3

我从两个代理行业的简单模型开始,我想打印属于每个代理的两个变量中较小的一个。我真的不知道如何比较来自不同代理的两个变量并打印值。代码的相关部分粘贴在下面:

to setup-turtles  
 create-I1 1 [  
  setxy 0 7  
  set shape "factory"  
  create-active-links-to I2  
  set color 125  
   set product product-I1  
  set raw-material 0.35 * product-I1  
  set waste (0.003 * product-I1)  
  ]  

  create-I2 1 [  
  set shape "factory"  
  create-active-links-to I1  
  set color 55  
  set product product-I2  
  set raw-material 0.102 * product-I2  
  set waste 0.032 * product-I2  
  ]  

end  

*the problem is here  
to-report E1-2 min [waste of I2 or raw-material of I1]  
  report E1-2  
end  

您是否在尝试将I2的废物价值与I1的原材料价值进行比较?看起来I1和I2都是海龟品种,每个品种只有一只海龟。如果这是正确的,则以下代码将起作用

to-report E1-2
  report min (list [waste] of one-of I2 [raw-material] of one-of I1)
end
请注意,我在您的尝试中添加了一个。NetLogo不知道您将只拥有一个T1和一个T2,因此您必须告诉NetLogo从所有T1s中选择一只海龟,并从所有T2s中选择一只海龟进行比较。在这种情况下,该列表是不必要的,因为您只有两个值要比较,但我将其包括在内,以防您希望将最小值置于更多值之上