Is it possible to set the seed to keep stochasticity but get repeatability?

All topics specific to modeling questions in Enterprise Dynamics
Post Reply
RobinKnoet
Posts: 7
Joined: Wednesday 13 March, 2013 - 09:06

Is it possible to set the seed to keep stochasticity but get repeatability?

Post by RobinKnoet »

Hello all,

We are using ED for one of my classes and while I was running the experiment wizard I noticed that my results kept changing (not surprising but still.)

Ideally I could give my model to my teacher and tell them, "These are the settings I used" and they could run the model to get the same results.
Is it possible, to set the seed at the start of the experiment so the experiment is repeatable, and I still get the benefits of a stochastic simulation?

I am using ED 9.0.0.1342 Academic / Classroom via school.

I looked at the Triggers but there is no "On start of experiment" in my version so the GeneratorSeed() command that I saw in this post: viewtopic.php?f=7&t=43 (assuming it exists, I haven't checked) seems of no help to me.

Thank you for your time,
Robin
User avatar
Fred
Posts: 22
Joined: Wednesday 17 November, 2010 - 12:06

Re: Is it possible to set the seed to keep stochasticity but get repeatability?

Post by Fred »

Hi Robin,

If you want each experiment sequence to start with the same seed value, you can indeed use GeneratorSeed.

Code: Select all

GeneratorSeed(0) := 10
Gr. Fred...
RobinKnoet
Posts: 7
Joined: Wednesday 13 March, 2013 - 09:06

Re: Is it possible to set the seed to keep stochasticity but get repeatability?

Post by RobinKnoet »

Hi Fred,
Thank you for your input. Where would I set that command?

Because setting it on start of run seems to defeat the point since you then lose the benefits of having the runs differ in results.
Unless I am misinterpreting On start of run to mean every new run. I am using Simulation method: "Separate runs".
I would assume that if the "Number of observations" is set to 30 that the "On start of run" trigger gets triggered 30 times
User avatar
HarryBunnik
Posts: 362
Joined: Monday 07 February, 2011 - 11:22

Re: Is it possible to set the seed to keep stochasticity but get repeatability?

Post by HarryBunnik »

Hi Robin,

What you could try is to set the seed value, based on the "CurRun" you're in. This you can find on the Attribute: Att([CurRun], refExperimentSupport).

So on your "On start of run", you can set the GeneratorSeed to this value. So you start each run with a seedvalue being equal to your run number.

Or you could choose it from a list, where with each additional run, the next seedvalue is set:

Code: Select all

GeneratorSeed(0) := Case(
  Att([CurRun], refExperimentSupport), 
  1000,
  9564, 
  5748, 
  ..

  30
)
I think that are 2 options you could try to get the variation, but still be able to repeat the complete experiment with its 30 replications.

I hope it helps you further,

Regards,

Harry
RobinKnoet
Posts: 7
Joined: Wednesday 13 March, 2013 - 09:06

Re: Is it possible to set the seed to keep stochasticity but get repeatability?

Post by RobinKnoet »

Hi Harry,

Thank you for pointing me to that attribute.
What I went for is the following in the "On start of run" trigger:

Code: Select all

GeneratorSeed(0):=Att([CurRun], refExperimentSupport)
At first I foolishly thought just setting the seed once (so only set the seed if the current run is 1) would be sufficient to get to my goal but it clearly changes on every run.

When I tried to use sub runs I also saw something that looked like the same values but I didn't look into it closer, mostly because I am not sure what the difference between Separate runs and sub runs is.

Thank you both for helping me with my problem
Robin
Post Reply