Integrating Vensim and GAMS
Integrating Vensim and GAMS
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
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
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
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
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
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
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
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
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]
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]
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
-
- Super Administrator
- Posts: 4573
- Joined: Wed Mar 05, 2003 3:10 am
-
- Super Administrator
- Posts: 4573
- Joined: Wed Mar 05, 2003 3:10 am
-
- Super Administrator
- Posts: 4573
- Joined: Wed Mar 05, 2003 3:10 am
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.
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.
-
- Super Administrator
- Posts: 4573
- Joined: Wed Mar 05, 2003 3:10 am
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
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]
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
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
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
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
DICE
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
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
No. What version of Vensim are you using. Did you try the .vpm version?
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
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?
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
I changed my server settings ... the mdl versions might work now.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/