Integrating Vensim and GAMS

Use this forum to post Vensim related questions.
trgzrich
Junior Member
Posts: 17
Joined: Fri Jun 11, 2010 10:45 am

Integrating Vensim and GAMS

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

Post 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
trgzrich
Junior Member
Posts: 17
Joined: Fri Jun 11, 2010 10:45 am

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

Post 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
trgzrich
Junior Member
Posts: 17
Joined: Fri Jun 11, 2010 10:45 am

Post 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]
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

the first command should be SPECIAL>LOADMODEL, after that it looks like it should work.
trgzrich
Junior Member
Posts: 17
Joined: Fri Jun 11, 2010 10:45 am

Post 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...
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

Can you try

vensim vensimrun.cmd

and see what happens?
trgzrich
Junior Member
Posts: 17
Joined: Fri Jun 11, 2010 10:45 am

Post 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]
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

Can you paste the contents of the cmd file here?
trgzrich
Junior Member
Posts: 17
Joined: Fri Jun 11, 2010 10:45 am

Post 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
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Post 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.
trgzrich
Junior Member
Posts: 17
Joined: Fri Jun 11, 2010 10:45 am

Post by trgzrich »

Sorry...I cut & paste my earlier post no. 5

I had already make the correction

I am using Vensim Professional 5.9
trgzrich
Junior Member
Posts: 17
Joined: Fri Jun 11, 2010 10:45 am

Post 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"
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

It doesn't look like Vensim Pro can run batch files.

Bob can you confirm?
trgzrich
Junior Member
Posts: 17
Joined: Fri Jun 11, 2010 10:45 am

Post by trgzrich »

Which version should l use? and how do l get it?
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post 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]
duilio
Senior Member
Posts: 59
Joined: Wed Oct 20, 2004 3:07 pm

DICE

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

Post by tomfid »

Hi -

I just posted a new set of DICE versions here
http://models.metasd.com/2010/06/dice/

Tom
duilio
Senior Member
Posts: 59
Joined: Wed Oct 20, 2004 3:07 pm

DICE

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

Post by tomfid »

No. What version of Vensim are you using. Did you try the .vpm version?
duilio
Senior Member
Posts: 59
Joined: Wed Oct 20, 2004 3:07 pm

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

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

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

Post by tomfid »

I changed my server settings ... the mdl versions might work now.
Post Reply