You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AnyLogic蒙特卡洛贝叶斯实验中incidence1无法解析问题求助

解决AnyLogic中"incidence1 cannot be resolved"编译错误
  • 修正拼写错误:你代码中写的是incidences1.put(...),但你定义的TreeMap集合名称是incidence1(末尾多了一个s),这是导致编译错误的直接原因,先把变量名统一为incidence1。

  • 确认变量作用域与访问方式:

    • 若incidence1是蒙特卡洛贝叶斯实验的全局变量:确保变量已在实验的「Variables」面板中正确定义(类型为TreeMap<Double, Double>),且在实验的On startup动作中完成初始化:
      incidence1 = new TreeMap<Double, Double>();
      
      之后在After Simulation Run中直接调用:
      incidence1.put(getCurrentIteration(), root.Incidence_Plot);
      
    • 若incidence1是主agent(root)中的变量:需要通过root对象引用访问,同时确保变量可见性设置为public,修正后的代码为:
      root.incidence1.put(getCurrentIteration(), root.Incidence_Plot);
      

内容的提问来源于stack exchange,提问作者Jahidul Hasan Razib

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 10:22:03