Every time you start 'sumo' the RNG gets initialized. Lets say with a given seed it generates the sequence 1,3,5,2,4 When running only B, the vehicles will consume random numbers 1,3,5 (for random slow-downs) When running A and B without restarting sumo in between, the vehicles from A will consumer the numbers 1,3 so that the vehicles from B get the next numbers 5,2,4
To make sure that the seed you are generating is actually used by sumo, look into any of the output files generated by the simulation. In the header it will list all the options that were given which should then include the non-default seed value. regards, Jakob Am Di., 14. Apr. 2020 um 09:35 Uhr schrieb Branka Mircevska < [email protected]>: > Hello Jakob, > > Given the following from the link you pointed out: > > "This random number generator (RNG) is initialized with a seed value which > defaults to the (arbitrary) value 23423. > This setup makes all applications deterministic by default as the sequence > of random numbers is fixed for a given seed. > The seed may be changed using the option --seed <INT> > <https://sumo.dlr.de/docs/Basics/Notation.html#referenced_data_types>. > When using the option --random the seed will be chosen based on the > current system time resulting in truly random behavior." > > I have two questions: > > First, I had the seed set to this: seed = np.random.randint(10000), so > the deterministic, totally reproducible behavior in certain settings, > shouldn't be expected. > Second, even if I hadn't chosen a random one, and let it to the default > 23423 stated above instead, I still don't get why this is fixed for always > when I run scenario A, and then B at once, and results in always the same > behavior, but it is different when I run only scenario B over and over, to > get always the same behavior, but different than the one in A. > > (1. Run A than reset Sumo (not restart), then run B ---> no matter how > often I run this I get exactly the same behavior, > 2. Run B ---> no matter how often I run this I get exactly the same > behavior but slightly different than the one in scenario B in 1.) > > > To me this two make sense: > > either I get the same behavior whenever I run scenario B regardless if I > run it on its own or before/after other scenarios, or I always(or > sometimes) get a slightly different ones due to a random seed (but also > within runs of A,B or just B). > > Can you please explain what am I missing here? > > Thanks! > > VG > Branka > > > > Am Dienstag, 14. April 2020, 07:58:18 MESZ hat Jakob Erdmann < > [email protected]> Folgendes geschrieben: > > > By default the random seed is fixed to achieve the reproducible behavior > you already noticed (as explained at > https://sumo.dlr.de/docs/Simulation/Randomness.html#random_number_generation_rng > ). > > Am Mo., 13. Apr. 2020 um 23:58 Uhr schrieb Branka Mircevska < > [email protected]>: > > Hey Jakob, > > thanks for the reply! > > I was assuming it has to do something with the seed, and random init of > vehicle parameters. > However, my confusion comes from the fact that if I run scenario 20 only, > N number of times, the behavior is always the same (even though there > should be randomness here as well if I am not mistaken?!). > Similarly, when I run scenario 20 after scenario 10, N number of times, I > get the same results all N times. > > Does this make sense? > > (Note that I set both, the starting speed and the starting position of the > vehicles, to a specific value, not to randomly chosen one.) > > Thanks! > > VG > Branka > > > > Am Montag, 13. April 2020, 22:36:07 MESZ hat Jakob Erdmann < > [email protected]> Folgendes geschrieben: > > > The sumo-controlled vehicles are using the default model with stochastic > components. This will result in divergent vehicle behavior when running a > different simulation sequence with a different number / ordering of random > number generator calls. For details, see > https://sumo.dlr.de/docs/Simulation/Randomness.html > > regards, > Jakob > > Am Mo., 13. Apr. 2020 um 15:08 Uhr schrieb Branka Mirchevska < > [email protected]>: > > Hello, > > I'm trying to run 2 predefined Sumo scenarios one after the other (scenario > ids 10_0, and 20_0). > They contain 10 and 20 Sumo controlled vehicles each, and I place my > remotely controlled vehicle at a certain position in both to drive among > them. > The problem is the following: > when I run scenario 10 and then scenario 20 after it, the behavior is > different than when I run scenario 20 right away. > > here is a demonstration: > > Only scenario 20_0: > _________________________________ > > > Scenario ID: 20_0 > ---------------------------------------- time-step: 0 > EGO lane pos and speed : 100.0 , 8.0 > x, y, angle, speed for EGO to execute: 101.530884567 5.19671627088 > 90.7360694615 8.10524126657 > HUMAN_19 lane position and speed : 121.0 10.0 > ---------------------------------------- time-step: 1 > EGO lane pos and speed : 101.530884567 , 8.10524126657 > x, y, angle, speed for EGO to execute: 103.100752622 5.1765673393 > 91.6889555588 8.39699835768 > HUMAN_19 lane position and speed : 123.054754372 10.2737718593 > ---------------------------------------- time-step: 2 > ... > > > First scenario 10_0 and then 20_0: > __________________________________ > > Scenario ID: 20_0 > ---------------------------------------- time-step: 0 > EGO lane pos and speed : 100.0 , 8.0 > x, y, angle, speed for EGO to execute: 101.530884567 5.19671627088 > 90.7360694615 8.10524126657 > HUMAN_19 lane position and speed : 121.0 10.0 > ---------------------------------------- time-step: 1 > EGO lane pos and speed : 101.530884567 , 8.10524126657 > x, y, angle, speed for EGO to execute: 103.100752622 5.1765673393 > 91.6889555588 8.39699835768 > HUMAN_19 lane position and speed : 123.093816682 10.4690834098 > ---------------------------------------- time-step: 2 > … > > You can see that the behavior of HUMAN_19 is slightly different in > time-step > 1 event though EGO doesn’t change its remote control parameters. > > I have included a small example in the .zip folder attached. If you run: > > python2.7 small_example/src/run_scenario.py, > > first scenario 10_0 then scenario 20_0 will be executed, one after > another. > > If you comment in line 63 (#scenario_ids = ['20_0']) in run_example.py, > only > scenario 20_0 will be executed. > > After running the two options, you will be able to see the above output, > where in time-step 1 ‘HUMAN_19’ behaves differently even though the > environment is exactly the same. > > Do you have any clue why? > > Thanks! > > Best, > Branka > > small_example.zip > < > http://sumo-user-mailing-list.90755.n8.nabble.com/file/t361/small_example.zip> > > > > > > -- > Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/ > _______________________________________________ > sumo-user mailing list > [email protected] > To unsubscribe from this list, visit > https://www.eclipse.org/mailman/listinfo/sumo-user > > _______________________________________________ > sumo-user mailing list > [email protected] > To unsubscribe from this list, visit > https://www.eclipse.org/mailman/listinfo/sumo-user > _______________________________________________ > sumo-user mailing list > [email protected] > To unsubscribe from this list, visit > https://www.eclipse.org/mailman/listinfo/sumo-user > > _______________________________________________ > sumo-user mailing list > [email protected] > To unsubscribe from this list, visit > https://www.eclipse.org/mailman/listinfo/sumo-user > _______________________________________________ > sumo-user mailing list > [email protected] > To unsubscribe from this list, visit > https://www.eclipse.org/mailman/listinfo/sumo-user >
_______________________________________________ sumo-user mailing list [email protected] To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
