Page 1 of 1

Initialize from last run?

Posted: Tue Aug 23, 2016 10:40 am
by kleemax
I want to start a model in flow equilibrium. I'd like to run one long simulation (3500years) to get it into equilibrium and then use the final values of that run to initialize (set the initial values of the stocks) for subsequent simulations. since my model has 10000 stocks copying the values is not an option.
What I currently do is starting every policy simulation at -3500 years, and then looking at the values from 0 to 100 years only, but that takes a lot of time for each run.
Is there some vensim function that can pick values from the final values of another run?

Re: Initialize from last run?

Posted: Tue Aug 23, 2016 2:02 pm
by tomfid
You could run from -3500 to 0, and then use the Based On and Resume At options to start the run from 0 to 100:
https://www.vensim.com/documentation/23320.htm

This won't work if you have pipeline delays in the model. If that's an issue, there might be other options, though the internal delay states make the equilibrium problematic.

Re: Initialize from last run?

Posted: Thu Sep 01, 2016 5:57 pm
by kleemax
Hi Tom, I've tried based on and resume at but vensim keeps telling me the model run on which I want to base the simulation is from a different model even though it is not. I have only changed start time, final time and save per. Any clues?

Re: Initialize from last run?

Posted: Thu Sep 01, 2016 5:59 pm
by kleemax
I have also tried something else: exporting to xls and then importing using get xls constants to initialize the stocks. The problem in the latter case appears to be that get xls constants would need the data as a 2-dimensional array, whereas exporting puts all subscripts in one column. And there are too many (the array is 501x100 now) to fix this by hand.

Re: Initialize from last run?

Posted: Sat Sep 03, 2016 10:38 am
by LAUJJL
Resuming did not work, probably because you changed the final time or initial time in the model settings time bounds window.
To make it work you must change the final time or initial time using exactly the same model without changes, but changing the final or initial time using the set command that allows the change of constants prior to the simulation.
to solve the memory problem, you can too chose the variables you want to save using a save list, probably easier than splitting the model into several periods using the resume method, or try to use the 64 bits version.

JJ

Re: Initialize from last run?

Posted: Mon Sep 05, 2016 1:44 pm
by tomfid
How have you changed the time parameters? If you use Model>Settings, you're changing the model. You can make runtime changes with via the various constant setting methods. For reuse, I would normally put the modified values in a .cin file that could be loaded as needed.

Re: Initialize from last run?

Posted: Tue May 28, 2019 12:46 pm
by kleemax
If there is a change in model, then Model/compare to... should reveal it. However, I sometimes encounter the error message that a simulation can't be based on another one even though Model/compare to... yields "no significant difference". In such cases it's hard for me to know what I've changed. Does it already change the model when I add a custom graph to the canvas of a view for example? It's a bit annoying because I have to resimulate the history run on which I'm basing my future runs about every half hour these days and I don't have a clue why.

Re: Initialize from last run?

Posted: Tue May 28, 2019 1:41 pm
by tomfid
My impression is that it's overly picky, but I'm not sure what the trigger is. We can take a look.

Writing a short cmd script to run the base and full sim is helpful, if you haven't already done it.