Page 1 of 2

Multiple seeds

Posted: Mon Apr 19, 2021 9:48 pm
by AshwinRaviraj
Hi,
Is it possible to give an experiment multiple seeds, so when the experiment finishes it will restart with the next seed.
Or do I need to make a new .argos file and then run it with the new seed?

Best,
Ashwin

Re: Multiple seeds

Posted: Mon Apr 19, 2021 10:05 pm
by pincy
You can set the seed to 0. When you press the reset button, or call CSimulator::Reset(), a new one will be picked at random (see the code).

If you need the experiments to be repeatable, yet to use multiple seeds, a better approach is to create a template .argos file that you can fill in with a command like sed. This is what I usually do.

Re: Multiple seeds

Posted: Mon Apr 19, 2021 10:17 pm
by AshwinRaviraj
Thank you!

So, would it be in the loop function /controller that I would need to pass the seed?
And how would it be possible for me to tell the controller to initiate the new experiment with the seed?

Re: Multiple seeds

Posted: Mon Apr 19, 2021 10:35 pm
by pincy
You configure this in the .argos file. See the commented file here.

ARGoS is different from other simulators. No individual robot controls the simulator.

Re: Multiple seeds

Posted: Mon Apr 19, 2021 10:44 pm
by AshwinRaviraj
I see, thank you for your help!

Re: Multiple seeds

Posted: Wed Apr 21, 2021 10:43 am
by AshwinRaviraj
After I Reset the loopfunction and start a new experiment, it looks like the controller is not getting reset?
How can I ensure that when I call cSimulation::Reset that the controller also will get reset?

Re: Multiple seeds

Posted: Wed Apr 21, 2021 2:06 pm
by pincy
The controller is reset, see the code here. Also, because this is a different question, please create a new topic.

Re: Multiple seeds

Posted: Wed Apr 28, 2021 12:27 pm
by AshwinRaviraj
Is this the correct way to reset an experiment and then giving it a new random seed, because it look like it can see that the agents are being placed the exact same place every time I reset the experiment..

Code: Select all

CSimulator &cSimulator = CSimulator::GetInstance(); cSimulator.SetExperimentFileName(PATH); cSimulator.LoadExperiment(); int ran = 124; for (int i = 0; i < iter; i++) { cSimulator.Execute(); ran = rand() % (max - min + 1) + min; cSimulator.Reset(ran); }
I can't figure out why the position of the robots are the same. Am I doing something wrong?

Re: Multiple seeds

Posted: Wed Apr 28, 2021 1:48 pm
by pincy
The simplest way to have ARGoS pick a different random at each Reset() is to set the random seed to 0 in the .argos file.

Re: Multiple seeds

Posted: Wed Apr 28, 2021 2:17 pm
by AshwinRaviraj
True, that would be the simplest, but is it possible to set the seed to a value of own choosing?
The reason for this is because I would like to use the same seed for different .argos file setup.
- Yes I guess, I could hard code that exact seed, but is there someway to give the seed, just like the Reset() function?