Reputation: 11
I use the function below to generate random flows in SUMO and output a file with the .rou.xml extension. I expect that every time I run my program to generate a new file (with the same name as before) and set the .sumocfg to run it, it will produce different traffic allocations. Unfortunately, it generates the same traffic allocation each time unless I change the file name.
[import subprocess
def run_duarouter(net_xml_file, input_file, output_file, add_xml):
command = [
'duarouter',
'-n', net_xml_file,
'--additional-files', add_xml,
'--route-files', input_file,
'--randomize-flows',
'--output-file', output_file,
]
subprocess.run(command, check=True)
]
How can I generate a new file with different traffic allocation while keeping the same file name?
For example:
for episode in range(num_episodes):
run_duarouter(net_xml,input_file,output_file,add_xml)
Upvotes: 1
Views: 49