Page 1 of 2
Integrating Vensim and GAMS
Posted: Fri Jun 11, 2010 9:24 pm
by trgzrich
Hi..
I am working on a project that requires to integrate Vensim and GAMS (a mathematical optimization software) models into a decision support system framework. Whereby a decision maker inputs some parameters using a GUI so as to compare model results generated by both Vensim and GAMS. How do l go about this?
I thank you
Posted: Fri Jun 11, 2010 11:10 pm
by tomfid
When you say "integrate" do you mean run the same model in Vensim and GAMS, for comparison, or run the two in sequence to solve different parts of a problem, or ... ?
For comparison/replication, the basic challenge is to translate the GAMS model into differential equations; then it's easy to implement those in Vensim. One example is the DICE model, which I translated here
http://models.metasd.com/2010/06/dice/ (you can get the original GAMS from Nordhaus' web site).
The practical difficulty is that GAMS has a horrible syntax, only supports discrete notation, obscures time, and doesn't formally document units. If you understand enough GAMS, and the model is not too big, the task is generally manageable.
The key question becomes how to handle decisions and equilibrium assumptions. Usually these can be replicated in advanced versions of Vensim by using the optimizer or FIND ZERO function. However, there are some things that GAMS will do that Vensim can't easily replicate (and vice versa).
Tom
Posted: Sat Jun 12, 2010 10:17 am
by trgzrich
Hi Tom,
Thanks for your response.
Actually, the Vensim and GAMS models are different, but are trying to solve same problem. I am thinking of a situation where some parameters are input to simulate the Vensim model and to run the GAMS model, so that results from both models can be compared
Posted: Sat Jun 12, 2010 1:07 pm
by tomfid
Got it ...
That's an easier problem, I think. One option would be to develop a common interface in something like Java, C, or Excel/VB and use that to run both models. For Vensim that's easy, using the .dll (see the examples that install with the Vensim app in vensim\dll). I don't know how it would work for GAMS.
Tom
Posted: Thu Jun 17, 2010 8:26 am
by trgzrich
Thanks...I have decided to start by trying to run my Vensim model (SDModel.mdl) from the command line. I have written the following command file...
SPECIAL>LOADNAME|C:\WorkClub\Briefcase 2010\Tuyi 2010\SD_Thesis\SDModel_1.mdl
SIMULATE>RUNNAME|base
MENU>RUN|o
MENU>VDF2DAT|base.vdf|base.dat|base.lst
MENU>EXIT
And named it "Vensimrun.cmd" as the Vensim DSS Reference Supplement says on Page 87.
But it reports an error....where am l getting it wrong?
[Edited on 6-17-2010 by trgzrich]
Posted: Thu Jun 17, 2010 9:23 am
by bob@vensim.com
the first command should be SPECIAL>LOADMODEL, after that it looks like it should work.
Posted: Thu Jun 17, 2010 9:49 am
by trgzrich
sorry....i couldn't realize that mistake.
But still, after copying "Vensimrun.cmd" to the vensim folder "C:\Program Files\Vensim>" then type "Vensim Vensimrun" at the command line, it opens Vensim with a blank window, implying that its not opening and simulating my model. Pliz help...
Posted: Thu Jun 17, 2010 10:24 am
by Administrator
Can you try
vensim vensimrun.cmd
and see what happens?
Posted: Thu Jun 17, 2010 10:40 am
by trgzrich
It says "File type cmd of Vensimrun.cmd is not known - Unable to load
Could l have made a mistake in creating the cmd file?
[Edited on 6-17-2010 by trgzrich]
Posted: Thu Jun 17, 2010 11:45 am
by Administrator
Can you paste the contents of the cmd file here?
Posted: Thu Jun 17, 2010 11:52 am
by trgzrich
SPECIAL>LOADNAME|C:\WorkClub\Briefcase 2010\Tuyi 2010\SD_Thesis\SDModel_1.mdl
SIMULATE>RUNNAME|base
MENU>RUN|o
MENU>VDF2DAT|base.vdf|base.dat|base.lst
MENU>EXIT
Posted: Thu Jun 17, 2010 12:16 pm
by Administrator
First, do as Bob said earlier and change
SPECIAL>LOADNAME|C:\WorkClub\Briefcase 2010\Tuyi 2010\SD_Thesis\SDModel_1.mdl
to
SPECIAL>LOADMODEL|C:\WorkClub\Briefcase 2010\Tuyi 2010\SD_Thesis\SDModel_1.mdl
Now at the command prompt, enter
vensim.exe Vensimrun.cmd
Can you also let us know what version of Vensim you are running?
Tony.
Posted: Thu Jun 17, 2010 12:22 pm
by trgzrich
Sorry...I cut & paste my earlier post no. 5
I had already make the correction
I am using Vensim Professional 5.9
Posted: Thu Jun 17, 2010 12:26 pm
by trgzrich
I created the cmd file by typing the commands in Notepad
It still gives the message "File type cmd of Vensimrun.cmd is not known - Unable to load"
Posted: Thu Jun 17, 2010 2:32 pm
by Administrator
It doesn't look like Vensim Pro can run batch files.
Bob can you confirm?
Posted: Fri Jun 18, 2010 7:36 am
by trgzrich
Which version should l use? and how do l get it?
Posted: Fri Jun 18, 2010 10:07 am
by bob@vensim.com
Command files are only supported by Vensim DSS. You can always upgrade for the difference in price after updating maintenance.
It is best not to put command files in the program files directories. These are protected and you can end up with results in hard to find places.
[Edited on 2010-6-18 by
bob@vensim.com]
DICE
Posted: Tue Jun 22, 2010 10:12 am
by duilio
Hi Tom,
I'd be interested in having all your different versions of DICE model in mdl format. Would it be possible. I remeber you told meonce that you have a version also set for the optimization. Is it one of the 3 you mentioned?
I have another question for you. do you have a detailed explanation of the equations in your NICE model? I have it but I've got lost and I'd need some more basic material to help me in understanding the equations.
Thanks a lot in advance!!
Giovanni
Posted: Tue Jun 22, 2010 1:22 pm
by tomfid
Hi -
I just posted a new set of DICE versions here
http://models.metasd.com/2010/06/dice/
Tom
DICE
Posted: Wed Jun 23, 2010 8:34 am
by duilio
Hi,
I've tried to get the model from the web, I save them ad .MDL but I cannot open them in a sketch mod just the text file with the equations. If I tried to open the models as sketch I get the message " syntax error". Is this an intended behaviour?
Thanks!!
G
Posted: Wed Jun 23, 2010 1:12 pm
by tomfid
No. What version of Vensim are you using. Did you try the .vpm version?
Posted: Wed Jun 23, 2010 1:37 pm
by duilio
Hi Tom,
I have an old DSS version, not sure which release.
I saved the files as .mdl in the extension and as text files and I opened them with Vensim.
I'll try with the vpm , is the process I followed correct ?
Thanks
G
Posted: Wed Jun 23, 2010 3:54 pm
by LAUJJL
I have the same problems, trying to load the Dices models. I load the model as .htm then change htm to mdl, get a text model in Vensim and when I try to see it as sketch it says 'syntax error'. I have the latest DSS release
JJ
Posted: Wed Jun 23, 2010 4:20 pm
by tomfid
Hmm ... sounds like a server MIME type issue. Shouldn't happen with the .vpm version. The .mdl works fine for me in Firefox - what browser are you using?
Posted: Wed Jun 23, 2010 4:33 pm
by tomfid
I changed my server settings ... the mdl versions might work now.