I have a couple of sections (see in the attachment, all LINE …), which I would like to run at one time, not separately as I do it now. Each section contains parameters that might repeat in another section, but not necessary.
How to do it in GAMS?
My point is to run each of them and create *gdx files each for each section separately.
You could use a file with all commonly used parameters in an include file at the root.
Then you could use a dos batch file and walk through the subfolders, like
cd subfolder1
call gams modelsub1
cd…
cd subfolder2
call gams modelsub2
cd…
etc.
The most important think is to receive *gdx file with all parameters for each specified section.
Usually, I start with running LINE1A_Data and create *gdx file (with the same name usually). Then I run LINE1A_Incomes.gms and create *.gdx file again.
And so on …
The point is to run each section independently with its own *gdx file (with the same name and including all parameters).
Every section contains a link to a program (called LINE.gms) that includes specification of sets and parameters for all sections.
It somehow has to use $onMulti statement, probably.
I do not know how this batch file works. Do you have a program to create such file?
Hi Irena
No, it is just a text file that runs in a dos window (like the one you can start from the Gams editor) using DOS commands (you could also do it with the newer script tool in Windows called powershell).
I could write the following batch file named “run.bat”:
cd directory1a
call gams line1a_income
cd..
cd directory1b
call gams line1b_income
cd..
If you open a command window (“cmd”), you just type “run” (without the “.bat” at the end) and this will jump to the subdirectory named “directory1a”, call gams to solve line1a_income, go one directory up (by cd…) and then to the subdirectory “directory1b”, solve line1b_income and return to the root directory.
The advantage is that if you make a mistake in one of your model files, it only will stop the execution of that file, but then jumps to the next directory and solves the gams model there.
Here an example to solve also multiple occasions of the same model by using global settings with “setglobal”. For example, if you want to solve the same model for different datasets.
You would then have the following in your model file “mymodel.gms”:
Hi Jelenka
Do they produce gdx files when you run it from the Gamside/Gams Studio?
I don’t know what the commands are you used, but you can also add the command option
gdx=file_name
in your batch file at the end of each line and replace file_name with the name you want the gdx file to have.
Cheers
Renger