Randomized noise seed crashes model

Use this forum to post Vensim related questions.
Post Reply
Floyt
Junior Member
Posts: 4
Joined: Fri Apr 26, 2013 5:47 am
Vensim version: PRO

Randomized noise seed crashes model

Post by Floyt »

Hello everyone...

I am trying to set the noise seed in my model to randomize off the timer on every model run, using GET TIME VALUE(2,0,10). However, this results in the model terminating with an error at initiation (time 0.0). The error is thrown by any variable that incorporates a RANDOM function (actually they are all RANDOM UNIFORM). I would interpret that as the RANDOM function lacking a seed at initiation, but making the noise seed an ACTIVE INITIAL(GET TIME VALUE(2,0,10),0) doesn't seem to solve anything.
The RANDOM UNIFORM formulas all have a seed parameter of 0.
Are there any ideas as to what exactly is causing this, and how to circumvent the problem?
(Vensim Professional v6.0.0.1 on Win7)

cheers
florian
Administrator
Super Administrator
Posts: 4611
Joined: Wed Mar 05, 2003 3:10 am

Re: Randomized noise seed crashes model

Post by Administrator »

Can you post a model that crashes so we can take a look?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Floyt
Junior Member
Posts: 4
Joined: Fri Apr 26, 2013 5:47 am
Vensim version: PRO

Re: Randomized noise seed crashes model

Post by Floyt »

I was probably not correct to say the model "crashes"; it terminates with an error message "ERROR: Floating point error computing - rYear - at time = 0.000000. ", where rYear is

integer( RANDOM UNIFORM( 1987, 2009.9, 0))

If I remove the random uniform function in rYear, the next variable containing that function crops up. If all random uniform functions are removed, or noise seed is set to a constant, the model executes as normal.

I'm sorry I'm not at liberty to share the actual where the issue is occurring... and I haven't managed to recreate the issue in a simpler model.
I was hoping this behaviour might be a known occurrence, but I might be out of luck here :)
Administrator
Super Administrator
Posts: 4611
Joined: Wed Mar 05, 2003 3:10 am

Re: Randomized noise seed crashes model

Post by Administrator »

Without something that re-creates the error, there is not much we can do.

Saying that, it would be a good idea (and good practice) to simplify things. The way you have it at the moment, you cannot see what sample from the distribution is.

For example, change your code to

Code: Select all

random sample = RANDOM UNIFORM( 1987, 2009.9, 0)
integer random number = integer( random sample )
I suspect the floating point error is somewhere else and is being incorrectly reported as rYear. If you view the tabular output, is one of the levels growing exponentially?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Floyt
Junior Member
Posts: 4
Joined: Fri Apr 26, 2013 5:47 am
Vensim version: PRO

Re: Randomized noise seed crashes model

Post by Floyt »

All levels are behaving as expected. As I said, this happens at time 0.000 (which is initial time), and setting noise seed to a constant removes the problem. Wouldn't it be reasonable to suppose that the connection to a function that actually uses noise seed (i.e. random uniform()) is genuine?
tomfid
Administrator
Posts: 3816
Joined: Wed May 24, 2006 4:54 am

Re: Randomized noise seed crashes model

Post by tomfid »

You should be using INITIAL(GET TIME VALUE(2,0,10)) to avoid reinitializing the random stream at every time step. I don't think that's the issue though.

If you delete everything from the model but the NOISE SEED and the RANDOM instances, does it still crash? If so, could you share that portion?
Floyt
Junior Member
Posts: 4
Joined: Fri Apr 26, 2013 5:47 am
Vensim version: PRO

Re: Randomized noise seed crashes model

Post by Floyt »

Working on it - it takes some doing to cut this down but keep it functional...
tomfid
Administrator
Posts: 3816
Joined: Wed May 24, 2006 4:54 am

Re: Randomized noise seed crashes model

Post by tomfid »

Definitely reasonable - just tough for us to replicate unfortunately. Trying on this end too.
tomfid
Administrator
Posts: 3816
Joined: Wed May 24, 2006 4:54 am

Re: Randomized noise seed crashes model

Post by tomfid »

Does this model run for you?
GET TIME VALUE.mdl
(5.02 KiB) Downloaded 229 times
(This is a modified version of what's in the help system.)

What version/hardware/OS are you on? [Never mind, I see this in your original post.]

Tom
Post Reply