Running incremental optimizations

Use this forum to post Vensim related questions.
Post Reply
linear feedback
Member
Posts: 25
Joined: Tue Sep 16, 2014 2:20 pm
Vensim version: DSS

Running incremental optimizations

Post by linear feedback »

I want to run sequential optimizations while monitoring the progress. E.g. run the optimizer n times, evaluate the best solution and if not good enough let the optimizer run another n times. I have come up with this:

SIMULATE>RUNNAME|opt
do
MENU>RUN_OPTIMZE
Analyse the opt.out file: if ok -> exit else
SIMULATE>RESUME|1|0
SIMULATE>BASED|opt.out
loop

This loads the best found solution as a base line but unfortunately the same Random-numbers are used for the next RUN, e.g. the same results are generated again... Is there a way to continue the optimization with the next n random iterations?
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: Running incremental optimizations

Post by Administrator »

This loads the best found solution as a base line but unfortunately the same Random-numbers are used for the next RUN, e.g. the same results are generated again... Is there a way to continue the optimization with the next n random iterations?
I cannot think of a way of doing it. The random number streams will be reinitialized, I cannot think of a way around that.

You could use the GET TIME VALUE function to get a system time and use that as the random number seed. But this would give you a different stream every time you run the simulation.
http://www.vensim.com/documentation/ind ... _value.htm
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
linear feedback
Member
Posts: 25
Joined: Tue Sep 16, 2014 2:20 pm
Vensim version: DSS

Re: Running incremental optimizations

Post by linear feedback »

Thanks - will do. Alas, it would be nice if there were a condition which would make Vensim always use a different seed when beginning an optimization. So I have to edit the voc file. The underlying reason for this request is that I cannot provide Vensim with a time limit for the calibration so I want to initiate brief runs until either the solution converges or time runs out.
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Running incremental optimizations

Post by tomfid »

it would be nice if there were a condition which would make Vensim always use a different seed when beginning an optimization
There is - set the :SEED to 0.
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Running incremental optimizations

Post by tomfid »

I think you don't want RESUME; that resumes at a time. http://www.vensim.com/documentation/25345.htm

Instead you can either use BASED|previousrun.vdf or READCIN|previousrun.out (BASED expects a vdf and is probably simpler if there are other change inputs; otherwise you'd have to use READCIN/ADDCIN to replicate the whole cascade of changes each time).

This should work, but there is a penalty. The Powell algorithm starts by searching each parameter axis individually, but as it progresses, it replaces parameter vectors with improved directions from the initial passes. Each time you restart, you lose the direction set information. This may not be a big problem though.

Tom
linear feedback
Member
Posts: 25
Joined: Tue Sep 16, 2014 2:20 pm
Vensim version: DSS

Re: Running incremental optimizations

Post by linear feedback »

Many thanks, Tom, this is very helpful.

The seed=0 might be made more explicit in the documentation - at least I never figured that one.
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Running incremental optimizations

Post by tomfid »

SEED=0 is new, with the new random number generator in 6.3.
http://www.vensim.com/documentation/opt ... htsub=seed

Note that random number stream IDs and NOISE SEED within a model behave differently.
http://www.vensim.com/documentation/noi ... htsub=seed
Post Reply