How do I use the compiled model with command script CMD

Use this forum to post Vensim related questions.
Post Reply
aliakhavan89
Senior Member
Posts: 215
Joined: Sun Oct 21, 2018 7:09 am
Vensim version: DSS

How do I use the compiled model with command script CMD

Post by aliakhavan89 »

I have this script, but when I run it back to back with different {idx} it compiles the model from scratch every time, which is confusing because i'm not changing anything in the model (like changing the constants in between the iterations). If I repeat the steps manually inside Vensim by changing the dataset from simulation control and run the optimization, it just compiles the model only for the first time and the next iterations of Powell run immediately without a need of compiling. Any suggestions? Should I update the CMD content?

SPECIAL>NOINTERACTION
SPECIAL>LOADMODEL|LV.mdl
SIMULATE>DATA|data_v{idx:02d}.vdfx
SIMULATE>RUNNAME|Powell_Gaussian_v{idx:02d}
SIMULATE>OPTPARM|Powell_Settings_Gaussian.voc
SIMULATE>PAYOFF|Payoff_Gaussian.vpd
MENU>RUN_OPTIMIZE|o
MENU>EXIT
aliakhavan89
Senior Member
Posts: 215
Joined: Sun Oct 21, 2018 7:09 am
Vensim version: DSS

Re: How do I use the compiled model with command script CMD

Post by aliakhavan89 »

I just noticed that even if I'm doing it manually, whenever I close Vensim window I need to recompile the model. so maybe it's the expected behavior.

Edit: I realized that I can write everything in a single CMD (without having 'No_Interaction' or 'Load_Model') to avoid recompiling the model. Something like this worked perfectly:

Code: Select all

SIMULATE>DATA|data_v01.vdfx
SIMULATE>RUNNAME|Powell_Gaussian_v01
SIMULATE>OPTPARM|Powell_Settings_Gaussian.voc
SIMULATE>PAYOFF|Payoff_Gaussian.vpd
MENU>RUN_OPTIMIZE|o
MENU>EXIT

SIMULATE>DATAdata_v02.vdfx
SIMULATE>RUNNAME|Powell_Gaussian_v02
SIMULATE>OPTPARM|Powell_Settings_Gaussian.voc
SIMULATE>PAYOFF|Payoff_Gaussian.vpd
MENU>RUN_OPTIMIZE|o
MENU>EXIT

SIMULATE>DATA|data_v03.vdfx
SIMULATE>RUNNAME|Powell_Gaussian_v03
SIMULATE>OPTPARM|Powell_Settings_Gaussian.voc
SIMULATE>PAYOFF|Payoff_Gaussian.vpd
MENU>RUN_OPTIMIZE|o
MENU>EXIT
tomfid
Administrator
Posts: 4006
Joined: Wed May 24, 2006 4:54 am

Re: How do I use the compiled model with command script CMD

Post by tomfid »

The other option is to package the model as a vpmx along with the compiled .dll.
aliakhavan89
Senior Member
Posts: 215
Joined: Sun Oct 21, 2018 7:09 am
Vensim version: DSS

Re: How do I use the compiled model with command script CMD

Post by aliakhavan89 »

Thank you, Tom. Unless I'm missing something, I haven't figured out how to generate .out files through dll yet:
viewtopic.php?t=8521
Post Reply