sumotraffic-simulation

Reroute with probability behaves strangely


I have network with 2 junctions. All cars starts from the left and on the first junction they drive bottom(with probability=0.2) or right (with probability=0.8). And that works perfectly fine. The code doing the stuff is below (hello.rou.xml):

<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/routes_file.xsd">
  <vType accel="1.0" decel="5.0" id="Car" length="5.0" minGap="2.0" maxSpeed="50.0" sigma="0" />
  <flow id="type1" color="1,1,0"  begin="0" end= "7200" period="3" type="Car">
    <routeDistribution id="routedist1">
        <route id="route0" edges="gneE7 gneE8" probability="0.2"/>
        <route id="route1" edges="gneE7 gneE10" probability="0.8"/>
    </routeDistribution>
</flow>
</routes>

So we have many cars that comes to gneE10 edge. I want to specify probability of going top/right/bottom in this moment. So I attach additional file with rerouter:

   <?xml version="1.0" encoding="UTF-8"?>
<additional>
   <routeDistribution id="reRouteE10">
      <route id="routeX0" edges="gneE10 -gneE14" probability="0.34" /><!--UP-->
      <route id="routeX1" edges="gneE10 gneE15" probability="0.33" /><!--STRAIGHT-->
      <route id="routeX2" edges="gneE10 gneE12" probability="0.33" /><!-- DOWN -->
   </routeDistribution>
   <rerouter id="rerouterE10" edges="gneE10">
      <interval begin="0" end="100000">
         <routeProbReroute id="reRouteE10" />
      </interval>
   </rerouter>
</additional>

If we have probabilities like above I always have such behaviour:

enter image description here

Every vehicle goes down! Why? Most likely because of being last in code to be honest. I have specified a little bit different density. enter image description here

Even with very large number 0.7 - all cars still goes straight. (It changes with 0.9 - then all goes up). enter image description here

Not sure if bug or I have misunderstood something. Full code aviable at Github


Solution

  • The rerouter does not take route distributions as argument. I agree this would be the logical thing to do, but the SUMO way to do it is:

    <rerouter id="rerouterE10" edges="gneE10">
      <interval begin="0" end="100000">
        <routeProbReroute id="routeX0" probability="0.34" />
        <routeProbReroute id="routeX1" probability="0.33" />
        <routeProbReroute id="routeX2" probability="0.33" />
      </interval>
    </rerouter>
    

    In your example sumo draws one route from the given distribution on creating the rerouter and then always uses this one.