【发布时间】:2019-09-07 10:44:38
【问题描述】:
我通过给出 from 和 to 边来定义流程。在测试一些交通信号算法时,我发现网络很容易陷入僵局,部分原因是车辆找不到动态的用户平衡路线。因此,我的目标是让那些定义的流程(车辆)在每个模拟时间步中找到动态的用户平衡路线。我知道双路由器应该是解决方案。但是如何在每个仿真时间步调用duarouter,我应该如何在我的代码中加入duarouter?
我遵循了 SUMO 网站提供的示例代码。基本上我定义了一个 run() 函数,它定义了我的信号控制算法。然后我在主函数中调用 run() 。
我应该在哪里插入双路由?
我应该如何在我的模拟循环中调用它,以确保在每个时间步,网络中的车辆都能找到它的用户平衡路线。
dua-iterate.py -n <PATH_TO_SUMO_NET> -t <PATH_TO_TRIPS>
def run():
"""execute the TraCI control loop"""
step = 0
NSphase = 0
EWphase = 2
while traci.simulation.getMinExpectedNumber() > 0:
traci.simulationStep() # this means let the simulation go forward for one step
step += 1
{signal control algorithm}
traci.close()
sys.stdout.flush()
if __name__ == "__main__":
traci.start(["/home/hao/sumo_binaries/bin/sumo-gui", "-c", "/home/hao/Documents/traci_test/randomnet4/random.sumo.cfg",
"--tripinfo-output", "tripinfo.xml"])
run()
【问题讨论】:
-
如果我理解正确的话,duarouter.py是否只在需求文件生成车辆时分配DUE路线?我的意思是,车辆已经加载到网络上,考虑到动态交通状况,它们还能更新路线吗?
标签: sumo