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?
Running incremental optimizations
-
- Member
- Posts: 25
- Joined: Tue Sep 16, 2014 2:20 pm
- Vensim version: DSS
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Running incremental optimizations
I cannot think of a way of doing it. The random number streams will be reinitialized, I cannot think of a way around that.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?
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
-
- Member
- Posts: 25
- Joined: Tue Sep 16, 2014 2:20 pm
- Vensim version: DSS
Re: Running incremental optimizations
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.
Re: Running incremental optimizations
There is - set the :SEED to 0.it would be nice if there were a condition which would make Vensim always use a different seed when beginning an optimization
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: Running incremental optimizations
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
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
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Member
- Posts: 25
- Joined: Tue Sep 16, 2014 2:20 pm
- Vensim version: DSS
Re: Running incremental optimizations
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.
The seed=0 might be made more explicit in the documentation - at least I never figured that one.
Re: Running incremental optimizations
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
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
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/