AnyLogic 中的 CustomDistribution() 函数发生了什么?

问题描述 投票:0回答:1

我一直在 AnyLogic 中使用 CustomDistribution() 函数以编程方式从 tableFunction 中抽取随机值。该代码用于验证我的 tableFunction 是否有效。它从 TableFunction 中提取大量样本并将它们存储到 csv 文件中。

String data="";
Random r=new Random(1);
CustomDistribution n=new CustomDistribution(tableFunction,r);
for(int i=0;i<10000;i++){
    data+=n.get()+"\n";
}
try{
    Files.write(Paths.get("files.csv"), data.getBytes());
}catch(IOException e){
    e.printStackTrace();
}

当我在 AnyLogic 中运行代码时,我收到一条错误消息,指出 CustomDistribution() 函数不存在。搜索 AnyLogic 帮助和互联网并没有帮助找到解决方案。

anylogic
1个回答
0
投票

您需要使用 AnyLogic API 为您提供的构造函数,即

CustomDistributionDiscrete
CustomDistributionContinuous
CustomDistributionOptions

始终使用完整代码,API 有助于了解您可以做什么和不能做什么:)

© www.soinside.com 2019 - 2024. All rights reserved.