在查看duaIterate.py中的代码时,我推测duaRouter仅根据行程文件考虑插入新的车辆。尽管交通状况动态,但已经在网络中运行的其他车辆的路线并未更新。
if options.trips:
input_demands = options.trips.split(",")
initial_type = "trip"
elif options.flows:
input_demands = options.flows.split(",")
initial_type = "flow"
else:
input_demands = options.routes.split(",")
initial_type = "route"
for step in range(options.firstStep, options.lastStep):
btimeA = datetime.now()
print("> Executing step %s" % step)
router_demands = input_demands
simulation_demands = input_demands
# demand files have regular names based on the basename and the step
if not (options.skipFirstRouting and step == 0):
simulation_demands = [
get_basename(f) + "_%03i.rou%s" % (step, routesSuffix) for f in input_demands]
if not ((options.skipFirstRouting and step == 1) or step == 0):
router_demands = [get_basename(
f) + "_%03i.rou.alt%s" % (step - 1, routesSuffix) for f in input_demands]
if not (options.skipFirstRouting and step == options.firstStep):
# call duarouter
# 66, see how the duarouter works from here
for router_input, output in zip(router_demands, simulation_demands): # a list of tuple
print(">> Running router on %s" % router_input) #66, see that router_input are used for re-routing
btime = datetime.now()
print(">>> Begin time: %s" % btime)
cfgname = writeRouteConf(duaBinary, step, options, dua_args, router_input,
output, options.routefile, initial_type)
#66 this is to generate the cfg file for duarouter
log.flush()
sys.stdout.flush()
call([duaBinary, "-c", cfgname], log)
上面的代码似乎告诉我们,input_demand来自行程文件。并进一步用作router_demand和Simulation_demand。
我希望SUMO每一步都应检索网络中当前的所有车辆,并从行程文件中插入车辆。我们应该考虑不同边缘的实时权重,路由选择,并为其应用最短路径算法。
我是对的吗?抱歉,如果我误解了代码。