Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Adding penalties to current travel times.


I am trying to run a simple simulation where all vehicles move from Point A
to Point B. There are only 2 routes to travel from A to B, say Route1 and

I want to "discourage" the router from assigning vehicles to Route1 by
adding a penalty/weight to the route. To do this, I am using weight files
with the traveltime attribute along with the traci command:
traci.vehicle.rerouteTraveltime(self, vehID, currentTravelTimes=False)

I understand that by doing this the vehicle will completely ignore the
current travel times and route according to the weights defined in the
weight file. What I want to do is add a penalty to the current travel
times, so that if Route 2 becomes congested, new trips will be routed
through Route 1.

An approach I was considering is:
travel_time = traci.edge.getTraveltime(edgeID)
new_travel_time = travel_time * penalty
traci.edge.adaptTraveltime(edgeID, new_travel_time)

If there is an easier way to solve this issue please let me know.

Check out the vibrant tech community on one of the world's most
engaging tech sites,!
sumo-user mailing list

Back to the top