Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Using numpy for traci commands

Hi Pascal,

why do you want to use numpy arrays?
At the end you have to call traci.edge.(get|adapt)TravelTime for every edge.
I do not see any advantage whether you iterate over a list or an array.
Might be you want to use libsumo (https://sumo.dlr.de/wiki/Libsumo) instead of traci to speed up your program.

Best regards, Harald

Am 19.07.19 um 11:41 schrieb Hoffmann, Pascal:

Dear sumo-user,


is there a possibility using numpy-array instead of for-queue's for traci commands? I tried it, but failed.

For example, I want to update every edge with the current travel-time with a for-queue:

def edge_traveltime_adaption(edges_all):
    for edges in edges_all:
        edge_time = traci.edge.getTraveltime(edges)
        traci.edge.adaptTraveltime(edges, edge_time)
Because it needs a lot of computation time, I want to do it with numpy:
def edge_traveltime_adaption_numpy(edges_all):
    edges = np.array(edges_all)
    edge_time = traci.edge.getTraveltime(edges)
    traci.edge.adaptTaveltime(edges, edge_time)

But it doesn't work like this. Could you help?

Best regards, Pascal


_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user



Back to the top