Repast Simphony调度方法优先级

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

我有一个模型,大约有10个预定方法。现在我对控制他们的执行感到有些困惑。我希望这些预定的方法按特定顺序执行。

如何具有Schedule Parameters.FIRST_PRIORITY,ScheduleParameters.Second_PRIORITY,ScheduleParameters.THIRD_PRIORITY,...和Schedules Parameters.LAST PRIORITY。

scheduler repast-simphony
1个回答
3
投票

各种ScheduleParameters.createX方法都采用指定优先级的double值。例如,如果你有

ScheduleParameters sp1 = ScheduleParameters.createRepeating(1, 1, 0); ScheduleParameters sp2 = ScheduleParameters.createRepeating(1, 1, 10);

sp1的优先级为0,sp2的优先级为10。使用sp1和sp2安排的操作将在tick 1处发生,然后在每个tick之后发生。但sp2操作将在sp1操作安排在相同的tick之前发生。

还有两个特殊优先级值ScheduleParameters.FIRST_PRIORITYScheduleParameters.LAST_PRIORITY,可用于确保在同一刻度的任何其他操作计划之前或之后执行操作。

有关更多信息,请参阅https://repast.github.io/docs/api/repast_simphony/repast/simphony/engine/schedule/ScheduleParameters.html

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