SYS BJTUCODING.WIN UTC --:--:--Z POW_GATE INIT HASHES 0 CORES - UTILITY 0.00%

SUMO 与 TraCI 交通仿真批处理脚本规范:固定种子与指标聚合

做放学时段或交叉口信控对照仿真时,最容易忽略的是随机种子与车辆出发序列一致性。建议每次批量仿真显式传入 --seed 并输出独立的 tripinfo.xml 与 summary.xml。

最小复现循环

import traci

def run_episode(cfg_path: str, seed: int, steps: int = 3600):
    traci.start(["sumo", "-c", cfg_path, "--seed", str(seed), "--no-step-log", "true"])
    try:
        for step in range(steps):
            traci.simulationStep()
    finally:
        traci.close()