Initialize from last run?

Use this forum to post Vensim related questions.
Post Reply
kleemax
Senior Member
Posts: 125
Joined: Tue Jan 26, 2016 3:50 pm
Vensim version: PRO

Initialize from last run?

Post 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?
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Initialize from last run?

Post 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.
kleemax
Senior Member
Posts: 125
Joined: Tue Jan 26, 2016 3:50 pm
Vensim version: PRO

Re: Initialize from last run?

Post 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?
kleemax
Senior Member
Posts: 125
Joined: Tue Jan 26, 2016 3:50 pm
Vensim version: PRO

Re: Initialize from last run?

Post 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.
LAUJJL
Senior Member
Posts: 1421
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Initialize from last run?

Post 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
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Initialize from last run?

Post 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.
kleemax
Senior Member
Posts: 125
Joined: Tue Jan 26, 2016 3:50 pm
Vensim version: PRO

Re: Initialize from last run?

Post 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.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Initialize from last run?

Post 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.
Post Reply