Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Reroute by effort using parallel processing

1. routing by effort is only effort (so the value is 3), however, the travel time is still tracked because you might have defined different effort for different times (i.e. the time to travel by train depends on the schedule and thus waiting time).
2. no.
3. yes. By launching multiple instances of sumo and switching between them. See

Note, that you should achieve a huge speedup in the setEffort part if you use libsumo ( though this precludes having parallel instances in a single python process.

Am Do., 1. Juni 2023 um 08:03 Uhr schrieb 최석환 <my2853121@xxxxxxxxx>:
Hello all,

I'm going to specify effort on all edges and reroute the vehicle according to effort every 5 minutes.
My code is as follows.
net ='')
edges = net.getEdges()
step = 0
while step < 86400:
        if traci.simulation.getTime() % 300 == 0:
            for edge in edges:
                if traci.edge.getTraveltime(edge.getID()) > 1000:
                    if edge.getID() in clist:
                        traci.edge.setEffort(edge.getID(), (edge.getSpeed()*0.7) / (edge.getLength()+edge.getLength()*4*0.06), step, step + 300)
                        traci.edge.setEffort(edge.getID(), (edge.getSpeed()*0.7) / edge.getLength(), step, step + 300)
                    if edge.getID() in clist:
                        traci.edge.setEffort(edge.getID(), traci.edge.getTraveltime(edge.getID())+edge.getLength()*4*0.06, step, step+300)
                        traci.edge.setEffort(edge.getID(), traci.edge.getTraveltime(edge.getID()), step, step+300)
                for vehId in traci.simulation.getDepartedIDList():
                    traci.vehicle.setEffort(vehId, edge.getID(), traci.edge.getEffort(edge.getID(), step))

            for vehId in traci.vehicle.getIDList():  

        step += 1

My network has 6400 edges and the traffic demand is 40,000 per hour. 
This takes a very long time in the traci.vehicle.setEffort part.

The questions I'm curious about are as follows.
1. I wonder if reroute by effort is only effort or travel time and effort, for example, if the effort is 3 and travel time is 9, the value used 3 or 12?
2. Is it possible to reroute based on the effort set in traci with routing settings in the .sumocfg file for more threads?
3. Is parallel processing possible in python using traci if effort-based rerouting is not available in .sumocfg?

Thank you reading my mail.

sumo-user mailing list
To unsubscribe from this list, visit

Back to the top