Skip to main content

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

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 = sumolib.net.readNet('osm.net.xml')
edges = net.getEdges()
step = 0
while step < 86400:
        traci.simulationStep()
       
        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)
                    else:
                        traci.edge.setEffort(edge.getID(), (edge.getSpeed()*0.7) / edge.getLength(), step, step + 300)
                else:
                    if edge.getID() in clist:
                        traci.edge.setEffort(edge.getID(), traci.edge.getTraveltime(edge.getID())+edge.getLength()*4*0.06, step, step+300)
                    else:
                        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():  
                traci.vehicle.rerouteEffort(vehId)

        step += 1

traci.close()
--------------------------------------------------------------------------------------------------------------------
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.

SeokHwan

Back to the top