Simulation
Intro
Ship check model
- 模型
软件-欢迎页面
软件界面
船舶过闸安检逻辑模型
逻辑界面
示例
属性面板
时间计算
1
2agent.timeStart=time();
timeStay=time()-agent.timeStart;优先级示例
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27class RandomSelector {
public int select(int[] nums, double[] probs) {
if (nums == null || nums.length == 0 || probs == null || probs.length == 0 || nums.length != probs.length) {
throw new IllegalArgumentException("Invalid input");
}
double cumProb = 0.0;
Random rand = new Random();
double probSelect = rand.nextDouble() * Arrays.stream(probs).sum();
for (int i = 0; i < nums.length; i++) {
cumProb += probs[i];
if (probSelect <= cumProb) {
return nums[i];
}
}
return nums[nums.length - 1];
}
}
int[] nums = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
double[] probs = {0.67, 0.1, 0.05, 0.04, 0.04, 0.03, 0.02, 0.02, 0.01, 0.01, 0.01};
RandomSelector generator = new RandomSelector();
int priority = generator.select(nums, probs);
return priority;拓展示例
Summary
- 如何建立自己的模型
- 明确研究问题
- 熟悉Anylogic软件操作
- 跟随教程搭建初始的基础模型
- 拓展/添加个性化属性
- Bug? Need help?
- Check
- Ask: 人 / 机
- Title: Simulation
- Author: Murphy Lee
- Created at : 2023-07-18 11:28:13
- Updated at : 2023-10-23 14:04:56
- Link: https://redefine.ohevan.com/2023/07/18/Simulation/
- License: This work is licensed under CC BY-NC-SA 4.0.
Comments